app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976
  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. console.log(index);
  2006. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2007. _this.deleteCred(index);
  2008. }).listen('CredentialAdded', function (e) {
  2009. _this.credentials.unshift(e.credential);
  2010. });
  2011. }
  2012. if (this.groupid) {
  2013. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2014. var deletedCred = e.credential;
  2015. var index = _this.credentials.findIndex(function (credential) {
  2016. return credential.groupid === deletedCred['groupid'];
  2017. });
  2018. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2019. _this.deleteCred(index);
  2020. }).listen('CredentialAdded', function (e) {
  2021. _this.credentials.unshift(e.credential);
  2022. });
  2023. }
  2024. }
  2025. });
  2026. /***/ }),
  2027. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2028. /*!*********************************************************************************************************************************************************************!*\
  2029. !*** ./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& ***!
  2030. \*********************************************************************************************************************************************************************/
  2031. /*! exports provided: default */
  2032. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2033. "use strict";
  2034. __webpack_require__.r(__webpack_exports__);
  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. //
  2078. /* harmony default export */ __webpack_exports__["default"] = ({
  2079. props: ['credential', 'descriptions'],
  2080. data: function data() {
  2081. return {
  2082. data: this.credential,
  2083. creddescList: this.descriptions
  2084. };
  2085. },
  2086. mounted: function mounted() {
  2087. var _this = this;
  2088. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2089. _this.data = e.credential;
  2090. });
  2091. },
  2092. methods: {
  2093. deleteCredential: function deleteCredential() {
  2094. var _this2 = this;
  2095. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2096. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2097. })["catch"](function (error) {
  2098. console.error(error);
  2099. });
  2100. }
  2101. }
  2102. });
  2103. /***/ }),
  2104. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2105. /*!********************************************************************************************************************************************************************!*\
  2106. !*** ./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& ***!
  2107. \********************************************************************************************************************************************************************/
  2108. /*! exports provided: default */
  2109. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2110. "use strict";
  2111. __webpack_require__.r(__webpack_exports__);
  2112. //
  2113. //
  2114. //
  2115. //
  2116. //
  2117. /* harmony default export */ __webpack_exports__["default"] = ({
  2118. props: ['errors'],
  2119. data: function data() {
  2120. return {
  2121. errorList: this.errors
  2122. };
  2123. },
  2124. watch: {
  2125. errors: function errors(newErrors) {
  2126. this.errorList = newErrors;
  2127. }
  2128. }
  2129. });
  2130. /***/ }),
  2131. /***/ "./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&":
  2132. /*!**************************************************************************************************************************************************************************!*\
  2133. !*** ./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& ***!
  2134. \**************************************************************************************************************************************************************************/
  2135. /*! exports provided: default */
  2136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2137. "use strict";
  2138. __webpack_require__.r(__webpack_exports__);
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. /* harmony default export */ __webpack_exports__["default"] = ({
  2157. props: {
  2158. populateWith: {
  2159. type: Object
  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: {}
  2178. };
  2179. },
  2180. mounted: function mounted() {
  2181. if (!this.populateWith) {
  2182. this.note = {
  2183. thenote: '',
  2184. notetype: this.noteType,
  2185. noteuser: this.noteUser,
  2186. woid: this.woid
  2187. };
  2188. } else {
  2189. this.note = JSON.parse(JSON.stringify(this.populateWith));
  2190. }
  2191. },
  2192. methods: {
  2193. updateNote: function updateNote(note) {
  2194. if (this.populateWith) {
  2195. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2196. hideModal();
  2197. });
  2198. } else {
  2199. axios.post('/api/workorders/notes', note).then(function (response) {
  2200. hideModal();
  2201. });
  2202. }
  2203. },
  2204. hideModal: function hideModal() {
  2205. $('#' + this.modalId).modal('hide');
  2206. }
  2207. }
  2208. });
  2209. /***/ }),
  2210. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2211. /*!****************************************************************************************************************************************************************!*\
  2212. !*** ./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& ***!
  2213. \****************************************************************************************************************************************************************/
  2214. /*! exports provided: default */
  2215. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2216. "use strict";
  2217. __webpack_require__.r(__webpack_exports__);
  2218. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. //
  2240. //
  2241. //
  2242. //
  2243. //
  2244. //
  2245. //
  2246. /* harmony default export */ __webpack_exports__["default"] = ({
  2247. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2248. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2249. data: function data() {
  2250. return {
  2251. notes: Object.values(this.initialnotes),
  2252. noteWoid: this.woid
  2253. };
  2254. },
  2255. methods: {
  2256. userChanged: function userChanged(index) {
  2257. if (index === 0) {
  2258. return false;
  2259. } else {
  2260. return this.notes[index].noteuser !== this.notes[index - 1].noteuser;
  2261. }
  2262. }
  2263. }
  2264. });
  2265. /***/ }),
  2266. /***/ "./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&":
  2267. /*!****************************************************************************************************************************************************************************!*\
  2268. !*** ./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& ***!
  2269. \****************************************************************************************************************************************************************************/
  2270. /*! exports provided: default */
  2271. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2272. "use strict";
  2273. __webpack_require__.r(__webpack_exports__);
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. /* harmony default export */ __webpack_exports__["default"] = ({
  2308. props: ['populateWith', 'storeList', 'modalId'],
  2309. data: function data() {
  2310. return {
  2311. // Copies object from prop, so it doesn't mutate the object
  2312. // from the parent component. Parent component will be updated via
  2313. // Websocket if updateWorkOrder is successful.
  2314. data: JSON.parse(JSON.stringify(this.populateWith)),
  2315. id: this.modalId,
  2316. store: {},
  2317. errors: []
  2318. };
  2319. },
  2320. mounted: function mounted() {
  2321. this.store = {
  2322. 'id': this.data.storeid,
  2323. 'name': this.storeList[this.data.storeid]
  2324. };
  2325. },
  2326. methods: {
  2327. updateWorkOrder: function updateWorkOrder() {
  2328. var _this = this;
  2329. this.data.storeid = this.store.id;
  2330. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2331. $('#workordereditModal').modal('hide');
  2332. })["catch"](function (error) {
  2333. _this.errors = JSON.parse(error.response.request.response).errors;
  2334. });
  2335. }
  2336. }
  2337. });
  2338. /***/ }),
  2339. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2340. /*!*****************************************************************************************************************************************************************!*\
  2341. !*** ./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& ***!
  2342. \*****************************************************************************************************************************************************************/
  2343. /*! exports provided: default */
  2344. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2345. "use strict";
  2346. __webpack_require__.r(__webpack_exports__);
  2347. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2348. //
  2349. //
  2350. //
  2351. //
  2352. //
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. //
  2361. //
  2362. //
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. /* harmony default export */ __webpack_exports__["default"] = ({
  2369. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2370. props: ['workOrder', 'stores'],
  2371. data: function data() {
  2372. return {
  2373. data: JSON.parse(this.workOrder)
  2374. };
  2375. },
  2376. computed: {
  2377. storeList: function storeList() {
  2378. var list = {};
  2379. JSON.parse(this.stores).map(function (val) {
  2380. list[val.storeid] = val.storesname;
  2381. });
  2382. return list;
  2383. }
  2384. },
  2385. mounted: function mounted() {
  2386. var _this = this;
  2387. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2388. _this.data = e.data;
  2389. });
  2390. }
  2391. });
  2392. /***/ }),
  2393. /***/ "./node_modules/base64-js/index.js":
  2394. /*!*****************************************!*\
  2395. !*** ./node_modules/base64-js/index.js ***!
  2396. \*****************************************/
  2397. /*! no static exports found */
  2398. /***/ (function(module, exports, __webpack_require__) {
  2399. "use strict";
  2400. exports.byteLength = byteLength
  2401. exports.toByteArray = toByteArray
  2402. exports.fromByteArray = fromByteArray
  2403. var lookup = []
  2404. var revLookup = []
  2405. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2406. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2407. for (var i = 0, len = code.length; i < len; ++i) {
  2408. lookup[i] = code[i]
  2409. revLookup[code.charCodeAt(i)] = i
  2410. }
  2411. // Support decoding URL-safe base64 strings, as Node.js does.
  2412. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2413. revLookup['-'.charCodeAt(0)] = 62
  2414. revLookup['_'.charCodeAt(0)] = 63
  2415. function getLens (b64) {
  2416. var len = b64.length
  2417. if (len % 4 > 0) {
  2418. throw new Error('Invalid string. Length must be a multiple of 4')
  2419. }
  2420. // Trim off extra bytes after placeholder bytes are found
  2421. // See: https://github.com/beatgammit/base64-js/issues/42
  2422. var validLen = b64.indexOf('=')
  2423. if (validLen === -1) validLen = len
  2424. var placeHoldersLen = validLen === len
  2425. ? 0
  2426. : 4 - (validLen % 4)
  2427. return [validLen, placeHoldersLen]
  2428. }
  2429. // base64 is 4/3 + up to two characters of the original data
  2430. function byteLength (b64) {
  2431. var lens = getLens(b64)
  2432. var validLen = lens[0]
  2433. var placeHoldersLen = lens[1]
  2434. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2435. }
  2436. function _byteLength (b64, validLen, placeHoldersLen) {
  2437. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2438. }
  2439. function toByteArray (b64) {
  2440. var tmp
  2441. var lens = getLens(b64)
  2442. var validLen = lens[0]
  2443. var placeHoldersLen = lens[1]
  2444. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2445. var curByte = 0
  2446. // if there are placeholders, only get up to the last complete 4 chars
  2447. var len = placeHoldersLen > 0
  2448. ? validLen - 4
  2449. : validLen
  2450. var i
  2451. for (i = 0; i < len; i += 4) {
  2452. tmp =
  2453. (revLookup[b64.charCodeAt(i)] << 18) |
  2454. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2455. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2456. revLookup[b64.charCodeAt(i + 3)]
  2457. arr[curByte++] = (tmp >> 16) & 0xFF
  2458. arr[curByte++] = (tmp >> 8) & 0xFF
  2459. arr[curByte++] = tmp & 0xFF
  2460. }
  2461. if (placeHoldersLen === 2) {
  2462. tmp =
  2463. (revLookup[b64.charCodeAt(i)] << 2) |
  2464. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2465. arr[curByte++] = tmp & 0xFF
  2466. }
  2467. if (placeHoldersLen === 1) {
  2468. tmp =
  2469. (revLookup[b64.charCodeAt(i)] << 10) |
  2470. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2471. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2472. arr[curByte++] = (tmp >> 8) & 0xFF
  2473. arr[curByte++] = tmp & 0xFF
  2474. }
  2475. return arr
  2476. }
  2477. function tripletToBase64 (num) {
  2478. return lookup[num >> 18 & 0x3F] +
  2479. lookup[num >> 12 & 0x3F] +
  2480. lookup[num >> 6 & 0x3F] +
  2481. lookup[num & 0x3F]
  2482. }
  2483. function encodeChunk (uint8, start, end) {
  2484. var tmp
  2485. var output = []
  2486. for (var i = start; i < end; i += 3) {
  2487. tmp =
  2488. ((uint8[i] << 16) & 0xFF0000) +
  2489. ((uint8[i + 1] << 8) & 0xFF00) +
  2490. (uint8[i + 2] & 0xFF)
  2491. output.push(tripletToBase64(tmp))
  2492. }
  2493. return output.join('')
  2494. }
  2495. function fromByteArray (uint8) {
  2496. var tmp
  2497. var len = uint8.length
  2498. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2499. var parts = []
  2500. var maxChunkLength = 16383 // must be multiple of 3
  2501. // go through the array every three bytes, we'll deal with trailing stuff later
  2502. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2503. parts.push(encodeChunk(
  2504. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2505. ))
  2506. }
  2507. // pad the end with zeros, but make sure to not forget the extra bytes
  2508. if (extraBytes === 1) {
  2509. tmp = uint8[len - 1]
  2510. parts.push(
  2511. lookup[tmp >> 2] +
  2512. lookup[(tmp << 4) & 0x3F] +
  2513. '=='
  2514. )
  2515. } else if (extraBytes === 2) {
  2516. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2517. parts.push(
  2518. lookup[tmp >> 10] +
  2519. lookup[(tmp >> 4) & 0x3F] +
  2520. lookup[(tmp << 2) & 0x3F] +
  2521. '='
  2522. )
  2523. }
  2524. return parts.join('')
  2525. }
  2526. /***/ }),
  2527. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2528. /*!*****************************************************!*\
  2529. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2530. \*****************************************************/
  2531. /*! no static exports found */
  2532. /***/ (function(module, exports, __webpack_require__) {
  2533. /*!
  2534. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2535. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2536. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2537. */
  2538. (function (global, factory) {
  2539. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2540. undefined;
  2541. }(this, (function (exports, $, Popper) { 'use strict';
  2542. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2543. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2544. function _defineProperties(target, props) {
  2545. for (var i = 0; i < props.length; i++) {
  2546. var descriptor = props[i];
  2547. descriptor.enumerable = descriptor.enumerable || false;
  2548. descriptor.configurable = true;
  2549. if ("value" in descriptor) descriptor.writable = true;
  2550. Object.defineProperty(target, descriptor.key, descriptor);
  2551. }
  2552. }
  2553. function _createClass(Constructor, protoProps, staticProps) {
  2554. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2555. if (staticProps) _defineProperties(Constructor, staticProps);
  2556. return Constructor;
  2557. }
  2558. function _defineProperty(obj, key, value) {
  2559. if (key in obj) {
  2560. Object.defineProperty(obj, key, {
  2561. value: value,
  2562. enumerable: true,
  2563. configurable: true,
  2564. writable: true
  2565. });
  2566. } else {
  2567. obj[key] = value;
  2568. }
  2569. return obj;
  2570. }
  2571. function ownKeys(object, enumerableOnly) {
  2572. var keys = Object.keys(object);
  2573. if (Object.getOwnPropertySymbols) {
  2574. var symbols = Object.getOwnPropertySymbols(object);
  2575. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2576. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2577. });
  2578. keys.push.apply(keys, symbols);
  2579. }
  2580. return keys;
  2581. }
  2582. function _objectSpread2(target) {
  2583. for (var i = 1; i < arguments.length; i++) {
  2584. var source = arguments[i] != null ? arguments[i] : {};
  2585. if (i % 2) {
  2586. ownKeys(Object(source), true).forEach(function (key) {
  2587. _defineProperty(target, key, source[key]);
  2588. });
  2589. } else if (Object.getOwnPropertyDescriptors) {
  2590. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2591. } else {
  2592. ownKeys(Object(source)).forEach(function (key) {
  2593. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2594. });
  2595. }
  2596. }
  2597. return target;
  2598. }
  2599. function _inheritsLoose(subClass, superClass) {
  2600. subClass.prototype = Object.create(superClass.prototype);
  2601. subClass.prototype.constructor = subClass;
  2602. subClass.__proto__ = superClass;
  2603. }
  2604. /**
  2605. * --------------------------------------------------------------------------
  2606. * Bootstrap (v4.4.1): util.js
  2607. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2608. * --------------------------------------------------------------------------
  2609. */
  2610. /**
  2611. * ------------------------------------------------------------------------
  2612. * Private TransitionEnd Helpers
  2613. * ------------------------------------------------------------------------
  2614. */
  2615. var TRANSITION_END = 'transitionend';
  2616. var MAX_UID = 1000000;
  2617. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2618. function toType(obj) {
  2619. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2620. }
  2621. function getSpecialTransitionEndEvent() {
  2622. return {
  2623. bindType: TRANSITION_END,
  2624. delegateType: TRANSITION_END,
  2625. handle: function handle(event) {
  2626. if ($(event.target).is(this)) {
  2627. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2628. }
  2629. return undefined; // eslint-disable-line no-undefined
  2630. }
  2631. };
  2632. }
  2633. function transitionEndEmulator(duration) {
  2634. var _this = this;
  2635. var called = false;
  2636. $(this).one(Util.TRANSITION_END, function () {
  2637. called = true;
  2638. });
  2639. setTimeout(function () {
  2640. if (!called) {
  2641. Util.triggerTransitionEnd(_this);
  2642. }
  2643. }, duration);
  2644. return this;
  2645. }
  2646. function setTransitionEndSupport() {
  2647. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2648. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2649. }
  2650. /**
  2651. * --------------------------------------------------------------------------
  2652. * Public Util Api
  2653. * --------------------------------------------------------------------------
  2654. */
  2655. var Util = {
  2656. TRANSITION_END: 'bsTransitionEnd',
  2657. getUID: function getUID(prefix) {
  2658. do {
  2659. // eslint-disable-next-line no-bitwise
  2660. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2661. } while (document.getElementById(prefix));
  2662. return prefix;
  2663. },
  2664. getSelectorFromElement: function getSelectorFromElement(element) {
  2665. var selector = element.getAttribute('data-target');
  2666. if (!selector || selector === '#') {
  2667. var hrefAttr = element.getAttribute('href');
  2668. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2669. }
  2670. try {
  2671. return document.querySelector(selector) ? selector : null;
  2672. } catch (err) {
  2673. return null;
  2674. }
  2675. },
  2676. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2677. if (!element) {
  2678. return 0;
  2679. } // Get transition-duration of the element
  2680. var transitionDuration = $(element).css('transition-duration');
  2681. var transitionDelay = $(element).css('transition-delay');
  2682. var floatTransitionDuration = parseFloat(transitionDuration);
  2683. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2684. if (!floatTransitionDuration && !floatTransitionDelay) {
  2685. return 0;
  2686. } // If multiple durations are defined, take the first
  2687. transitionDuration = transitionDuration.split(',')[0];
  2688. transitionDelay = transitionDelay.split(',')[0];
  2689. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2690. },
  2691. reflow: function reflow(element) {
  2692. return element.offsetHeight;
  2693. },
  2694. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2695. $(element).trigger(TRANSITION_END);
  2696. },
  2697. // TODO: Remove in v5
  2698. supportsTransitionEnd: function supportsTransitionEnd() {
  2699. return Boolean(TRANSITION_END);
  2700. },
  2701. isElement: function isElement(obj) {
  2702. return (obj[0] || obj).nodeType;
  2703. },
  2704. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2705. for (var property in configTypes) {
  2706. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2707. var expectedTypes = configTypes[property];
  2708. var value = config[property];
  2709. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2710. if (!new RegExp(expectedTypes).test(valueType)) {
  2711. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2712. }
  2713. }
  2714. }
  2715. },
  2716. findShadowRoot: function findShadowRoot(element) {
  2717. if (!document.documentElement.attachShadow) {
  2718. return null;
  2719. } // Can find the shadow root otherwise it'll return the document
  2720. if (typeof element.getRootNode === 'function') {
  2721. var root = element.getRootNode();
  2722. return root instanceof ShadowRoot ? root : null;
  2723. }
  2724. if (element instanceof ShadowRoot) {
  2725. return element;
  2726. } // when we don't find a shadow root
  2727. if (!element.parentNode) {
  2728. return null;
  2729. }
  2730. return Util.findShadowRoot(element.parentNode);
  2731. },
  2732. jQueryDetection: function jQueryDetection() {
  2733. if (typeof $ === 'undefined') {
  2734. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2735. }
  2736. var version = $.fn.jquery.split(' ')[0].split('.');
  2737. var minMajor = 1;
  2738. var ltMajor = 2;
  2739. var minMinor = 9;
  2740. var minPatch = 1;
  2741. var maxMajor = 4;
  2742. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2743. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2744. }
  2745. }
  2746. };
  2747. Util.jQueryDetection();
  2748. setTransitionEndSupport();
  2749. /**
  2750. * ------------------------------------------------------------------------
  2751. * Constants
  2752. * ------------------------------------------------------------------------
  2753. */
  2754. var NAME = 'alert';
  2755. var VERSION = '4.4.1';
  2756. var DATA_KEY = 'bs.alert';
  2757. var EVENT_KEY = "." + DATA_KEY;
  2758. var DATA_API_KEY = '.data-api';
  2759. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2760. var Selector = {
  2761. DISMISS: '[data-dismiss="alert"]'
  2762. };
  2763. var Event = {
  2764. CLOSE: "close" + EVENT_KEY,
  2765. CLOSED: "closed" + EVENT_KEY,
  2766. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2767. };
  2768. var ClassName = {
  2769. ALERT: 'alert',
  2770. FADE: 'fade',
  2771. SHOW: 'show'
  2772. };
  2773. /**
  2774. * ------------------------------------------------------------------------
  2775. * Class Definition
  2776. * ------------------------------------------------------------------------
  2777. */
  2778. var Alert =
  2779. /*#__PURE__*/
  2780. function () {
  2781. function Alert(element) {
  2782. this._element = element;
  2783. } // Getters
  2784. var _proto = Alert.prototype;
  2785. // Public
  2786. _proto.close = function close(element) {
  2787. var rootElement = this._element;
  2788. if (element) {
  2789. rootElement = this._getRootElement(element);
  2790. }
  2791. var customEvent = this._triggerCloseEvent(rootElement);
  2792. if (customEvent.isDefaultPrevented()) {
  2793. return;
  2794. }
  2795. this._removeElement(rootElement);
  2796. };
  2797. _proto.dispose = function dispose() {
  2798. $.removeData(this._element, DATA_KEY);
  2799. this._element = null;
  2800. } // Private
  2801. ;
  2802. _proto._getRootElement = function _getRootElement(element) {
  2803. var selector = Util.getSelectorFromElement(element);
  2804. var parent = false;
  2805. if (selector) {
  2806. parent = document.querySelector(selector);
  2807. }
  2808. if (!parent) {
  2809. parent = $(element).closest("." + ClassName.ALERT)[0];
  2810. }
  2811. return parent;
  2812. };
  2813. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2814. var closeEvent = $.Event(Event.CLOSE);
  2815. $(element).trigger(closeEvent);
  2816. return closeEvent;
  2817. };
  2818. _proto._removeElement = function _removeElement(element) {
  2819. var _this = this;
  2820. $(element).removeClass(ClassName.SHOW);
  2821. if (!$(element).hasClass(ClassName.FADE)) {
  2822. this._destroyElement(element);
  2823. return;
  2824. }
  2825. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2826. $(element).one(Util.TRANSITION_END, function (event) {
  2827. return _this._destroyElement(element, event);
  2828. }).emulateTransitionEnd(transitionDuration);
  2829. };
  2830. _proto._destroyElement = function _destroyElement(element) {
  2831. $(element).detach().trigger(Event.CLOSED).remove();
  2832. } // Static
  2833. ;
  2834. Alert._jQueryInterface = function _jQueryInterface(config) {
  2835. return this.each(function () {
  2836. var $element = $(this);
  2837. var data = $element.data(DATA_KEY);
  2838. if (!data) {
  2839. data = new Alert(this);
  2840. $element.data(DATA_KEY, data);
  2841. }
  2842. if (config === 'close') {
  2843. data[config](this);
  2844. }
  2845. });
  2846. };
  2847. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2848. return function (event) {
  2849. if (event) {
  2850. event.preventDefault();
  2851. }
  2852. alertInstance.close(this);
  2853. };
  2854. };
  2855. _createClass(Alert, null, [{
  2856. key: "VERSION",
  2857. get: function get() {
  2858. return VERSION;
  2859. }
  2860. }]);
  2861. return Alert;
  2862. }();
  2863. /**
  2864. * ------------------------------------------------------------------------
  2865. * Data Api implementation
  2866. * ------------------------------------------------------------------------
  2867. */
  2868. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2869. /**
  2870. * ------------------------------------------------------------------------
  2871. * jQuery
  2872. * ------------------------------------------------------------------------
  2873. */
  2874. $.fn[NAME] = Alert._jQueryInterface;
  2875. $.fn[NAME].Constructor = Alert;
  2876. $.fn[NAME].noConflict = function () {
  2877. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2878. return Alert._jQueryInterface;
  2879. };
  2880. /**
  2881. * ------------------------------------------------------------------------
  2882. * Constants
  2883. * ------------------------------------------------------------------------
  2884. */
  2885. var NAME$1 = 'button';
  2886. var VERSION$1 = '4.4.1';
  2887. var DATA_KEY$1 = 'bs.button';
  2888. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2889. var DATA_API_KEY$1 = '.data-api';
  2890. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2891. var ClassName$1 = {
  2892. ACTIVE: 'active',
  2893. BUTTON: 'btn',
  2894. FOCUS: 'focus'
  2895. };
  2896. var Selector$1 = {
  2897. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2898. DATA_TOGGLES: '[data-toggle="buttons"]',
  2899. DATA_TOGGLE: '[data-toggle="button"]',
  2900. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2901. INPUT: 'input:not([type="hidden"])',
  2902. ACTIVE: '.active',
  2903. BUTTON: '.btn'
  2904. };
  2905. var Event$1 = {
  2906. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2907. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2908. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2909. };
  2910. /**
  2911. * ------------------------------------------------------------------------
  2912. * Class Definition
  2913. * ------------------------------------------------------------------------
  2914. */
  2915. var Button =
  2916. /*#__PURE__*/
  2917. function () {
  2918. function Button(element) {
  2919. this._element = element;
  2920. } // Getters
  2921. var _proto = Button.prototype;
  2922. // Public
  2923. _proto.toggle = function toggle() {
  2924. var triggerChangeEvent = true;
  2925. var addAriaPressed = true;
  2926. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2927. if (rootElement) {
  2928. var input = this._element.querySelector(Selector$1.INPUT);
  2929. if (input) {
  2930. if (input.type === 'radio') {
  2931. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2932. triggerChangeEvent = false;
  2933. } else {
  2934. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2935. if (activeElement) {
  2936. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2937. }
  2938. }
  2939. } else if (input.type === 'checkbox') {
  2940. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2941. triggerChangeEvent = false;
  2942. }
  2943. } else {
  2944. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2945. triggerChangeEvent = false;
  2946. }
  2947. if (triggerChangeEvent) {
  2948. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2949. $(input).trigger('change');
  2950. }
  2951. input.focus();
  2952. addAriaPressed = false;
  2953. }
  2954. }
  2955. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2956. if (addAriaPressed) {
  2957. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2958. }
  2959. if (triggerChangeEvent) {
  2960. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2961. }
  2962. }
  2963. };
  2964. _proto.dispose = function dispose() {
  2965. $.removeData(this._element, DATA_KEY$1);
  2966. this._element = null;
  2967. } // Static
  2968. ;
  2969. Button._jQueryInterface = function _jQueryInterface(config) {
  2970. return this.each(function () {
  2971. var data = $(this).data(DATA_KEY$1);
  2972. if (!data) {
  2973. data = new Button(this);
  2974. $(this).data(DATA_KEY$1, data);
  2975. }
  2976. if (config === 'toggle') {
  2977. data[config]();
  2978. }
  2979. });
  2980. };
  2981. _createClass(Button, null, [{
  2982. key: "VERSION",
  2983. get: function get() {
  2984. return VERSION$1;
  2985. }
  2986. }]);
  2987. return Button;
  2988. }();
  2989. /**
  2990. * ------------------------------------------------------------------------
  2991. * Data Api implementation
  2992. * ------------------------------------------------------------------------
  2993. */
  2994. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2995. var button = event.target;
  2996. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2997. button = $(button).closest(Selector$1.BUTTON)[0];
  2998. }
  2999. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3000. event.preventDefault(); // work around Firefox bug #1540995
  3001. } else {
  3002. var inputBtn = button.querySelector(Selector$1.INPUT);
  3003. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3004. event.preventDefault(); // work around Firefox bug #1540995
  3005. return;
  3006. }
  3007. Button._jQueryInterface.call($(button), 'toggle');
  3008. }
  3009. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3010. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3011. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3012. });
  3013. $(window).on(Event$1.LOAD_DATA_API, function () {
  3014. // ensure correct active class is set to match the controls' actual values/states
  3015. // find all checkboxes/readio buttons inside data-toggle groups
  3016. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3017. for (var i = 0, len = buttons.length; i < len; i++) {
  3018. var button = buttons[i];
  3019. var input = button.querySelector(Selector$1.INPUT);
  3020. if (input.checked || input.hasAttribute('checked')) {
  3021. button.classList.add(ClassName$1.ACTIVE);
  3022. } else {
  3023. button.classList.remove(ClassName$1.ACTIVE);
  3024. }
  3025. } // find all button toggles
  3026. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3027. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3028. var _button = buttons[_i];
  3029. if (_button.getAttribute('aria-pressed') === 'true') {
  3030. _button.classList.add(ClassName$1.ACTIVE);
  3031. } else {
  3032. _button.classList.remove(ClassName$1.ACTIVE);
  3033. }
  3034. }
  3035. });
  3036. /**
  3037. * ------------------------------------------------------------------------
  3038. * jQuery
  3039. * ------------------------------------------------------------------------
  3040. */
  3041. $.fn[NAME$1] = Button._jQueryInterface;
  3042. $.fn[NAME$1].Constructor = Button;
  3043. $.fn[NAME$1].noConflict = function () {
  3044. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3045. return Button._jQueryInterface;
  3046. };
  3047. /**
  3048. * ------------------------------------------------------------------------
  3049. * Constants
  3050. * ------------------------------------------------------------------------
  3051. */
  3052. var NAME$2 = 'carousel';
  3053. var VERSION$2 = '4.4.1';
  3054. var DATA_KEY$2 = 'bs.carousel';
  3055. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3056. var DATA_API_KEY$2 = '.data-api';
  3057. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3058. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3059. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3060. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3061. var SWIPE_THRESHOLD = 40;
  3062. var Default = {
  3063. interval: 5000,
  3064. keyboard: true,
  3065. slide: false,
  3066. pause: 'hover',
  3067. wrap: true,
  3068. touch: true
  3069. };
  3070. var DefaultType = {
  3071. interval: '(number|boolean)',
  3072. keyboard: 'boolean',
  3073. slide: '(boolean|string)',
  3074. pause: '(string|boolean)',
  3075. wrap: 'boolean',
  3076. touch: 'boolean'
  3077. };
  3078. var Direction = {
  3079. NEXT: 'next',
  3080. PREV: 'prev',
  3081. LEFT: 'left',
  3082. RIGHT: 'right'
  3083. };
  3084. var Event$2 = {
  3085. SLIDE: "slide" + EVENT_KEY$2,
  3086. SLID: "slid" + EVENT_KEY$2,
  3087. KEYDOWN: "keydown" + EVENT_KEY$2,
  3088. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3089. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3090. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3091. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3092. TOUCHEND: "touchend" + EVENT_KEY$2,
  3093. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3094. POINTERUP: "pointerup" + EVENT_KEY$2,
  3095. DRAG_START: "dragstart" + EVENT_KEY$2,
  3096. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3097. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3098. };
  3099. var ClassName$2 = {
  3100. CAROUSEL: 'carousel',
  3101. ACTIVE: 'active',
  3102. SLIDE: 'slide',
  3103. RIGHT: 'carousel-item-right',
  3104. LEFT: 'carousel-item-left',
  3105. NEXT: 'carousel-item-next',
  3106. PREV: 'carousel-item-prev',
  3107. ITEM: 'carousel-item',
  3108. POINTER_EVENT: 'pointer-event'
  3109. };
  3110. var Selector$2 = {
  3111. ACTIVE: '.active',
  3112. ACTIVE_ITEM: '.active.carousel-item',
  3113. ITEM: '.carousel-item',
  3114. ITEM_IMG: '.carousel-item img',
  3115. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3116. INDICATORS: '.carousel-indicators',
  3117. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3118. DATA_RIDE: '[data-ride="carousel"]'
  3119. };
  3120. var PointerType = {
  3121. TOUCH: 'touch',
  3122. PEN: 'pen'
  3123. };
  3124. /**
  3125. * ------------------------------------------------------------------------
  3126. * Class Definition
  3127. * ------------------------------------------------------------------------
  3128. */
  3129. var Carousel =
  3130. /*#__PURE__*/
  3131. function () {
  3132. function Carousel(element, config) {
  3133. this._items = null;
  3134. this._interval = null;
  3135. this._activeElement = null;
  3136. this._isPaused = false;
  3137. this._isSliding = false;
  3138. this.touchTimeout = null;
  3139. this.touchStartX = 0;
  3140. this.touchDeltaX = 0;
  3141. this._config = this._getConfig(config);
  3142. this._element = element;
  3143. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3144. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3145. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3146. this._addEventListeners();
  3147. } // Getters
  3148. var _proto = Carousel.prototype;
  3149. // Public
  3150. _proto.next = function next() {
  3151. if (!this._isSliding) {
  3152. this._slide(Direction.NEXT);
  3153. }
  3154. };
  3155. _proto.nextWhenVisible = function nextWhenVisible() {
  3156. // Don't call next when the page isn't visible
  3157. // or the carousel or its parent isn't visible
  3158. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3159. this.next();
  3160. }
  3161. };
  3162. _proto.prev = function prev() {
  3163. if (!this._isSliding) {
  3164. this._slide(Direction.PREV);
  3165. }
  3166. };
  3167. _proto.pause = function pause(event) {
  3168. if (!event) {
  3169. this._isPaused = true;
  3170. }
  3171. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3172. Util.triggerTransitionEnd(this._element);
  3173. this.cycle(true);
  3174. }
  3175. clearInterval(this._interval);
  3176. this._interval = null;
  3177. };
  3178. _proto.cycle = function cycle(event) {
  3179. if (!event) {
  3180. this._isPaused = false;
  3181. }
  3182. if (this._interval) {
  3183. clearInterval(this._interval);
  3184. this._interval = null;
  3185. }
  3186. if (this._config.interval && !this._isPaused) {
  3187. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3188. }
  3189. };
  3190. _proto.to = function to(index) {
  3191. var _this = this;
  3192. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3193. var activeIndex = this._getItemIndex(this._activeElement);
  3194. if (index > this._items.length - 1 || index < 0) {
  3195. return;
  3196. }
  3197. if (this._isSliding) {
  3198. $(this._element).one(Event$2.SLID, function () {
  3199. return _this.to(index);
  3200. });
  3201. return;
  3202. }
  3203. if (activeIndex === index) {
  3204. this.pause();
  3205. this.cycle();
  3206. return;
  3207. }
  3208. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3209. this._slide(direction, this._items[index]);
  3210. };
  3211. _proto.dispose = function dispose() {
  3212. $(this._element).off(EVENT_KEY$2);
  3213. $.removeData(this._element, DATA_KEY$2);
  3214. this._items = null;
  3215. this._config = null;
  3216. this._element = null;
  3217. this._interval = null;
  3218. this._isPaused = null;
  3219. this._isSliding = null;
  3220. this._activeElement = null;
  3221. this._indicatorsElement = null;
  3222. } // Private
  3223. ;
  3224. _proto._getConfig = function _getConfig(config) {
  3225. config = _objectSpread2({}, Default, {}, config);
  3226. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3227. return config;
  3228. };
  3229. _proto._handleSwipe = function _handleSwipe() {
  3230. var absDeltax = Math.abs(this.touchDeltaX);
  3231. if (absDeltax <= SWIPE_THRESHOLD) {
  3232. return;
  3233. }
  3234. var direction = absDeltax / this.touchDeltaX;
  3235. this.touchDeltaX = 0; // swipe left
  3236. if (direction > 0) {
  3237. this.prev();
  3238. } // swipe right
  3239. if (direction < 0) {
  3240. this.next();
  3241. }
  3242. };
  3243. _proto._addEventListeners = function _addEventListeners() {
  3244. var _this2 = this;
  3245. if (this._config.keyboard) {
  3246. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3247. return _this2._keydown(event);
  3248. });
  3249. }
  3250. if (this._config.pause === 'hover') {
  3251. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3252. return _this2.pause(event);
  3253. }).on(Event$2.MOUSELEAVE, function (event) {
  3254. return _this2.cycle(event);
  3255. });
  3256. }
  3257. if (this._config.touch) {
  3258. this._addTouchEventListeners();
  3259. }
  3260. };
  3261. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3262. var _this3 = this;
  3263. if (!this._touchSupported) {
  3264. return;
  3265. }
  3266. var start = function start(event) {
  3267. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3268. _this3.touchStartX = event.originalEvent.clientX;
  3269. } else if (!_this3._pointerEvent) {
  3270. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3271. }
  3272. };
  3273. var move = function move(event) {
  3274. // ensure swiping with one touch and not pinching
  3275. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3276. _this3.touchDeltaX = 0;
  3277. } else {
  3278. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3279. }
  3280. };
  3281. var end = function end(event) {
  3282. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3283. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3284. }
  3285. _this3._handleSwipe();
  3286. if (_this3._config.pause === 'hover') {
  3287. // If it's a touch-enabled device, mouseenter/leave are fired as
  3288. // part of the mouse compatibility events on first tap - the carousel
  3289. // would stop cycling until user tapped out of it;
  3290. // here, we listen for touchend, explicitly pause the carousel
  3291. // (as if it's the second time we tap on it, mouseenter compat event
  3292. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3293. // events to fire) we explicitly restart cycling
  3294. _this3.pause();
  3295. if (_this3.touchTimeout) {
  3296. clearTimeout(_this3.touchTimeout);
  3297. }
  3298. _this3.touchTimeout = setTimeout(function (event) {
  3299. return _this3.cycle(event);
  3300. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3301. }
  3302. };
  3303. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3304. return e.preventDefault();
  3305. });
  3306. if (this._pointerEvent) {
  3307. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3308. return start(event);
  3309. });
  3310. $(this._element).on(Event$2.POINTERUP, function (event) {
  3311. return end(event);
  3312. });
  3313. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3314. } else {
  3315. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3316. return start(event);
  3317. });
  3318. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3319. return move(event);
  3320. });
  3321. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3322. return end(event);
  3323. });
  3324. }
  3325. };
  3326. _proto._keydown = function _keydown(event) {
  3327. if (/input|textarea/i.test(event.target.tagName)) {
  3328. return;
  3329. }
  3330. switch (event.which) {
  3331. case ARROW_LEFT_KEYCODE:
  3332. event.preventDefault();
  3333. this.prev();
  3334. break;
  3335. case ARROW_RIGHT_KEYCODE:
  3336. event.preventDefault();
  3337. this.next();
  3338. break;
  3339. }
  3340. };
  3341. _proto._getItemIndex = function _getItemIndex(element) {
  3342. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3343. return this._items.indexOf(element);
  3344. };
  3345. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3346. var isNextDirection = direction === Direction.NEXT;
  3347. var isPrevDirection = direction === Direction.PREV;
  3348. var activeIndex = this._getItemIndex(activeElement);
  3349. var lastItemIndex = this._items.length - 1;
  3350. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3351. if (isGoingToWrap && !this._config.wrap) {
  3352. return activeElement;
  3353. }
  3354. var delta = direction === Direction.PREV ? -1 : 1;
  3355. var itemIndex = (activeIndex + delta) % this._items.length;
  3356. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3357. };
  3358. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3359. var targetIndex = this._getItemIndex(relatedTarget);
  3360. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3361. var slideEvent = $.Event(Event$2.SLIDE, {
  3362. relatedTarget: relatedTarget,
  3363. direction: eventDirectionName,
  3364. from: fromIndex,
  3365. to: targetIndex
  3366. });
  3367. $(this._element).trigger(slideEvent);
  3368. return slideEvent;
  3369. };
  3370. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3371. if (this._indicatorsElement) {
  3372. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3373. $(indicators).removeClass(ClassName$2.ACTIVE);
  3374. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3375. if (nextIndicator) {
  3376. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3377. }
  3378. }
  3379. };
  3380. _proto._slide = function _slide(direction, element) {
  3381. var _this4 = this;
  3382. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3383. var activeElementIndex = this._getItemIndex(activeElement);
  3384. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3385. var nextElementIndex = this._getItemIndex(nextElement);
  3386. var isCycling = Boolean(this._interval);
  3387. var directionalClassName;
  3388. var orderClassName;
  3389. var eventDirectionName;
  3390. if (direction === Direction.NEXT) {
  3391. directionalClassName = ClassName$2.LEFT;
  3392. orderClassName = ClassName$2.NEXT;
  3393. eventDirectionName = Direction.LEFT;
  3394. } else {
  3395. directionalClassName = ClassName$2.RIGHT;
  3396. orderClassName = ClassName$2.PREV;
  3397. eventDirectionName = Direction.RIGHT;
  3398. }
  3399. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3400. this._isSliding = false;
  3401. return;
  3402. }
  3403. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3404. if (slideEvent.isDefaultPrevented()) {
  3405. return;
  3406. }
  3407. if (!activeElement || !nextElement) {
  3408. // Some weirdness is happening, so we bail
  3409. return;
  3410. }
  3411. this._isSliding = true;
  3412. if (isCycling) {
  3413. this.pause();
  3414. }
  3415. this._setActiveIndicatorElement(nextElement);
  3416. var slidEvent = $.Event(Event$2.SLID, {
  3417. relatedTarget: nextElement,
  3418. direction: eventDirectionName,
  3419. from: activeElementIndex,
  3420. to: nextElementIndex
  3421. });
  3422. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3423. $(nextElement).addClass(orderClassName);
  3424. Util.reflow(nextElement);
  3425. $(activeElement).addClass(directionalClassName);
  3426. $(nextElement).addClass(directionalClassName);
  3427. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3428. if (nextElementInterval) {
  3429. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3430. this._config.interval = nextElementInterval;
  3431. } else {
  3432. this._config.interval = this._config.defaultInterval || this._config.interval;
  3433. }
  3434. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3435. $(activeElement).one(Util.TRANSITION_END, function () {
  3436. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3437. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3438. _this4._isSliding = false;
  3439. setTimeout(function () {
  3440. return $(_this4._element).trigger(slidEvent);
  3441. }, 0);
  3442. }).emulateTransitionEnd(transitionDuration);
  3443. } else {
  3444. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3445. $(nextElement).addClass(ClassName$2.ACTIVE);
  3446. this._isSliding = false;
  3447. $(this._element).trigger(slidEvent);
  3448. }
  3449. if (isCycling) {
  3450. this.cycle();
  3451. }
  3452. } // Static
  3453. ;
  3454. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3455. return this.each(function () {
  3456. var data = $(this).data(DATA_KEY$2);
  3457. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3458. if (typeof config === 'object') {
  3459. _config = _objectSpread2({}, _config, {}, config);
  3460. }
  3461. var action = typeof config === 'string' ? config : _config.slide;
  3462. if (!data) {
  3463. data = new Carousel(this, _config);
  3464. $(this).data(DATA_KEY$2, data);
  3465. }
  3466. if (typeof config === 'number') {
  3467. data.to(config);
  3468. } else if (typeof action === 'string') {
  3469. if (typeof data[action] === 'undefined') {
  3470. throw new TypeError("No method named \"" + action + "\"");
  3471. }
  3472. data[action]();
  3473. } else if (_config.interval && _config.ride) {
  3474. data.pause();
  3475. data.cycle();
  3476. }
  3477. });
  3478. };
  3479. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3480. var selector = Util.getSelectorFromElement(this);
  3481. if (!selector) {
  3482. return;
  3483. }
  3484. var target = $(selector)[0];
  3485. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3486. return;
  3487. }
  3488. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3489. var slideIndex = this.getAttribute('data-slide-to');
  3490. if (slideIndex) {
  3491. config.interval = false;
  3492. }
  3493. Carousel._jQueryInterface.call($(target), config);
  3494. if (slideIndex) {
  3495. $(target).data(DATA_KEY$2).to(slideIndex);
  3496. }
  3497. event.preventDefault();
  3498. };
  3499. _createClass(Carousel, null, [{
  3500. key: "VERSION",
  3501. get: function get() {
  3502. return VERSION$2;
  3503. }
  3504. }, {
  3505. key: "Default",
  3506. get: function get() {
  3507. return Default;
  3508. }
  3509. }]);
  3510. return Carousel;
  3511. }();
  3512. /**
  3513. * ------------------------------------------------------------------------
  3514. * Data Api implementation
  3515. * ------------------------------------------------------------------------
  3516. */
  3517. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3518. $(window).on(Event$2.LOAD_DATA_API, function () {
  3519. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3520. for (var i = 0, len = carousels.length; i < len; i++) {
  3521. var $carousel = $(carousels[i]);
  3522. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3523. }
  3524. });
  3525. /**
  3526. * ------------------------------------------------------------------------
  3527. * jQuery
  3528. * ------------------------------------------------------------------------
  3529. */
  3530. $.fn[NAME$2] = Carousel._jQueryInterface;
  3531. $.fn[NAME$2].Constructor = Carousel;
  3532. $.fn[NAME$2].noConflict = function () {
  3533. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3534. return Carousel._jQueryInterface;
  3535. };
  3536. /**
  3537. * ------------------------------------------------------------------------
  3538. * Constants
  3539. * ------------------------------------------------------------------------
  3540. */
  3541. var NAME$3 = 'collapse';
  3542. var VERSION$3 = '4.4.1';
  3543. var DATA_KEY$3 = 'bs.collapse';
  3544. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3545. var DATA_API_KEY$3 = '.data-api';
  3546. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3547. var Default$1 = {
  3548. toggle: true,
  3549. parent: ''
  3550. };
  3551. var DefaultType$1 = {
  3552. toggle: 'boolean',
  3553. parent: '(string|element)'
  3554. };
  3555. var Event$3 = {
  3556. SHOW: "show" + EVENT_KEY$3,
  3557. SHOWN: "shown" + EVENT_KEY$3,
  3558. HIDE: "hide" + EVENT_KEY$3,
  3559. HIDDEN: "hidden" + EVENT_KEY$3,
  3560. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3561. };
  3562. var ClassName$3 = {
  3563. SHOW: 'show',
  3564. COLLAPSE: 'collapse',
  3565. COLLAPSING: 'collapsing',
  3566. COLLAPSED: 'collapsed'
  3567. };
  3568. var Dimension = {
  3569. WIDTH: 'width',
  3570. HEIGHT: 'height'
  3571. };
  3572. var Selector$3 = {
  3573. ACTIVES: '.show, .collapsing',
  3574. DATA_TOGGLE: '[data-toggle="collapse"]'
  3575. };
  3576. /**
  3577. * ------------------------------------------------------------------------
  3578. * Class Definition
  3579. * ------------------------------------------------------------------------
  3580. */
  3581. var Collapse =
  3582. /*#__PURE__*/
  3583. function () {
  3584. function Collapse(element, config) {
  3585. this._isTransitioning = false;
  3586. this._element = element;
  3587. this._config = this._getConfig(config);
  3588. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3589. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3590. for (var i = 0, len = toggleList.length; i < len; i++) {
  3591. var elem = toggleList[i];
  3592. var selector = Util.getSelectorFromElement(elem);
  3593. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3594. return foundElem === element;
  3595. });
  3596. if (selector !== null && filterElement.length > 0) {
  3597. this._selector = selector;
  3598. this._triggerArray.push(elem);
  3599. }
  3600. }
  3601. this._parent = this._config.parent ? this._getParent() : null;
  3602. if (!this._config.parent) {
  3603. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3604. }
  3605. if (this._config.toggle) {
  3606. this.toggle();
  3607. }
  3608. } // Getters
  3609. var _proto = Collapse.prototype;
  3610. // Public
  3611. _proto.toggle = function toggle() {
  3612. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3613. this.hide();
  3614. } else {
  3615. this.show();
  3616. }
  3617. };
  3618. _proto.show = function show() {
  3619. var _this = this;
  3620. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3621. return;
  3622. }
  3623. var actives;
  3624. var activesData;
  3625. if (this._parent) {
  3626. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3627. if (typeof _this._config.parent === 'string') {
  3628. return elem.getAttribute('data-parent') === _this._config.parent;
  3629. }
  3630. return elem.classList.contains(ClassName$3.COLLAPSE);
  3631. });
  3632. if (actives.length === 0) {
  3633. actives = null;
  3634. }
  3635. }
  3636. if (actives) {
  3637. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3638. if (activesData && activesData._isTransitioning) {
  3639. return;
  3640. }
  3641. }
  3642. var startEvent = $.Event(Event$3.SHOW);
  3643. $(this._element).trigger(startEvent);
  3644. if (startEvent.isDefaultPrevented()) {
  3645. return;
  3646. }
  3647. if (actives) {
  3648. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3649. if (!activesData) {
  3650. $(actives).data(DATA_KEY$3, null);
  3651. }
  3652. }
  3653. var dimension = this._getDimension();
  3654. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3655. this._element.style[dimension] = 0;
  3656. if (this._triggerArray.length) {
  3657. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3658. }
  3659. this.setTransitioning(true);
  3660. var complete = function complete() {
  3661. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3662. _this._element.style[dimension] = '';
  3663. _this.setTransitioning(false);
  3664. $(_this._element).trigger(Event$3.SHOWN);
  3665. };
  3666. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3667. var scrollSize = "scroll" + capitalizedDimension;
  3668. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3669. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3670. this._element.style[dimension] = this._element[scrollSize] + "px";
  3671. };
  3672. _proto.hide = function hide() {
  3673. var _this2 = this;
  3674. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3675. return;
  3676. }
  3677. var startEvent = $.Event(Event$3.HIDE);
  3678. $(this._element).trigger(startEvent);
  3679. if (startEvent.isDefaultPrevented()) {
  3680. return;
  3681. }
  3682. var dimension = this._getDimension();
  3683. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3684. Util.reflow(this._element);
  3685. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3686. var triggerArrayLength = this._triggerArray.length;
  3687. if (triggerArrayLength > 0) {
  3688. for (var i = 0; i < triggerArrayLength; i++) {
  3689. var trigger = this._triggerArray[i];
  3690. var selector = Util.getSelectorFromElement(trigger);
  3691. if (selector !== null) {
  3692. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3693. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3694. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3695. }
  3696. }
  3697. }
  3698. }
  3699. this.setTransitioning(true);
  3700. var complete = function complete() {
  3701. _this2.setTransitioning(false);
  3702. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3703. };
  3704. this._element.style[dimension] = '';
  3705. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3706. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3707. };
  3708. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3709. this._isTransitioning = isTransitioning;
  3710. };
  3711. _proto.dispose = function dispose() {
  3712. $.removeData(this._element, DATA_KEY$3);
  3713. this._config = null;
  3714. this._parent = null;
  3715. this._element = null;
  3716. this._triggerArray = null;
  3717. this._isTransitioning = null;
  3718. } // Private
  3719. ;
  3720. _proto._getConfig = function _getConfig(config) {
  3721. config = _objectSpread2({}, Default$1, {}, config);
  3722. config.toggle = Boolean(config.toggle); // Coerce string values
  3723. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3724. return config;
  3725. };
  3726. _proto._getDimension = function _getDimension() {
  3727. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3728. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3729. };
  3730. _proto._getParent = function _getParent() {
  3731. var _this3 = this;
  3732. var parent;
  3733. if (Util.isElement(this._config.parent)) {
  3734. parent = this._config.parent; // It's a jQuery object
  3735. if (typeof this._config.parent.jquery !== 'undefined') {
  3736. parent = this._config.parent[0];
  3737. }
  3738. } else {
  3739. parent = document.querySelector(this._config.parent);
  3740. }
  3741. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3742. var children = [].slice.call(parent.querySelectorAll(selector));
  3743. $(children).each(function (i, element) {
  3744. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3745. });
  3746. return parent;
  3747. };
  3748. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3749. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3750. if (triggerArray.length) {
  3751. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3752. }
  3753. } // Static
  3754. ;
  3755. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3756. var selector = Util.getSelectorFromElement(element);
  3757. return selector ? document.querySelector(selector) : null;
  3758. };
  3759. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3760. return this.each(function () {
  3761. var $this = $(this);
  3762. var data = $this.data(DATA_KEY$3);
  3763. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3764. if (!data && _config.toggle && /show|hide/.test(config)) {
  3765. _config.toggle = false;
  3766. }
  3767. if (!data) {
  3768. data = new Collapse(this, _config);
  3769. $this.data(DATA_KEY$3, data);
  3770. }
  3771. if (typeof config === 'string') {
  3772. if (typeof data[config] === 'undefined') {
  3773. throw new TypeError("No method named \"" + config + "\"");
  3774. }
  3775. data[config]();
  3776. }
  3777. });
  3778. };
  3779. _createClass(Collapse, null, [{
  3780. key: "VERSION",
  3781. get: function get() {
  3782. return VERSION$3;
  3783. }
  3784. }, {
  3785. key: "Default",
  3786. get: function get() {
  3787. return Default$1;
  3788. }
  3789. }]);
  3790. return Collapse;
  3791. }();
  3792. /**
  3793. * ------------------------------------------------------------------------
  3794. * Data Api implementation
  3795. * ------------------------------------------------------------------------
  3796. */
  3797. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3798. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3799. if (event.currentTarget.tagName === 'A') {
  3800. event.preventDefault();
  3801. }
  3802. var $trigger = $(this);
  3803. var selector = Util.getSelectorFromElement(this);
  3804. var selectors = [].slice.call(document.querySelectorAll(selector));
  3805. $(selectors).each(function () {
  3806. var $target = $(this);
  3807. var data = $target.data(DATA_KEY$3);
  3808. var config = data ? 'toggle' : $trigger.data();
  3809. Collapse._jQueryInterface.call($target, config);
  3810. });
  3811. });
  3812. /**
  3813. * ------------------------------------------------------------------------
  3814. * jQuery
  3815. * ------------------------------------------------------------------------
  3816. */
  3817. $.fn[NAME$3] = Collapse._jQueryInterface;
  3818. $.fn[NAME$3].Constructor = Collapse;
  3819. $.fn[NAME$3].noConflict = function () {
  3820. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3821. return Collapse._jQueryInterface;
  3822. };
  3823. /**
  3824. * ------------------------------------------------------------------------
  3825. * Constants
  3826. * ------------------------------------------------------------------------
  3827. */
  3828. var NAME$4 = 'dropdown';
  3829. var VERSION$4 = '4.4.1';
  3830. var DATA_KEY$4 = 'bs.dropdown';
  3831. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3832. var DATA_API_KEY$4 = '.data-api';
  3833. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3834. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3835. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3836. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3837. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3838. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3839. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3840. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3841. var Event$4 = {
  3842. HIDE: "hide" + EVENT_KEY$4,
  3843. HIDDEN: "hidden" + EVENT_KEY$4,
  3844. SHOW: "show" + EVENT_KEY$4,
  3845. SHOWN: "shown" + EVENT_KEY$4,
  3846. CLICK: "click" + EVENT_KEY$4,
  3847. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3848. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3849. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3850. };
  3851. var ClassName$4 = {
  3852. DISABLED: 'disabled',
  3853. SHOW: 'show',
  3854. DROPUP: 'dropup',
  3855. DROPRIGHT: 'dropright',
  3856. DROPLEFT: 'dropleft',
  3857. MENURIGHT: 'dropdown-menu-right',
  3858. MENULEFT: 'dropdown-menu-left',
  3859. POSITION_STATIC: 'position-static'
  3860. };
  3861. var Selector$4 = {
  3862. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3863. FORM_CHILD: '.dropdown form',
  3864. MENU: '.dropdown-menu',
  3865. NAVBAR_NAV: '.navbar-nav',
  3866. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3867. };
  3868. var AttachmentMap = {
  3869. TOP: 'top-start',
  3870. TOPEND: 'top-end',
  3871. BOTTOM: 'bottom-start',
  3872. BOTTOMEND: 'bottom-end',
  3873. RIGHT: 'right-start',
  3874. RIGHTEND: 'right-end',
  3875. LEFT: 'left-start',
  3876. LEFTEND: 'left-end'
  3877. };
  3878. var Default$2 = {
  3879. offset: 0,
  3880. flip: true,
  3881. boundary: 'scrollParent',
  3882. reference: 'toggle',
  3883. display: 'dynamic',
  3884. popperConfig: null
  3885. };
  3886. var DefaultType$2 = {
  3887. offset: '(number|string|function)',
  3888. flip: 'boolean',
  3889. boundary: '(string|element)',
  3890. reference: '(string|element)',
  3891. display: 'string',
  3892. popperConfig: '(null|object)'
  3893. };
  3894. /**
  3895. * ------------------------------------------------------------------------
  3896. * Class Definition
  3897. * ------------------------------------------------------------------------
  3898. */
  3899. var Dropdown =
  3900. /*#__PURE__*/
  3901. function () {
  3902. function Dropdown(element, config) {
  3903. this._element = element;
  3904. this._popper = null;
  3905. this._config = this._getConfig(config);
  3906. this._menu = this._getMenuElement();
  3907. this._inNavbar = this._detectNavbar();
  3908. this._addEventListeners();
  3909. } // Getters
  3910. var _proto = Dropdown.prototype;
  3911. // Public
  3912. _proto.toggle = function toggle() {
  3913. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3914. return;
  3915. }
  3916. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3917. Dropdown._clearMenus();
  3918. if (isActive) {
  3919. return;
  3920. }
  3921. this.show(true);
  3922. };
  3923. _proto.show = function show(usePopper) {
  3924. if (usePopper === void 0) {
  3925. usePopper = false;
  3926. }
  3927. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3928. return;
  3929. }
  3930. var relatedTarget = {
  3931. relatedTarget: this._element
  3932. };
  3933. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3934. var parent = Dropdown._getParentFromElement(this._element);
  3935. $(parent).trigger(showEvent);
  3936. if (showEvent.isDefaultPrevented()) {
  3937. return;
  3938. } // Disable totally Popper.js for Dropdown in Navbar
  3939. if (!this._inNavbar && usePopper) {
  3940. /**
  3941. * Check for Popper dependency
  3942. * Popper - https://popper.js.org
  3943. */
  3944. if (typeof Popper === 'undefined') {
  3945. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3946. }
  3947. var referenceElement = this._element;
  3948. if (this._config.reference === 'parent') {
  3949. referenceElement = parent;
  3950. } else if (Util.isElement(this._config.reference)) {
  3951. referenceElement = this._config.reference; // Check if it's jQuery element
  3952. if (typeof this._config.reference.jquery !== 'undefined') {
  3953. referenceElement = this._config.reference[0];
  3954. }
  3955. } // If boundary is not `scrollParent`, then set position to `static`
  3956. // to allow the menu to "escape" the scroll parent's boundaries
  3957. // https://github.com/twbs/bootstrap/issues/24251
  3958. if (this._config.boundary !== 'scrollParent') {
  3959. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3960. }
  3961. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3962. } // If this is a touch-enabled device we add extra
  3963. // empty mouseover listeners to the body's immediate children;
  3964. // only needed because of broken event delegation on iOS
  3965. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3966. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3967. $(document.body).children().on('mouseover', null, $.noop);
  3968. }
  3969. this._element.focus();
  3970. this._element.setAttribute('aria-expanded', true);
  3971. $(this._menu).toggleClass(ClassName$4.SHOW);
  3972. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3973. };
  3974. _proto.hide = function hide() {
  3975. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3976. return;
  3977. }
  3978. var relatedTarget = {
  3979. relatedTarget: this._element
  3980. };
  3981. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3982. var parent = Dropdown._getParentFromElement(this._element);
  3983. $(parent).trigger(hideEvent);
  3984. if (hideEvent.isDefaultPrevented()) {
  3985. return;
  3986. }
  3987. if (this._popper) {
  3988. this._popper.destroy();
  3989. }
  3990. $(this._menu).toggleClass(ClassName$4.SHOW);
  3991. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3992. };
  3993. _proto.dispose = function dispose() {
  3994. $.removeData(this._element, DATA_KEY$4);
  3995. $(this._element).off(EVENT_KEY$4);
  3996. this._element = null;
  3997. this._menu = null;
  3998. if (this._popper !== null) {
  3999. this._popper.destroy();
  4000. this._popper = null;
  4001. }
  4002. };
  4003. _proto.update = function update() {
  4004. this._inNavbar = this._detectNavbar();
  4005. if (this._popper !== null) {
  4006. this._popper.scheduleUpdate();
  4007. }
  4008. } // Private
  4009. ;
  4010. _proto._addEventListeners = function _addEventListeners() {
  4011. var _this = this;
  4012. $(this._element).on(Event$4.CLICK, function (event) {
  4013. event.preventDefault();
  4014. event.stopPropagation();
  4015. _this.toggle();
  4016. });
  4017. };
  4018. _proto._getConfig = function _getConfig(config) {
  4019. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4020. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4021. return config;
  4022. };
  4023. _proto._getMenuElement = function _getMenuElement() {
  4024. if (!this._menu) {
  4025. var parent = Dropdown._getParentFromElement(this._element);
  4026. if (parent) {
  4027. this._menu = parent.querySelector(Selector$4.MENU);
  4028. }
  4029. }
  4030. return this._menu;
  4031. };
  4032. _proto._getPlacement = function _getPlacement() {
  4033. var $parentDropdown = $(this._element.parentNode);
  4034. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4035. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4036. placement = AttachmentMap.TOP;
  4037. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4038. placement = AttachmentMap.TOPEND;
  4039. }
  4040. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4041. placement = AttachmentMap.RIGHT;
  4042. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4043. placement = AttachmentMap.LEFT;
  4044. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4045. placement = AttachmentMap.BOTTOMEND;
  4046. }
  4047. return placement;
  4048. };
  4049. _proto._detectNavbar = function _detectNavbar() {
  4050. return $(this._element).closest('.navbar').length > 0;
  4051. };
  4052. _proto._getOffset = function _getOffset() {
  4053. var _this2 = this;
  4054. var offset = {};
  4055. if (typeof this._config.offset === 'function') {
  4056. offset.fn = function (data) {
  4057. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4058. return data;
  4059. };
  4060. } else {
  4061. offset.offset = this._config.offset;
  4062. }
  4063. return offset;
  4064. };
  4065. _proto._getPopperConfig = function _getPopperConfig() {
  4066. var popperConfig = {
  4067. placement: this._getPlacement(),
  4068. modifiers: {
  4069. offset: this._getOffset(),
  4070. flip: {
  4071. enabled: this._config.flip
  4072. },
  4073. preventOverflow: {
  4074. boundariesElement: this._config.boundary
  4075. }
  4076. }
  4077. }; // Disable Popper.js if we have a static display
  4078. if (this._config.display === 'static') {
  4079. popperConfig.modifiers.applyStyle = {
  4080. enabled: false
  4081. };
  4082. }
  4083. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4084. } // Static
  4085. ;
  4086. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4087. return this.each(function () {
  4088. var data = $(this).data(DATA_KEY$4);
  4089. var _config = typeof config === 'object' ? config : null;
  4090. if (!data) {
  4091. data = new Dropdown(this, _config);
  4092. $(this).data(DATA_KEY$4, data);
  4093. }
  4094. if (typeof config === 'string') {
  4095. if (typeof data[config] === 'undefined') {
  4096. throw new TypeError("No method named \"" + config + "\"");
  4097. }
  4098. data[config]();
  4099. }
  4100. });
  4101. };
  4102. Dropdown._clearMenus = function _clearMenus(event) {
  4103. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4104. return;
  4105. }
  4106. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4107. for (var i = 0, len = toggles.length; i < len; i++) {
  4108. var parent = Dropdown._getParentFromElement(toggles[i]);
  4109. var context = $(toggles[i]).data(DATA_KEY$4);
  4110. var relatedTarget = {
  4111. relatedTarget: toggles[i]
  4112. };
  4113. if (event && event.type === 'click') {
  4114. relatedTarget.clickEvent = event;
  4115. }
  4116. if (!context) {
  4117. continue;
  4118. }
  4119. var dropdownMenu = context._menu;
  4120. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4121. continue;
  4122. }
  4123. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4124. continue;
  4125. }
  4126. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4127. $(parent).trigger(hideEvent);
  4128. if (hideEvent.isDefaultPrevented()) {
  4129. continue;
  4130. } // If this is a touch-enabled device we remove the extra
  4131. // empty mouseover listeners we added for iOS support
  4132. if ('ontouchstart' in document.documentElement) {
  4133. $(document.body).children().off('mouseover', null, $.noop);
  4134. }
  4135. toggles[i].setAttribute('aria-expanded', 'false');
  4136. if (context._popper) {
  4137. context._popper.destroy();
  4138. }
  4139. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4140. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4141. }
  4142. };
  4143. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4144. var parent;
  4145. var selector = Util.getSelectorFromElement(element);
  4146. if (selector) {
  4147. parent = document.querySelector(selector);
  4148. }
  4149. return parent || element.parentNode;
  4150. } // eslint-disable-next-line complexity
  4151. ;
  4152. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4153. // If not input/textarea:
  4154. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4155. // If input/textarea:
  4156. // - If space key => not a dropdown command
  4157. // - If key is other than escape
  4158. // - If key is not up or down => not a dropdown command
  4159. // - If trigger inside the menu => not a dropdown command
  4160. 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)) {
  4161. return;
  4162. }
  4163. event.preventDefault();
  4164. event.stopPropagation();
  4165. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4166. return;
  4167. }
  4168. var parent = Dropdown._getParentFromElement(this);
  4169. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4170. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4171. return;
  4172. }
  4173. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4174. if (event.which === ESCAPE_KEYCODE) {
  4175. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4176. $(toggle).trigger('focus');
  4177. }
  4178. $(this).trigger('click');
  4179. return;
  4180. }
  4181. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4182. return $(item).is(':visible');
  4183. });
  4184. if (items.length === 0) {
  4185. return;
  4186. }
  4187. var index = items.indexOf(event.target);
  4188. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4189. // Up
  4190. index--;
  4191. }
  4192. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4193. // Down
  4194. index++;
  4195. }
  4196. if (index < 0) {
  4197. index = 0;
  4198. }
  4199. items[index].focus();
  4200. };
  4201. _createClass(Dropdown, null, [{
  4202. key: "VERSION",
  4203. get: function get() {
  4204. return VERSION$4;
  4205. }
  4206. }, {
  4207. key: "Default",
  4208. get: function get() {
  4209. return Default$2;
  4210. }
  4211. }, {
  4212. key: "DefaultType",
  4213. get: function get() {
  4214. return DefaultType$2;
  4215. }
  4216. }]);
  4217. return Dropdown;
  4218. }();
  4219. /**
  4220. * ------------------------------------------------------------------------
  4221. * Data Api implementation
  4222. * ------------------------------------------------------------------------
  4223. */
  4224. $(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) {
  4225. event.preventDefault();
  4226. event.stopPropagation();
  4227. Dropdown._jQueryInterface.call($(this), 'toggle');
  4228. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4229. e.stopPropagation();
  4230. });
  4231. /**
  4232. * ------------------------------------------------------------------------
  4233. * jQuery
  4234. * ------------------------------------------------------------------------
  4235. */
  4236. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4237. $.fn[NAME$4].Constructor = Dropdown;
  4238. $.fn[NAME$4].noConflict = function () {
  4239. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4240. return Dropdown._jQueryInterface;
  4241. };
  4242. /**
  4243. * ------------------------------------------------------------------------
  4244. * Constants
  4245. * ------------------------------------------------------------------------
  4246. */
  4247. var NAME$5 = 'modal';
  4248. var VERSION$5 = '4.4.1';
  4249. var DATA_KEY$5 = 'bs.modal';
  4250. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4251. var DATA_API_KEY$5 = '.data-api';
  4252. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4253. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4254. var Default$3 = {
  4255. backdrop: true,
  4256. keyboard: true,
  4257. focus: true,
  4258. show: true
  4259. };
  4260. var DefaultType$3 = {
  4261. backdrop: '(boolean|string)',
  4262. keyboard: 'boolean',
  4263. focus: 'boolean',
  4264. show: 'boolean'
  4265. };
  4266. var Event$5 = {
  4267. HIDE: "hide" + EVENT_KEY$5,
  4268. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4269. HIDDEN: "hidden" + EVENT_KEY$5,
  4270. SHOW: "show" + EVENT_KEY$5,
  4271. SHOWN: "shown" + EVENT_KEY$5,
  4272. FOCUSIN: "focusin" + EVENT_KEY$5,
  4273. RESIZE: "resize" + EVENT_KEY$5,
  4274. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4275. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4276. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4277. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4278. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4279. };
  4280. var ClassName$5 = {
  4281. SCROLLABLE: 'modal-dialog-scrollable',
  4282. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4283. BACKDROP: 'modal-backdrop',
  4284. OPEN: 'modal-open',
  4285. FADE: 'fade',
  4286. SHOW: 'show',
  4287. STATIC: 'modal-static'
  4288. };
  4289. var Selector$5 = {
  4290. DIALOG: '.modal-dialog',
  4291. MODAL_BODY: '.modal-body',
  4292. DATA_TOGGLE: '[data-toggle="modal"]',
  4293. DATA_DISMISS: '[data-dismiss="modal"]',
  4294. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4295. STICKY_CONTENT: '.sticky-top'
  4296. };
  4297. /**
  4298. * ------------------------------------------------------------------------
  4299. * Class Definition
  4300. * ------------------------------------------------------------------------
  4301. */
  4302. var Modal =
  4303. /*#__PURE__*/
  4304. function () {
  4305. function Modal(element, config) {
  4306. this._config = this._getConfig(config);
  4307. this._element = element;
  4308. this._dialog = element.querySelector(Selector$5.DIALOG);
  4309. this._backdrop = null;
  4310. this._isShown = false;
  4311. this._isBodyOverflowing = false;
  4312. this._ignoreBackdropClick = false;
  4313. this._isTransitioning = false;
  4314. this._scrollbarWidth = 0;
  4315. } // Getters
  4316. var _proto = Modal.prototype;
  4317. // Public
  4318. _proto.toggle = function toggle(relatedTarget) {
  4319. return this._isShown ? this.hide() : this.show(relatedTarget);
  4320. };
  4321. _proto.show = function show(relatedTarget) {
  4322. var _this = this;
  4323. if (this._isShown || this._isTransitioning) {
  4324. return;
  4325. }
  4326. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4327. this._isTransitioning = true;
  4328. }
  4329. var showEvent = $.Event(Event$5.SHOW, {
  4330. relatedTarget: relatedTarget
  4331. });
  4332. $(this._element).trigger(showEvent);
  4333. if (this._isShown || showEvent.isDefaultPrevented()) {
  4334. return;
  4335. }
  4336. this._isShown = true;
  4337. this._checkScrollbar();
  4338. this._setScrollbar();
  4339. this._adjustDialog();
  4340. this._setEscapeEvent();
  4341. this._setResizeEvent();
  4342. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4343. return _this.hide(event);
  4344. });
  4345. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4346. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4347. if ($(event.target).is(_this._element)) {
  4348. _this._ignoreBackdropClick = true;
  4349. }
  4350. });
  4351. });
  4352. this._showBackdrop(function () {
  4353. return _this._showElement(relatedTarget);
  4354. });
  4355. };
  4356. _proto.hide = function hide(event) {
  4357. var _this2 = this;
  4358. if (event) {
  4359. event.preventDefault();
  4360. }
  4361. if (!this._isShown || this._isTransitioning) {
  4362. return;
  4363. }
  4364. var hideEvent = $.Event(Event$5.HIDE);
  4365. $(this._element).trigger(hideEvent);
  4366. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4367. return;
  4368. }
  4369. this._isShown = false;
  4370. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4371. if (transition) {
  4372. this._isTransitioning = true;
  4373. }
  4374. this._setEscapeEvent();
  4375. this._setResizeEvent();
  4376. $(document).off(Event$5.FOCUSIN);
  4377. $(this._element).removeClass(ClassName$5.SHOW);
  4378. $(this._element).off(Event$5.CLICK_DISMISS);
  4379. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4380. if (transition) {
  4381. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4382. $(this._element).one(Util.TRANSITION_END, function (event) {
  4383. return _this2._hideModal(event);
  4384. }).emulateTransitionEnd(transitionDuration);
  4385. } else {
  4386. this._hideModal();
  4387. }
  4388. };
  4389. _proto.dispose = function dispose() {
  4390. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4391. return $(htmlElement).off(EVENT_KEY$5);
  4392. });
  4393. /**
  4394. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4395. * Do not move `document` in `htmlElements` array
  4396. * It will remove `Event.CLICK_DATA_API` event that should remain
  4397. */
  4398. $(document).off(Event$5.FOCUSIN);
  4399. $.removeData(this._element, DATA_KEY$5);
  4400. this._config = null;
  4401. this._element = null;
  4402. this._dialog = null;
  4403. this._backdrop = null;
  4404. this._isShown = null;
  4405. this._isBodyOverflowing = null;
  4406. this._ignoreBackdropClick = null;
  4407. this._isTransitioning = null;
  4408. this._scrollbarWidth = null;
  4409. };
  4410. _proto.handleUpdate = function handleUpdate() {
  4411. this._adjustDialog();
  4412. } // Private
  4413. ;
  4414. _proto._getConfig = function _getConfig(config) {
  4415. config = _objectSpread2({}, Default$3, {}, config);
  4416. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4417. return config;
  4418. };
  4419. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4420. var _this3 = this;
  4421. if (this._config.backdrop === 'static') {
  4422. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4423. $(this._element).trigger(hideEventPrevented);
  4424. if (hideEventPrevented.defaultPrevented) {
  4425. return;
  4426. }
  4427. this._element.classList.add(ClassName$5.STATIC);
  4428. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4429. $(this._element).one(Util.TRANSITION_END, function () {
  4430. _this3._element.classList.remove(ClassName$5.STATIC);
  4431. }).emulateTransitionEnd(modalTransitionDuration);
  4432. this._element.focus();
  4433. } else {
  4434. this.hide();
  4435. }
  4436. };
  4437. _proto._showElement = function _showElement(relatedTarget) {
  4438. var _this4 = this;
  4439. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4440. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4441. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4442. // Don't move modal's DOM position
  4443. document.body.appendChild(this._element);
  4444. }
  4445. this._element.style.display = 'block';
  4446. this._element.removeAttribute('aria-hidden');
  4447. this._element.setAttribute('aria-modal', true);
  4448. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4449. modalBody.scrollTop = 0;
  4450. } else {
  4451. this._element.scrollTop = 0;
  4452. }
  4453. if (transition) {
  4454. Util.reflow(this._element);
  4455. }
  4456. $(this._element).addClass(ClassName$5.SHOW);
  4457. if (this._config.focus) {
  4458. this._enforceFocus();
  4459. }
  4460. var shownEvent = $.Event(Event$5.SHOWN, {
  4461. relatedTarget: relatedTarget
  4462. });
  4463. var transitionComplete = function transitionComplete() {
  4464. if (_this4._config.focus) {
  4465. _this4._element.focus();
  4466. }
  4467. _this4._isTransitioning = false;
  4468. $(_this4._element).trigger(shownEvent);
  4469. };
  4470. if (transition) {
  4471. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4472. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4473. } else {
  4474. transitionComplete();
  4475. }
  4476. };
  4477. _proto._enforceFocus = function _enforceFocus() {
  4478. var _this5 = this;
  4479. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4480. .on(Event$5.FOCUSIN, function (event) {
  4481. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4482. _this5._element.focus();
  4483. }
  4484. });
  4485. };
  4486. _proto._setEscapeEvent = function _setEscapeEvent() {
  4487. var _this6 = this;
  4488. if (this._isShown && this._config.keyboard) {
  4489. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4490. if (event.which === ESCAPE_KEYCODE$1) {
  4491. _this6._triggerBackdropTransition();
  4492. }
  4493. });
  4494. } else if (!this._isShown) {
  4495. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4496. }
  4497. };
  4498. _proto._setResizeEvent = function _setResizeEvent() {
  4499. var _this7 = this;
  4500. if (this._isShown) {
  4501. $(window).on(Event$5.RESIZE, function (event) {
  4502. return _this7.handleUpdate(event);
  4503. });
  4504. } else {
  4505. $(window).off(Event$5.RESIZE);
  4506. }
  4507. };
  4508. _proto._hideModal = function _hideModal() {
  4509. var _this8 = this;
  4510. this._element.style.display = 'none';
  4511. this._element.setAttribute('aria-hidden', true);
  4512. this._element.removeAttribute('aria-modal');
  4513. this._isTransitioning = false;
  4514. this._showBackdrop(function () {
  4515. $(document.body).removeClass(ClassName$5.OPEN);
  4516. _this8._resetAdjustments();
  4517. _this8._resetScrollbar();
  4518. $(_this8._element).trigger(Event$5.HIDDEN);
  4519. });
  4520. };
  4521. _proto._removeBackdrop = function _removeBackdrop() {
  4522. if (this._backdrop) {
  4523. $(this._backdrop).remove();
  4524. this._backdrop = null;
  4525. }
  4526. };
  4527. _proto._showBackdrop = function _showBackdrop(callback) {
  4528. var _this9 = this;
  4529. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4530. if (this._isShown && this._config.backdrop) {
  4531. this._backdrop = document.createElement('div');
  4532. this._backdrop.className = ClassName$5.BACKDROP;
  4533. if (animate) {
  4534. this._backdrop.classList.add(animate);
  4535. }
  4536. $(this._backdrop).appendTo(document.body);
  4537. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4538. if (_this9._ignoreBackdropClick) {
  4539. _this9._ignoreBackdropClick = false;
  4540. return;
  4541. }
  4542. if (event.target !== event.currentTarget) {
  4543. return;
  4544. }
  4545. _this9._triggerBackdropTransition();
  4546. });
  4547. if (animate) {
  4548. Util.reflow(this._backdrop);
  4549. }
  4550. $(this._backdrop).addClass(ClassName$5.SHOW);
  4551. if (!callback) {
  4552. return;
  4553. }
  4554. if (!animate) {
  4555. callback();
  4556. return;
  4557. }
  4558. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4559. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4560. } else if (!this._isShown && this._backdrop) {
  4561. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4562. var callbackRemove = function callbackRemove() {
  4563. _this9._removeBackdrop();
  4564. if (callback) {
  4565. callback();
  4566. }
  4567. };
  4568. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4569. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4570. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4571. } else {
  4572. callbackRemove();
  4573. }
  4574. } else if (callback) {
  4575. callback();
  4576. }
  4577. } // ----------------------------------------------------------------------
  4578. // the following methods are used to handle overflowing modals
  4579. // todo (fat): these should probably be refactored out of modal.js
  4580. // ----------------------------------------------------------------------
  4581. ;
  4582. _proto._adjustDialog = function _adjustDialog() {
  4583. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4584. if (!this._isBodyOverflowing && isModalOverflowing) {
  4585. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4586. }
  4587. if (this._isBodyOverflowing && !isModalOverflowing) {
  4588. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4589. }
  4590. };
  4591. _proto._resetAdjustments = function _resetAdjustments() {
  4592. this._element.style.paddingLeft = '';
  4593. this._element.style.paddingRight = '';
  4594. };
  4595. _proto._checkScrollbar = function _checkScrollbar() {
  4596. var rect = document.body.getBoundingClientRect();
  4597. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4598. this._scrollbarWidth = this._getScrollbarWidth();
  4599. };
  4600. _proto._setScrollbar = function _setScrollbar() {
  4601. var _this10 = this;
  4602. if (this._isBodyOverflowing) {
  4603. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4604. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4605. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4606. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4607. $(fixedContent).each(function (index, element) {
  4608. var actualPadding = element.style.paddingRight;
  4609. var calculatedPadding = $(element).css('padding-right');
  4610. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4611. }); // Adjust sticky content margin
  4612. $(stickyContent).each(function (index, element) {
  4613. var actualMargin = element.style.marginRight;
  4614. var calculatedMargin = $(element).css('margin-right');
  4615. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4616. }); // Adjust body padding
  4617. var actualPadding = document.body.style.paddingRight;
  4618. var calculatedPadding = $(document.body).css('padding-right');
  4619. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4620. }
  4621. $(document.body).addClass(ClassName$5.OPEN);
  4622. };
  4623. _proto._resetScrollbar = function _resetScrollbar() {
  4624. // Restore fixed content padding
  4625. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4626. $(fixedContent).each(function (index, element) {
  4627. var padding = $(element).data('padding-right');
  4628. $(element).removeData('padding-right');
  4629. element.style.paddingRight = padding ? padding : '';
  4630. }); // Restore sticky content
  4631. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4632. $(elements).each(function (index, element) {
  4633. var margin = $(element).data('margin-right');
  4634. if (typeof margin !== 'undefined') {
  4635. $(element).css('margin-right', margin).removeData('margin-right');
  4636. }
  4637. }); // Restore body padding
  4638. var padding = $(document.body).data('padding-right');
  4639. $(document.body).removeData('padding-right');
  4640. document.body.style.paddingRight = padding ? padding : '';
  4641. };
  4642. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4643. // thx d.walsh
  4644. var scrollDiv = document.createElement('div');
  4645. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4646. document.body.appendChild(scrollDiv);
  4647. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4648. document.body.removeChild(scrollDiv);
  4649. return scrollbarWidth;
  4650. } // Static
  4651. ;
  4652. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4653. return this.each(function () {
  4654. var data = $(this).data(DATA_KEY$5);
  4655. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4656. if (!data) {
  4657. data = new Modal(this, _config);
  4658. $(this).data(DATA_KEY$5, data);
  4659. }
  4660. if (typeof config === 'string') {
  4661. if (typeof data[config] === 'undefined') {
  4662. throw new TypeError("No method named \"" + config + "\"");
  4663. }
  4664. data[config](relatedTarget);
  4665. } else if (_config.show) {
  4666. data.show(relatedTarget);
  4667. }
  4668. });
  4669. };
  4670. _createClass(Modal, null, [{
  4671. key: "VERSION",
  4672. get: function get() {
  4673. return VERSION$5;
  4674. }
  4675. }, {
  4676. key: "Default",
  4677. get: function get() {
  4678. return Default$3;
  4679. }
  4680. }]);
  4681. return Modal;
  4682. }();
  4683. /**
  4684. * ------------------------------------------------------------------------
  4685. * Data Api implementation
  4686. * ------------------------------------------------------------------------
  4687. */
  4688. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4689. var _this11 = this;
  4690. var target;
  4691. var selector = Util.getSelectorFromElement(this);
  4692. if (selector) {
  4693. target = document.querySelector(selector);
  4694. }
  4695. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4696. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4697. event.preventDefault();
  4698. }
  4699. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4700. if (showEvent.isDefaultPrevented()) {
  4701. // Only register focus restorer if modal will actually get shown
  4702. return;
  4703. }
  4704. $target.one(Event$5.HIDDEN, function () {
  4705. if ($(_this11).is(':visible')) {
  4706. _this11.focus();
  4707. }
  4708. });
  4709. });
  4710. Modal._jQueryInterface.call($(target), config, this);
  4711. });
  4712. /**
  4713. * ------------------------------------------------------------------------
  4714. * jQuery
  4715. * ------------------------------------------------------------------------
  4716. */
  4717. $.fn[NAME$5] = Modal._jQueryInterface;
  4718. $.fn[NAME$5].Constructor = Modal;
  4719. $.fn[NAME$5].noConflict = function () {
  4720. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4721. return Modal._jQueryInterface;
  4722. };
  4723. /**
  4724. * --------------------------------------------------------------------------
  4725. * Bootstrap (v4.4.1): tools/sanitizer.js
  4726. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4727. * --------------------------------------------------------------------------
  4728. */
  4729. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4730. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4731. var DefaultWhitelist = {
  4732. // Global attributes allowed on any supplied element below.
  4733. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4734. a: ['target', 'href', 'title', 'rel'],
  4735. area: [],
  4736. b: [],
  4737. br: [],
  4738. col: [],
  4739. code: [],
  4740. div: [],
  4741. em: [],
  4742. hr: [],
  4743. h1: [],
  4744. h2: [],
  4745. h3: [],
  4746. h4: [],
  4747. h5: [],
  4748. h6: [],
  4749. i: [],
  4750. img: ['src', 'alt', 'title', 'width', 'height'],
  4751. li: [],
  4752. ol: [],
  4753. p: [],
  4754. pre: [],
  4755. s: [],
  4756. small: [],
  4757. span: [],
  4758. sub: [],
  4759. sup: [],
  4760. strong: [],
  4761. u: [],
  4762. ul: []
  4763. };
  4764. /**
  4765. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4766. *
  4767. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4768. */
  4769. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4770. /**
  4771. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4772. *
  4773. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4774. */
  4775. 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;
  4776. function allowedAttribute(attr, allowedAttributeList) {
  4777. var attrName = attr.nodeName.toLowerCase();
  4778. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4779. if (uriAttrs.indexOf(attrName) !== -1) {
  4780. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4781. }
  4782. return true;
  4783. }
  4784. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4785. return attrRegex instanceof RegExp;
  4786. }); // Check if a regular expression validates the attribute.
  4787. for (var i = 0, l = regExp.length; i < l; i++) {
  4788. if (attrName.match(regExp[i])) {
  4789. return true;
  4790. }
  4791. }
  4792. return false;
  4793. }
  4794. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4795. if (unsafeHtml.length === 0) {
  4796. return unsafeHtml;
  4797. }
  4798. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4799. return sanitizeFn(unsafeHtml);
  4800. }
  4801. var domParser = new window.DOMParser();
  4802. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4803. var whitelistKeys = Object.keys(whiteList);
  4804. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4805. var _loop = function _loop(i, len) {
  4806. var el = elements[i];
  4807. var elName = el.nodeName.toLowerCase();
  4808. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4809. el.parentNode.removeChild(el);
  4810. return "continue";
  4811. }
  4812. var attributeList = [].slice.call(el.attributes);
  4813. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4814. attributeList.forEach(function (attr) {
  4815. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4816. el.removeAttribute(attr.nodeName);
  4817. }
  4818. });
  4819. };
  4820. for (var i = 0, len = elements.length; i < len; i++) {
  4821. var _ret = _loop(i);
  4822. if (_ret === "continue") continue;
  4823. }
  4824. return createdDocument.body.innerHTML;
  4825. }
  4826. /**
  4827. * ------------------------------------------------------------------------
  4828. * Constants
  4829. * ------------------------------------------------------------------------
  4830. */
  4831. var NAME$6 = 'tooltip';
  4832. var VERSION$6 = '4.4.1';
  4833. var DATA_KEY$6 = 'bs.tooltip';
  4834. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4835. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4836. var CLASS_PREFIX = 'bs-tooltip';
  4837. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4838. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4839. var DefaultType$4 = {
  4840. animation: 'boolean',
  4841. template: 'string',
  4842. title: '(string|element|function)',
  4843. trigger: 'string',
  4844. delay: '(number|object)',
  4845. html: 'boolean',
  4846. selector: '(string|boolean)',
  4847. placement: '(string|function)',
  4848. offset: '(number|string|function)',
  4849. container: '(string|element|boolean)',
  4850. fallbackPlacement: '(string|array)',
  4851. boundary: '(string|element)',
  4852. sanitize: 'boolean',
  4853. sanitizeFn: '(null|function)',
  4854. whiteList: 'object',
  4855. popperConfig: '(null|object)'
  4856. };
  4857. var AttachmentMap$1 = {
  4858. AUTO: 'auto',
  4859. TOP: 'top',
  4860. RIGHT: 'right',
  4861. BOTTOM: 'bottom',
  4862. LEFT: 'left'
  4863. };
  4864. var Default$4 = {
  4865. animation: true,
  4866. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4867. trigger: 'hover focus',
  4868. title: '',
  4869. delay: 0,
  4870. html: false,
  4871. selector: false,
  4872. placement: 'top',
  4873. offset: 0,
  4874. container: false,
  4875. fallbackPlacement: 'flip',
  4876. boundary: 'scrollParent',
  4877. sanitize: true,
  4878. sanitizeFn: null,
  4879. whiteList: DefaultWhitelist,
  4880. popperConfig: null
  4881. };
  4882. var HoverState = {
  4883. SHOW: 'show',
  4884. OUT: 'out'
  4885. };
  4886. var Event$6 = {
  4887. HIDE: "hide" + EVENT_KEY$6,
  4888. HIDDEN: "hidden" + EVENT_KEY$6,
  4889. SHOW: "show" + EVENT_KEY$6,
  4890. SHOWN: "shown" + EVENT_KEY$6,
  4891. INSERTED: "inserted" + EVENT_KEY$6,
  4892. CLICK: "click" + EVENT_KEY$6,
  4893. FOCUSIN: "focusin" + EVENT_KEY$6,
  4894. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4895. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4896. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4897. };
  4898. var ClassName$6 = {
  4899. FADE: 'fade',
  4900. SHOW: 'show'
  4901. };
  4902. var Selector$6 = {
  4903. TOOLTIP: '.tooltip',
  4904. TOOLTIP_INNER: '.tooltip-inner',
  4905. ARROW: '.arrow'
  4906. };
  4907. var Trigger = {
  4908. HOVER: 'hover',
  4909. FOCUS: 'focus',
  4910. CLICK: 'click',
  4911. MANUAL: 'manual'
  4912. };
  4913. /**
  4914. * ------------------------------------------------------------------------
  4915. * Class Definition
  4916. * ------------------------------------------------------------------------
  4917. */
  4918. var Tooltip =
  4919. /*#__PURE__*/
  4920. function () {
  4921. function Tooltip(element, config) {
  4922. if (typeof Popper === 'undefined') {
  4923. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4924. } // private
  4925. this._isEnabled = true;
  4926. this._timeout = 0;
  4927. this._hoverState = '';
  4928. this._activeTrigger = {};
  4929. this._popper = null; // Protected
  4930. this.element = element;
  4931. this.config = this._getConfig(config);
  4932. this.tip = null;
  4933. this._setListeners();
  4934. } // Getters
  4935. var _proto = Tooltip.prototype;
  4936. // Public
  4937. _proto.enable = function enable() {
  4938. this._isEnabled = true;
  4939. };
  4940. _proto.disable = function disable() {
  4941. this._isEnabled = false;
  4942. };
  4943. _proto.toggleEnabled = function toggleEnabled() {
  4944. this._isEnabled = !this._isEnabled;
  4945. };
  4946. _proto.toggle = function toggle(event) {
  4947. if (!this._isEnabled) {
  4948. return;
  4949. }
  4950. if (event) {
  4951. var dataKey = this.constructor.DATA_KEY;
  4952. var context = $(event.currentTarget).data(dataKey);
  4953. if (!context) {
  4954. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4955. $(event.currentTarget).data(dataKey, context);
  4956. }
  4957. context._activeTrigger.click = !context._activeTrigger.click;
  4958. if (context._isWithActiveTrigger()) {
  4959. context._enter(null, context);
  4960. } else {
  4961. context._leave(null, context);
  4962. }
  4963. } else {
  4964. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4965. this._leave(null, this);
  4966. return;
  4967. }
  4968. this._enter(null, this);
  4969. }
  4970. };
  4971. _proto.dispose = function dispose() {
  4972. clearTimeout(this._timeout);
  4973. $.removeData(this.element, this.constructor.DATA_KEY);
  4974. $(this.element).off(this.constructor.EVENT_KEY);
  4975. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4976. if (this.tip) {
  4977. $(this.tip).remove();
  4978. }
  4979. this._isEnabled = null;
  4980. this._timeout = null;
  4981. this._hoverState = null;
  4982. this._activeTrigger = null;
  4983. if (this._popper) {
  4984. this._popper.destroy();
  4985. }
  4986. this._popper = null;
  4987. this.element = null;
  4988. this.config = null;
  4989. this.tip = null;
  4990. };
  4991. _proto.show = function show() {
  4992. var _this = this;
  4993. if ($(this.element).css('display') === 'none') {
  4994. throw new Error('Please use show on visible elements');
  4995. }
  4996. var showEvent = $.Event(this.constructor.Event.SHOW);
  4997. if (this.isWithContent() && this._isEnabled) {
  4998. $(this.element).trigger(showEvent);
  4999. var shadowRoot = Util.findShadowRoot(this.element);
  5000. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5001. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5002. return;
  5003. }
  5004. var tip = this.getTipElement();
  5005. var tipId = Util.getUID(this.constructor.NAME);
  5006. tip.setAttribute('id', tipId);
  5007. this.element.setAttribute('aria-describedby', tipId);
  5008. this.setContent();
  5009. if (this.config.animation) {
  5010. $(tip).addClass(ClassName$6.FADE);
  5011. }
  5012. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5013. var attachment = this._getAttachment(placement);
  5014. this.addAttachmentClass(attachment);
  5015. var container = this._getContainer();
  5016. $(tip).data(this.constructor.DATA_KEY, this);
  5017. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5018. $(tip).appendTo(container);
  5019. }
  5020. $(this.element).trigger(this.constructor.Event.INSERTED);
  5021. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5022. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5023. // empty mouseover listeners to the body's immediate children;
  5024. // only needed because of broken event delegation on iOS
  5025. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5026. if ('ontouchstart' in document.documentElement) {
  5027. $(document.body).children().on('mouseover', null, $.noop);
  5028. }
  5029. var complete = function complete() {
  5030. if (_this.config.animation) {
  5031. _this._fixTransition();
  5032. }
  5033. var prevHoverState = _this._hoverState;
  5034. _this._hoverState = null;
  5035. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5036. if (prevHoverState === HoverState.OUT) {
  5037. _this._leave(null, _this);
  5038. }
  5039. };
  5040. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5041. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5042. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5043. } else {
  5044. complete();
  5045. }
  5046. }
  5047. };
  5048. _proto.hide = function hide(callback) {
  5049. var _this2 = this;
  5050. var tip = this.getTipElement();
  5051. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5052. var complete = function complete() {
  5053. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5054. tip.parentNode.removeChild(tip);
  5055. }
  5056. _this2._cleanTipClass();
  5057. _this2.element.removeAttribute('aria-describedby');
  5058. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5059. if (_this2._popper !== null) {
  5060. _this2._popper.destroy();
  5061. }
  5062. if (callback) {
  5063. callback();
  5064. }
  5065. };
  5066. $(this.element).trigger(hideEvent);
  5067. if (hideEvent.isDefaultPrevented()) {
  5068. return;
  5069. }
  5070. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5071. // empty mouseover listeners we added for iOS support
  5072. if ('ontouchstart' in document.documentElement) {
  5073. $(document.body).children().off('mouseover', null, $.noop);
  5074. }
  5075. this._activeTrigger[Trigger.CLICK] = false;
  5076. this._activeTrigger[Trigger.FOCUS] = false;
  5077. this._activeTrigger[Trigger.HOVER] = false;
  5078. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5079. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5080. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5081. } else {
  5082. complete();
  5083. }
  5084. this._hoverState = '';
  5085. };
  5086. _proto.update = function update() {
  5087. if (this._popper !== null) {
  5088. this._popper.scheduleUpdate();
  5089. }
  5090. } // Protected
  5091. ;
  5092. _proto.isWithContent = function isWithContent() {
  5093. return Boolean(this.getTitle());
  5094. };
  5095. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5096. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5097. };
  5098. _proto.getTipElement = function getTipElement() {
  5099. this.tip = this.tip || $(this.config.template)[0];
  5100. return this.tip;
  5101. };
  5102. _proto.setContent = function setContent() {
  5103. var tip = this.getTipElement();
  5104. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5105. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5106. };
  5107. _proto.setElementContent = function setElementContent($element, content) {
  5108. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5109. // Content is a DOM node or a jQuery
  5110. if (this.config.html) {
  5111. if (!$(content).parent().is($element)) {
  5112. $element.empty().append(content);
  5113. }
  5114. } else {
  5115. $element.text($(content).text());
  5116. }
  5117. return;
  5118. }
  5119. if (this.config.html) {
  5120. if (this.config.sanitize) {
  5121. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5122. }
  5123. $element.html(content);
  5124. } else {
  5125. $element.text(content);
  5126. }
  5127. };
  5128. _proto.getTitle = function getTitle() {
  5129. var title = this.element.getAttribute('data-original-title');
  5130. if (!title) {
  5131. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5132. }
  5133. return title;
  5134. } // Private
  5135. ;
  5136. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5137. var _this3 = this;
  5138. var defaultBsConfig = {
  5139. placement: attachment,
  5140. modifiers: {
  5141. offset: this._getOffset(),
  5142. flip: {
  5143. behavior: this.config.fallbackPlacement
  5144. },
  5145. arrow: {
  5146. element: Selector$6.ARROW
  5147. },
  5148. preventOverflow: {
  5149. boundariesElement: this.config.boundary
  5150. }
  5151. },
  5152. onCreate: function onCreate(data) {
  5153. if (data.originalPlacement !== data.placement) {
  5154. _this3._handlePopperPlacementChange(data);
  5155. }
  5156. },
  5157. onUpdate: function onUpdate(data) {
  5158. return _this3._handlePopperPlacementChange(data);
  5159. }
  5160. };
  5161. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5162. };
  5163. _proto._getOffset = function _getOffset() {
  5164. var _this4 = this;
  5165. var offset = {};
  5166. if (typeof this.config.offset === 'function') {
  5167. offset.fn = function (data) {
  5168. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5169. return data;
  5170. };
  5171. } else {
  5172. offset.offset = this.config.offset;
  5173. }
  5174. return offset;
  5175. };
  5176. _proto._getContainer = function _getContainer() {
  5177. if (this.config.container === false) {
  5178. return document.body;
  5179. }
  5180. if (Util.isElement(this.config.container)) {
  5181. return $(this.config.container);
  5182. }
  5183. return $(document).find(this.config.container);
  5184. };
  5185. _proto._getAttachment = function _getAttachment(placement) {
  5186. return AttachmentMap$1[placement.toUpperCase()];
  5187. };
  5188. _proto._setListeners = function _setListeners() {
  5189. var _this5 = this;
  5190. var triggers = this.config.trigger.split(' ');
  5191. triggers.forEach(function (trigger) {
  5192. if (trigger === 'click') {
  5193. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5194. return _this5.toggle(event);
  5195. });
  5196. } else if (trigger !== Trigger.MANUAL) {
  5197. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5198. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5199. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5200. return _this5._enter(event);
  5201. }).on(eventOut, _this5.config.selector, function (event) {
  5202. return _this5._leave(event);
  5203. });
  5204. }
  5205. });
  5206. this._hideModalHandler = function () {
  5207. if (_this5.element) {
  5208. _this5.hide();
  5209. }
  5210. };
  5211. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5212. if (this.config.selector) {
  5213. this.config = _objectSpread2({}, this.config, {
  5214. trigger: 'manual',
  5215. selector: ''
  5216. });
  5217. } else {
  5218. this._fixTitle();
  5219. }
  5220. };
  5221. _proto._fixTitle = function _fixTitle() {
  5222. var titleType = typeof this.element.getAttribute('data-original-title');
  5223. if (this.element.getAttribute('title') || titleType !== 'string') {
  5224. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5225. this.element.setAttribute('title', '');
  5226. }
  5227. };
  5228. _proto._enter = function _enter(event, context) {
  5229. var dataKey = this.constructor.DATA_KEY;
  5230. context = context || $(event.currentTarget).data(dataKey);
  5231. if (!context) {
  5232. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5233. $(event.currentTarget).data(dataKey, context);
  5234. }
  5235. if (event) {
  5236. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5237. }
  5238. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5239. context._hoverState = HoverState.SHOW;
  5240. return;
  5241. }
  5242. clearTimeout(context._timeout);
  5243. context._hoverState = HoverState.SHOW;
  5244. if (!context.config.delay || !context.config.delay.show) {
  5245. context.show();
  5246. return;
  5247. }
  5248. context._timeout = setTimeout(function () {
  5249. if (context._hoverState === HoverState.SHOW) {
  5250. context.show();
  5251. }
  5252. }, context.config.delay.show);
  5253. };
  5254. _proto._leave = function _leave(event, context) {
  5255. var dataKey = this.constructor.DATA_KEY;
  5256. context = context || $(event.currentTarget).data(dataKey);
  5257. if (!context) {
  5258. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5259. $(event.currentTarget).data(dataKey, context);
  5260. }
  5261. if (event) {
  5262. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5263. }
  5264. if (context._isWithActiveTrigger()) {
  5265. return;
  5266. }
  5267. clearTimeout(context._timeout);
  5268. context._hoverState = HoverState.OUT;
  5269. if (!context.config.delay || !context.config.delay.hide) {
  5270. context.hide();
  5271. return;
  5272. }
  5273. context._timeout = setTimeout(function () {
  5274. if (context._hoverState === HoverState.OUT) {
  5275. context.hide();
  5276. }
  5277. }, context.config.delay.hide);
  5278. };
  5279. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5280. for (var trigger in this._activeTrigger) {
  5281. if (this._activeTrigger[trigger]) {
  5282. return true;
  5283. }
  5284. }
  5285. return false;
  5286. };
  5287. _proto._getConfig = function _getConfig(config) {
  5288. var dataAttributes = $(this.element).data();
  5289. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5290. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5291. delete dataAttributes[dataAttr];
  5292. }
  5293. });
  5294. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5295. if (typeof config.delay === 'number') {
  5296. config.delay = {
  5297. show: config.delay,
  5298. hide: config.delay
  5299. };
  5300. }
  5301. if (typeof config.title === 'number') {
  5302. config.title = config.title.toString();
  5303. }
  5304. if (typeof config.content === 'number') {
  5305. config.content = config.content.toString();
  5306. }
  5307. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5308. if (config.sanitize) {
  5309. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5310. }
  5311. return config;
  5312. };
  5313. _proto._getDelegateConfig = function _getDelegateConfig() {
  5314. var config = {};
  5315. if (this.config) {
  5316. for (var key in this.config) {
  5317. if (this.constructor.Default[key] !== this.config[key]) {
  5318. config[key] = this.config[key];
  5319. }
  5320. }
  5321. }
  5322. return config;
  5323. };
  5324. _proto._cleanTipClass = function _cleanTipClass() {
  5325. var $tip = $(this.getTipElement());
  5326. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5327. if (tabClass !== null && tabClass.length) {
  5328. $tip.removeClass(tabClass.join(''));
  5329. }
  5330. };
  5331. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5332. var popperInstance = popperData.instance;
  5333. this.tip = popperInstance.popper;
  5334. this._cleanTipClass();
  5335. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5336. };
  5337. _proto._fixTransition = function _fixTransition() {
  5338. var tip = this.getTipElement();
  5339. var initConfigAnimation = this.config.animation;
  5340. if (tip.getAttribute('x-placement') !== null) {
  5341. return;
  5342. }
  5343. $(tip).removeClass(ClassName$6.FADE);
  5344. this.config.animation = false;
  5345. this.hide();
  5346. this.show();
  5347. this.config.animation = initConfigAnimation;
  5348. } // Static
  5349. ;
  5350. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5351. return this.each(function () {
  5352. var data = $(this).data(DATA_KEY$6);
  5353. var _config = typeof config === 'object' && config;
  5354. if (!data && /dispose|hide/.test(config)) {
  5355. return;
  5356. }
  5357. if (!data) {
  5358. data = new Tooltip(this, _config);
  5359. $(this).data(DATA_KEY$6, data);
  5360. }
  5361. if (typeof config === 'string') {
  5362. if (typeof data[config] === 'undefined') {
  5363. throw new TypeError("No method named \"" + config + "\"");
  5364. }
  5365. data[config]();
  5366. }
  5367. });
  5368. };
  5369. _createClass(Tooltip, null, [{
  5370. key: "VERSION",
  5371. get: function get() {
  5372. return VERSION$6;
  5373. }
  5374. }, {
  5375. key: "Default",
  5376. get: function get() {
  5377. return Default$4;
  5378. }
  5379. }, {
  5380. key: "NAME",
  5381. get: function get() {
  5382. return NAME$6;
  5383. }
  5384. }, {
  5385. key: "DATA_KEY",
  5386. get: function get() {
  5387. return DATA_KEY$6;
  5388. }
  5389. }, {
  5390. key: "Event",
  5391. get: function get() {
  5392. return Event$6;
  5393. }
  5394. }, {
  5395. key: "EVENT_KEY",
  5396. get: function get() {
  5397. return EVENT_KEY$6;
  5398. }
  5399. }, {
  5400. key: "DefaultType",
  5401. get: function get() {
  5402. return DefaultType$4;
  5403. }
  5404. }]);
  5405. return Tooltip;
  5406. }();
  5407. /**
  5408. * ------------------------------------------------------------------------
  5409. * jQuery
  5410. * ------------------------------------------------------------------------
  5411. */
  5412. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5413. $.fn[NAME$6].Constructor = Tooltip;
  5414. $.fn[NAME$6].noConflict = function () {
  5415. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5416. return Tooltip._jQueryInterface;
  5417. };
  5418. /**
  5419. * ------------------------------------------------------------------------
  5420. * Constants
  5421. * ------------------------------------------------------------------------
  5422. */
  5423. var NAME$7 = 'popover';
  5424. var VERSION$7 = '4.4.1';
  5425. var DATA_KEY$7 = 'bs.popover';
  5426. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5427. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5428. var CLASS_PREFIX$1 = 'bs-popover';
  5429. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5430. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5431. placement: 'right',
  5432. trigger: 'click',
  5433. content: '',
  5434. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5435. });
  5436. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5437. content: '(string|element|function)'
  5438. });
  5439. var ClassName$7 = {
  5440. FADE: 'fade',
  5441. SHOW: 'show'
  5442. };
  5443. var Selector$7 = {
  5444. TITLE: '.popover-header',
  5445. CONTENT: '.popover-body'
  5446. };
  5447. var Event$7 = {
  5448. HIDE: "hide" + EVENT_KEY$7,
  5449. HIDDEN: "hidden" + EVENT_KEY$7,
  5450. SHOW: "show" + EVENT_KEY$7,
  5451. SHOWN: "shown" + EVENT_KEY$7,
  5452. INSERTED: "inserted" + EVENT_KEY$7,
  5453. CLICK: "click" + EVENT_KEY$7,
  5454. FOCUSIN: "focusin" + EVENT_KEY$7,
  5455. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5456. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5457. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5458. };
  5459. /**
  5460. * ------------------------------------------------------------------------
  5461. * Class Definition
  5462. * ------------------------------------------------------------------------
  5463. */
  5464. var Popover =
  5465. /*#__PURE__*/
  5466. function (_Tooltip) {
  5467. _inheritsLoose(Popover, _Tooltip);
  5468. function Popover() {
  5469. return _Tooltip.apply(this, arguments) || this;
  5470. }
  5471. var _proto = Popover.prototype;
  5472. // Overrides
  5473. _proto.isWithContent = function isWithContent() {
  5474. return this.getTitle() || this._getContent();
  5475. };
  5476. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5477. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5478. };
  5479. _proto.getTipElement = function getTipElement() {
  5480. this.tip = this.tip || $(this.config.template)[0];
  5481. return this.tip;
  5482. };
  5483. _proto.setContent = function setContent() {
  5484. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5485. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5486. var content = this._getContent();
  5487. if (typeof content === 'function') {
  5488. content = content.call(this.element);
  5489. }
  5490. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5491. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5492. } // Private
  5493. ;
  5494. _proto._getContent = function _getContent() {
  5495. return this.element.getAttribute('data-content') || this.config.content;
  5496. };
  5497. _proto._cleanTipClass = function _cleanTipClass() {
  5498. var $tip = $(this.getTipElement());
  5499. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5500. if (tabClass !== null && tabClass.length > 0) {
  5501. $tip.removeClass(tabClass.join(''));
  5502. }
  5503. } // Static
  5504. ;
  5505. Popover._jQueryInterface = function _jQueryInterface(config) {
  5506. return this.each(function () {
  5507. var data = $(this).data(DATA_KEY$7);
  5508. var _config = typeof config === 'object' ? config : null;
  5509. if (!data && /dispose|hide/.test(config)) {
  5510. return;
  5511. }
  5512. if (!data) {
  5513. data = new Popover(this, _config);
  5514. $(this).data(DATA_KEY$7, data);
  5515. }
  5516. if (typeof config === 'string') {
  5517. if (typeof data[config] === 'undefined') {
  5518. throw new TypeError("No method named \"" + config + "\"");
  5519. }
  5520. data[config]();
  5521. }
  5522. });
  5523. };
  5524. _createClass(Popover, null, [{
  5525. key: "VERSION",
  5526. // Getters
  5527. get: function get() {
  5528. return VERSION$7;
  5529. }
  5530. }, {
  5531. key: "Default",
  5532. get: function get() {
  5533. return Default$5;
  5534. }
  5535. }, {
  5536. key: "NAME",
  5537. get: function get() {
  5538. return NAME$7;
  5539. }
  5540. }, {
  5541. key: "DATA_KEY",
  5542. get: function get() {
  5543. return DATA_KEY$7;
  5544. }
  5545. }, {
  5546. key: "Event",
  5547. get: function get() {
  5548. return Event$7;
  5549. }
  5550. }, {
  5551. key: "EVENT_KEY",
  5552. get: function get() {
  5553. return EVENT_KEY$7;
  5554. }
  5555. }, {
  5556. key: "DefaultType",
  5557. get: function get() {
  5558. return DefaultType$5;
  5559. }
  5560. }]);
  5561. return Popover;
  5562. }(Tooltip);
  5563. /**
  5564. * ------------------------------------------------------------------------
  5565. * jQuery
  5566. * ------------------------------------------------------------------------
  5567. */
  5568. $.fn[NAME$7] = Popover._jQueryInterface;
  5569. $.fn[NAME$7].Constructor = Popover;
  5570. $.fn[NAME$7].noConflict = function () {
  5571. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5572. return Popover._jQueryInterface;
  5573. };
  5574. /**
  5575. * ------------------------------------------------------------------------
  5576. * Constants
  5577. * ------------------------------------------------------------------------
  5578. */
  5579. var NAME$8 = 'scrollspy';
  5580. var VERSION$8 = '4.4.1';
  5581. var DATA_KEY$8 = 'bs.scrollspy';
  5582. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5583. var DATA_API_KEY$6 = '.data-api';
  5584. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5585. var Default$6 = {
  5586. offset: 10,
  5587. method: 'auto',
  5588. target: ''
  5589. };
  5590. var DefaultType$6 = {
  5591. offset: 'number',
  5592. method: 'string',
  5593. target: '(string|element)'
  5594. };
  5595. var Event$8 = {
  5596. ACTIVATE: "activate" + EVENT_KEY$8,
  5597. SCROLL: "scroll" + EVENT_KEY$8,
  5598. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5599. };
  5600. var ClassName$8 = {
  5601. DROPDOWN_ITEM: 'dropdown-item',
  5602. DROPDOWN_MENU: 'dropdown-menu',
  5603. ACTIVE: 'active'
  5604. };
  5605. var Selector$8 = {
  5606. DATA_SPY: '[data-spy="scroll"]',
  5607. ACTIVE: '.active',
  5608. NAV_LIST_GROUP: '.nav, .list-group',
  5609. NAV_LINKS: '.nav-link',
  5610. NAV_ITEMS: '.nav-item',
  5611. LIST_ITEMS: '.list-group-item',
  5612. DROPDOWN: '.dropdown',
  5613. DROPDOWN_ITEMS: '.dropdown-item',
  5614. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5615. };
  5616. var OffsetMethod = {
  5617. OFFSET: 'offset',
  5618. POSITION: 'position'
  5619. };
  5620. /**
  5621. * ------------------------------------------------------------------------
  5622. * Class Definition
  5623. * ------------------------------------------------------------------------
  5624. */
  5625. var ScrollSpy =
  5626. /*#__PURE__*/
  5627. function () {
  5628. function ScrollSpy(element, config) {
  5629. var _this = this;
  5630. this._element = element;
  5631. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5632. this._config = this._getConfig(config);
  5633. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5634. this._offsets = [];
  5635. this._targets = [];
  5636. this._activeTarget = null;
  5637. this._scrollHeight = 0;
  5638. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5639. return _this._process(event);
  5640. });
  5641. this.refresh();
  5642. this._process();
  5643. } // Getters
  5644. var _proto = ScrollSpy.prototype;
  5645. // Public
  5646. _proto.refresh = function refresh() {
  5647. var _this2 = this;
  5648. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5649. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5650. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5651. this._offsets = [];
  5652. this._targets = [];
  5653. this._scrollHeight = this._getScrollHeight();
  5654. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5655. targets.map(function (element) {
  5656. var target;
  5657. var targetSelector = Util.getSelectorFromElement(element);
  5658. if (targetSelector) {
  5659. target = document.querySelector(targetSelector);
  5660. }
  5661. if (target) {
  5662. var targetBCR = target.getBoundingClientRect();
  5663. if (targetBCR.width || targetBCR.height) {
  5664. // TODO (fat): remove sketch reliance on jQuery position/offset
  5665. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5666. }
  5667. }
  5668. return null;
  5669. }).filter(function (item) {
  5670. return item;
  5671. }).sort(function (a, b) {
  5672. return a[0] - b[0];
  5673. }).forEach(function (item) {
  5674. _this2._offsets.push(item[0]);
  5675. _this2._targets.push(item[1]);
  5676. });
  5677. };
  5678. _proto.dispose = function dispose() {
  5679. $.removeData(this._element, DATA_KEY$8);
  5680. $(this._scrollElement).off(EVENT_KEY$8);
  5681. this._element = null;
  5682. this._scrollElement = null;
  5683. this._config = null;
  5684. this._selector = null;
  5685. this._offsets = null;
  5686. this._targets = null;
  5687. this._activeTarget = null;
  5688. this._scrollHeight = null;
  5689. } // Private
  5690. ;
  5691. _proto._getConfig = function _getConfig(config) {
  5692. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5693. if (typeof config.target !== 'string') {
  5694. var id = $(config.target).attr('id');
  5695. if (!id) {
  5696. id = Util.getUID(NAME$8);
  5697. $(config.target).attr('id', id);
  5698. }
  5699. config.target = "#" + id;
  5700. }
  5701. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5702. return config;
  5703. };
  5704. _proto._getScrollTop = function _getScrollTop() {
  5705. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5706. };
  5707. _proto._getScrollHeight = function _getScrollHeight() {
  5708. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5709. };
  5710. _proto._getOffsetHeight = function _getOffsetHeight() {
  5711. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5712. };
  5713. _proto._process = function _process() {
  5714. var scrollTop = this._getScrollTop() + this._config.offset;
  5715. var scrollHeight = this._getScrollHeight();
  5716. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5717. if (this._scrollHeight !== scrollHeight) {
  5718. this.refresh();
  5719. }
  5720. if (scrollTop >= maxScroll) {
  5721. var target = this._targets[this._targets.length - 1];
  5722. if (this._activeTarget !== target) {
  5723. this._activate(target);
  5724. }
  5725. return;
  5726. }
  5727. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5728. this._activeTarget = null;
  5729. this._clear();
  5730. return;
  5731. }
  5732. var offsetLength = this._offsets.length;
  5733. for (var i = offsetLength; i--;) {
  5734. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5735. if (isActiveTarget) {
  5736. this._activate(this._targets[i]);
  5737. }
  5738. }
  5739. };
  5740. _proto._activate = function _activate(target) {
  5741. this._activeTarget = target;
  5742. this._clear();
  5743. var queries = this._selector.split(',').map(function (selector) {
  5744. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5745. });
  5746. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5747. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5748. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5749. $link.addClass(ClassName$8.ACTIVE);
  5750. } else {
  5751. // Set triggered link as active
  5752. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5753. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5754. $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
  5755. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5756. }
  5757. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5758. relatedTarget: target
  5759. });
  5760. };
  5761. _proto._clear = function _clear() {
  5762. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5763. return node.classList.contains(ClassName$8.ACTIVE);
  5764. }).forEach(function (node) {
  5765. return node.classList.remove(ClassName$8.ACTIVE);
  5766. });
  5767. } // Static
  5768. ;
  5769. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5770. return this.each(function () {
  5771. var data = $(this).data(DATA_KEY$8);
  5772. var _config = typeof config === 'object' && config;
  5773. if (!data) {
  5774. data = new ScrollSpy(this, _config);
  5775. $(this).data(DATA_KEY$8, data);
  5776. }
  5777. if (typeof config === 'string') {
  5778. if (typeof data[config] === 'undefined') {
  5779. throw new TypeError("No method named \"" + config + "\"");
  5780. }
  5781. data[config]();
  5782. }
  5783. });
  5784. };
  5785. _createClass(ScrollSpy, null, [{
  5786. key: "VERSION",
  5787. get: function get() {
  5788. return VERSION$8;
  5789. }
  5790. }, {
  5791. key: "Default",
  5792. get: function get() {
  5793. return Default$6;
  5794. }
  5795. }]);
  5796. return ScrollSpy;
  5797. }();
  5798. /**
  5799. * ------------------------------------------------------------------------
  5800. * Data Api implementation
  5801. * ------------------------------------------------------------------------
  5802. */
  5803. $(window).on(Event$8.LOAD_DATA_API, function () {
  5804. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5805. var scrollSpysLength = scrollSpys.length;
  5806. for (var i = scrollSpysLength; i--;) {
  5807. var $spy = $(scrollSpys[i]);
  5808. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5809. }
  5810. });
  5811. /**
  5812. * ------------------------------------------------------------------------
  5813. * jQuery
  5814. * ------------------------------------------------------------------------
  5815. */
  5816. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5817. $.fn[NAME$8].Constructor = ScrollSpy;
  5818. $.fn[NAME$8].noConflict = function () {
  5819. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5820. return ScrollSpy._jQueryInterface;
  5821. };
  5822. /**
  5823. * ------------------------------------------------------------------------
  5824. * Constants
  5825. * ------------------------------------------------------------------------
  5826. */
  5827. var NAME$9 = 'tab';
  5828. var VERSION$9 = '4.4.1';
  5829. var DATA_KEY$9 = 'bs.tab';
  5830. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5831. var DATA_API_KEY$7 = '.data-api';
  5832. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5833. var Event$9 = {
  5834. HIDE: "hide" + EVENT_KEY$9,
  5835. HIDDEN: "hidden" + EVENT_KEY$9,
  5836. SHOW: "show" + EVENT_KEY$9,
  5837. SHOWN: "shown" + EVENT_KEY$9,
  5838. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5839. };
  5840. var ClassName$9 = {
  5841. DROPDOWN_MENU: 'dropdown-menu',
  5842. ACTIVE: 'active',
  5843. DISABLED: 'disabled',
  5844. FADE: 'fade',
  5845. SHOW: 'show'
  5846. };
  5847. var Selector$9 = {
  5848. DROPDOWN: '.dropdown',
  5849. NAV_LIST_GROUP: '.nav, .list-group',
  5850. ACTIVE: '.active',
  5851. ACTIVE_UL: '> li > .active',
  5852. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5853. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5854. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5855. };
  5856. /**
  5857. * ------------------------------------------------------------------------
  5858. * Class Definition
  5859. * ------------------------------------------------------------------------
  5860. */
  5861. var Tab =
  5862. /*#__PURE__*/
  5863. function () {
  5864. function Tab(element) {
  5865. this._element = element;
  5866. } // Getters
  5867. var _proto = Tab.prototype;
  5868. // Public
  5869. _proto.show = function show() {
  5870. var _this = this;
  5871. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5872. return;
  5873. }
  5874. var target;
  5875. var previous;
  5876. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5877. var selector = Util.getSelectorFromElement(this._element);
  5878. if (listElement) {
  5879. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5880. previous = $.makeArray($(listElement).find(itemSelector));
  5881. previous = previous[previous.length - 1];
  5882. }
  5883. var hideEvent = $.Event(Event$9.HIDE, {
  5884. relatedTarget: this._element
  5885. });
  5886. var showEvent = $.Event(Event$9.SHOW, {
  5887. relatedTarget: previous
  5888. });
  5889. if (previous) {
  5890. $(previous).trigger(hideEvent);
  5891. }
  5892. $(this._element).trigger(showEvent);
  5893. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5894. return;
  5895. }
  5896. if (selector) {
  5897. target = document.querySelector(selector);
  5898. }
  5899. this._activate(this._element, listElement);
  5900. var complete = function complete() {
  5901. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5902. relatedTarget: _this._element
  5903. });
  5904. var shownEvent = $.Event(Event$9.SHOWN, {
  5905. relatedTarget: previous
  5906. });
  5907. $(previous).trigger(hiddenEvent);
  5908. $(_this._element).trigger(shownEvent);
  5909. };
  5910. if (target) {
  5911. this._activate(target, target.parentNode, complete);
  5912. } else {
  5913. complete();
  5914. }
  5915. };
  5916. _proto.dispose = function dispose() {
  5917. $.removeData(this._element, DATA_KEY$9);
  5918. this._element = null;
  5919. } // Private
  5920. ;
  5921. _proto._activate = function _activate(element, container, callback) {
  5922. var _this2 = this;
  5923. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5924. var active = activeElements[0];
  5925. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5926. var complete = function complete() {
  5927. return _this2._transitionComplete(element, active, callback);
  5928. };
  5929. if (active && isTransitioning) {
  5930. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5931. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5932. } else {
  5933. complete();
  5934. }
  5935. };
  5936. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5937. if (active) {
  5938. $(active).removeClass(ClassName$9.ACTIVE);
  5939. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5940. if (dropdownChild) {
  5941. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5942. }
  5943. if (active.getAttribute('role') === 'tab') {
  5944. active.setAttribute('aria-selected', false);
  5945. }
  5946. }
  5947. $(element).addClass(ClassName$9.ACTIVE);
  5948. if (element.getAttribute('role') === 'tab') {
  5949. element.setAttribute('aria-selected', true);
  5950. }
  5951. Util.reflow(element);
  5952. if (element.classList.contains(ClassName$9.FADE)) {
  5953. element.classList.add(ClassName$9.SHOW);
  5954. }
  5955. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5956. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5957. if (dropdownElement) {
  5958. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5959. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5960. }
  5961. element.setAttribute('aria-expanded', true);
  5962. }
  5963. if (callback) {
  5964. callback();
  5965. }
  5966. } // Static
  5967. ;
  5968. Tab._jQueryInterface = function _jQueryInterface(config) {
  5969. return this.each(function () {
  5970. var $this = $(this);
  5971. var data = $this.data(DATA_KEY$9);
  5972. if (!data) {
  5973. data = new Tab(this);
  5974. $this.data(DATA_KEY$9, data);
  5975. }
  5976. if (typeof config === 'string') {
  5977. if (typeof data[config] === 'undefined') {
  5978. throw new TypeError("No method named \"" + config + "\"");
  5979. }
  5980. data[config]();
  5981. }
  5982. });
  5983. };
  5984. _createClass(Tab, null, [{
  5985. key: "VERSION",
  5986. get: function get() {
  5987. return VERSION$9;
  5988. }
  5989. }]);
  5990. return Tab;
  5991. }();
  5992. /**
  5993. * ------------------------------------------------------------------------
  5994. * Data Api implementation
  5995. * ------------------------------------------------------------------------
  5996. */
  5997. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5998. event.preventDefault();
  5999. Tab._jQueryInterface.call($(this), 'show');
  6000. });
  6001. /**
  6002. * ------------------------------------------------------------------------
  6003. * jQuery
  6004. * ------------------------------------------------------------------------
  6005. */
  6006. $.fn[NAME$9] = Tab._jQueryInterface;
  6007. $.fn[NAME$9].Constructor = Tab;
  6008. $.fn[NAME$9].noConflict = function () {
  6009. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6010. return Tab._jQueryInterface;
  6011. };
  6012. /**
  6013. * ------------------------------------------------------------------------
  6014. * Constants
  6015. * ------------------------------------------------------------------------
  6016. */
  6017. var NAME$a = 'toast';
  6018. var VERSION$a = '4.4.1';
  6019. var DATA_KEY$a = 'bs.toast';
  6020. var EVENT_KEY$a = "." + DATA_KEY$a;
  6021. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6022. var Event$a = {
  6023. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6024. HIDE: "hide" + EVENT_KEY$a,
  6025. HIDDEN: "hidden" + EVENT_KEY$a,
  6026. SHOW: "show" + EVENT_KEY$a,
  6027. SHOWN: "shown" + EVENT_KEY$a
  6028. };
  6029. var ClassName$a = {
  6030. FADE: 'fade',
  6031. HIDE: 'hide',
  6032. SHOW: 'show',
  6033. SHOWING: 'showing'
  6034. };
  6035. var DefaultType$7 = {
  6036. animation: 'boolean',
  6037. autohide: 'boolean',
  6038. delay: 'number'
  6039. };
  6040. var Default$7 = {
  6041. animation: true,
  6042. autohide: true,
  6043. delay: 500
  6044. };
  6045. var Selector$a = {
  6046. DATA_DISMISS: '[data-dismiss="toast"]'
  6047. };
  6048. /**
  6049. * ------------------------------------------------------------------------
  6050. * Class Definition
  6051. * ------------------------------------------------------------------------
  6052. */
  6053. var Toast =
  6054. /*#__PURE__*/
  6055. function () {
  6056. function Toast(element, config) {
  6057. this._element = element;
  6058. this._config = this._getConfig(config);
  6059. this._timeout = null;
  6060. this._setListeners();
  6061. } // Getters
  6062. var _proto = Toast.prototype;
  6063. // Public
  6064. _proto.show = function show() {
  6065. var _this = this;
  6066. var showEvent = $.Event(Event$a.SHOW);
  6067. $(this._element).trigger(showEvent);
  6068. if (showEvent.isDefaultPrevented()) {
  6069. return;
  6070. }
  6071. if (this._config.animation) {
  6072. this._element.classList.add(ClassName$a.FADE);
  6073. }
  6074. var complete = function complete() {
  6075. _this._element.classList.remove(ClassName$a.SHOWING);
  6076. _this._element.classList.add(ClassName$a.SHOW);
  6077. $(_this._element).trigger(Event$a.SHOWN);
  6078. if (_this._config.autohide) {
  6079. _this._timeout = setTimeout(function () {
  6080. _this.hide();
  6081. }, _this._config.delay);
  6082. }
  6083. };
  6084. this._element.classList.remove(ClassName$a.HIDE);
  6085. Util.reflow(this._element);
  6086. this._element.classList.add(ClassName$a.SHOWING);
  6087. if (this._config.animation) {
  6088. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6089. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6090. } else {
  6091. complete();
  6092. }
  6093. };
  6094. _proto.hide = function hide() {
  6095. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6096. return;
  6097. }
  6098. var hideEvent = $.Event(Event$a.HIDE);
  6099. $(this._element).trigger(hideEvent);
  6100. if (hideEvent.isDefaultPrevented()) {
  6101. return;
  6102. }
  6103. this._close();
  6104. };
  6105. _proto.dispose = function dispose() {
  6106. clearTimeout(this._timeout);
  6107. this._timeout = null;
  6108. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6109. this._element.classList.remove(ClassName$a.SHOW);
  6110. }
  6111. $(this._element).off(Event$a.CLICK_DISMISS);
  6112. $.removeData(this._element, DATA_KEY$a);
  6113. this._element = null;
  6114. this._config = null;
  6115. } // Private
  6116. ;
  6117. _proto._getConfig = function _getConfig(config) {
  6118. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6119. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6120. return config;
  6121. };
  6122. _proto._setListeners = function _setListeners() {
  6123. var _this2 = this;
  6124. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6125. return _this2.hide();
  6126. });
  6127. };
  6128. _proto._close = function _close() {
  6129. var _this3 = this;
  6130. var complete = function complete() {
  6131. _this3._element.classList.add(ClassName$a.HIDE);
  6132. $(_this3._element).trigger(Event$a.HIDDEN);
  6133. };
  6134. this._element.classList.remove(ClassName$a.SHOW);
  6135. if (this._config.animation) {
  6136. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6137. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6138. } else {
  6139. complete();
  6140. }
  6141. } // Static
  6142. ;
  6143. Toast._jQueryInterface = function _jQueryInterface(config) {
  6144. return this.each(function () {
  6145. var $element = $(this);
  6146. var data = $element.data(DATA_KEY$a);
  6147. var _config = typeof config === 'object' && config;
  6148. if (!data) {
  6149. data = new Toast(this, _config);
  6150. $element.data(DATA_KEY$a, data);
  6151. }
  6152. if (typeof config === 'string') {
  6153. if (typeof data[config] === 'undefined') {
  6154. throw new TypeError("No method named \"" + config + "\"");
  6155. }
  6156. data[config](this);
  6157. }
  6158. });
  6159. };
  6160. _createClass(Toast, null, [{
  6161. key: "VERSION",
  6162. get: function get() {
  6163. return VERSION$a;
  6164. }
  6165. }, {
  6166. key: "DefaultType",
  6167. get: function get() {
  6168. return DefaultType$7;
  6169. }
  6170. }, {
  6171. key: "Default",
  6172. get: function get() {
  6173. return Default$7;
  6174. }
  6175. }]);
  6176. return Toast;
  6177. }();
  6178. /**
  6179. * ------------------------------------------------------------------------
  6180. * jQuery
  6181. * ------------------------------------------------------------------------
  6182. */
  6183. $.fn[NAME$a] = Toast._jQueryInterface;
  6184. $.fn[NAME$a].Constructor = Toast;
  6185. $.fn[NAME$a].noConflict = function () {
  6186. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6187. return Toast._jQueryInterface;
  6188. };
  6189. exports.Alert = Alert;
  6190. exports.Button = Button;
  6191. exports.Carousel = Carousel;
  6192. exports.Collapse = Collapse;
  6193. exports.Dropdown = Dropdown;
  6194. exports.Modal = Modal;
  6195. exports.Popover = Popover;
  6196. exports.Scrollspy = ScrollSpy;
  6197. exports.Tab = Tab;
  6198. exports.Toast = Toast;
  6199. exports.Tooltip = Tooltip;
  6200. exports.Util = Util;
  6201. Object.defineProperty(exports, '__esModule', { value: true });
  6202. })));
  6203. //# sourceMappingURL=bootstrap.js.map
  6204. /***/ }),
  6205. /***/ "./node_modules/buffer/index.js":
  6206. /*!**************************************!*\
  6207. !*** ./node_modules/buffer/index.js ***!
  6208. \**************************************/
  6209. /*! no static exports found */
  6210. /***/ (function(module, exports, __webpack_require__) {
  6211. "use strict";
  6212. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6213. * The buffer module from node.js, for the browser.
  6214. *
  6215. * @author Feross Aboukhadijeh <http://feross.org>
  6216. * @license MIT
  6217. */
  6218. /* eslint-disable no-proto */
  6219. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6220. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6221. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6222. exports.Buffer = Buffer
  6223. exports.SlowBuffer = SlowBuffer
  6224. exports.INSPECT_MAX_BYTES = 50
  6225. /**
  6226. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6227. * === true Use Uint8Array implementation (fastest)
  6228. * === false Use Object implementation (most compatible, even IE6)
  6229. *
  6230. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6231. * Opera 11.6+, iOS 4.2+.
  6232. *
  6233. * Due to various browser bugs, sometimes the Object implementation will be used even
  6234. * when the browser supports typed arrays.
  6235. *
  6236. * Note:
  6237. *
  6238. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6239. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6240. *
  6241. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6242. *
  6243. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6244. * incorrect length in some situations.
  6245. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6246. * get the Object implementation, which is slower but behaves correctly.
  6247. */
  6248. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6249. ? global.TYPED_ARRAY_SUPPORT
  6250. : typedArraySupport()
  6251. /*
  6252. * Export kMaxLength after typed array support is determined.
  6253. */
  6254. exports.kMaxLength = kMaxLength()
  6255. function typedArraySupport () {
  6256. try {
  6257. var arr = new Uint8Array(1)
  6258. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6259. return arr.foo() === 42 && // typed array instances can be augmented
  6260. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6261. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6262. } catch (e) {
  6263. return false
  6264. }
  6265. }
  6266. function kMaxLength () {
  6267. return Buffer.TYPED_ARRAY_SUPPORT
  6268. ? 0x7fffffff
  6269. : 0x3fffffff
  6270. }
  6271. function createBuffer (that, length) {
  6272. if (kMaxLength() < length) {
  6273. throw new RangeError('Invalid typed array length')
  6274. }
  6275. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6276. // Return an augmented `Uint8Array` instance, for best performance
  6277. that = new Uint8Array(length)
  6278. that.__proto__ = Buffer.prototype
  6279. } else {
  6280. // Fallback: Return an object instance of the Buffer class
  6281. if (that === null) {
  6282. that = new Buffer(length)
  6283. }
  6284. that.length = length
  6285. }
  6286. return that
  6287. }
  6288. /**
  6289. * The Buffer constructor returns instances of `Uint8Array` that have their
  6290. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6291. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6292. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6293. * returns a single octet.
  6294. *
  6295. * The `Uint8Array` prototype remains unmodified.
  6296. */
  6297. function Buffer (arg, encodingOrOffset, length) {
  6298. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6299. return new Buffer(arg, encodingOrOffset, length)
  6300. }
  6301. // Common case.
  6302. if (typeof arg === 'number') {
  6303. if (typeof encodingOrOffset === 'string') {
  6304. throw new Error(
  6305. 'If encoding is specified then the first argument must be a string'
  6306. )
  6307. }
  6308. return allocUnsafe(this, arg)
  6309. }
  6310. return from(this, arg, encodingOrOffset, length)
  6311. }
  6312. Buffer.poolSize = 8192 // not used by this implementation
  6313. // TODO: Legacy, not needed anymore. Remove in next major version.
  6314. Buffer._augment = function (arr) {
  6315. arr.__proto__ = Buffer.prototype
  6316. return arr
  6317. }
  6318. function from (that, value, encodingOrOffset, length) {
  6319. if (typeof value === 'number') {
  6320. throw new TypeError('"value" argument must not be a number')
  6321. }
  6322. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6323. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6324. }
  6325. if (typeof value === 'string') {
  6326. return fromString(that, value, encodingOrOffset)
  6327. }
  6328. return fromObject(that, value)
  6329. }
  6330. /**
  6331. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6332. * if value is a number.
  6333. * Buffer.from(str[, encoding])
  6334. * Buffer.from(array)
  6335. * Buffer.from(buffer)
  6336. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6337. **/
  6338. Buffer.from = function (value, encodingOrOffset, length) {
  6339. return from(null, value, encodingOrOffset, length)
  6340. }
  6341. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6342. Buffer.prototype.__proto__ = Uint8Array.prototype
  6343. Buffer.__proto__ = Uint8Array
  6344. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6345. Buffer[Symbol.species] === Buffer) {
  6346. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6347. Object.defineProperty(Buffer, Symbol.species, {
  6348. value: null,
  6349. configurable: true
  6350. })
  6351. }
  6352. }
  6353. function assertSize (size) {
  6354. if (typeof size !== 'number') {
  6355. throw new TypeError('"size" argument must be a number')
  6356. } else if (size < 0) {
  6357. throw new RangeError('"size" argument must not be negative')
  6358. }
  6359. }
  6360. function alloc (that, size, fill, encoding) {
  6361. assertSize(size)
  6362. if (size <= 0) {
  6363. return createBuffer(that, size)
  6364. }
  6365. if (fill !== undefined) {
  6366. // Only pay attention to encoding if it's a string. This
  6367. // prevents accidentally sending in a number that would
  6368. // be interpretted as a start offset.
  6369. return typeof encoding === 'string'
  6370. ? createBuffer(that, size).fill(fill, encoding)
  6371. : createBuffer(that, size).fill(fill)
  6372. }
  6373. return createBuffer(that, size)
  6374. }
  6375. /**
  6376. * Creates a new filled Buffer instance.
  6377. * alloc(size[, fill[, encoding]])
  6378. **/
  6379. Buffer.alloc = function (size, fill, encoding) {
  6380. return alloc(null, size, fill, encoding)
  6381. }
  6382. function allocUnsafe (that, size) {
  6383. assertSize(size)
  6384. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6385. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6386. for (var i = 0; i < size; ++i) {
  6387. that[i] = 0
  6388. }
  6389. }
  6390. return that
  6391. }
  6392. /**
  6393. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6394. * */
  6395. Buffer.allocUnsafe = function (size) {
  6396. return allocUnsafe(null, size)
  6397. }
  6398. /**
  6399. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6400. */
  6401. Buffer.allocUnsafeSlow = function (size) {
  6402. return allocUnsafe(null, size)
  6403. }
  6404. function fromString (that, string, encoding) {
  6405. if (typeof encoding !== 'string' || encoding === '') {
  6406. encoding = 'utf8'
  6407. }
  6408. if (!Buffer.isEncoding(encoding)) {
  6409. throw new TypeError('"encoding" must be a valid string encoding')
  6410. }
  6411. var length = byteLength(string, encoding) | 0
  6412. that = createBuffer(that, length)
  6413. var actual = that.write(string, encoding)
  6414. if (actual !== length) {
  6415. // Writing a hex string, for example, that contains invalid characters will
  6416. // cause everything after the first invalid character to be ignored. (e.g.
  6417. // 'abxxcd' will be treated as 'ab')
  6418. that = that.slice(0, actual)
  6419. }
  6420. return that
  6421. }
  6422. function fromArrayLike (that, array) {
  6423. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6424. that = createBuffer(that, length)
  6425. for (var i = 0; i < length; i += 1) {
  6426. that[i] = array[i] & 255
  6427. }
  6428. return that
  6429. }
  6430. function fromArrayBuffer (that, array, byteOffset, length) {
  6431. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6432. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6433. throw new RangeError('\'offset\' is out of bounds')
  6434. }
  6435. if (array.byteLength < byteOffset + (length || 0)) {
  6436. throw new RangeError('\'length\' is out of bounds')
  6437. }
  6438. if (byteOffset === undefined && length === undefined) {
  6439. array = new Uint8Array(array)
  6440. } else if (length === undefined) {
  6441. array = new Uint8Array(array, byteOffset)
  6442. } else {
  6443. array = new Uint8Array(array, byteOffset, length)
  6444. }
  6445. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6446. // Return an augmented `Uint8Array` instance, for best performance
  6447. that = array
  6448. that.__proto__ = Buffer.prototype
  6449. } else {
  6450. // Fallback: Return an object instance of the Buffer class
  6451. that = fromArrayLike(that, array)
  6452. }
  6453. return that
  6454. }
  6455. function fromObject (that, obj) {
  6456. if (Buffer.isBuffer(obj)) {
  6457. var len = checked(obj.length) | 0
  6458. that = createBuffer(that, len)
  6459. if (that.length === 0) {
  6460. return that
  6461. }
  6462. obj.copy(that, 0, 0, len)
  6463. return that
  6464. }
  6465. if (obj) {
  6466. if ((typeof ArrayBuffer !== 'undefined' &&
  6467. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6468. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6469. return createBuffer(that, 0)
  6470. }
  6471. return fromArrayLike(that, obj)
  6472. }
  6473. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6474. return fromArrayLike(that, obj.data)
  6475. }
  6476. }
  6477. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6478. }
  6479. function checked (length) {
  6480. // Note: cannot use `length < kMaxLength()` here because that fails when
  6481. // length is NaN (which is otherwise coerced to zero.)
  6482. if (length >= kMaxLength()) {
  6483. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6484. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6485. }
  6486. return length | 0
  6487. }
  6488. function SlowBuffer (length) {
  6489. if (+length != length) { // eslint-disable-line eqeqeq
  6490. length = 0
  6491. }
  6492. return Buffer.alloc(+length)
  6493. }
  6494. Buffer.isBuffer = function isBuffer (b) {
  6495. return !!(b != null && b._isBuffer)
  6496. }
  6497. Buffer.compare = function compare (a, b) {
  6498. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6499. throw new TypeError('Arguments must be Buffers')
  6500. }
  6501. if (a === b) return 0
  6502. var x = a.length
  6503. var y = b.length
  6504. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6505. if (a[i] !== b[i]) {
  6506. x = a[i]
  6507. y = b[i]
  6508. break
  6509. }
  6510. }
  6511. if (x < y) return -1
  6512. if (y < x) return 1
  6513. return 0
  6514. }
  6515. Buffer.isEncoding = function isEncoding (encoding) {
  6516. switch (String(encoding).toLowerCase()) {
  6517. case 'hex':
  6518. case 'utf8':
  6519. case 'utf-8':
  6520. case 'ascii':
  6521. case 'latin1':
  6522. case 'binary':
  6523. case 'base64':
  6524. case 'ucs2':
  6525. case 'ucs-2':
  6526. case 'utf16le':
  6527. case 'utf-16le':
  6528. return true
  6529. default:
  6530. return false
  6531. }
  6532. }
  6533. Buffer.concat = function concat (list, length) {
  6534. if (!isArray(list)) {
  6535. throw new TypeError('"list" argument must be an Array of Buffers')
  6536. }
  6537. if (list.length === 0) {
  6538. return Buffer.alloc(0)
  6539. }
  6540. var i
  6541. if (length === undefined) {
  6542. length = 0
  6543. for (i = 0; i < list.length; ++i) {
  6544. length += list[i].length
  6545. }
  6546. }
  6547. var buffer = Buffer.allocUnsafe(length)
  6548. var pos = 0
  6549. for (i = 0; i < list.length; ++i) {
  6550. var buf = list[i]
  6551. if (!Buffer.isBuffer(buf)) {
  6552. throw new TypeError('"list" argument must be an Array of Buffers')
  6553. }
  6554. buf.copy(buffer, pos)
  6555. pos += buf.length
  6556. }
  6557. return buffer
  6558. }
  6559. function byteLength (string, encoding) {
  6560. if (Buffer.isBuffer(string)) {
  6561. return string.length
  6562. }
  6563. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6564. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6565. return string.byteLength
  6566. }
  6567. if (typeof string !== 'string') {
  6568. string = '' + string
  6569. }
  6570. var len = string.length
  6571. if (len === 0) return 0
  6572. // Use a for loop to avoid recursion
  6573. var loweredCase = false
  6574. for (;;) {
  6575. switch (encoding) {
  6576. case 'ascii':
  6577. case 'latin1':
  6578. case 'binary':
  6579. return len
  6580. case 'utf8':
  6581. case 'utf-8':
  6582. case undefined:
  6583. return utf8ToBytes(string).length
  6584. case 'ucs2':
  6585. case 'ucs-2':
  6586. case 'utf16le':
  6587. case 'utf-16le':
  6588. return len * 2
  6589. case 'hex':
  6590. return len >>> 1
  6591. case 'base64':
  6592. return base64ToBytes(string).length
  6593. default:
  6594. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6595. encoding = ('' + encoding).toLowerCase()
  6596. loweredCase = true
  6597. }
  6598. }
  6599. }
  6600. Buffer.byteLength = byteLength
  6601. function slowToString (encoding, start, end) {
  6602. var loweredCase = false
  6603. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6604. // property of a typed array.
  6605. // This behaves neither like String nor Uint8Array in that we set start/end
  6606. // to their upper/lower bounds if the value passed is out of range.
  6607. // undefined is handled specially as per ECMA-262 6th Edition,
  6608. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6609. if (start === undefined || start < 0) {
  6610. start = 0
  6611. }
  6612. // Return early if start > this.length. Done here to prevent potential uint32
  6613. // coercion fail below.
  6614. if (start > this.length) {
  6615. return ''
  6616. }
  6617. if (end === undefined || end > this.length) {
  6618. end = this.length
  6619. }
  6620. if (end <= 0) {
  6621. return ''
  6622. }
  6623. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6624. end >>>= 0
  6625. start >>>= 0
  6626. if (end <= start) {
  6627. return ''
  6628. }
  6629. if (!encoding) encoding = 'utf8'
  6630. while (true) {
  6631. switch (encoding) {
  6632. case 'hex':
  6633. return hexSlice(this, start, end)
  6634. case 'utf8':
  6635. case 'utf-8':
  6636. return utf8Slice(this, start, end)
  6637. case 'ascii':
  6638. return asciiSlice(this, start, end)
  6639. case 'latin1':
  6640. case 'binary':
  6641. return latin1Slice(this, start, end)
  6642. case 'base64':
  6643. return base64Slice(this, start, end)
  6644. case 'ucs2':
  6645. case 'ucs-2':
  6646. case 'utf16le':
  6647. case 'utf-16le':
  6648. return utf16leSlice(this, start, end)
  6649. default:
  6650. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6651. encoding = (encoding + '').toLowerCase()
  6652. loweredCase = true
  6653. }
  6654. }
  6655. }
  6656. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6657. // Buffer instances.
  6658. Buffer.prototype._isBuffer = true
  6659. function swap (b, n, m) {
  6660. var i = b[n]
  6661. b[n] = b[m]
  6662. b[m] = i
  6663. }
  6664. Buffer.prototype.swap16 = function swap16 () {
  6665. var len = this.length
  6666. if (len % 2 !== 0) {
  6667. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6668. }
  6669. for (var i = 0; i < len; i += 2) {
  6670. swap(this, i, i + 1)
  6671. }
  6672. return this
  6673. }
  6674. Buffer.prototype.swap32 = function swap32 () {
  6675. var len = this.length
  6676. if (len % 4 !== 0) {
  6677. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6678. }
  6679. for (var i = 0; i < len; i += 4) {
  6680. swap(this, i, i + 3)
  6681. swap(this, i + 1, i + 2)
  6682. }
  6683. return this
  6684. }
  6685. Buffer.prototype.swap64 = function swap64 () {
  6686. var len = this.length
  6687. if (len % 8 !== 0) {
  6688. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6689. }
  6690. for (var i = 0; i < len; i += 8) {
  6691. swap(this, i, i + 7)
  6692. swap(this, i + 1, i + 6)
  6693. swap(this, i + 2, i + 5)
  6694. swap(this, i + 3, i + 4)
  6695. }
  6696. return this
  6697. }
  6698. Buffer.prototype.toString = function toString () {
  6699. var length = this.length | 0
  6700. if (length === 0) return ''
  6701. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6702. return slowToString.apply(this, arguments)
  6703. }
  6704. Buffer.prototype.equals = function equals (b) {
  6705. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6706. if (this === b) return true
  6707. return Buffer.compare(this, b) === 0
  6708. }
  6709. Buffer.prototype.inspect = function inspect () {
  6710. var str = ''
  6711. var max = exports.INSPECT_MAX_BYTES
  6712. if (this.length > 0) {
  6713. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6714. if (this.length > max) str += ' ... '
  6715. }
  6716. return '<Buffer ' + str + '>'
  6717. }
  6718. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6719. if (!Buffer.isBuffer(target)) {
  6720. throw new TypeError('Argument must be a Buffer')
  6721. }
  6722. if (start === undefined) {
  6723. start = 0
  6724. }
  6725. if (end === undefined) {
  6726. end = target ? target.length : 0
  6727. }
  6728. if (thisStart === undefined) {
  6729. thisStart = 0
  6730. }
  6731. if (thisEnd === undefined) {
  6732. thisEnd = this.length
  6733. }
  6734. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6735. throw new RangeError('out of range index')
  6736. }
  6737. if (thisStart >= thisEnd && start >= end) {
  6738. return 0
  6739. }
  6740. if (thisStart >= thisEnd) {
  6741. return -1
  6742. }
  6743. if (start >= end) {
  6744. return 1
  6745. }
  6746. start >>>= 0
  6747. end >>>= 0
  6748. thisStart >>>= 0
  6749. thisEnd >>>= 0
  6750. if (this === target) return 0
  6751. var x = thisEnd - thisStart
  6752. var y = end - start
  6753. var len = Math.min(x, y)
  6754. var thisCopy = this.slice(thisStart, thisEnd)
  6755. var targetCopy = target.slice(start, end)
  6756. for (var i = 0; i < len; ++i) {
  6757. if (thisCopy[i] !== targetCopy[i]) {
  6758. x = thisCopy[i]
  6759. y = targetCopy[i]
  6760. break
  6761. }
  6762. }
  6763. if (x < y) return -1
  6764. if (y < x) return 1
  6765. return 0
  6766. }
  6767. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6768. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6769. //
  6770. // Arguments:
  6771. // - buffer - a Buffer to search
  6772. // - val - a string, Buffer, or number
  6773. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6774. // - encoding - an optional encoding, relevant is val is a string
  6775. // - dir - true for indexOf, false for lastIndexOf
  6776. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6777. // Empty buffer means no match
  6778. if (buffer.length === 0) return -1
  6779. // Normalize byteOffset
  6780. if (typeof byteOffset === 'string') {
  6781. encoding = byteOffset
  6782. byteOffset = 0
  6783. } else if (byteOffset > 0x7fffffff) {
  6784. byteOffset = 0x7fffffff
  6785. } else if (byteOffset < -0x80000000) {
  6786. byteOffset = -0x80000000
  6787. }
  6788. byteOffset = +byteOffset // Coerce to Number.
  6789. if (isNaN(byteOffset)) {
  6790. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6791. byteOffset = dir ? 0 : (buffer.length - 1)
  6792. }
  6793. // Normalize byteOffset: negative offsets start from the end of the buffer
  6794. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6795. if (byteOffset >= buffer.length) {
  6796. if (dir) return -1
  6797. else byteOffset = buffer.length - 1
  6798. } else if (byteOffset < 0) {
  6799. if (dir) byteOffset = 0
  6800. else return -1
  6801. }
  6802. // Normalize val
  6803. if (typeof val === 'string') {
  6804. val = Buffer.from(val, encoding)
  6805. }
  6806. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6807. if (Buffer.isBuffer(val)) {
  6808. // Special case: looking for empty string/buffer always fails
  6809. if (val.length === 0) {
  6810. return -1
  6811. }
  6812. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6813. } else if (typeof val === 'number') {
  6814. val = val & 0xFF // Search for a byte value [0-255]
  6815. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6816. typeof Uint8Array.prototype.indexOf === 'function') {
  6817. if (dir) {
  6818. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6819. } else {
  6820. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6821. }
  6822. }
  6823. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6824. }
  6825. throw new TypeError('val must be string, number or Buffer')
  6826. }
  6827. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6828. var indexSize = 1
  6829. var arrLength = arr.length
  6830. var valLength = val.length
  6831. if (encoding !== undefined) {
  6832. encoding = String(encoding).toLowerCase()
  6833. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6834. encoding === 'utf16le' || encoding === 'utf-16le') {
  6835. if (arr.length < 2 || val.length < 2) {
  6836. return -1
  6837. }
  6838. indexSize = 2
  6839. arrLength /= 2
  6840. valLength /= 2
  6841. byteOffset /= 2
  6842. }
  6843. }
  6844. function read (buf, i) {
  6845. if (indexSize === 1) {
  6846. return buf[i]
  6847. } else {
  6848. return buf.readUInt16BE(i * indexSize)
  6849. }
  6850. }
  6851. var i
  6852. if (dir) {
  6853. var foundIndex = -1
  6854. for (i = byteOffset; i < arrLength; i++) {
  6855. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6856. if (foundIndex === -1) foundIndex = i
  6857. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6858. } else {
  6859. if (foundIndex !== -1) i -= i - foundIndex
  6860. foundIndex = -1
  6861. }
  6862. }
  6863. } else {
  6864. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6865. for (i = byteOffset; i >= 0; i--) {
  6866. var found = true
  6867. for (var j = 0; j < valLength; j++) {
  6868. if (read(arr, i + j) !== read(val, j)) {
  6869. found = false
  6870. break
  6871. }
  6872. }
  6873. if (found) return i
  6874. }
  6875. }
  6876. return -1
  6877. }
  6878. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6879. return this.indexOf(val, byteOffset, encoding) !== -1
  6880. }
  6881. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6882. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6883. }
  6884. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6885. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6886. }
  6887. function hexWrite (buf, string, offset, length) {
  6888. offset = Number(offset) || 0
  6889. var remaining = buf.length - offset
  6890. if (!length) {
  6891. length = remaining
  6892. } else {
  6893. length = Number(length)
  6894. if (length > remaining) {
  6895. length = remaining
  6896. }
  6897. }
  6898. // must be an even number of digits
  6899. var strLen = string.length
  6900. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6901. if (length > strLen / 2) {
  6902. length = strLen / 2
  6903. }
  6904. for (var i = 0; i < length; ++i) {
  6905. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6906. if (isNaN(parsed)) return i
  6907. buf[offset + i] = parsed
  6908. }
  6909. return i
  6910. }
  6911. function utf8Write (buf, string, offset, length) {
  6912. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6913. }
  6914. function asciiWrite (buf, string, offset, length) {
  6915. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6916. }
  6917. function latin1Write (buf, string, offset, length) {
  6918. return asciiWrite(buf, string, offset, length)
  6919. }
  6920. function base64Write (buf, string, offset, length) {
  6921. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6922. }
  6923. function ucs2Write (buf, string, offset, length) {
  6924. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6925. }
  6926. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6927. // Buffer#write(string)
  6928. if (offset === undefined) {
  6929. encoding = 'utf8'
  6930. length = this.length
  6931. offset = 0
  6932. // Buffer#write(string, encoding)
  6933. } else if (length === undefined && typeof offset === 'string') {
  6934. encoding = offset
  6935. length = this.length
  6936. offset = 0
  6937. // Buffer#write(string, offset[, length][, encoding])
  6938. } else if (isFinite(offset)) {
  6939. offset = offset | 0
  6940. if (isFinite(length)) {
  6941. length = length | 0
  6942. if (encoding === undefined) encoding = 'utf8'
  6943. } else {
  6944. encoding = length
  6945. length = undefined
  6946. }
  6947. // legacy write(string, encoding, offset, length) - remove in v0.13
  6948. } else {
  6949. throw new Error(
  6950. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6951. )
  6952. }
  6953. var remaining = this.length - offset
  6954. if (length === undefined || length > remaining) length = remaining
  6955. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6956. throw new RangeError('Attempt to write outside buffer bounds')
  6957. }
  6958. if (!encoding) encoding = 'utf8'
  6959. var loweredCase = false
  6960. for (;;) {
  6961. switch (encoding) {
  6962. case 'hex':
  6963. return hexWrite(this, string, offset, length)
  6964. case 'utf8':
  6965. case 'utf-8':
  6966. return utf8Write(this, string, offset, length)
  6967. case 'ascii':
  6968. return asciiWrite(this, string, offset, length)
  6969. case 'latin1':
  6970. case 'binary':
  6971. return latin1Write(this, string, offset, length)
  6972. case 'base64':
  6973. // Warning: maxLength not taken into account in base64Write
  6974. return base64Write(this, string, offset, length)
  6975. case 'ucs2':
  6976. case 'ucs-2':
  6977. case 'utf16le':
  6978. case 'utf-16le':
  6979. return ucs2Write(this, string, offset, length)
  6980. default:
  6981. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6982. encoding = ('' + encoding).toLowerCase()
  6983. loweredCase = true
  6984. }
  6985. }
  6986. }
  6987. Buffer.prototype.toJSON = function toJSON () {
  6988. return {
  6989. type: 'Buffer',
  6990. data: Array.prototype.slice.call(this._arr || this, 0)
  6991. }
  6992. }
  6993. function base64Slice (buf, start, end) {
  6994. if (start === 0 && end === buf.length) {
  6995. return base64.fromByteArray(buf)
  6996. } else {
  6997. return base64.fromByteArray(buf.slice(start, end))
  6998. }
  6999. }
  7000. function utf8Slice (buf, start, end) {
  7001. end = Math.min(buf.length, end)
  7002. var res = []
  7003. var i = start
  7004. while (i < end) {
  7005. var firstByte = buf[i]
  7006. var codePoint = null
  7007. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7008. : (firstByte > 0xDF) ? 3
  7009. : (firstByte > 0xBF) ? 2
  7010. : 1
  7011. if (i + bytesPerSequence <= end) {
  7012. var secondByte, thirdByte, fourthByte, tempCodePoint
  7013. switch (bytesPerSequence) {
  7014. case 1:
  7015. if (firstByte < 0x80) {
  7016. codePoint = firstByte
  7017. }
  7018. break
  7019. case 2:
  7020. secondByte = buf[i + 1]
  7021. if ((secondByte & 0xC0) === 0x80) {
  7022. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7023. if (tempCodePoint > 0x7F) {
  7024. codePoint = tempCodePoint
  7025. }
  7026. }
  7027. break
  7028. case 3:
  7029. secondByte = buf[i + 1]
  7030. thirdByte = buf[i + 2]
  7031. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7032. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7033. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7034. codePoint = tempCodePoint
  7035. }
  7036. }
  7037. break
  7038. case 4:
  7039. secondByte = buf[i + 1]
  7040. thirdByte = buf[i + 2]
  7041. fourthByte = buf[i + 3]
  7042. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7043. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7044. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7045. codePoint = tempCodePoint
  7046. }
  7047. }
  7048. }
  7049. }
  7050. if (codePoint === null) {
  7051. // we did not generate a valid codePoint so insert a
  7052. // replacement char (U+FFFD) and advance only 1 byte
  7053. codePoint = 0xFFFD
  7054. bytesPerSequence = 1
  7055. } else if (codePoint > 0xFFFF) {
  7056. // encode to utf16 (surrogate pair dance)
  7057. codePoint -= 0x10000
  7058. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7059. codePoint = 0xDC00 | codePoint & 0x3FF
  7060. }
  7061. res.push(codePoint)
  7062. i += bytesPerSequence
  7063. }
  7064. return decodeCodePointsArray(res)
  7065. }
  7066. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7067. // the lowest limit is Chrome, with 0x10000 args.
  7068. // We go 1 magnitude less, for safety
  7069. var MAX_ARGUMENTS_LENGTH = 0x1000
  7070. function decodeCodePointsArray (codePoints) {
  7071. var len = codePoints.length
  7072. if (len <= MAX_ARGUMENTS_LENGTH) {
  7073. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7074. }
  7075. // Decode in chunks to avoid "call stack size exceeded".
  7076. var res = ''
  7077. var i = 0
  7078. while (i < len) {
  7079. res += String.fromCharCode.apply(
  7080. String,
  7081. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7082. )
  7083. }
  7084. return res
  7085. }
  7086. function asciiSlice (buf, start, end) {
  7087. var ret = ''
  7088. end = Math.min(buf.length, end)
  7089. for (var i = start; i < end; ++i) {
  7090. ret += String.fromCharCode(buf[i] & 0x7F)
  7091. }
  7092. return ret
  7093. }
  7094. function latin1Slice (buf, start, end) {
  7095. var ret = ''
  7096. end = Math.min(buf.length, end)
  7097. for (var i = start; i < end; ++i) {
  7098. ret += String.fromCharCode(buf[i])
  7099. }
  7100. return ret
  7101. }
  7102. function hexSlice (buf, start, end) {
  7103. var len = buf.length
  7104. if (!start || start < 0) start = 0
  7105. if (!end || end < 0 || end > len) end = len
  7106. var out = ''
  7107. for (var i = start; i < end; ++i) {
  7108. out += toHex(buf[i])
  7109. }
  7110. return out
  7111. }
  7112. function utf16leSlice (buf, start, end) {
  7113. var bytes = buf.slice(start, end)
  7114. var res = ''
  7115. for (var i = 0; i < bytes.length; i += 2) {
  7116. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7117. }
  7118. return res
  7119. }
  7120. Buffer.prototype.slice = function slice (start, end) {
  7121. var len = this.length
  7122. start = ~~start
  7123. end = end === undefined ? len : ~~end
  7124. if (start < 0) {
  7125. start += len
  7126. if (start < 0) start = 0
  7127. } else if (start > len) {
  7128. start = len
  7129. }
  7130. if (end < 0) {
  7131. end += len
  7132. if (end < 0) end = 0
  7133. } else if (end > len) {
  7134. end = len
  7135. }
  7136. if (end < start) end = start
  7137. var newBuf
  7138. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7139. newBuf = this.subarray(start, end)
  7140. newBuf.__proto__ = Buffer.prototype
  7141. } else {
  7142. var sliceLen = end - start
  7143. newBuf = new Buffer(sliceLen, undefined)
  7144. for (var i = 0; i < sliceLen; ++i) {
  7145. newBuf[i] = this[i + start]
  7146. }
  7147. }
  7148. return newBuf
  7149. }
  7150. /*
  7151. * Need to make sure that buffer isn't trying to write out of bounds.
  7152. */
  7153. function checkOffset (offset, ext, length) {
  7154. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7155. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7156. }
  7157. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7158. offset = offset | 0
  7159. byteLength = byteLength | 0
  7160. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7161. var val = this[offset]
  7162. var mul = 1
  7163. var i = 0
  7164. while (++i < byteLength && (mul *= 0x100)) {
  7165. val += this[offset + i] * mul
  7166. }
  7167. return val
  7168. }
  7169. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7170. offset = offset | 0
  7171. byteLength = byteLength | 0
  7172. if (!noAssert) {
  7173. checkOffset(offset, byteLength, this.length)
  7174. }
  7175. var val = this[offset + --byteLength]
  7176. var mul = 1
  7177. while (byteLength > 0 && (mul *= 0x100)) {
  7178. val += this[offset + --byteLength] * mul
  7179. }
  7180. return val
  7181. }
  7182. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7183. if (!noAssert) checkOffset(offset, 1, this.length)
  7184. return this[offset]
  7185. }
  7186. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7187. if (!noAssert) checkOffset(offset, 2, this.length)
  7188. return this[offset] | (this[offset + 1] << 8)
  7189. }
  7190. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7191. if (!noAssert) checkOffset(offset, 2, this.length)
  7192. return (this[offset] << 8) | this[offset + 1]
  7193. }
  7194. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7195. if (!noAssert) checkOffset(offset, 4, this.length)
  7196. return ((this[offset]) |
  7197. (this[offset + 1] << 8) |
  7198. (this[offset + 2] << 16)) +
  7199. (this[offset + 3] * 0x1000000)
  7200. }
  7201. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7202. if (!noAssert) checkOffset(offset, 4, this.length)
  7203. return (this[offset] * 0x1000000) +
  7204. ((this[offset + 1] << 16) |
  7205. (this[offset + 2] << 8) |
  7206. this[offset + 3])
  7207. }
  7208. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7209. offset = offset | 0
  7210. byteLength = byteLength | 0
  7211. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7212. var val = this[offset]
  7213. var mul = 1
  7214. var i = 0
  7215. while (++i < byteLength && (mul *= 0x100)) {
  7216. val += this[offset + i] * mul
  7217. }
  7218. mul *= 0x80
  7219. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7220. return val
  7221. }
  7222. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7223. offset = offset | 0
  7224. byteLength = byteLength | 0
  7225. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7226. var i = byteLength
  7227. var mul = 1
  7228. var val = this[offset + --i]
  7229. while (i > 0 && (mul *= 0x100)) {
  7230. val += this[offset + --i] * mul
  7231. }
  7232. mul *= 0x80
  7233. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7234. return val
  7235. }
  7236. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7237. if (!noAssert) checkOffset(offset, 1, this.length)
  7238. if (!(this[offset] & 0x80)) return (this[offset])
  7239. return ((0xff - this[offset] + 1) * -1)
  7240. }
  7241. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7242. if (!noAssert) checkOffset(offset, 2, this.length)
  7243. var val = this[offset] | (this[offset + 1] << 8)
  7244. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7245. }
  7246. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7247. if (!noAssert) checkOffset(offset, 2, this.length)
  7248. var val = this[offset + 1] | (this[offset] << 8)
  7249. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7250. }
  7251. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7252. if (!noAssert) checkOffset(offset, 4, this.length)
  7253. return (this[offset]) |
  7254. (this[offset + 1] << 8) |
  7255. (this[offset + 2] << 16) |
  7256. (this[offset + 3] << 24)
  7257. }
  7258. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7259. if (!noAssert) checkOffset(offset, 4, this.length)
  7260. return (this[offset] << 24) |
  7261. (this[offset + 1] << 16) |
  7262. (this[offset + 2] << 8) |
  7263. (this[offset + 3])
  7264. }
  7265. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7266. if (!noAssert) checkOffset(offset, 4, this.length)
  7267. return ieee754.read(this, offset, true, 23, 4)
  7268. }
  7269. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7270. if (!noAssert) checkOffset(offset, 4, this.length)
  7271. return ieee754.read(this, offset, false, 23, 4)
  7272. }
  7273. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7274. if (!noAssert) checkOffset(offset, 8, this.length)
  7275. return ieee754.read(this, offset, true, 52, 8)
  7276. }
  7277. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7278. if (!noAssert) checkOffset(offset, 8, this.length)
  7279. return ieee754.read(this, offset, false, 52, 8)
  7280. }
  7281. function checkInt (buf, value, offset, ext, max, min) {
  7282. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7283. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7284. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7285. }
  7286. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7287. value = +value
  7288. offset = offset | 0
  7289. byteLength = byteLength | 0
  7290. if (!noAssert) {
  7291. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7292. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7293. }
  7294. var mul = 1
  7295. var i = 0
  7296. this[offset] = value & 0xFF
  7297. while (++i < byteLength && (mul *= 0x100)) {
  7298. this[offset + i] = (value / mul) & 0xFF
  7299. }
  7300. return offset + byteLength
  7301. }
  7302. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7303. value = +value
  7304. offset = offset | 0
  7305. byteLength = byteLength | 0
  7306. if (!noAssert) {
  7307. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7308. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7309. }
  7310. var i = byteLength - 1
  7311. var mul = 1
  7312. this[offset + i] = value & 0xFF
  7313. while (--i >= 0 && (mul *= 0x100)) {
  7314. this[offset + i] = (value / mul) & 0xFF
  7315. }
  7316. return offset + byteLength
  7317. }
  7318. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7319. value = +value
  7320. offset = offset | 0
  7321. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7322. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7323. this[offset] = (value & 0xff)
  7324. return offset + 1
  7325. }
  7326. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7327. if (value < 0) value = 0xffff + value + 1
  7328. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7329. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7330. (littleEndian ? i : 1 - i) * 8
  7331. }
  7332. }
  7333. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7334. value = +value
  7335. offset = offset | 0
  7336. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7337. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7338. this[offset] = (value & 0xff)
  7339. this[offset + 1] = (value >>> 8)
  7340. } else {
  7341. objectWriteUInt16(this, value, offset, true)
  7342. }
  7343. return offset + 2
  7344. }
  7345. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7346. value = +value
  7347. offset = offset | 0
  7348. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7349. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7350. this[offset] = (value >>> 8)
  7351. this[offset + 1] = (value & 0xff)
  7352. } else {
  7353. objectWriteUInt16(this, value, offset, false)
  7354. }
  7355. return offset + 2
  7356. }
  7357. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7358. if (value < 0) value = 0xffffffff + value + 1
  7359. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7360. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7361. }
  7362. }
  7363. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7364. value = +value
  7365. offset = offset | 0
  7366. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7367. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7368. this[offset + 3] = (value >>> 24)
  7369. this[offset + 2] = (value >>> 16)
  7370. this[offset + 1] = (value >>> 8)
  7371. this[offset] = (value & 0xff)
  7372. } else {
  7373. objectWriteUInt32(this, value, offset, true)
  7374. }
  7375. return offset + 4
  7376. }
  7377. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7378. value = +value
  7379. offset = offset | 0
  7380. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7381. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7382. this[offset] = (value >>> 24)
  7383. this[offset + 1] = (value >>> 16)
  7384. this[offset + 2] = (value >>> 8)
  7385. this[offset + 3] = (value & 0xff)
  7386. } else {
  7387. objectWriteUInt32(this, value, offset, false)
  7388. }
  7389. return offset + 4
  7390. }
  7391. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7392. value = +value
  7393. offset = offset | 0
  7394. if (!noAssert) {
  7395. var limit = Math.pow(2, 8 * byteLength - 1)
  7396. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7397. }
  7398. var i = 0
  7399. var mul = 1
  7400. var sub = 0
  7401. this[offset] = value & 0xFF
  7402. while (++i < byteLength && (mul *= 0x100)) {
  7403. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7404. sub = 1
  7405. }
  7406. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7407. }
  7408. return offset + byteLength
  7409. }
  7410. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7411. value = +value
  7412. offset = offset | 0
  7413. if (!noAssert) {
  7414. var limit = Math.pow(2, 8 * byteLength - 1)
  7415. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7416. }
  7417. var i = byteLength - 1
  7418. var mul = 1
  7419. var sub = 0
  7420. this[offset + i] = value & 0xFF
  7421. while (--i >= 0 && (mul *= 0x100)) {
  7422. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7423. sub = 1
  7424. }
  7425. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7426. }
  7427. return offset + byteLength
  7428. }
  7429. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7430. value = +value
  7431. offset = offset | 0
  7432. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7433. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7434. if (value < 0) value = 0xff + value + 1
  7435. this[offset] = (value & 0xff)
  7436. return offset + 1
  7437. }
  7438. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7439. value = +value
  7440. offset = offset | 0
  7441. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7442. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7443. this[offset] = (value & 0xff)
  7444. this[offset + 1] = (value >>> 8)
  7445. } else {
  7446. objectWriteUInt16(this, value, offset, true)
  7447. }
  7448. return offset + 2
  7449. }
  7450. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7451. value = +value
  7452. offset = offset | 0
  7453. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7454. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7455. this[offset] = (value >>> 8)
  7456. this[offset + 1] = (value & 0xff)
  7457. } else {
  7458. objectWriteUInt16(this, value, offset, false)
  7459. }
  7460. return offset + 2
  7461. }
  7462. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7463. value = +value
  7464. offset = offset | 0
  7465. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7466. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7467. this[offset] = (value & 0xff)
  7468. this[offset + 1] = (value >>> 8)
  7469. this[offset + 2] = (value >>> 16)
  7470. this[offset + 3] = (value >>> 24)
  7471. } else {
  7472. objectWriteUInt32(this, value, offset, true)
  7473. }
  7474. return offset + 4
  7475. }
  7476. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7477. value = +value
  7478. offset = offset | 0
  7479. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7480. if (value < 0) value = 0xffffffff + value + 1
  7481. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7482. this[offset] = (value >>> 24)
  7483. this[offset + 1] = (value >>> 16)
  7484. this[offset + 2] = (value >>> 8)
  7485. this[offset + 3] = (value & 0xff)
  7486. } else {
  7487. objectWriteUInt32(this, value, offset, false)
  7488. }
  7489. return offset + 4
  7490. }
  7491. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7492. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7493. if (offset < 0) throw new RangeError('Index out of range')
  7494. }
  7495. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7496. if (!noAssert) {
  7497. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7498. }
  7499. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7500. return offset + 4
  7501. }
  7502. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7503. return writeFloat(this, value, offset, true, noAssert)
  7504. }
  7505. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7506. return writeFloat(this, value, offset, false, noAssert)
  7507. }
  7508. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7509. if (!noAssert) {
  7510. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7511. }
  7512. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7513. return offset + 8
  7514. }
  7515. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7516. return writeDouble(this, value, offset, true, noAssert)
  7517. }
  7518. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7519. return writeDouble(this, value, offset, false, noAssert)
  7520. }
  7521. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7522. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7523. if (!start) start = 0
  7524. if (!end && end !== 0) end = this.length
  7525. if (targetStart >= target.length) targetStart = target.length
  7526. if (!targetStart) targetStart = 0
  7527. if (end > 0 && end < start) end = start
  7528. // Copy 0 bytes; we're done
  7529. if (end === start) return 0
  7530. if (target.length === 0 || this.length === 0) return 0
  7531. // Fatal error conditions
  7532. if (targetStart < 0) {
  7533. throw new RangeError('targetStart out of bounds')
  7534. }
  7535. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7536. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7537. // Are we oob?
  7538. if (end > this.length) end = this.length
  7539. if (target.length - targetStart < end - start) {
  7540. end = target.length - targetStart + start
  7541. }
  7542. var len = end - start
  7543. var i
  7544. if (this === target && start < targetStart && targetStart < end) {
  7545. // descending copy from end
  7546. for (i = len - 1; i >= 0; --i) {
  7547. target[i + targetStart] = this[i + start]
  7548. }
  7549. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7550. // ascending copy from start
  7551. for (i = 0; i < len; ++i) {
  7552. target[i + targetStart] = this[i + start]
  7553. }
  7554. } else {
  7555. Uint8Array.prototype.set.call(
  7556. target,
  7557. this.subarray(start, start + len),
  7558. targetStart
  7559. )
  7560. }
  7561. return len
  7562. }
  7563. // Usage:
  7564. // buffer.fill(number[, offset[, end]])
  7565. // buffer.fill(buffer[, offset[, end]])
  7566. // buffer.fill(string[, offset[, end]][, encoding])
  7567. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7568. // Handle string cases:
  7569. if (typeof val === 'string') {
  7570. if (typeof start === 'string') {
  7571. encoding = start
  7572. start = 0
  7573. end = this.length
  7574. } else if (typeof end === 'string') {
  7575. encoding = end
  7576. end = this.length
  7577. }
  7578. if (val.length === 1) {
  7579. var code = val.charCodeAt(0)
  7580. if (code < 256) {
  7581. val = code
  7582. }
  7583. }
  7584. if (encoding !== undefined && typeof encoding !== 'string') {
  7585. throw new TypeError('encoding must be a string')
  7586. }
  7587. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7588. throw new TypeError('Unknown encoding: ' + encoding)
  7589. }
  7590. } else if (typeof val === 'number') {
  7591. val = val & 255
  7592. }
  7593. // Invalid ranges are not set to a default, so can range check early.
  7594. if (start < 0 || this.length < start || this.length < end) {
  7595. throw new RangeError('Out of range index')
  7596. }
  7597. if (end <= start) {
  7598. return this
  7599. }
  7600. start = start >>> 0
  7601. end = end === undefined ? this.length : end >>> 0
  7602. if (!val) val = 0
  7603. var i
  7604. if (typeof val === 'number') {
  7605. for (i = start; i < end; ++i) {
  7606. this[i] = val
  7607. }
  7608. } else {
  7609. var bytes = Buffer.isBuffer(val)
  7610. ? val
  7611. : utf8ToBytes(new Buffer(val, encoding).toString())
  7612. var len = bytes.length
  7613. for (i = 0; i < end - start; ++i) {
  7614. this[i + start] = bytes[i % len]
  7615. }
  7616. }
  7617. return this
  7618. }
  7619. // HELPER FUNCTIONS
  7620. // ================
  7621. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7622. function base64clean (str) {
  7623. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7624. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7625. // Node converts strings with length < 2 to ''
  7626. if (str.length < 2) return ''
  7627. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7628. while (str.length % 4 !== 0) {
  7629. str = str + '='
  7630. }
  7631. return str
  7632. }
  7633. function stringtrim (str) {
  7634. if (str.trim) return str.trim()
  7635. return str.replace(/^\s+|\s+$/g, '')
  7636. }
  7637. function toHex (n) {
  7638. if (n < 16) return '0' + n.toString(16)
  7639. return n.toString(16)
  7640. }
  7641. function utf8ToBytes (string, units) {
  7642. units = units || Infinity
  7643. var codePoint
  7644. var length = string.length
  7645. var leadSurrogate = null
  7646. var bytes = []
  7647. for (var i = 0; i < length; ++i) {
  7648. codePoint = string.charCodeAt(i)
  7649. // is surrogate component
  7650. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7651. // last char was a lead
  7652. if (!leadSurrogate) {
  7653. // no lead yet
  7654. if (codePoint > 0xDBFF) {
  7655. // unexpected trail
  7656. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7657. continue
  7658. } else if (i + 1 === length) {
  7659. // unpaired lead
  7660. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7661. continue
  7662. }
  7663. // valid lead
  7664. leadSurrogate = codePoint
  7665. continue
  7666. }
  7667. // 2 leads in a row
  7668. if (codePoint < 0xDC00) {
  7669. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7670. leadSurrogate = codePoint
  7671. continue
  7672. }
  7673. // valid surrogate pair
  7674. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7675. } else if (leadSurrogate) {
  7676. // valid bmp char, but last char was a lead
  7677. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7678. }
  7679. leadSurrogate = null
  7680. // encode utf8
  7681. if (codePoint < 0x80) {
  7682. if ((units -= 1) < 0) break
  7683. bytes.push(codePoint)
  7684. } else if (codePoint < 0x800) {
  7685. if ((units -= 2) < 0) break
  7686. bytes.push(
  7687. codePoint >> 0x6 | 0xC0,
  7688. codePoint & 0x3F | 0x80
  7689. )
  7690. } else if (codePoint < 0x10000) {
  7691. if ((units -= 3) < 0) break
  7692. bytes.push(
  7693. codePoint >> 0xC | 0xE0,
  7694. codePoint >> 0x6 & 0x3F | 0x80,
  7695. codePoint & 0x3F | 0x80
  7696. )
  7697. } else if (codePoint < 0x110000) {
  7698. if ((units -= 4) < 0) break
  7699. bytes.push(
  7700. codePoint >> 0x12 | 0xF0,
  7701. codePoint >> 0xC & 0x3F | 0x80,
  7702. codePoint >> 0x6 & 0x3F | 0x80,
  7703. codePoint & 0x3F | 0x80
  7704. )
  7705. } else {
  7706. throw new Error('Invalid code point')
  7707. }
  7708. }
  7709. return bytes
  7710. }
  7711. function asciiToBytes (str) {
  7712. var byteArray = []
  7713. for (var i = 0; i < str.length; ++i) {
  7714. // Node's code seems to be doing this and not & 0x7F..
  7715. byteArray.push(str.charCodeAt(i) & 0xFF)
  7716. }
  7717. return byteArray
  7718. }
  7719. function utf16leToBytes (str, units) {
  7720. var c, hi, lo
  7721. var byteArray = []
  7722. for (var i = 0; i < str.length; ++i) {
  7723. if ((units -= 2) < 0) break
  7724. c = str.charCodeAt(i)
  7725. hi = c >> 8
  7726. lo = c % 256
  7727. byteArray.push(lo)
  7728. byteArray.push(hi)
  7729. }
  7730. return byteArray
  7731. }
  7732. function base64ToBytes (str) {
  7733. return base64.toByteArray(base64clean(str))
  7734. }
  7735. function blitBuffer (src, dst, offset, length) {
  7736. for (var i = 0; i < length; ++i) {
  7737. if ((i + offset >= dst.length) || (i >= src.length)) break
  7738. dst[i + offset] = src[i]
  7739. }
  7740. return i
  7741. }
  7742. function isnan (val) {
  7743. return val !== val // eslint-disable-line no-self-compare
  7744. }
  7745. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7746. /***/ }),
  7747. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7748. /*!**************************************************!*\
  7749. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7750. \**************************************************/
  7751. /*! no static exports found */
  7752. /***/ (function(module, exports, __webpack_require__) {
  7753. /*!
  7754. * clipboard.js v2.0.4
  7755. * https://zenorocha.github.io/clipboard.js
  7756. *
  7757. * Licensed MIT © Zeno Rocha
  7758. */
  7759. (function webpackUniversalModuleDefinition(root, factory) {
  7760. if(true)
  7761. module.exports = factory();
  7762. else {}
  7763. })(this, function() {
  7764. return /******/ (function(modules) { // webpackBootstrap
  7765. /******/ // The module cache
  7766. /******/ var installedModules = {};
  7767. /******/
  7768. /******/ // The require function
  7769. /******/ function __webpack_require__(moduleId) {
  7770. /******/
  7771. /******/ // Check if module is in cache
  7772. /******/ if(installedModules[moduleId]) {
  7773. /******/ return installedModules[moduleId].exports;
  7774. /******/ }
  7775. /******/ // Create a new module (and put it into the cache)
  7776. /******/ var module = installedModules[moduleId] = {
  7777. /******/ i: moduleId,
  7778. /******/ l: false,
  7779. /******/ exports: {}
  7780. /******/ };
  7781. /******/
  7782. /******/ // Execute the module function
  7783. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7784. /******/
  7785. /******/ // Flag the module as loaded
  7786. /******/ module.l = true;
  7787. /******/
  7788. /******/ // Return the exports of the module
  7789. /******/ return module.exports;
  7790. /******/ }
  7791. /******/
  7792. /******/
  7793. /******/ // expose the modules object (__webpack_modules__)
  7794. /******/ __webpack_require__.m = modules;
  7795. /******/
  7796. /******/ // expose the module cache
  7797. /******/ __webpack_require__.c = installedModules;
  7798. /******/
  7799. /******/ // define getter function for harmony exports
  7800. /******/ __webpack_require__.d = function(exports, name, getter) {
  7801. /******/ if(!__webpack_require__.o(exports, name)) {
  7802. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7803. /******/ }
  7804. /******/ };
  7805. /******/
  7806. /******/ // define __esModule on exports
  7807. /******/ __webpack_require__.r = function(exports) {
  7808. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7809. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7810. /******/ }
  7811. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7812. /******/ };
  7813. /******/
  7814. /******/ // create a fake namespace object
  7815. /******/ // mode & 1: value is a module id, require it
  7816. /******/ // mode & 2: merge all properties of value into the ns
  7817. /******/ // mode & 4: return value when already ns object
  7818. /******/ // mode & 8|1: behave like require
  7819. /******/ __webpack_require__.t = function(value, mode) {
  7820. /******/ if(mode & 1) value = __webpack_require__(value);
  7821. /******/ if(mode & 8) return value;
  7822. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7823. /******/ var ns = Object.create(null);
  7824. /******/ __webpack_require__.r(ns);
  7825. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7826. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7827. /******/ return ns;
  7828. /******/ };
  7829. /******/
  7830. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7831. /******/ __webpack_require__.n = function(module) {
  7832. /******/ var getter = module && module.__esModule ?
  7833. /******/ function getDefault() { return module['default']; } :
  7834. /******/ function getModuleExports() { return module; };
  7835. /******/ __webpack_require__.d(getter, 'a', getter);
  7836. /******/ return getter;
  7837. /******/ };
  7838. /******/
  7839. /******/ // Object.prototype.hasOwnProperty.call
  7840. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7841. /******/
  7842. /******/ // __webpack_public_path__
  7843. /******/ __webpack_require__.p = "";
  7844. /******/
  7845. /******/
  7846. /******/ // Load entry module and return exports
  7847. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7848. /******/ })
  7849. /************************************************************************/
  7850. /******/ ([
  7851. /* 0 */
  7852. /***/ (function(module, exports, __webpack_require__) {
  7853. "use strict";
  7854. 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; };
  7855. 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; }; }();
  7856. var _clipboardAction = __webpack_require__(1);
  7857. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7858. var _tinyEmitter = __webpack_require__(3);
  7859. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7860. var _goodListener = __webpack_require__(4);
  7861. var _goodListener2 = _interopRequireDefault(_goodListener);
  7862. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7863. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7864. 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; }
  7865. 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; }
  7866. /**
  7867. * Base class which takes one or more elements, adds event listeners to them,
  7868. * and instantiates a new `ClipboardAction` on each click.
  7869. */
  7870. var Clipboard = function (_Emitter) {
  7871. _inherits(Clipboard, _Emitter);
  7872. /**
  7873. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7874. * @param {Object} options
  7875. */
  7876. function Clipboard(trigger, options) {
  7877. _classCallCheck(this, Clipboard);
  7878. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7879. _this.resolveOptions(options);
  7880. _this.listenClick(trigger);
  7881. return _this;
  7882. }
  7883. /**
  7884. * Defines if attributes would be resolved using internal setter functions
  7885. * or custom functions that were passed in the constructor.
  7886. * @param {Object} options
  7887. */
  7888. _createClass(Clipboard, [{
  7889. key: 'resolveOptions',
  7890. value: function resolveOptions() {
  7891. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7892. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7893. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7894. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7895. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7896. }
  7897. /**
  7898. * Adds a click event listener to the passed trigger.
  7899. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7900. */
  7901. }, {
  7902. key: 'listenClick',
  7903. value: function listenClick(trigger) {
  7904. var _this2 = this;
  7905. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7906. return _this2.onClick(e);
  7907. });
  7908. }
  7909. /**
  7910. * Defines a new `ClipboardAction` on each click event.
  7911. * @param {Event} e
  7912. */
  7913. }, {
  7914. key: 'onClick',
  7915. value: function onClick(e) {
  7916. var trigger = e.delegateTarget || e.currentTarget;
  7917. if (this.clipboardAction) {
  7918. this.clipboardAction = null;
  7919. }
  7920. this.clipboardAction = new _clipboardAction2.default({
  7921. action: this.action(trigger),
  7922. target: this.target(trigger),
  7923. text: this.text(trigger),
  7924. container: this.container,
  7925. trigger: trigger,
  7926. emitter: this
  7927. });
  7928. }
  7929. /**
  7930. * Default `action` lookup function.
  7931. * @param {Element} trigger
  7932. */
  7933. }, {
  7934. key: 'defaultAction',
  7935. value: function defaultAction(trigger) {
  7936. return getAttributeValue('action', trigger);
  7937. }
  7938. /**
  7939. * Default `target` lookup function.
  7940. * @param {Element} trigger
  7941. */
  7942. }, {
  7943. key: 'defaultTarget',
  7944. value: function defaultTarget(trigger) {
  7945. var selector = getAttributeValue('target', trigger);
  7946. if (selector) {
  7947. return document.querySelector(selector);
  7948. }
  7949. }
  7950. /**
  7951. * Returns the support of the given action, or all actions if no action is
  7952. * given.
  7953. * @param {String} [action]
  7954. */
  7955. }, {
  7956. key: 'defaultText',
  7957. /**
  7958. * Default `text` lookup function.
  7959. * @param {Element} trigger
  7960. */
  7961. value: function defaultText(trigger) {
  7962. return getAttributeValue('text', trigger);
  7963. }
  7964. /**
  7965. * Destroy lifecycle.
  7966. */
  7967. }, {
  7968. key: 'destroy',
  7969. value: function destroy() {
  7970. this.listener.destroy();
  7971. if (this.clipboardAction) {
  7972. this.clipboardAction.destroy();
  7973. this.clipboardAction = null;
  7974. }
  7975. }
  7976. }], [{
  7977. key: 'isSupported',
  7978. value: function isSupported() {
  7979. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7980. var actions = typeof action === 'string' ? [action] : action;
  7981. var support = !!document.queryCommandSupported;
  7982. actions.forEach(function (action) {
  7983. support = support && !!document.queryCommandSupported(action);
  7984. });
  7985. return support;
  7986. }
  7987. }]);
  7988. return Clipboard;
  7989. }(_tinyEmitter2.default);
  7990. /**
  7991. * Helper function to retrieve attribute value.
  7992. * @param {String} suffix
  7993. * @param {Element} element
  7994. */
  7995. function getAttributeValue(suffix, element) {
  7996. var attribute = 'data-clipboard-' + suffix;
  7997. if (!element.hasAttribute(attribute)) {
  7998. return;
  7999. }
  8000. return element.getAttribute(attribute);
  8001. }
  8002. module.exports = Clipboard;
  8003. /***/ }),
  8004. /* 1 */
  8005. /***/ (function(module, exports, __webpack_require__) {
  8006. "use strict";
  8007. 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; };
  8008. 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; }; }();
  8009. var _select = __webpack_require__(2);
  8010. var _select2 = _interopRequireDefault(_select);
  8011. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8012. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8013. /**
  8014. * Inner class which performs selection from either `text` or `target`
  8015. * properties and then executes copy or cut operations.
  8016. */
  8017. var ClipboardAction = function () {
  8018. /**
  8019. * @param {Object} options
  8020. */
  8021. function ClipboardAction(options) {
  8022. _classCallCheck(this, ClipboardAction);
  8023. this.resolveOptions(options);
  8024. this.initSelection();
  8025. }
  8026. /**
  8027. * Defines base properties passed from constructor.
  8028. * @param {Object} options
  8029. */
  8030. _createClass(ClipboardAction, [{
  8031. key: 'resolveOptions',
  8032. value: function resolveOptions() {
  8033. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8034. this.action = options.action;
  8035. this.container = options.container;
  8036. this.emitter = options.emitter;
  8037. this.target = options.target;
  8038. this.text = options.text;
  8039. this.trigger = options.trigger;
  8040. this.selectedText = '';
  8041. }
  8042. /**
  8043. * Decides which selection strategy is going to be applied based
  8044. * on the existence of `text` and `target` properties.
  8045. */
  8046. }, {
  8047. key: 'initSelection',
  8048. value: function initSelection() {
  8049. if (this.text) {
  8050. this.selectFake();
  8051. } else if (this.target) {
  8052. this.selectTarget();
  8053. }
  8054. }
  8055. /**
  8056. * Creates a fake textarea element, sets its value from `text` property,
  8057. * and makes a selection on it.
  8058. */
  8059. }, {
  8060. key: 'selectFake',
  8061. value: function selectFake() {
  8062. var _this = this;
  8063. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8064. this.removeFake();
  8065. this.fakeHandlerCallback = function () {
  8066. return _this.removeFake();
  8067. };
  8068. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8069. this.fakeElem = document.createElement('textarea');
  8070. // Prevent zooming on iOS
  8071. this.fakeElem.style.fontSize = '12pt';
  8072. // Reset box model
  8073. this.fakeElem.style.border = '0';
  8074. this.fakeElem.style.padding = '0';
  8075. this.fakeElem.style.margin = '0';
  8076. // Move element out of screen horizontally
  8077. this.fakeElem.style.position = 'absolute';
  8078. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8079. // Move element to the same position vertically
  8080. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8081. this.fakeElem.style.top = yPosition + 'px';
  8082. this.fakeElem.setAttribute('readonly', '');
  8083. this.fakeElem.value = this.text;
  8084. this.container.appendChild(this.fakeElem);
  8085. this.selectedText = (0, _select2.default)(this.fakeElem);
  8086. this.copyText();
  8087. }
  8088. /**
  8089. * Only removes the fake element after another click event, that way
  8090. * a user can hit `Ctrl+C` to copy because selection still exists.
  8091. */
  8092. }, {
  8093. key: 'removeFake',
  8094. value: function removeFake() {
  8095. if (this.fakeHandler) {
  8096. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8097. this.fakeHandler = null;
  8098. this.fakeHandlerCallback = null;
  8099. }
  8100. if (this.fakeElem) {
  8101. this.container.removeChild(this.fakeElem);
  8102. this.fakeElem = null;
  8103. }
  8104. }
  8105. /**
  8106. * Selects the content from element passed on `target` property.
  8107. */
  8108. }, {
  8109. key: 'selectTarget',
  8110. value: function selectTarget() {
  8111. this.selectedText = (0, _select2.default)(this.target);
  8112. this.copyText();
  8113. }
  8114. /**
  8115. * Executes the copy operation based on the current selection.
  8116. */
  8117. }, {
  8118. key: 'copyText',
  8119. value: function copyText() {
  8120. var succeeded = void 0;
  8121. try {
  8122. succeeded = document.execCommand(this.action);
  8123. } catch (err) {
  8124. succeeded = false;
  8125. }
  8126. this.handleResult(succeeded);
  8127. }
  8128. /**
  8129. * Fires an event based on the copy operation result.
  8130. * @param {Boolean} succeeded
  8131. */
  8132. }, {
  8133. key: 'handleResult',
  8134. value: function handleResult(succeeded) {
  8135. this.emitter.emit(succeeded ? 'success' : 'error', {
  8136. action: this.action,
  8137. text: this.selectedText,
  8138. trigger: this.trigger,
  8139. clearSelection: this.clearSelection.bind(this)
  8140. });
  8141. }
  8142. /**
  8143. * Moves focus away from `target` and back to the trigger, removes current selection.
  8144. */
  8145. }, {
  8146. key: 'clearSelection',
  8147. value: function clearSelection() {
  8148. if (this.trigger) {
  8149. this.trigger.focus();
  8150. }
  8151. window.getSelection().removeAllRanges();
  8152. }
  8153. /**
  8154. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8155. * @param {String} action
  8156. */
  8157. }, {
  8158. key: 'destroy',
  8159. /**
  8160. * Destroy lifecycle.
  8161. */
  8162. value: function destroy() {
  8163. this.removeFake();
  8164. }
  8165. }, {
  8166. key: 'action',
  8167. set: function set() {
  8168. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8169. this._action = action;
  8170. if (this._action !== 'copy' && this._action !== 'cut') {
  8171. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8172. }
  8173. }
  8174. /**
  8175. * Gets the `action` property.
  8176. * @return {String}
  8177. */
  8178. ,
  8179. get: function get() {
  8180. return this._action;
  8181. }
  8182. /**
  8183. * Sets the `target` property using an element
  8184. * that will be have its content copied.
  8185. * @param {Element} target
  8186. */
  8187. }, {
  8188. key: 'target',
  8189. set: function set(target) {
  8190. if (target !== undefined) {
  8191. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8192. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8193. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8194. }
  8195. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8196. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8197. }
  8198. this._target = target;
  8199. } else {
  8200. throw new Error('Invalid "target" value, use a valid Element');
  8201. }
  8202. }
  8203. }
  8204. /**
  8205. * Gets the `target` property.
  8206. * @return {String|HTMLElement}
  8207. */
  8208. ,
  8209. get: function get() {
  8210. return this._target;
  8211. }
  8212. }]);
  8213. return ClipboardAction;
  8214. }();
  8215. module.exports = ClipboardAction;
  8216. /***/ }),
  8217. /* 2 */
  8218. /***/ (function(module, exports) {
  8219. function select(element) {
  8220. var selectedText;
  8221. if (element.nodeName === 'SELECT') {
  8222. element.focus();
  8223. selectedText = element.value;
  8224. }
  8225. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8226. var isReadOnly = element.hasAttribute('readonly');
  8227. if (!isReadOnly) {
  8228. element.setAttribute('readonly', '');
  8229. }
  8230. element.select();
  8231. element.setSelectionRange(0, element.value.length);
  8232. if (!isReadOnly) {
  8233. element.removeAttribute('readonly');
  8234. }
  8235. selectedText = element.value;
  8236. }
  8237. else {
  8238. if (element.hasAttribute('contenteditable')) {
  8239. element.focus();
  8240. }
  8241. var selection = window.getSelection();
  8242. var range = document.createRange();
  8243. range.selectNodeContents(element);
  8244. selection.removeAllRanges();
  8245. selection.addRange(range);
  8246. selectedText = selection.toString();
  8247. }
  8248. return selectedText;
  8249. }
  8250. module.exports = select;
  8251. /***/ }),
  8252. /* 3 */
  8253. /***/ (function(module, exports) {
  8254. function E () {
  8255. // Keep this empty so it's easier to inherit from
  8256. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8257. }
  8258. E.prototype = {
  8259. on: function (name, callback, ctx) {
  8260. var e = this.e || (this.e = {});
  8261. (e[name] || (e[name] = [])).push({
  8262. fn: callback,
  8263. ctx: ctx
  8264. });
  8265. return this;
  8266. },
  8267. once: function (name, callback, ctx) {
  8268. var self = this;
  8269. function listener () {
  8270. self.off(name, listener);
  8271. callback.apply(ctx, arguments);
  8272. };
  8273. listener._ = callback
  8274. return this.on(name, listener, ctx);
  8275. },
  8276. emit: function (name) {
  8277. var data = [].slice.call(arguments, 1);
  8278. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8279. var i = 0;
  8280. var len = evtArr.length;
  8281. for (i; i < len; i++) {
  8282. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8283. }
  8284. return this;
  8285. },
  8286. off: function (name, callback) {
  8287. var e = this.e || (this.e = {});
  8288. var evts = e[name];
  8289. var liveEvents = [];
  8290. if (evts && callback) {
  8291. for (var i = 0, len = evts.length; i < len; i++) {
  8292. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8293. liveEvents.push(evts[i]);
  8294. }
  8295. }
  8296. // Remove event from queue to prevent memory leak
  8297. // Suggested by https://github.com/lazd
  8298. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8299. (liveEvents.length)
  8300. ? e[name] = liveEvents
  8301. : delete e[name];
  8302. return this;
  8303. }
  8304. };
  8305. module.exports = E;
  8306. /***/ }),
  8307. /* 4 */
  8308. /***/ (function(module, exports, __webpack_require__) {
  8309. var is = __webpack_require__(5);
  8310. var delegate = __webpack_require__(6);
  8311. /**
  8312. * Validates all params and calls the right
  8313. * listener function based on its target type.
  8314. *
  8315. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8316. * @param {String} type
  8317. * @param {Function} callback
  8318. * @return {Object}
  8319. */
  8320. function listen(target, type, callback) {
  8321. if (!target && !type && !callback) {
  8322. throw new Error('Missing required arguments');
  8323. }
  8324. if (!is.string(type)) {
  8325. throw new TypeError('Second argument must be a String');
  8326. }
  8327. if (!is.fn(callback)) {
  8328. throw new TypeError('Third argument must be a Function');
  8329. }
  8330. if (is.node(target)) {
  8331. return listenNode(target, type, callback);
  8332. }
  8333. else if (is.nodeList(target)) {
  8334. return listenNodeList(target, type, callback);
  8335. }
  8336. else if (is.string(target)) {
  8337. return listenSelector(target, type, callback);
  8338. }
  8339. else {
  8340. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8341. }
  8342. }
  8343. /**
  8344. * Adds an event listener to a HTML element
  8345. * and returns a remove listener function.
  8346. *
  8347. * @param {HTMLElement} node
  8348. * @param {String} type
  8349. * @param {Function} callback
  8350. * @return {Object}
  8351. */
  8352. function listenNode(node, type, callback) {
  8353. node.addEventListener(type, callback);
  8354. return {
  8355. destroy: function() {
  8356. node.removeEventListener(type, callback);
  8357. }
  8358. }
  8359. }
  8360. /**
  8361. * Add an event listener to a list of HTML elements
  8362. * and returns a remove listener function.
  8363. *
  8364. * @param {NodeList|HTMLCollection} nodeList
  8365. * @param {String} type
  8366. * @param {Function} callback
  8367. * @return {Object}
  8368. */
  8369. function listenNodeList(nodeList, type, callback) {
  8370. Array.prototype.forEach.call(nodeList, function(node) {
  8371. node.addEventListener(type, callback);
  8372. });
  8373. return {
  8374. destroy: function() {
  8375. Array.prototype.forEach.call(nodeList, function(node) {
  8376. node.removeEventListener(type, callback);
  8377. });
  8378. }
  8379. }
  8380. }
  8381. /**
  8382. * Add an event listener to a selector
  8383. * and returns a remove listener function.
  8384. *
  8385. * @param {String} selector
  8386. * @param {String} type
  8387. * @param {Function} callback
  8388. * @return {Object}
  8389. */
  8390. function listenSelector(selector, type, callback) {
  8391. return delegate(document.body, selector, type, callback);
  8392. }
  8393. module.exports = listen;
  8394. /***/ }),
  8395. /* 5 */
  8396. /***/ (function(module, exports) {
  8397. /**
  8398. * Check if argument is a HTML element.
  8399. *
  8400. * @param {Object} value
  8401. * @return {Boolean}
  8402. */
  8403. exports.node = function(value) {
  8404. return value !== undefined
  8405. && value instanceof HTMLElement
  8406. && value.nodeType === 1;
  8407. };
  8408. /**
  8409. * Check if argument is a list of HTML elements.
  8410. *
  8411. * @param {Object} value
  8412. * @return {Boolean}
  8413. */
  8414. exports.nodeList = function(value) {
  8415. var type = Object.prototype.toString.call(value);
  8416. return value !== undefined
  8417. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8418. && ('length' in value)
  8419. && (value.length === 0 || exports.node(value[0]));
  8420. };
  8421. /**
  8422. * Check if argument is a string.
  8423. *
  8424. * @param {Object} value
  8425. * @return {Boolean}
  8426. */
  8427. exports.string = function(value) {
  8428. return typeof value === 'string'
  8429. || value instanceof String;
  8430. };
  8431. /**
  8432. * Check if argument is a function.
  8433. *
  8434. * @param {Object} value
  8435. * @return {Boolean}
  8436. */
  8437. exports.fn = function(value) {
  8438. var type = Object.prototype.toString.call(value);
  8439. return type === '[object Function]';
  8440. };
  8441. /***/ }),
  8442. /* 6 */
  8443. /***/ (function(module, exports, __webpack_require__) {
  8444. var closest = __webpack_require__(7);
  8445. /**
  8446. * Delegates event to a selector.
  8447. *
  8448. * @param {Element} element
  8449. * @param {String} selector
  8450. * @param {String} type
  8451. * @param {Function} callback
  8452. * @param {Boolean} useCapture
  8453. * @return {Object}
  8454. */
  8455. function _delegate(element, selector, type, callback, useCapture) {
  8456. var listenerFn = listener.apply(this, arguments);
  8457. element.addEventListener(type, listenerFn, useCapture);
  8458. return {
  8459. destroy: function() {
  8460. element.removeEventListener(type, listenerFn, useCapture);
  8461. }
  8462. }
  8463. }
  8464. /**
  8465. * Delegates event to a selector.
  8466. *
  8467. * @param {Element|String|Array} [elements]
  8468. * @param {String} selector
  8469. * @param {String} type
  8470. * @param {Function} callback
  8471. * @param {Boolean} useCapture
  8472. * @return {Object}
  8473. */
  8474. function delegate(elements, selector, type, callback, useCapture) {
  8475. // Handle the regular Element usage
  8476. if (typeof elements.addEventListener === 'function') {
  8477. return _delegate.apply(null, arguments);
  8478. }
  8479. // Handle Element-less usage, it defaults to global delegation
  8480. if (typeof type === 'function') {
  8481. // Use `document` as the first parameter, then apply arguments
  8482. // This is a short way to .unshift `arguments` without running into deoptimizations
  8483. return _delegate.bind(null, document).apply(null, arguments);
  8484. }
  8485. // Handle Selector-based usage
  8486. if (typeof elements === 'string') {
  8487. elements = document.querySelectorAll(elements);
  8488. }
  8489. // Handle Array-like based usage
  8490. return Array.prototype.map.call(elements, function (element) {
  8491. return _delegate(element, selector, type, callback, useCapture);
  8492. });
  8493. }
  8494. /**
  8495. * Finds closest match and invokes callback.
  8496. *
  8497. * @param {Element} element
  8498. * @param {String} selector
  8499. * @param {String} type
  8500. * @param {Function} callback
  8501. * @return {Function}
  8502. */
  8503. function listener(element, selector, type, callback) {
  8504. return function(e) {
  8505. e.delegateTarget = closest(e.target, selector);
  8506. if (e.delegateTarget) {
  8507. callback.call(element, e);
  8508. }
  8509. }
  8510. }
  8511. module.exports = delegate;
  8512. /***/ }),
  8513. /* 7 */
  8514. /***/ (function(module, exports) {
  8515. var DOCUMENT_NODE_TYPE = 9;
  8516. /**
  8517. * A polyfill for Element.matches()
  8518. */
  8519. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8520. var proto = Element.prototype;
  8521. proto.matches = proto.matchesSelector ||
  8522. proto.mozMatchesSelector ||
  8523. proto.msMatchesSelector ||
  8524. proto.oMatchesSelector ||
  8525. proto.webkitMatchesSelector;
  8526. }
  8527. /**
  8528. * Finds the closest parent that matches a selector.
  8529. *
  8530. * @param {Element} element
  8531. * @param {String} selector
  8532. * @return {Function}
  8533. */
  8534. function closest (element, selector) {
  8535. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8536. if (typeof element.matches === 'function' &&
  8537. element.matches(selector)) {
  8538. return element;
  8539. }
  8540. element = element.parentNode;
  8541. }
  8542. }
  8543. module.exports = closest;
  8544. /***/ })
  8545. /******/ ]);
  8546. });
  8547. /***/ }),
  8548. /***/ "./node_modules/ieee754/index.js":
  8549. /*!***************************************!*\
  8550. !*** ./node_modules/ieee754/index.js ***!
  8551. \***************************************/
  8552. /*! no static exports found */
  8553. /***/ (function(module, exports) {
  8554. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8555. var e, m
  8556. var eLen = (nBytes * 8) - mLen - 1
  8557. var eMax = (1 << eLen) - 1
  8558. var eBias = eMax >> 1
  8559. var nBits = -7
  8560. var i = isLE ? (nBytes - 1) : 0
  8561. var d = isLE ? -1 : 1
  8562. var s = buffer[offset + i]
  8563. i += d
  8564. e = s & ((1 << (-nBits)) - 1)
  8565. s >>= (-nBits)
  8566. nBits += eLen
  8567. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8568. m = e & ((1 << (-nBits)) - 1)
  8569. e >>= (-nBits)
  8570. nBits += mLen
  8571. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8572. if (e === 0) {
  8573. e = 1 - eBias
  8574. } else if (e === eMax) {
  8575. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8576. } else {
  8577. m = m + Math.pow(2, mLen)
  8578. e = e - eBias
  8579. }
  8580. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8581. }
  8582. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8583. var e, m, c
  8584. var eLen = (nBytes * 8) - mLen - 1
  8585. var eMax = (1 << eLen) - 1
  8586. var eBias = eMax >> 1
  8587. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8588. var i = isLE ? 0 : (nBytes - 1)
  8589. var d = isLE ? 1 : -1
  8590. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8591. value = Math.abs(value)
  8592. if (isNaN(value) || value === Infinity) {
  8593. m = isNaN(value) ? 1 : 0
  8594. e = eMax
  8595. } else {
  8596. e = Math.floor(Math.log(value) / Math.LN2)
  8597. if (value * (c = Math.pow(2, -e)) < 1) {
  8598. e--
  8599. c *= 2
  8600. }
  8601. if (e + eBias >= 1) {
  8602. value += rt / c
  8603. } else {
  8604. value += rt * Math.pow(2, 1 - eBias)
  8605. }
  8606. if (value * c >= 2) {
  8607. e++
  8608. c /= 2
  8609. }
  8610. if (e + eBias >= eMax) {
  8611. m = 0
  8612. e = eMax
  8613. } else if (e + eBias >= 1) {
  8614. m = ((value * c) - 1) * Math.pow(2, mLen)
  8615. e = e + eBias
  8616. } else {
  8617. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8618. e = 0
  8619. }
  8620. }
  8621. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8622. e = (e << mLen) | m
  8623. eLen += mLen
  8624. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8625. buffer[offset + i - d] |= s * 128
  8626. }
  8627. /***/ }),
  8628. /***/ "./node_modules/isarray/index.js":
  8629. /*!***************************************!*\
  8630. !*** ./node_modules/isarray/index.js ***!
  8631. \***************************************/
  8632. /*! no static exports found */
  8633. /***/ (function(module, exports) {
  8634. var toString = {}.toString;
  8635. module.exports = Array.isArray || function (arr) {
  8636. return toString.call(arr) == '[object Array]';
  8637. };
  8638. /***/ }),
  8639. /***/ "./node_modules/jquery/dist/jquery.js":
  8640. /*!********************************************!*\
  8641. !*** ./node_modules/jquery/dist/jquery.js ***!
  8642. \********************************************/
  8643. /*! no static exports found */
  8644. /***/ (function(module, exports, __webpack_require__) {
  8645. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8646. * jQuery JavaScript Library v3.4.1
  8647. * https://jquery.com/
  8648. *
  8649. * Includes Sizzle.js
  8650. * https://sizzlejs.com/
  8651. *
  8652. * Copyright JS Foundation and other contributors
  8653. * Released under the MIT license
  8654. * https://jquery.org/license
  8655. *
  8656. * Date: 2019-05-01T21:04Z
  8657. */
  8658. ( function( global, factory ) {
  8659. "use strict";
  8660. if ( true && typeof module.exports === "object" ) {
  8661. // For CommonJS and CommonJS-like environments where a proper `window`
  8662. // is present, execute the factory and get jQuery.
  8663. // For environments that do not have a `window` with a `document`
  8664. // (such as Node.js), expose a factory as module.exports.
  8665. // This accentuates the need for the creation of a real `window`.
  8666. // e.g. var jQuery = require("jquery")(window);
  8667. // See ticket #14549 for more info.
  8668. module.exports = global.document ?
  8669. factory( global, true ) :
  8670. function( w ) {
  8671. if ( !w.document ) {
  8672. throw new Error( "jQuery requires a window with a document" );
  8673. }
  8674. return factory( w );
  8675. };
  8676. } else {
  8677. factory( global );
  8678. }
  8679. // Pass this if window is not defined yet
  8680. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8681. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8682. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8683. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8684. // enough that all such attempts are guarded in a try block.
  8685. "use strict";
  8686. var arr = [];
  8687. var document = window.document;
  8688. var getProto = Object.getPrototypeOf;
  8689. var slice = arr.slice;
  8690. var concat = arr.concat;
  8691. var push = arr.push;
  8692. var indexOf = arr.indexOf;
  8693. var class2type = {};
  8694. var toString = class2type.toString;
  8695. var hasOwn = class2type.hasOwnProperty;
  8696. var fnToString = hasOwn.toString;
  8697. var ObjectFunctionString = fnToString.call( Object );
  8698. var support = {};
  8699. var isFunction = function isFunction( obj ) {
  8700. // Support: Chrome <=57, Firefox <=52
  8701. // In some browsers, typeof returns "function" for HTML <object> elements
  8702. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8703. // We don't want to classify *any* DOM node as a function.
  8704. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8705. };
  8706. var isWindow = function isWindow( obj ) {
  8707. return obj != null && obj === obj.window;
  8708. };
  8709. var preservedScriptAttributes = {
  8710. type: true,
  8711. src: true,
  8712. nonce: true,
  8713. noModule: true
  8714. };
  8715. function DOMEval( code, node, doc ) {
  8716. doc = doc || document;
  8717. var i, val,
  8718. script = doc.createElement( "script" );
  8719. script.text = code;
  8720. if ( node ) {
  8721. for ( i in preservedScriptAttributes ) {
  8722. // Support: Firefox 64+, Edge 18+
  8723. // Some browsers don't support the "nonce" property on scripts.
  8724. // On the other hand, just using `getAttribute` is not enough as
  8725. // the `nonce` attribute is reset to an empty string whenever it
  8726. // becomes browsing-context connected.
  8727. // See https://github.com/whatwg/html/issues/2369
  8728. // See https://html.spec.whatwg.org/#nonce-attributes
  8729. // The `node.getAttribute` check was added for the sake of
  8730. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8731. // via an object.
  8732. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8733. if ( val ) {
  8734. script.setAttribute( i, val );
  8735. }
  8736. }
  8737. }
  8738. doc.head.appendChild( script ).parentNode.removeChild( script );
  8739. }
  8740. function toType( obj ) {
  8741. if ( obj == null ) {
  8742. return obj + "";
  8743. }
  8744. // Support: Android <=2.3 only (functionish RegExp)
  8745. return typeof obj === "object" || typeof obj === "function" ?
  8746. class2type[ toString.call( obj ) ] || "object" :
  8747. typeof obj;
  8748. }
  8749. /* global Symbol */
  8750. // Defining this global in .eslintrc.json would create a danger of using the global
  8751. // unguarded in another place, it seems safer to define global only for this module
  8752. var
  8753. version = "3.4.1",
  8754. // Define a local copy of jQuery
  8755. jQuery = function( selector, context ) {
  8756. // The jQuery object is actually just the init constructor 'enhanced'
  8757. // Need init if jQuery is called (just allow error to be thrown if not included)
  8758. return new jQuery.fn.init( selector, context );
  8759. },
  8760. // Support: Android <=4.0 only
  8761. // Make sure we trim BOM and NBSP
  8762. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8763. jQuery.fn = jQuery.prototype = {
  8764. // The current version of jQuery being used
  8765. jquery: version,
  8766. constructor: jQuery,
  8767. // The default length of a jQuery object is 0
  8768. length: 0,
  8769. toArray: function() {
  8770. return slice.call( this );
  8771. },
  8772. // Get the Nth element in the matched element set OR
  8773. // Get the whole matched element set as a clean array
  8774. get: function( num ) {
  8775. // Return all the elements in a clean array
  8776. if ( num == null ) {
  8777. return slice.call( this );
  8778. }
  8779. // Return just the one element from the set
  8780. return num < 0 ? this[ num + this.length ] : this[ num ];
  8781. },
  8782. // Take an array of elements and push it onto the stack
  8783. // (returning the new matched element set)
  8784. pushStack: function( elems ) {
  8785. // Build a new jQuery matched element set
  8786. var ret = jQuery.merge( this.constructor(), elems );
  8787. // Add the old object onto the stack (as a reference)
  8788. ret.prevObject = this;
  8789. // Return the newly-formed element set
  8790. return ret;
  8791. },
  8792. // Execute a callback for every element in the matched set.
  8793. each: function( callback ) {
  8794. return jQuery.each( this, callback );
  8795. },
  8796. map: function( callback ) {
  8797. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8798. return callback.call( elem, i, elem );
  8799. } ) );
  8800. },
  8801. slice: function() {
  8802. return this.pushStack( slice.apply( this, arguments ) );
  8803. },
  8804. first: function() {
  8805. return this.eq( 0 );
  8806. },
  8807. last: function() {
  8808. return this.eq( -1 );
  8809. },
  8810. eq: function( i ) {
  8811. var len = this.length,
  8812. j = +i + ( i < 0 ? len : 0 );
  8813. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8814. },
  8815. end: function() {
  8816. return this.prevObject || this.constructor();
  8817. },
  8818. // For internal use only.
  8819. // Behaves like an Array's method, not like a jQuery method.
  8820. push: push,
  8821. sort: arr.sort,
  8822. splice: arr.splice
  8823. };
  8824. jQuery.extend = jQuery.fn.extend = function() {
  8825. var options, name, src, copy, copyIsArray, clone,
  8826. target = arguments[ 0 ] || {},
  8827. i = 1,
  8828. length = arguments.length,
  8829. deep = false;
  8830. // Handle a deep copy situation
  8831. if ( typeof target === "boolean" ) {
  8832. deep = target;
  8833. // Skip the boolean and the target
  8834. target = arguments[ i ] || {};
  8835. i++;
  8836. }
  8837. // Handle case when target is a string or something (possible in deep copy)
  8838. if ( typeof target !== "object" && !isFunction( target ) ) {
  8839. target = {};
  8840. }
  8841. // Extend jQuery itself if only one argument is passed
  8842. if ( i === length ) {
  8843. target = this;
  8844. i--;
  8845. }
  8846. for ( ; i < length; i++ ) {
  8847. // Only deal with non-null/undefined values
  8848. if ( ( options = arguments[ i ] ) != null ) {
  8849. // Extend the base object
  8850. for ( name in options ) {
  8851. copy = options[ name ];
  8852. // Prevent Object.prototype pollution
  8853. // Prevent never-ending loop
  8854. if ( name === "__proto__" || target === copy ) {
  8855. continue;
  8856. }
  8857. // Recurse if we're merging plain objects or arrays
  8858. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8859. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8860. src = target[ name ];
  8861. // Ensure proper type for the source value
  8862. if ( copyIsArray && !Array.isArray( src ) ) {
  8863. clone = [];
  8864. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8865. clone = {};
  8866. } else {
  8867. clone = src;
  8868. }
  8869. copyIsArray = false;
  8870. // Never move original objects, clone them
  8871. target[ name ] = jQuery.extend( deep, clone, copy );
  8872. // Don't bring in undefined values
  8873. } else if ( copy !== undefined ) {
  8874. target[ name ] = copy;
  8875. }
  8876. }
  8877. }
  8878. }
  8879. // Return the modified object
  8880. return target;
  8881. };
  8882. jQuery.extend( {
  8883. // Unique for each copy of jQuery on the page
  8884. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8885. // Assume jQuery is ready without the ready module
  8886. isReady: true,
  8887. error: function( msg ) {
  8888. throw new Error( msg );
  8889. },
  8890. noop: function() {},
  8891. isPlainObject: function( obj ) {
  8892. var proto, Ctor;
  8893. // Detect obvious negatives
  8894. // Use toString instead of jQuery.type to catch host objects
  8895. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8896. return false;
  8897. }
  8898. proto = getProto( obj );
  8899. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8900. if ( !proto ) {
  8901. return true;
  8902. }
  8903. // Objects with prototype are plain iff they were constructed by a global Object function
  8904. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8905. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8906. },
  8907. isEmptyObject: function( obj ) {
  8908. var name;
  8909. for ( name in obj ) {
  8910. return false;
  8911. }
  8912. return true;
  8913. },
  8914. // Evaluates a script in a global context
  8915. globalEval: function( code, options ) {
  8916. DOMEval( code, { nonce: options && options.nonce } );
  8917. },
  8918. each: function( obj, callback ) {
  8919. var length, i = 0;
  8920. if ( isArrayLike( obj ) ) {
  8921. length = obj.length;
  8922. for ( ; i < length; i++ ) {
  8923. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8924. break;
  8925. }
  8926. }
  8927. } else {
  8928. for ( i in obj ) {
  8929. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8930. break;
  8931. }
  8932. }
  8933. }
  8934. return obj;
  8935. },
  8936. // Support: Android <=4.0 only
  8937. trim: function( text ) {
  8938. return text == null ?
  8939. "" :
  8940. ( text + "" ).replace( rtrim, "" );
  8941. },
  8942. // results is for internal usage only
  8943. makeArray: function( arr, results ) {
  8944. var ret = results || [];
  8945. if ( arr != null ) {
  8946. if ( isArrayLike( Object( arr ) ) ) {
  8947. jQuery.merge( ret,
  8948. typeof arr === "string" ?
  8949. [ arr ] : arr
  8950. );
  8951. } else {
  8952. push.call( ret, arr );
  8953. }
  8954. }
  8955. return ret;
  8956. },
  8957. inArray: function( elem, arr, i ) {
  8958. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8959. },
  8960. // Support: Android <=4.0 only, PhantomJS 1 only
  8961. // push.apply(_, arraylike) throws on ancient WebKit
  8962. merge: function( first, second ) {
  8963. var len = +second.length,
  8964. j = 0,
  8965. i = first.length;
  8966. for ( ; j < len; j++ ) {
  8967. first[ i++ ] = second[ j ];
  8968. }
  8969. first.length = i;
  8970. return first;
  8971. },
  8972. grep: function( elems, callback, invert ) {
  8973. var callbackInverse,
  8974. matches = [],
  8975. i = 0,
  8976. length = elems.length,
  8977. callbackExpect = !invert;
  8978. // Go through the array, only saving the items
  8979. // that pass the validator function
  8980. for ( ; i < length; i++ ) {
  8981. callbackInverse = !callback( elems[ i ], i );
  8982. if ( callbackInverse !== callbackExpect ) {
  8983. matches.push( elems[ i ] );
  8984. }
  8985. }
  8986. return matches;
  8987. },
  8988. // arg is for internal usage only
  8989. map: function( elems, callback, arg ) {
  8990. var length, value,
  8991. i = 0,
  8992. ret = [];
  8993. // Go through the array, translating each of the items to their new values
  8994. if ( isArrayLike( elems ) ) {
  8995. length = elems.length;
  8996. for ( ; i < length; i++ ) {
  8997. value = callback( elems[ i ], i, arg );
  8998. if ( value != null ) {
  8999. ret.push( value );
  9000. }
  9001. }
  9002. // Go through every key on the object,
  9003. } else {
  9004. for ( i in elems ) {
  9005. value = callback( elems[ i ], i, arg );
  9006. if ( value != null ) {
  9007. ret.push( value );
  9008. }
  9009. }
  9010. }
  9011. // Flatten any nested arrays
  9012. return concat.apply( [], ret );
  9013. },
  9014. // A global GUID counter for objects
  9015. guid: 1,
  9016. // jQuery.support is not used in Core but other projects attach their
  9017. // properties to it so it needs to exist.
  9018. support: support
  9019. } );
  9020. if ( typeof Symbol === "function" ) {
  9021. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9022. }
  9023. // Populate the class2type map
  9024. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9025. function( i, name ) {
  9026. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9027. } );
  9028. function isArrayLike( obj ) {
  9029. // Support: real iOS 8.2 only (not reproducible in simulator)
  9030. // `in` check used to prevent JIT error (gh-2145)
  9031. // hasOwn isn't used here due to false negatives
  9032. // regarding Nodelist length in IE
  9033. var length = !!obj && "length" in obj && obj.length,
  9034. type = toType( obj );
  9035. if ( isFunction( obj ) || isWindow( obj ) ) {
  9036. return false;
  9037. }
  9038. return type === "array" || length === 0 ||
  9039. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9040. }
  9041. var Sizzle =
  9042. /*!
  9043. * Sizzle CSS Selector Engine v2.3.4
  9044. * https://sizzlejs.com/
  9045. *
  9046. * Copyright JS Foundation and other contributors
  9047. * Released under the MIT license
  9048. * https://js.foundation/
  9049. *
  9050. * Date: 2019-04-08
  9051. */
  9052. (function( window ) {
  9053. var i,
  9054. support,
  9055. Expr,
  9056. getText,
  9057. isXML,
  9058. tokenize,
  9059. compile,
  9060. select,
  9061. outermostContext,
  9062. sortInput,
  9063. hasDuplicate,
  9064. // Local document vars
  9065. setDocument,
  9066. document,
  9067. docElem,
  9068. documentIsHTML,
  9069. rbuggyQSA,
  9070. rbuggyMatches,
  9071. matches,
  9072. contains,
  9073. // Instance-specific data
  9074. expando = "sizzle" + 1 * new Date(),
  9075. preferredDoc = window.document,
  9076. dirruns = 0,
  9077. done = 0,
  9078. classCache = createCache(),
  9079. tokenCache = createCache(),
  9080. compilerCache = createCache(),
  9081. nonnativeSelectorCache = createCache(),
  9082. sortOrder = function( a, b ) {
  9083. if ( a === b ) {
  9084. hasDuplicate = true;
  9085. }
  9086. return 0;
  9087. },
  9088. // Instance methods
  9089. hasOwn = ({}).hasOwnProperty,
  9090. arr = [],
  9091. pop = arr.pop,
  9092. push_native = arr.push,
  9093. push = arr.push,
  9094. slice = arr.slice,
  9095. // Use a stripped-down indexOf as it's faster than native
  9096. // https://jsperf.com/thor-indexof-vs-for/5
  9097. indexOf = function( list, elem ) {
  9098. var i = 0,
  9099. len = list.length;
  9100. for ( ; i < len; i++ ) {
  9101. if ( list[i] === elem ) {
  9102. return i;
  9103. }
  9104. }
  9105. return -1;
  9106. },
  9107. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9108. // Regular expressions
  9109. // http://www.w3.org/TR/css3-selectors/#whitespace
  9110. whitespace = "[\\x20\\t\\r\\n\\f]",
  9111. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9112. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9113. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9114. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9115. // Operator (capture 2)
  9116. "*([*^$|!~]?=)" + whitespace +
  9117. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9118. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9119. "*\\]",
  9120. pseudos = ":(" + identifier + ")(?:\\((" +
  9121. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9122. // 1. quoted (capture 3; capture 4 or capture 5)
  9123. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9124. // 2. simple (capture 6)
  9125. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9126. // 3. anything else (capture 2)
  9127. ".*" +
  9128. ")\\)|)",
  9129. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9130. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9131. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9132. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9133. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9134. rdescend = new RegExp( whitespace + "|>" ),
  9135. rpseudo = new RegExp( pseudos ),
  9136. ridentifier = new RegExp( "^" + identifier + "$" ),
  9137. matchExpr = {
  9138. "ID": new RegExp( "^#(" + identifier + ")" ),
  9139. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9140. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9141. "ATTR": new RegExp( "^" + attributes ),
  9142. "PSEUDO": new RegExp( "^" + pseudos ),
  9143. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9144. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9145. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9146. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9147. // For use in libraries implementing .is()
  9148. // We use this for POS matching in `select`
  9149. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9150. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9151. },
  9152. rhtml = /HTML$/i,
  9153. rinputs = /^(?:input|select|textarea|button)$/i,
  9154. rheader = /^h\d$/i,
  9155. rnative = /^[^{]+\{\s*\[native \w/,
  9156. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9157. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9158. rsibling = /[+~]/,
  9159. // CSS escapes
  9160. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9161. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9162. funescape = function( _, escaped, escapedWhitespace ) {
  9163. var high = "0x" + escaped - 0x10000;
  9164. // NaN means non-codepoint
  9165. // Support: Firefox<24
  9166. // Workaround erroneous numeric interpretation of +"0x"
  9167. return high !== high || escapedWhitespace ?
  9168. escaped :
  9169. high < 0 ?
  9170. // BMP codepoint
  9171. String.fromCharCode( high + 0x10000 ) :
  9172. // Supplemental Plane codepoint (surrogate pair)
  9173. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9174. },
  9175. // CSS string/identifier serialization
  9176. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9177. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9178. fcssescape = function( ch, asCodePoint ) {
  9179. if ( asCodePoint ) {
  9180. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9181. if ( ch === "\0" ) {
  9182. return "\uFFFD";
  9183. }
  9184. // Control characters and (dependent upon position) numbers get escaped as code points
  9185. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9186. }
  9187. // Other potentially-special ASCII characters get backslash-escaped
  9188. return "\\" + ch;
  9189. },
  9190. // Used for iframes
  9191. // See setDocument()
  9192. // Removing the function wrapper causes a "Permission Denied"
  9193. // error in IE
  9194. unloadHandler = function() {
  9195. setDocument();
  9196. },
  9197. inDisabledFieldset = addCombinator(
  9198. function( elem ) {
  9199. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9200. },
  9201. { dir: "parentNode", next: "legend" }
  9202. );
  9203. // Optimize for push.apply( _, NodeList )
  9204. try {
  9205. push.apply(
  9206. (arr = slice.call( preferredDoc.childNodes )),
  9207. preferredDoc.childNodes
  9208. );
  9209. // Support: Android<4.0
  9210. // Detect silently failing push.apply
  9211. arr[ preferredDoc.childNodes.length ].nodeType;
  9212. } catch ( e ) {
  9213. push = { apply: arr.length ?
  9214. // Leverage slice if possible
  9215. function( target, els ) {
  9216. push_native.apply( target, slice.call(els) );
  9217. } :
  9218. // Support: IE<9
  9219. // Otherwise append directly
  9220. function( target, els ) {
  9221. var j = target.length,
  9222. i = 0;
  9223. // Can't trust NodeList.length
  9224. while ( (target[j++] = els[i++]) ) {}
  9225. target.length = j - 1;
  9226. }
  9227. };
  9228. }
  9229. function Sizzle( selector, context, results, seed ) {
  9230. var m, i, elem, nid, match, groups, newSelector,
  9231. newContext = context && context.ownerDocument,
  9232. // nodeType defaults to 9, since context defaults to document
  9233. nodeType = context ? context.nodeType : 9;
  9234. results = results || [];
  9235. // Return early from calls with invalid selector or context
  9236. if ( typeof selector !== "string" || !selector ||
  9237. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9238. return results;
  9239. }
  9240. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9241. if ( !seed ) {
  9242. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9243. setDocument( context );
  9244. }
  9245. context = context || document;
  9246. if ( documentIsHTML ) {
  9247. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9248. // (excepting DocumentFragment context, where the methods don't exist)
  9249. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9250. // ID selector
  9251. if ( (m = match[1]) ) {
  9252. // Document context
  9253. if ( nodeType === 9 ) {
  9254. if ( (elem = context.getElementById( m )) ) {
  9255. // Support: IE, Opera, Webkit
  9256. // TODO: identify versions
  9257. // getElementById can match elements by name instead of ID
  9258. if ( elem.id === m ) {
  9259. results.push( elem );
  9260. return results;
  9261. }
  9262. } else {
  9263. return results;
  9264. }
  9265. // Element context
  9266. } else {
  9267. // Support: IE, Opera, Webkit
  9268. // TODO: identify versions
  9269. // getElementById can match elements by name instead of ID
  9270. if ( newContext && (elem = newContext.getElementById( m )) &&
  9271. contains( context, elem ) &&
  9272. elem.id === m ) {
  9273. results.push( elem );
  9274. return results;
  9275. }
  9276. }
  9277. // Type selector
  9278. } else if ( match[2] ) {
  9279. push.apply( results, context.getElementsByTagName( selector ) );
  9280. return results;
  9281. // Class selector
  9282. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9283. context.getElementsByClassName ) {
  9284. push.apply( results, context.getElementsByClassName( m ) );
  9285. return results;
  9286. }
  9287. }
  9288. // Take advantage of querySelectorAll
  9289. if ( support.qsa &&
  9290. !nonnativeSelectorCache[ selector + " " ] &&
  9291. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9292. // Support: IE 8 only
  9293. // Exclude object elements
  9294. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9295. newSelector = selector;
  9296. newContext = context;
  9297. // qSA considers elements outside a scoping root when evaluating child or
  9298. // descendant combinators, which is not what we want.
  9299. // In such cases, we work around the behavior by prefixing every selector in the
  9300. // list with an ID selector referencing the scope context.
  9301. // Thanks to Andrew Dupont for this technique.
  9302. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9303. // Capture the context ID, setting it first if necessary
  9304. if ( (nid = context.getAttribute( "id" )) ) {
  9305. nid = nid.replace( rcssescape, fcssescape );
  9306. } else {
  9307. context.setAttribute( "id", (nid = expando) );
  9308. }
  9309. // Prefix every selector in the list
  9310. groups = tokenize( selector );
  9311. i = groups.length;
  9312. while ( i-- ) {
  9313. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9314. }
  9315. newSelector = groups.join( "," );
  9316. // Expand context for sibling selectors
  9317. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9318. context;
  9319. }
  9320. try {
  9321. push.apply( results,
  9322. newContext.querySelectorAll( newSelector )
  9323. );
  9324. return results;
  9325. } catch ( qsaError ) {
  9326. nonnativeSelectorCache( selector, true );
  9327. } finally {
  9328. if ( nid === expando ) {
  9329. context.removeAttribute( "id" );
  9330. }
  9331. }
  9332. }
  9333. }
  9334. }
  9335. // All others
  9336. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9337. }
  9338. /**
  9339. * Create key-value caches of limited size
  9340. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9341. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9342. * deleting the oldest entry
  9343. */
  9344. function createCache() {
  9345. var keys = [];
  9346. function cache( key, value ) {
  9347. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9348. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9349. // Only keep the most recent entries
  9350. delete cache[ keys.shift() ];
  9351. }
  9352. return (cache[ key + " " ] = value);
  9353. }
  9354. return cache;
  9355. }
  9356. /**
  9357. * Mark a function for special use by Sizzle
  9358. * @param {Function} fn The function to mark
  9359. */
  9360. function markFunction( fn ) {
  9361. fn[ expando ] = true;
  9362. return fn;
  9363. }
  9364. /**
  9365. * Support testing using an element
  9366. * @param {Function} fn Passed the created element and returns a boolean result
  9367. */
  9368. function assert( fn ) {
  9369. var el = document.createElement("fieldset");
  9370. try {
  9371. return !!fn( el );
  9372. } catch (e) {
  9373. return false;
  9374. } finally {
  9375. // Remove from its parent by default
  9376. if ( el.parentNode ) {
  9377. el.parentNode.removeChild( el );
  9378. }
  9379. // release memory in IE
  9380. el = null;
  9381. }
  9382. }
  9383. /**
  9384. * Adds the same handler for all of the specified attrs
  9385. * @param {String} attrs Pipe-separated list of attributes
  9386. * @param {Function} handler The method that will be applied
  9387. */
  9388. function addHandle( attrs, handler ) {
  9389. var arr = attrs.split("|"),
  9390. i = arr.length;
  9391. while ( i-- ) {
  9392. Expr.attrHandle[ arr[i] ] = handler;
  9393. }
  9394. }
  9395. /**
  9396. * Checks document order of two siblings
  9397. * @param {Element} a
  9398. * @param {Element} b
  9399. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9400. */
  9401. function siblingCheck( a, b ) {
  9402. var cur = b && a,
  9403. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9404. a.sourceIndex - b.sourceIndex;
  9405. // Use IE sourceIndex if available on both nodes
  9406. if ( diff ) {
  9407. return diff;
  9408. }
  9409. // Check if b follows a
  9410. if ( cur ) {
  9411. while ( (cur = cur.nextSibling) ) {
  9412. if ( cur === b ) {
  9413. return -1;
  9414. }
  9415. }
  9416. }
  9417. return a ? 1 : -1;
  9418. }
  9419. /**
  9420. * Returns a function to use in pseudos for input types
  9421. * @param {String} type
  9422. */
  9423. function createInputPseudo( type ) {
  9424. return function( elem ) {
  9425. var name = elem.nodeName.toLowerCase();
  9426. return name === "input" && elem.type === type;
  9427. };
  9428. }
  9429. /**
  9430. * Returns a function to use in pseudos for buttons
  9431. * @param {String} type
  9432. */
  9433. function createButtonPseudo( type ) {
  9434. return function( elem ) {
  9435. var name = elem.nodeName.toLowerCase();
  9436. return (name === "input" || name === "button") && elem.type === type;
  9437. };
  9438. }
  9439. /**
  9440. * Returns a function to use in pseudos for :enabled/:disabled
  9441. * @param {Boolean} disabled true for :disabled; false for :enabled
  9442. */
  9443. function createDisabledPseudo( disabled ) {
  9444. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9445. return function( elem ) {
  9446. // Only certain elements can match :enabled or :disabled
  9447. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9448. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9449. if ( "form" in elem ) {
  9450. // Check for inherited disabledness on relevant non-disabled elements:
  9451. // * listed form-associated elements in a disabled fieldset
  9452. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9453. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9454. // * option elements in a disabled optgroup
  9455. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9456. // All such elements have a "form" property.
  9457. if ( elem.parentNode && elem.disabled === false ) {
  9458. // Option elements defer to a parent optgroup if present
  9459. if ( "label" in elem ) {
  9460. if ( "label" in elem.parentNode ) {
  9461. return elem.parentNode.disabled === disabled;
  9462. } else {
  9463. return elem.disabled === disabled;
  9464. }
  9465. }
  9466. // Support: IE 6 - 11
  9467. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9468. return elem.isDisabled === disabled ||
  9469. // Where there is no isDisabled, check manually
  9470. /* jshint -W018 */
  9471. elem.isDisabled !== !disabled &&
  9472. inDisabledFieldset( elem ) === disabled;
  9473. }
  9474. return elem.disabled === disabled;
  9475. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9476. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9477. // even exist on them, let alone have a boolean value.
  9478. } else if ( "label" in elem ) {
  9479. return elem.disabled === disabled;
  9480. }
  9481. // Remaining elements are neither :enabled nor :disabled
  9482. return false;
  9483. };
  9484. }
  9485. /**
  9486. * Returns a function to use in pseudos for positionals
  9487. * @param {Function} fn
  9488. */
  9489. function createPositionalPseudo( fn ) {
  9490. return markFunction(function( argument ) {
  9491. argument = +argument;
  9492. return markFunction(function( seed, matches ) {
  9493. var j,
  9494. matchIndexes = fn( [], seed.length, argument ),
  9495. i = matchIndexes.length;
  9496. // Match elements found at the specified indexes
  9497. while ( i-- ) {
  9498. if ( seed[ (j = matchIndexes[i]) ] ) {
  9499. seed[j] = !(matches[j] = seed[j]);
  9500. }
  9501. }
  9502. });
  9503. });
  9504. }
  9505. /**
  9506. * Checks a node for validity as a Sizzle context
  9507. * @param {Element|Object=} context
  9508. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9509. */
  9510. function testContext( context ) {
  9511. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9512. }
  9513. // Expose support vars for convenience
  9514. support = Sizzle.support = {};
  9515. /**
  9516. * Detects XML nodes
  9517. * @param {Element|Object} elem An element or a document
  9518. * @returns {Boolean} True iff elem is a non-HTML XML node
  9519. */
  9520. isXML = Sizzle.isXML = function( elem ) {
  9521. var namespace = elem.namespaceURI,
  9522. docElem = (elem.ownerDocument || elem).documentElement;
  9523. // Support: IE <=8
  9524. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9525. // https://bugs.jquery.com/ticket/4833
  9526. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9527. };
  9528. /**
  9529. * Sets document-related variables once based on the current document
  9530. * @param {Element|Object} [doc] An element or document object to use to set the document
  9531. * @returns {Object} Returns the current document
  9532. */
  9533. setDocument = Sizzle.setDocument = function( node ) {
  9534. var hasCompare, subWindow,
  9535. doc = node ? node.ownerDocument || node : preferredDoc;
  9536. // Return early if doc is invalid or already selected
  9537. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9538. return document;
  9539. }
  9540. // Update global variables
  9541. document = doc;
  9542. docElem = document.documentElement;
  9543. documentIsHTML = !isXML( document );
  9544. // Support: IE 9-11, Edge
  9545. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9546. if ( preferredDoc !== document &&
  9547. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9548. // Support: IE 11, Edge
  9549. if ( subWindow.addEventListener ) {
  9550. subWindow.addEventListener( "unload", unloadHandler, false );
  9551. // Support: IE 9 - 10 only
  9552. } else if ( subWindow.attachEvent ) {
  9553. subWindow.attachEvent( "onunload", unloadHandler );
  9554. }
  9555. }
  9556. /* Attributes
  9557. ---------------------------------------------------------------------- */
  9558. // Support: IE<8
  9559. // Verify that getAttribute really returns attributes and not properties
  9560. // (excepting IE8 booleans)
  9561. support.attributes = assert(function( el ) {
  9562. el.className = "i";
  9563. return !el.getAttribute("className");
  9564. });
  9565. /* getElement(s)By*
  9566. ---------------------------------------------------------------------- */
  9567. // Check if getElementsByTagName("*") returns only elements
  9568. support.getElementsByTagName = assert(function( el ) {
  9569. el.appendChild( document.createComment("") );
  9570. return !el.getElementsByTagName("*").length;
  9571. });
  9572. // Support: IE<9
  9573. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9574. // Support: IE<10
  9575. // Check if getElementById returns elements by name
  9576. // The broken getElementById methods don't pick up programmatically-set names,
  9577. // so use a roundabout getElementsByName test
  9578. support.getById = assert(function( el ) {
  9579. docElem.appendChild( el ).id = expando;
  9580. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9581. });
  9582. // ID filter and find
  9583. if ( support.getById ) {
  9584. Expr.filter["ID"] = function( id ) {
  9585. var attrId = id.replace( runescape, funescape );
  9586. return function( elem ) {
  9587. return elem.getAttribute("id") === attrId;
  9588. };
  9589. };
  9590. Expr.find["ID"] = function( id, context ) {
  9591. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9592. var elem = context.getElementById( id );
  9593. return elem ? [ elem ] : [];
  9594. }
  9595. };
  9596. } else {
  9597. Expr.filter["ID"] = function( id ) {
  9598. var attrId = id.replace( runescape, funescape );
  9599. return function( elem ) {
  9600. var node = typeof elem.getAttributeNode !== "undefined" &&
  9601. elem.getAttributeNode("id");
  9602. return node && node.value === attrId;
  9603. };
  9604. };
  9605. // Support: IE 6 - 7 only
  9606. // getElementById is not reliable as a find shortcut
  9607. Expr.find["ID"] = function( id, context ) {
  9608. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9609. var node, i, elems,
  9610. elem = context.getElementById( id );
  9611. if ( elem ) {
  9612. // Verify the id attribute
  9613. node = elem.getAttributeNode("id");
  9614. if ( node && node.value === id ) {
  9615. return [ elem ];
  9616. }
  9617. // Fall back on getElementsByName
  9618. elems = context.getElementsByName( id );
  9619. i = 0;
  9620. while ( (elem = elems[i++]) ) {
  9621. node = elem.getAttributeNode("id");
  9622. if ( node && node.value === id ) {
  9623. return [ elem ];
  9624. }
  9625. }
  9626. }
  9627. return [];
  9628. }
  9629. };
  9630. }
  9631. // Tag
  9632. Expr.find["TAG"] = support.getElementsByTagName ?
  9633. function( tag, context ) {
  9634. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9635. return context.getElementsByTagName( tag );
  9636. // DocumentFragment nodes don't have gEBTN
  9637. } else if ( support.qsa ) {
  9638. return context.querySelectorAll( tag );
  9639. }
  9640. } :
  9641. function( tag, context ) {
  9642. var elem,
  9643. tmp = [],
  9644. i = 0,
  9645. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9646. results = context.getElementsByTagName( tag );
  9647. // Filter out possible comments
  9648. if ( tag === "*" ) {
  9649. while ( (elem = results[i++]) ) {
  9650. if ( elem.nodeType === 1 ) {
  9651. tmp.push( elem );
  9652. }
  9653. }
  9654. return tmp;
  9655. }
  9656. return results;
  9657. };
  9658. // Class
  9659. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9660. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9661. return context.getElementsByClassName( className );
  9662. }
  9663. };
  9664. /* QSA/matchesSelector
  9665. ---------------------------------------------------------------------- */
  9666. // QSA and matchesSelector support
  9667. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9668. rbuggyMatches = [];
  9669. // qSa(:focus) reports false when true (Chrome 21)
  9670. // We allow this because of a bug in IE8/9 that throws an error
  9671. // whenever `document.activeElement` is accessed on an iframe
  9672. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9673. // See https://bugs.jquery.com/ticket/13378
  9674. rbuggyQSA = [];
  9675. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9676. // Build QSA regex
  9677. // Regex strategy adopted from Diego Perini
  9678. assert(function( el ) {
  9679. // Select is set to empty string on purpose
  9680. // This is to test IE's treatment of not explicitly
  9681. // setting a boolean content attribute,
  9682. // since its presence should be enough
  9683. // https://bugs.jquery.com/ticket/12359
  9684. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9685. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9686. "<option selected=''></option></select>";
  9687. // Support: IE8, Opera 11-12.16
  9688. // Nothing should be selected when empty strings follow ^= or $= or *=
  9689. // The test attribute must be unknown in Opera but "safe" for WinRT
  9690. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9691. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9692. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9693. }
  9694. // Support: IE8
  9695. // Boolean attributes and "value" are not treated correctly
  9696. if ( !el.querySelectorAll("[selected]").length ) {
  9697. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9698. }
  9699. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9700. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9701. rbuggyQSA.push("~=");
  9702. }
  9703. // Webkit/Opera - :checked should return selected option elements
  9704. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9705. // IE8 throws error here and will not see later tests
  9706. if ( !el.querySelectorAll(":checked").length ) {
  9707. rbuggyQSA.push(":checked");
  9708. }
  9709. // Support: Safari 8+, iOS 8+
  9710. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9711. // In-page `selector#id sibling-combinator selector` fails
  9712. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9713. rbuggyQSA.push(".#.+[+~]");
  9714. }
  9715. });
  9716. assert(function( el ) {
  9717. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9718. "<select disabled='disabled'><option/></select>";
  9719. // Support: Windows 8 Native Apps
  9720. // The type and name attributes are restricted during .innerHTML assignment
  9721. var input = document.createElement("input");
  9722. input.setAttribute( "type", "hidden" );
  9723. el.appendChild( input ).setAttribute( "name", "D" );
  9724. // Support: IE8
  9725. // Enforce case-sensitivity of name attribute
  9726. if ( el.querySelectorAll("[name=d]").length ) {
  9727. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9728. }
  9729. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9730. // IE8 throws error here and will not see later tests
  9731. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9732. rbuggyQSA.push( ":enabled", ":disabled" );
  9733. }
  9734. // Support: IE9-11+
  9735. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9736. docElem.appendChild( el ).disabled = true;
  9737. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9738. rbuggyQSA.push( ":enabled", ":disabled" );
  9739. }
  9740. // Opera 10-11 does not throw on post-comma invalid pseudos
  9741. el.querySelectorAll("*,:x");
  9742. rbuggyQSA.push(",.*:");
  9743. });
  9744. }
  9745. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9746. docElem.webkitMatchesSelector ||
  9747. docElem.mozMatchesSelector ||
  9748. docElem.oMatchesSelector ||
  9749. docElem.msMatchesSelector) )) ) {
  9750. assert(function( el ) {
  9751. // Check to see if it's possible to do matchesSelector
  9752. // on a disconnected node (IE 9)
  9753. support.disconnectedMatch = matches.call( el, "*" );
  9754. // This should fail with an exception
  9755. // Gecko does not error, returns false instead
  9756. matches.call( el, "[s!='']:x" );
  9757. rbuggyMatches.push( "!=", pseudos );
  9758. });
  9759. }
  9760. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9761. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9762. /* Contains
  9763. ---------------------------------------------------------------------- */
  9764. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9765. // Element contains another
  9766. // Purposefully self-exclusive
  9767. // As in, an element does not contain itself
  9768. contains = hasCompare || rnative.test( docElem.contains ) ?
  9769. function( a, b ) {
  9770. var adown = a.nodeType === 9 ? a.documentElement : a,
  9771. bup = b && b.parentNode;
  9772. return a === bup || !!( bup && bup.nodeType === 1 && (
  9773. adown.contains ?
  9774. adown.contains( bup ) :
  9775. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9776. ));
  9777. } :
  9778. function( a, b ) {
  9779. if ( b ) {
  9780. while ( (b = b.parentNode) ) {
  9781. if ( b === a ) {
  9782. return true;
  9783. }
  9784. }
  9785. }
  9786. return false;
  9787. };
  9788. /* Sorting
  9789. ---------------------------------------------------------------------- */
  9790. // Document order sorting
  9791. sortOrder = hasCompare ?
  9792. function( a, b ) {
  9793. // Flag for duplicate removal
  9794. if ( a === b ) {
  9795. hasDuplicate = true;
  9796. return 0;
  9797. }
  9798. // Sort on method existence if only one input has compareDocumentPosition
  9799. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9800. if ( compare ) {
  9801. return compare;
  9802. }
  9803. // Calculate position if both inputs belong to the same document
  9804. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9805. a.compareDocumentPosition( b ) :
  9806. // Otherwise we know they are disconnected
  9807. 1;
  9808. // Disconnected nodes
  9809. if ( compare & 1 ||
  9810. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9811. // Choose the first element that is related to our preferred document
  9812. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9813. return -1;
  9814. }
  9815. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9816. return 1;
  9817. }
  9818. // Maintain original order
  9819. return sortInput ?
  9820. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9821. 0;
  9822. }
  9823. return compare & 4 ? -1 : 1;
  9824. } :
  9825. function( a, b ) {
  9826. // Exit early if the nodes are identical
  9827. if ( a === b ) {
  9828. hasDuplicate = true;
  9829. return 0;
  9830. }
  9831. var cur,
  9832. i = 0,
  9833. aup = a.parentNode,
  9834. bup = b.parentNode,
  9835. ap = [ a ],
  9836. bp = [ b ];
  9837. // Parentless nodes are either documents or disconnected
  9838. if ( !aup || !bup ) {
  9839. return a === document ? -1 :
  9840. b === document ? 1 :
  9841. aup ? -1 :
  9842. bup ? 1 :
  9843. sortInput ?
  9844. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9845. 0;
  9846. // If the nodes are siblings, we can do a quick check
  9847. } else if ( aup === bup ) {
  9848. return siblingCheck( a, b );
  9849. }
  9850. // Otherwise we need full lists of their ancestors for comparison
  9851. cur = a;
  9852. while ( (cur = cur.parentNode) ) {
  9853. ap.unshift( cur );
  9854. }
  9855. cur = b;
  9856. while ( (cur = cur.parentNode) ) {
  9857. bp.unshift( cur );
  9858. }
  9859. // Walk down the tree looking for a discrepancy
  9860. while ( ap[i] === bp[i] ) {
  9861. i++;
  9862. }
  9863. return i ?
  9864. // Do a sibling check if the nodes have a common ancestor
  9865. siblingCheck( ap[i], bp[i] ) :
  9866. // Otherwise nodes in our document sort first
  9867. ap[i] === preferredDoc ? -1 :
  9868. bp[i] === preferredDoc ? 1 :
  9869. 0;
  9870. };
  9871. return document;
  9872. };
  9873. Sizzle.matches = function( expr, elements ) {
  9874. return Sizzle( expr, null, null, elements );
  9875. };
  9876. Sizzle.matchesSelector = function( elem, expr ) {
  9877. // Set document vars if needed
  9878. if ( ( elem.ownerDocument || elem ) !== document ) {
  9879. setDocument( elem );
  9880. }
  9881. if ( support.matchesSelector && documentIsHTML &&
  9882. !nonnativeSelectorCache[ expr + " " ] &&
  9883. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9884. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9885. try {
  9886. var ret = matches.call( elem, expr );
  9887. // IE 9's matchesSelector returns false on disconnected nodes
  9888. if ( ret || support.disconnectedMatch ||
  9889. // As well, disconnected nodes are said to be in a document
  9890. // fragment in IE 9
  9891. elem.document && elem.document.nodeType !== 11 ) {
  9892. return ret;
  9893. }
  9894. } catch (e) {
  9895. nonnativeSelectorCache( expr, true );
  9896. }
  9897. }
  9898. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9899. };
  9900. Sizzle.contains = function( context, elem ) {
  9901. // Set document vars if needed
  9902. if ( ( context.ownerDocument || context ) !== document ) {
  9903. setDocument( context );
  9904. }
  9905. return contains( context, elem );
  9906. };
  9907. Sizzle.attr = function( elem, name ) {
  9908. // Set document vars if needed
  9909. if ( ( elem.ownerDocument || elem ) !== document ) {
  9910. setDocument( elem );
  9911. }
  9912. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9913. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9914. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9915. fn( elem, name, !documentIsHTML ) :
  9916. undefined;
  9917. return val !== undefined ?
  9918. val :
  9919. support.attributes || !documentIsHTML ?
  9920. elem.getAttribute( name ) :
  9921. (val = elem.getAttributeNode(name)) && val.specified ?
  9922. val.value :
  9923. null;
  9924. };
  9925. Sizzle.escape = function( sel ) {
  9926. return (sel + "").replace( rcssescape, fcssescape );
  9927. };
  9928. Sizzle.error = function( msg ) {
  9929. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9930. };
  9931. /**
  9932. * Document sorting and removing duplicates
  9933. * @param {ArrayLike} results
  9934. */
  9935. Sizzle.uniqueSort = function( results ) {
  9936. var elem,
  9937. duplicates = [],
  9938. j = 0,
  9939. i = 0;
  9940. // Unless we *know* we can detect duplicates, assume their presence
  9941. hasDuplicate = !support.detectDuplicates;
  9942. sortInput = !support.sortStable && results.slice( 0 );
  9943. results.sort( sortOrder );
  9944. if ( hasDuplicate ) {
  9945. while ( (elem = results[i++]) ) {
  9946. if ( elem === results[ i ] ) {
  9947. j = duplicates.push( i );
  9948. }
  9949. }
  9950. while ( j-- ) {
  9951. results.splice( duplicates[ j ], 1 );
  9952. }
  9953. }
  9954. // Clear input after sorting to release objects
  9955. // See https://github.com/jquery/sizzle/pull/225
  9956. sortInput = null;
  9957. return results;
  9958. };
  9959. /**
  9960. * Utility function for retrieving the text value of an array of DOM nodes
  9961. * @param {Array|Element} elem
  9962. */
  9963. getText = Sizzle.getText = function( elem ) {
  9964. var node,
  9965. ret = "",
  9966. i = 0,
  9967. nodeType = elem.nodeType;
  9968. if ( !nodeType ) {
  9969. // If no nodeType, this is expected to be an array
  9970. while ( (node = elem[i++]) ) {
  9971. // Do not traverse comment nodes
  9972. ret += getText( node );
  9973. }
  9974. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9975. // Use textContent for elements
  9976. // innerText usage removed for consistency of new lines (jQuery #11153)
  9977. if ( typeof elem.textContent === "string" ) {
  9978. return elem.textContent;
  9979. } else {
  9980. // Traverse its children
  9981. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9982. ret += getText( elem );
  9983. }
  9984. }
  9985. } else if ( nodeType === 3 || nodeType === 4 ) {
  9986. return elem.nodeValue;
  9987. }
  9988. // Do not include comment or processing instruction nodes
  9989. return ret;
  9990. };
  9991. Expr = Sizzle.selectors = {
  9992. // Can be adjusted by the user
  9993. cacheLength: 50,
  9994. createPseudo: markFunction,
  9995. match: matchExpr,
  9996. attrHandle: {},
  9997. find: {},
  9998. relative: {
  9999. ">": { dir: "parentNode", first: true },
  10000. " ": { dir: "parentNode" },
  10001. "+": { dir: "previousSibling", first: true },
  10002. "~": { dir: "previousSibling" }
  10003. },
  10004. preFilter: {
  10005. "ATTR": function( match ) {
  10006. match[1] = match[1].replace( runescape, funescape );
  10007. // Move the given value to match[3] whether quoted or unquoted
  10008. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10009. if ( match[2] === "~=" ) {
  10010. match[3] = " " + match[3] + " ";
  10011. }
  10012. return match.slice( 0, 4 );
  10013. },
  10014. "CHILD": function( match ) {
  10015. /* matches from matchExpr["CHILD"]
  10016. 1 type (only|nth|...)
  10017. 2 what (child|of-type)
  10018. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10019. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10020. 5 sign of xn-component
  10021. 6 x of xn-component
  10022. 7 sign of y-component
  10023. 8 y of y-component
  10024. */
  10025. match[1] = match[1].toLowerCase();
  10026. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10027. // nth-* requires argument
  10028. if ( !match[3] ) {
  10029. Sizzle.error( match[0] );
  10030. }
  10031. // numeric x and y parameters for Expr.filter.CHILD
  10032. // remember that false/true cast respectively to 0/1
  10033. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10034. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10035. // other types prohibit arguments
  10036. } else if ( match[3] ) {
  10037. Sizzle.error( match[0] );
  10038. }
  10039. return match;
  10040. },
  10041. "PSEUDO": function( match ) {
  10042. var excess,
  10043. unquoted = !match[6] && match[2];
  10044. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10045. return null;
  10046. }
  10047. // Accept quoted arguments as-is
  10048. if ( match[3] ) {
  10049. match[2] = match[4] || match[5] || "";
  10050. // Strip excess characters from unquoted arguments
  10051. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10052. // Get excess from tokenize (recursively)
  10053. (excess = tokenize( unquoted, true )) &&
  10054. // advance to the next closing parenthesis
  10055. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10056. // excess is a negative index
  10057. match[0] = match[0].slice( 0, excess );
  10058. match[2] = unquoted.slice( 0, excess );
  10059. }
  10060. // Return only captures needed by the pseudo filter method (type and argument)
  10061. return match.slice( 0, 3 );
  10062. }
  10063. },
  10064. filter: {
  10065. "TAG": function( nodeNameSelector ) {
  10066. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10067. return nodeNameSelector === "*" ?
  10068. function() { return true; } :
  10069. function( elem ) {
  10070. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10071. };
  10072. },
  10073. "CLASS": function( className ) {
  10074. var pattern = classCache[ className + " " ];
  10075. return pattern ||
  10076. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10077. classCache( className, function( elem ) {
  10078. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10079. });
  10080. },
  10081. "ATTR": function( name, operator, check ) {
  10082. return function( elem ) {
  10083. var result = Sizzle.attr( elem, name );
  10084. if ( result == null ) {
  10085. return operator === "!=";
  10086. }
  10087. if ( !operator ) {
  10088. return true;
  10089. }
  10090. result += "";
  10091. return operator === "=" ? result === check :
  10092. operator === "!=" ? result !== check :
  10093. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10094. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10095. operator === "$=" ? check && result.slice( -check.length ) === check :
  10096. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10097. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10098. false;
  10099. };
  10100. },
  10101. "CHILD": function( type, what, argument, first, last ) {
  10102. var simple = type.slice( 0, 3 ) !== "nth",
  10103. forward = type.slice( -4 ) !== "last",
  10104. ofType = what === "of-type";
  10105. return first === 1 && last === 0 ?
  10106. // Shortcut for :nth-*(n)
  10107. function( elem ) {
  10108. return !!elem.parentNode;
  10109. } :
  10110. function( elem, context, xml ) {
  10111. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10112. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10113. parent = elem.parentNode,
  10114. name = ofType && elem.nodeName.toLowerCase(),
  10115. useCache = !xml && !ofType,
  10116. diff = false;
  10117. if ( parent ) {
  10118. // :(first|last|only)-(child|of-type)
  10119. if ( simple ) {
  10120. while ( dir ) {
  10121. node = elem;
  10122. while ( (node = node[ dir ]) ) {
  10123. if ( ofType ?
  10124. node.nodeName.toLowerCase() === name :
  10125. node.nodeType === 1 ) {
  10126. return false;
  10127. }
  10128. }
  10129. // Reverse direction for :only-* (if we haven't yet done so)
  10130. start = dir = type === "only" && !start && "nextSibling";
  10131. }
  10132. return true;
  10133. }
  10134. start = [ forward ? parent.firstChild : parent.lastChild ];
  10135. // non-xml :nth-child(...) stores cache data on `parent`
  10136. if ( forward && useCache ) {
  10137. // Seek `elem` from a previously-cached index
  10138. // ...in a gzip-friendly way
  10139. node = parent;
  10140. outerCache = node[ expando ] || (node[ expando ] = {});
  10141. // Support: IE <9 only
  10142. // Defend against cloned attroperties (jQuery gh-1709)
  10143. uniqueCache = outerCache[ node.uniqueID ] ||
  10144. (outerCache[ node.uniqueID ] = {});
  10145. cache = uniqueCache[ type ] || [];
  10146. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10147. diff = nodeIndex && cache[ 2 ];
  10148. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10149. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10150. // Fallback to seeking `elem` from the start
  10151. (diff = nodeIndex = 0) || start.pop()) ) {
  10152. // When found, cache indexes on `parent` and break
  10153. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10154. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10155. break;
  10156. }
  10157. }
  10158. } else {
  10159. // Use previously-cached element index if available
  10160. if ( useCache ) {
  10161. // ...in a gzip-friendly way
  10162. node = elem;
  10163. outerCache = node[ expando ] || (node[ expando ] = {});
  10164. // Support: IE <9 only
  10165. // Defend against cloned attroperties (jQuery gh-1709)
  10166. uniqueCache = outerCache[ node.uniqueID ] ||
  10167. (outerCache[ node.uniqueID ] = {});
  10168. cache = uniqueCache[ type ] || [];
  10169. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10170. diff = nodeIndex;
  10171. }
  10172. // xml :nth-child(...)
  10173. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10174. if ( diff === false ) {
  10175. // Use the same loop as above to seek `elem` from the start
  10176. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10177. (diff = nodeIndex = 0) || start.pop()) ) {
  10178. if ( ( ofType ?
  10179. node.nodeName.toLowerCase() === name :
  10180. node.nodeType === 1 ) &&
  10181. ++diff ) {
  10182. // Cache the index of each encountered element
  10183. if ( useCache ) {
  10184. outerCache = node[ expando ] || (node[ expando ] = {});
  10185. // Support: IE <9 only
  10186. // Defend against cloned attroperties (jQuery gh-1709)
  10187. uniqueCache = outerCache[ node.uniqueID ] ||
  10188. (outerCache[ node.uniqueID ] = {});
  10189. uniqueCache[ type ] = [ dirruns, diff ];
  10190. }
  10191. if ( node === elem ) {
  10192. break;
  10193. }
  10194. }
  10195. }
  10196. }
  10197. }
  10198. // Incorporate the offset, then check against cycle size
  10199. diff -= last;
  10200. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10201. }
  10202. };
  10203. },
  10204. "PSEUDO": function( pseudo, argument ) {
  10205. // pseudo-class names are case-insensitive
  10206. // http://www.w3.org/TR/selectors/#pseudo-classes
  10207. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10208. // Remember that setFilters inherits from pseudos
  10209. var args,
  10210. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10211. Sizzle.error( "unsupported pseudo: " + pseudo );
  10212. // The user may use createPseudo to indicate that
  10213. // arguments are needed to create the filter function
  10214. // just as Sizzle does
  10215. if ( fn[ expando ] ) {
  10216. return fn( argument );
  10217. }
  10218. // But maintain support for old signatures
  10219. if ( fn.length > 1 ) {
  10220. args = [ pseudo, pseudo, "", argument ];
  10221. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10222. markFunction(function( seed, matches ) {
  10223. var idx,
  10224. matched = fn( seed, argument ),
  10225. i = matched.length;
  10226. while ( i-- ) {
  10227. idx = indexOf( seed, matched[i] );
  10228. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10229. }
  10230. }) :
  10231. function( elem ) {
  10232. return fn( elem, 0, args );
  10233. };
  10234. }
  10235. return fn;
  10236. }
  10237. },
  10238. pseudos: {
  10239. // Potentially complex pseudos
  10240. "not": markFunction(function( selector ) {
  10241. // Trim the selector passed to compile
  10242. // to avoid treating leading and trailing
  10243. // spaces as combinators
  10244. var input = [],
  10245. results = [],
  10246. matcher = compile( selector.replace( rtrim, "$1" ) );
  10247. return matcher[ expando ] ?
  10248. markFunction(function( seed, matches, context, xml ) {
  10249. var elem,
  10250. unmatched = matcher( seed, null, xml, [] ),
  10251. i = seed.length;
  10252. // Match elements unmatched by `matcher`
  10253. while ( i-- ) {
  10254. if ( (elem = unmatched[i]) ) {
  10255. seed[i] = !(matches[i] = elem);
  10256. }
  10257. }
  10258. }) :
  10259. function( elem, context, xml ) {
  10260. input[0] = elem;
  10261. matcher( input, null, xml, results );
  10262. // Don't keep the element (issue #299)
  10263. input[0] = null;
  10264. return !results.pop();
  10265. };
  10266. }),
  10267. "has": markFunction(function( selector ) {
  10268. return function( elem ) {
  10269. return Sizzle( selector, elem ).length > 0;
  10270. };
  10271. }),
  10272. "contains": markFunction(function( text ) {
  10273. text = text.replace( runescape, funescape );
  10274. return function( elem ) {
  10275. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10276. };
  10277. }),
  10278. // "Whether an element is represented by a :lang() selector
  10279. // is based solely on the element's language value
  10280. // being equal to the identifier C,
  10281. // or beginning with the identifier C immediately followed by "-".
  10282. // The matching of C against the element's language value is performed case-insensitively.
  10283. // The identifier C does not have to be a valid language name."
  10284. // http://www.w3.org/TR/selectors/#lang-pseudo
  10285. "lang": markFunction( function( lang ) {
  10286. // lang value must be a valid identifier
  10287. if ( !ridentifier.test(lang || "") ) {
  10288. Sizzle.error( "unsupported lang: " + lang );
  10289. }
  10290. lang = lang.replace( runescape, funescape ).toLowerCase();
  10291. return function( elem ) {
  10292. var elemLang;
  10293. do {
  10294. if ( (elemLang = documentIsHTML ?
  10295. elem.lang :
  10296. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10297. elemLang = elemLang.toLowerCase();
  10298. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10299. }
  10300. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10301. return false;
  10302. };
  10303. }),
  10304. // Miscellaneous
  10305. "target": function( elem ) {
  10306. var hash = window.location && window.location.hash;
  10307. return hash && hash.slice( 1 ) === elem.id;
  10308. },
  10309. "root": function( elem ) {
  10310. return elem === docElem;
  10311. },
  10312. "focus": function( elem ) {
  10313. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10314. },
  10315. // Boolean properties
  10316. "enabled": createDisabledPseudo( false ),
  10317. "disabled": createDisabledPseudo( true ),
  10318. "checked": function( elem ) {
  10319. // In CSS3, :checked should return both checked and selected elements
  10320. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10321. var nodeName = elem.nodeName.toLowerCase();
  10322. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10323. },
  10324. "selected": function( elem ) {
  10325. // Accessing this property makes selected-by-default
  10326. // options in Safari work properly
  10327. if ( elem.parentNode ) {
  10328. elem.parentNode.selectedIndex;
  10329. }
  10330. return elem.selected === true;
  10331. },
  10332. // Contents
  10333. "empty": function( elem ) {
  10334. // http://www.w3.org/TR/selectors/#empty-pseudo
  10335. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10336. // but not by others (comment: 8; processing instruction: 7; etc.)
  10337. // nodeType < 6 works because attributes (2) do not appear as children
  10338. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10339. if ( elem.nodeType < 6 ) {
  10340. return false;
  10341. }
  10342. }
  10343. return true;
  10344. },
  10345. "parent": function( elem ) {
  10346. return !Expr.pseudos["empty"]( elem );
  10347. },
  10348. // Element/input types
  10349. "header": function( elem ) {
  10350. return rheader.test( elem.nodeName );
  10351. },
  10352. "input": function( elem ) {
  10353. return rinputs.test( elem.nodeName );
  10354. },
  10355. "button": function( elem ) {
  10356. var name = elem.nodeName.toLowerCase();
  10357. return name === "input" && elem.type === "button" || name === "button";
  10358. },
  10359. "text": function( elem ) {
  10360. var attr;
  10361. return elem.nodeName.toLowerCase() === "input" &&
  10362. elem.type === "text" &&
  10363. // Support: IE<8
  10364. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10365. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10366. },
  10367. // Position-in-collection
  10368. "first": createPositionalPseudo(function() {
  10369. return [ 0 ];
  10370. }),
  10371. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10372. return [ length - 1 ];
  10373. }),
  10374. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10375. return [ argument < 0 ? argument + length : argument ];
  10376. }),
  10377. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10378. var i = 0;
  10379. for ( ; i < length; i += 2 ) {
  10380. matchIndexes.push( i );
  10381. }
  10382. return matchIndexes;
  10383. }),
  10384. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10385. var i = 1;
  10386. for ( ; i < length; i += 2 ) {
  10387. matchIndexes.push( i );
  10388. }
  10389. return matchIndexes;
  10390. }),
  10391. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10392. var i = argument < 0 ?
  10393. argument + length :
  10394. argument > length ?
  10395. length :
  10396. argument;
  10397. for ( ; --i >= 0; ) {
  10398. matchIndexes.push( i );
  10399. }
  10400. return matchIndexes;
  10401. }),
  10402. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10403. var i = argument < 0 ? argument + length : argument;
  10404. for ( ; ++i < length; ) {
  10405. matchIndexes.push( i );
  10406. }
  10407. return matchIndexes;
  10408. })
  10409. }
  10410. };
  10411. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10412. // Add button/input type pseudos
  10413. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10414. Expr.pseudos[ i ] = createInputPseudo( i );
  10415. }
  10416. for ( i in { submit: true, reset: true } ) {
  10417. Expr.pseudos[ i ] = createButtonPseudo( i );
  10418. }
  10419. // Easy API for creating new setFilters
  10420. function setFilters() {}
  10421. setFilters.prototype = Expr.filters = Expr.pseudos;
  10422. Expr.setFilters = new setFilters();
  10423. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10424. var matched, match, tokens, type,
  10425. soFar, groups, preFilters,
  10426. cached = tokenCache[ selector + " " ];
  10427. if ( cached ) {
  10428. return parseOnly ? 0 : cached.slice( 0 );
  10429. }
  10430. soFar = selector;
  10431. groups = [];
  10432. preFilters = Expr.preFilter;
  10433. while ( soFar ) {
  10434. // Comma and first run
  10435. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10436. if ( match ) {
  10437. // Don't consume trailing commas as valid
  10438. soFar = soFar.slice( match[0].length ) || soFar;
  10439. }
  10440. groups.push( (tokens = []) );
  10441. }
  10442. matched = false;
  10443. // Combinators
  10444. if ( (match = rcombinators.exec( soFar )) ) {
  10445. matched = match.shift();
  10446. tokens.push({
  10447. value: matched,
  10448. // Cast descendant combinators to space
  10449. type: match[0].replace( rtrim, " " )
  10450. });
  10451. soFar = soFar.slice( matched.length );
  10452. }
  10453. // Filters
  10454. for ( type in Expr.filter ) {
  10455. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10456. (match = preFilters[ type ]( match ))) ) {
  10457. matched = match.shift();
  10458. tokens.push({
  10459. value: matched,
  10460. type: type,
  10461. matches: match
  10462. });
  10463. soFar = soFar.slice( matched.length );
  10464. }
  10465. }
  10466. if ( !matched ) {
  10467. break;
  10468. }
  10469. }
  10470. // Return the length of the invalid excess
  10471. // if we're just parsing
  10472. // Otherwise, throw an error or return tokens
  10473. return parseOnly ?
  10474. soFar.length :
  10475. soFar ?
  10476. Sizzle.error( selector ) :
  10477. // Cache the tokens
  10478. tokenCache( selector, groups ).slice( 0 );
  10479. };
  10480. function toSelector( tokens ) {
  10481. var i = 0,
  10482. len = tokens.length,
  10483. selector = "";
  10484. for ( ; i < len; i++ ) {
  10485. selector += tokens[i].value;
  10486. }
  10487. return selector;
  10488. }
  10489. function addCombinator( matcher, combinator, base ) {
  10490. var dir = combinator.dir,
  10491. skip = combinator.next,
  10492. key = skip || dir,
  10493. checkNonElements = base && key === "parentNode",
  10494. doneName = done++;
  10495. return combinator.first ?
  10496. // Check against closest ancestor/preceding element
  10497. function( elem, context, xml ) {
  10498. while ( (elem = elem[ dir ]) ) {
  10499. if ( elem.nodeType === 1 || checkNonElements ) {
  10500. return matcher( elem, context, xml );
  10501. }
  10502. }
  10503. return false;
  10504. } :
  10505. // Check against all ancestor/preceding elements
  10506. function( elem, context, xml ) {
  10507. var oldCache, uniqueCache, outerCache,
  10508. newCache = [ dirruns, doneName ];
  10509. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10510. if ( xml ) {
  10511. while ( (elem = elem[ dir ]) ) {
  10512. if ( elem.nodeType === 1 || checkNonElements ) {
  10513. if ( matcher( elem, context, xml ) ) {
  10514. return true;
  10515. }
  10516. }
  10517. }
  10518. } else {
  10519. while ( (elem = elem[ dir ]) ) {
  10520. if ( elem.nodeType === 1 || checkNonElements ) {
  10521. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10522. // Support: IE <9 only
  10523. // Defend against cloned attroperties (jQuery gh-1709)
  10524. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10525. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10526. elem = elem[ dir ] || elem;
  10527. } else if ( (oldCache = uniqueCache[ key ]) &&
  10528. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10529. // Assign to newCache so results back-propagate to previous elements
  10530. return (newCache[ 2 ] = oldCache[ 2 ]);
  10531. } else {
  10532. // Reuse newcache so results back-propagate to previous elements
  10533. uniqueCache[ key ] = newCache;
  10534. // A match means we're done; a fail means we have to keep checking
  10535. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10536. return true;
  10537. }
  10538. }
  10539. }
  10540. }
  10541. }
  10542. return false;
  10543. };
  10544. }
  10545. function elementMatcher( matchers ) {
  10546. return matchers.length > 1 ?
  10547. function( elem, context, xml ) {
  10548. var i = matchers.length;
  10549. while ( i-- ) {
  10550. if ( !matchers[i]( elem, context, xml ) ) {
  10551. return false;
  10552. }
  10553. }
  10554. return true;
  10555. } :
  10556. matchers[0];
  10557. }
  10558. function multipleContexts( selector, contexts, results ) {
  10559. var i = 0,
  10560. len = contexts.length;
  10561. for ( ; i < len; i++ ) {
  10562. Sizzle( selector, contexts[i], results );
  10563. }
  10564. return results;
  10565. }
  10566. function condense( unmatched, map, filter, context, xml ) {
  10567. var elem,
  10568. newUnmatched = [],
  10569. i = 0,
  10570. len = unmatched.length,
  10571. mapped = map != null;
  10572. for ( ; i < len; i++ ) {
  10573. if ( (elem = unmatched[i]) ) {
  10574. if ( !filter || filter( elem, context, xml ) ) {
  10575. newUnmatched.push( elem );
  10576. if ( mapped ) {
  10577. map.push( i );
  10578. }
  10579. }
  10580. }
  10581. }
  10582. return newUnmatched;
  10583. }
  10584. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10585. if ( postFilter && !postFilter[ expando ] ) {
  10586. postFilter = setMatcher( postFilter );
  10587. }
  10588. if ( postFinder && !postFinder[ expando ] ) {
  10589. postFinder = setMatcher( postFinder, postSelector );
  10590. }
  10591. return markFunction(function( seed, results, context, xml ) {
  10592. var temp, i, elem,
  10593. preMap = [],
  10594. postMap = [],
  10595. preexisting = results.length,
  10596. // Get initial elements from seed or context
  10597. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10598. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10599. matcherIn = preFilter && ( seed || !selector ) ?
  10600. condense( elems, preMap, preFilter, context, xml ) :
  10601. elems,
  10602. matcherOut = matcher ?
  10603. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10604. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10605. // ...intermediate processing is necessary
  10606. [] :
  10607. // ...otherwise use results directly
  10608. results :
  10609. matcherIn;
  10610. // Find primary matches
  10611. if ( matcher ) {
  10612. matcher( matcherIn, matcherOut, context, xml );
  10613. }
  10614. // Apply postFilter
  10615. if ( postFilter ) {
  10616. temp = condense( matcherOut, postMap );
  10617. postFilter( temp, [], context, xml );
  10618. // Un-match failing elements by moving them back to matcherIn
  10619. i = temp.length;
  10620. while ( i-- ) {
  10621. if ( (elem = temp[i]) ) {
  10622. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10623. }
  10624. }
  10625. }
  10626. if ( seed ) {
  10627. if ( postFinder || preFilter ) {
  10628. if ( postFinder ) {
  10629. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10630. temp = [];
  10631. i = matcherOut.length;
  10632. while ( i-- ) {
  10633. if ( (elem = matcherOut[i]) ) {
  10634. // Restore matcherIn since elem is not yet a final match
  10635. temp.push( (matcherIn[i] = elem) );
  10636. }
  10637. }
  10638. postFinder( null, (matcherOut = []), temp, xml );
  10639. }
  10640. // Move matched elements from seed to results to keep them synchronized
  10641. i = matcherOut.length;
  10642. while ( i-- ) {
  10643. if ( (elem = matcherOut[i]) &&
  10644. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10645. seed[temp] = !(results[temp] = elem);
  10646. }
  10647. }
  10648. }
  10649. // Add elements to results, through postFinder if defined
  10650. } else {
  10651. matcherOut = condense(
  10652. matcherOut === results ?
  10653. matcherOut.splice( preexisting, matcherOut.length ) :
  10654. matcherOut
  10655. );
  10656. if ( postFinder ) {
  10657. postFinder( null, results, matcherOut, xml );
  10658. } else {
  10659. push.apply( results, matcherOut );
  10660. }
  10661. }
  10662. });
  10663. }
  10664. function matcherFromTokens( tokens ) {
  10665. var checkContext, matcher, j,
  10666. len = tokens.length,
  10667. leadingRelative = Expr.relative[ tokens[0].type ],
  10668. implicitRelative = leadingRelative || Expr.relative[" "],
  10669. i = leadingRelative ? 1 : 0,
  10670. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10671. matchContext = addCombinator( function( elem ) {
  10672. return elem === checkContext;
  10673. }, implicitRelative, true ),
  10674. matchAnyContext = addCombinator( function( elem ) {
  10675. return indexOf( checkContext, elem ) > -1;
  10676. }, implicitRelative, true ),
  10677. matchers = [ function( elem, context, xml ) {
  10678. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10679. (checkContext = context).nodeType ?
  10680. matchContext( elem, context, xml ) :
  10681. matchAnyContext( elem, context, xml ) );
  10682. // Avoid hanging onto element (issue #299)
  10683. checkContext = null;
  10684. return ret;
  10685. } ];
  10686. for ( ; i < len; i++ ) {
  10687. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10688. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10689. } else {
  10690. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10691. // Return special upon seeing a positional matcher
  10692. if ( matcher[ expando ] ) {
  10693. // Find the next relative operator (if any) for proper handling
  10694. j = ++i;
  10695. for ( ; j < len; j++ ) {
  10696. if ( Expr.relative[ tokens[j].type ] ) {
  10697. break;
  10698. }
  10699. }
  10700. return setMatcher(
  10701. i > 1 && elementMatcher( matchers ),
  10702. i > 1 && toSelector(
  10703. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10704. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10705. ).replace( rtrim, "$1" ),
  10706. matcher,
  10707. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10708. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10709. j < len && toSelector( tokens )
  10710. );
  10711. }
  10712. matchers.push( matcher );
  10713. }
  10714. }
  10715. return elementMatcher( matchers );
  10716. }
  10717. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10718. var bySet = setMatchers.length > 0,
  10719. byElement = elementMatchers.length > 0,
  10720. superMatcher = function( seed, context, xml, results, outermost ) {
  10721. var elem, j, matcher,
  10722. matchedCount = 0,
  10723. i = "0",
  10724. unmatched = seed && [],
  10725. setMatched = [],
  10726. contextBackup = outermostContext,
  10727. // We must always have either seed elements or outermost context
  10728. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10729. // Use integer dirruns iff this is the outermost matcher
  10730. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10731. len = elems.length;
  10732. if ( outermost ) {
  10733. outermostContext = context === document || context || outermost;
  10734. }
  10735. // Add elements passing elementMatchers directly to results
  10736. // Support: IE<9, Safari
  10737. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10738. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10739. if ( byElement && elem ) {
  10740. j = 0;
  10741. if ( !context && elem.ownerDocument !== document ) {
  10742. setDocument( elem );
  10743. xml = !documentIsHTML;
  10744. }
  10745. while ( (matcher = elementMatchers[j++]) ) {
  10746. if ( matcher( elem, context || document, xml) ) {
  10747. results.push( elem );
  10748. break;
  10749. }
  10750. }
  10751. if ( outermost ) {
  10752. dirruns = dirrunsUnique;
  10753. }
  10754. }
  10755. // Track unmatched elements for set filters
  10756. if ( bySet ) {
  10757. // They will have gone through all possible matchers
  10758. if ( (elem = !matcher && elem) ) {
  10759. matchedCount--;
  10760. }
  10761. // Lengthen the array for every element, matched or not
  10762. if ( seed ) {
  10763. unmatched.push( elem );
  10764. }
  10765. }
  10766. }
  10767. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10768. // makes the latter nonnegative.
  10769. matchedCount += i;
  10770. // Apply set filters to unmatched elements
  10771. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10772. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10773. // no element matchers and no seed.
  10774. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10775. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10776. // numerically zero.
  10777. if ( bySet && i !== matchedCount ) {
  10778. j = 0;
  10779. while ( (matcher = setMatchers[j++]) ) {
  10780. matcher( unmatched, setMatched, context, xml );
  10781. }
  10782. if ( seed ) {
  10783. // Reintegrate element matches to eliminate the need for sorting
  10784. if ( matchedCount > 0 ) {
  10785. while ( i-- ) {
  10786. if ( !(unmatched[i] || setMatched[i]) ) {
  10787. setMatched[i] = pop.call( results );
  10788. }
  10789. }
  10790. }
  10791. // Discard index placeholder values to get only actual matches
  10792. setMatched = condense( setMatched );
  10793. }
  10794. // Add matches to results
  10795. push.apply( results, setMatched );
  10796. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10797. if ( outermost && !seed && setMatched.length > 0 &&
  10798. ( matchedCount + setMatchers.length ) > 1 ) {
  10799. Sizzle.uniqueSort( results );
  10800. }
  10801. }
  10802. // Override manipulation of globals by nested matchers
  10803. if ( outermost ) {
  10804. dirruns = dirrunsUnique;
  10805. outermostContext = contextBackup;
  10806. }
  10807. return unmatched;
  10808. };
  10809. return bySet ?
  10810. markFunction( superMatcher ) :
  10811. superMatcher;
  10812. }
  10813. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10814. var i,
  10815. setMatchers = [],
  10816. elementMatchers = [],
  10817. cached = compilerCache[ selector + " " ];
  10818. if ( !cached ) {
  10819. // Generate a function of recursive functions that can be used to check each element
  10820. if ( !match ) {
  10821. match = tokenize( selector );
  10822. }
  10823. i = match.length;
  10824. while ( i-- ) {
  10825. cached = matcherFromTokens( match[i] );
  10826. if ( cached[ expando ] ) {
  10827. setMatchers.push( cached );
  10828. } else {
  10829. elementMatchers.push( cached );
  10830. }
  10831. }
  10832. // Cache the compiled function
  10833. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10834. // Save selector and tokenization
  10835. cached.selector = selector;
  10836. }
  10837. return cached;
  10838. };
  10839. /**
  10840. * A low-level selection function that works with Sizzle's compiled
  10841. * selector functions
  10842. * @param {String|Function} selector A selector or a pre-compiled
  10843. * selector function built with Sizzle.compile
  10844. * @param {Element} context
  10845. * @param {Array} [results]
  10846. * @param {Array} [seed] A set of elements to match against
  10847. */
  10848. select = Sizzle.select = function( selector, context, results, seed ) {
  10849. var i, tokens, token, type, find,
  10850. compiled = typeof selector === "function" && selector,
  10851. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10852. results = results || [];
  10853. // Try to minimize operations if there is only one selector in the list and no seed
  10854. // (the latter of which guarantees us context)
  10855. if ( match.length === 1 ) {
  10856. // Reduce context if the leading compound selector is an ID
  10857. tokens = match[0] = match[0].slice( 0 );
  10858. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10859. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10860. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10861. if ( !context ) {
  10862. return results;
  10863. // Precompiled matchers will still verify ancestry, so step up a level
  10864. } else if ( compiled ) {
  10865. context = context.parentNode;
  10866. }
  10867. selector = selector.slice( tokens.shift().value.length );
  10868. }
  10869. // Fetch a seed set for right-to-left matching
  10870. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10871. while ( i-- ) {
  10872. token = tokens[i];
  10873. // Abort if we hit a combinator
  10874. if ( Expr.relative[ (type = token.type) ] ) {
  10875. break;
  10876. }
  10877. if ( (find = Expr.find[ type ]) ) {
  10878. // Search, expanding context for leading sibling combinators
  10879. if ( (seed = find(
  10880. token.matches[0].replace( runescape, funescape ),
  10881. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10882. )) ) {
  10883. // If seed is empty or no tokens remain, we can return early
  10884. tokens.splice( i, 1 );
  10885. selector = seed.length && toSelector( tokens );
  10886. if ( !selector ) {
  10887. push.apply( results, seed );
  10888. return results;
  10889. }
  10890. break;
  10891. }
  10892. }
  10893. }
  10894. }
  10895. // Compile and execute a filtering function if one is not provided
  10896. // Provide `match` to avoid retokenization if we modified the selector above
  10897. ( compiled || compile( selector, match ) )(
  10898. seed,
  10899. context,
  10900. !documentIsHTML,
  10901. results,
  10902. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10903. );
  10904. return results;
  10905. };
  10906. // One-time assignments
  10907. // Sort stability
  10908. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10909. // Support: Chrome 14-35+
  10910. // Always assume duplicates if they aren't passed to the comparison function
  10911. support.detectDuplicates = !!hasDuplicate;
  10912. // Initialize against the default document
  10913. setDocument();
  10914. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10915. // Detached nodes confoundingly follow *each other*
  10916. support.sortDetached = assert(function( el ) {
  10917. // Should return 1, but returns 4 (following)
  10918. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10919. });
  10920. // Support: IE<8
  10921. // Prevent attribute/property "interpolation"
  10922. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10923. if ( !assert(function( el ) {
  10924. el.innerHTML = "<a href='#'></a>";
  10925. return el.firstChild.getAttribute("href") === "#" ;
  10926. }) ) {
  10927. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10928. if ( !isXML ) {
  10929. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10930. }
  10931. });
  10932. }
  10933. // Support: IE<9
  10934. // Use defaultValue in place of getAttribute("value")
  10935. if ( !support.attributes || !assert(function( el ) {
  10936. el.innerHTML = "<input/>";
  10937. el.firstChild.setAttribute( "value", "" );
  10938. return el.firstChild.getAttribute( "value" ) === "";
  10939. }) ) {
  10940. addHandle( "value", function( elem, name, isXML ) {
  10941. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10942. return elem.defaultValue;
  10943. }
  10944. });
  10945. }
  10946. // Support: IE<9
  10947. // Use getAttributeNode to fetch booleans when getAttribute lies
  10948. if ( !assert(function( el ) {
  10949. return el.getAttribute("disabled") == null;
  10950. }) ) {
  10951. addHandle( booleans, function( elem, name, isXML ) {
  10952. var val;
  10953. if ( !isXML ) {
  10954. return elem[ name ] === true ? name.toLowerCase() :
  10955. (val = elem.getAttributeNode( name )) && val.specified ?
  10956. val.value :
  10957. null;
  10958. }
  10959. });
  10960. }
  10961. return Sizzle;
  10962. })( window );
  10963. jQuery.find = Sizzle;
  10964. jQuery.expr = Sizzle.selectors;
  10965. // Deprecated
  10966. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10967. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10968. jQuery.text = Sizzle.getText;
  10969. jQuery.isXMLDoc = Sizzle.isXML;
  10970. jQuery.contains = Sizzle.contains;
  10971. jQuery.escapeSelector = Sizzle.escape;
  10972. var dir = function( elem, dir, until ) {
  10973. var matched = [],
  10974. truncate = until !== undefined;
  10975. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10976. if ( elem.nodeType === 1 ) {
  10977. if ( truncate && jQuery( elem ).is( until ) ) {
  10978. break;
  10979. }
  10980. matched.push( elem );
  10981. }
  10982. }
  10983. return matched;
  10984. };
  10985. var siblings = function( n, elem ) {
  10986. var matched = [];
  10987. for ( ; n; n = n.nextSibling ) {
  10988. if ( n.nodeType === 1 && n !== elem ) {
  10989. matched.push( n );
  10990. }
  10991. }
  10992. return matched;
  10993. };
  10994. var rneedsContext = jQuery.expr.match.needsContext;
  10995. function nodeName( elem, name ) {
  10996. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10997. };
  10998. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10999. // Implement the identical functionality for filter and not
  11000. function winnow( elements, qualifier, not ) {
  11001. if ( isFunction( qualifier ) ) {
  11002. return jQuery.grep( elements, function( elem, i ) {
  11003. return !!qualifier.call( elem, i, elem ) !== not;
  11004. } );
  11005. }
  11006. // Single element
  11007. if ( qualifier.nodeType ) {
  11008. return jQuery.grep( elements, function( elem ) {
  11009. return ( elem === qualifier ) !== not;
  11010. } );
  11011. }
  11012. // Arraylike of elements (jQuery, arguments, Array)
  11013. if ( typeof qualifier !== "string" ) {
  11014. return jQuery.grep( elements, function( elem ) {
  11015. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11016. } );
  11017. }
  11018. // Filtered directly for both simple and complex selectors
  11019. return jQuery.filter( qualifier, elements, not );
  11020. }
  11021. jQuery.filter = function( expr, elems, not ) {
  11022. var elem = elems[ 0 ];
  11023. if ( not ) {
  11024. expr = ":not(" + expr + ")";
  11025. }
  11026. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11027. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11028. }
  11029. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11030. return elem.nodeType === 1;
  11031. } ) );
  11032. };
  11033. jQuery.fn.extend( {
  11034. find: function( selector ) {
  11035. var i, ret,
  11036. len = this.length,
  11037. self = this;
  11038. if ( typeof selector !== "string" ) {
  11039. return this.pushStack( jQuery( selector ).filter( function() {
  11040. for ( i = 0; i < len; i++ ) {
  11041. if ( jQuery.contains( self[ i ], this ) ) {
  11042. return true;
  11043. }
  11044. }
  11045. } ) );
  11046. }
  11047. ret = this.pushStack( [] );
  11048. for ( i = 0; i < len; i++ ) {
  11049. jQuery.find( selector, self[ i ], ret );
  11050. }
  11051. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11052. },
  11053. filter: function( selector ) {
  11054. return this.pushStack( winnow( this, selector || [], false ) );
  11055. },
  11056. not: function( selector ) {
  11057. return this.pushStack( winnow( this, selector || [], true ) );
  11058. },
  11059. is: function( selector ) {
  11060. return !!winnow(
  11061. this,
  11062. // If this is a positional/relative selector, check membership in the returned set
  11063. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11064. typeof selector === "string" && rneedsContext.test( selector ) ?
  11065. jQuery( selector ) :
  11066. selector || [],
  11067. false
  11068. ).length;
  11069. }
  11070. } );
  11071. // Initialize a jQuery object
  11072. // A central reference to the root jQuery(document)
  11073. var rootjQuery,
  11074. // A simple way to check for HTML strings
  11075. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11076. // Strict HTML recognition (#11290: must start with <)
  11077. // Shortcut simple #id case for speed
  11078. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11079. init = jQuery.fn.init = function( selector, context, root ) {
  11080. var match, elem;
  11081. // HANDLE: $(""), $(null), $(undefined), $(false)
  11082. if ( !selector ) {
  11083. return this;
  11084. }
  11085. // Method init() accepts an alternate rootjQuery
  11086. // so migrate can support jQuery.sub (gh-2101)
  11087. root = root || rootjQuery;
  11088. // Handle HTML strings
  11089. if ( typeof selector === "string" ) {
  11090. if ( selector[ 0 ] === "<" &&
  11091. selector[ selector.length - 1 ] === ">" &&
  11092. selector.length >= 3 ) {
  11093. // Assume that strings that start and end with <> are HTML and skip the regex check
  11094. match = [ null, selector, null ];
  11095. } else {
  11096. match = rquickExpr.exec( selector );
  11097. }
  11098. // Match html or make sure no context is specified for #id
  11099. if ( match && ( match[ 1 ] || !context ) ) {
  11100. // HANDLE: $(html) -> $(array)
  11101. if ( match[ 1 ] ) {
  11102. context = context instanceof jQuery ? context[ 0 ] : context;
  11103. // Option to run scripts is true for back-compat
  11104. // Intentionally let the error be thrown if parseHTML is not present
  11105. jQuery.merge( this, jQuery.parseHTML(
  11106. match[ 1 ],
  11107. context && context.nodeType ? context.ownerDocument || context : document,
  11108. true
  11109. ) );
  11110. // HANDLE: $(html, props)
  11111. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11112. for ( match in context ) {
  11113. // Properties of context are called as methods if possible
  11114. if ( isFunction( this[ match ] ) ) {
  11115. this[ match ]( context[ match ] );
  11116. // ...and otherwise set as attributes
  11117. } else {
  11118. this.attr( match, context[ match ] );
  11119. }
  11120. }
  11121. }
  11122. return this;
  11123. // HANDLE: $(#id)
  11124. } else {
  11125. elem = document.getElementById( match[ 2 ] );
  11126. if ( elem ) {
  11127. // Inject the element directly into the jQuery object
  11128. this[ 0 ] = elem;
  11129. this.length = 1;
  11130. }
  11131. return this;
  11132. }
  11133. // HANDLE: $(expr, $(...))
  11134. } else if ( !context || context.jquery ) {
  11135. return ( context || root ).find( selector );
  11136. // HANDLE: $(expr, context)
  11137. // (which is just equivalent to: $(context).find(expr)
  11138. } else {
  11139. return this.constructor( context ).find( selector );
  11140. }
  11141. // HANDLE: $(DOMElement)
  11142. } else if ( selector.nodeType ) {
  11143. this[ 0 ] = selector;
  11144. this.length = 1;
  11145. return this;
  11146. // HANDLE: $(function)
  11147. // Shortcut for document ready
  11148. } else if ( isFunction( selector ) ) {
  11149. return root.ready !== undefined ?
  11150. root.ready( selector ) :
  11151. // Execute immediately if ready is not present
  11152. selector( jQuery );
  11153. }
  11154. return jQuery.makeArray( selector, this );
  11155. };
  11156. // Give the init function the jQuery prototype for later instantiation
  11157. init.prototype = jQuery.fn;
  11158. // Initialize central reference
  11159. rootjQuery = jQuery( document );
  11160. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11161. // Methods guaranteed to produce a unique set when starting from a unique set
  11162. guaranteedUnique = {
  11163. children: true,
  11164. contents: true,
  11165. next: true,
  11166. prev: true
  11167. };
  11168. jQuery.fn.extend( {
  11169. has: function( target ) {
  11170. var targets = jQuery( target, this ),
  11171. l = targets.length;
  11172. return this.filter( function() {
  11173. var i = 0;
  11174. for ( ; i < l; i++ ) {
  11175. if ( jQuery.contains( this, targets[ i ] ) ) {
  11176. return true;
  11177. }
  11178. }
  11179. } );
  11180. },
  11181. closest: function( selectors, context ) {
  11182. var cur,
  11183. i = 0,
  11184. l = this.length,
  11185. matched = [],
  11186. targets = typeof selectors !== "string" && jQuery( selectors );
  11187. // Positional selectors never match, since there's no _selection_ context
  11188. if ( !rneedsContext.test( selectors ) ) {
  11189. for ( ; i < l; i++ ) {
  11190. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11191. // Always skip document fragments
  11192. if ( cur.nodeType < 11 && ( targets ?
  11193. targets.index( cur ) > -1 :
  11194. // Don't pass non-elements to Sizzle
  11195. cur.nodeType === 1 &&
  11196. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11197. matched.push( cur );
  11198. break;
  11199. }
  11200. }
  11201. }
  11202. }
  11203. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11204. },
  11205. // Determine the position of an element within the set
  11206. index: function( elem ) {
  11207. // No argument, return index in parent
  11208. if ( !elem ) {
  11209. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11210. }
  11211. // Index in selector
  11212. if ( typeof elem === "string" ) {
  11213. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11214. }
  11215. // Locate the position of the desired element
  11216. return indexOf.call( this,
  11217. // If it receives a jQuery object, the first element is used
  11218. elem.jquery ? elem[ 0 ] : elem
  11219. );
  11220. },
  11221. add: function( selector, context ) {
  11222. return this.pushStack(
  11223. jQuery.uniqueSort(
  11224. jQuery.merge( this.get(), jQuery( selector, context ) )
  11225. )
  11226. );
  11227. },
  11228. addBack: function( selector ) {
  11229. return this.add( selector == null ?
  11230. this.prevObject : this.prevObject.filter( selector )
  11231. );
  11232. }
  11233. } );
  11234. function sibling( cur, dir ) {
  11235. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11236. return cur;
  11237. }
  11238. jQuery.each( {
  11239. parent: function( elem ) {
  11240. var parent = elem.parentNode;
  11241. return parent && parent.nodeType !== 11 ? parent : null;
  11242. },
  11243. parents: function( elem ) {
  11244. return dir( elem, "parentNode" );
  11245. },
  11246. parentsUntil: function( elem, i, until ) {
  11247. return dir( elem, "parentNode", until );
  11248. },
  11249. next: function( elem ) {
  11250. return sibling( elem, "nextSibling" );
  11251. },
  11252. prev: function( elem ) {
  11253. return sibling( elem, "previousSibling" );
  11254. },
  11255. nextAll: function( elem ) {
  11256. return dir( elem, "nextSibling" );
  11257. },
  11258. prevAll: function( elem ) {
  11259. return dir( elem, "previousSibling" );
  11260. },
  11261. nextUntil: function( elem, i, until ) {
  11262. return dir( elem, "nextSibling", until );
  11263. },
  11264. prevUntil: function( elem, i, until ) {
  11265. return dir( elem, "previousSibling", until );
  11266. },
  11267. siblings: function( elem ) {
  11268. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11269. },
  11270. children: function( elem ) {
  11271. return siblings( elem.firstChild );
  11272. },
  11273. contents: function( elem ) {
  11274. if ( typeof elem.contentDocument !== "undefined" ) {
  11275. return elem.contentDocument;
  11276. }
  11277. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11278. // Treat the template element as a regular one in browsers that
  11279. // don't support it.
  11280. if ( nodeName( elem, "template" ) ) {
  11281. elem = elem.content || elem;
  11282. }
  11283. return jQuery.merge( [], elem.childNodes );
  11284. }
  11285. }, function( name, fn ) {
  11286. jQuery.fn[ name ] = function( until, selector ) {
  11287. var matched = jQuery.map( this, fn, until );
  11288. if ( name.slice( -5 ) !== "Until" ) {
  11289. selector = until;
  11290. }
  11291. if ( selector && typeof selector === "string" ) {
  11292. matched = jQuery.filter( selector, matched );
  11293. }
  11294. if ( this.length > 1 ) {
  11295. // Remove duplicates
  11296. if ( !guaranteedUnique[ name ] ) {
  11297. jQuery.uniqueSort( matched );
  11298. }
  11299. // Reverse order for parents* and prev-derivatives
  11300. if ( rparentsprev.test( name ) ) {
  11301. matched.reverse();
  11302. }
  11303. }
  11304. return this.pushStack( matched );
  11305. };
  11306. } );
  11307. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11308. // Convert String-formatted options into Object-formatted ones
  11309. function createOptions( options ) {
  11310. var object = {};
  11311. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11312. object[ flag ] = true;
  11313. } );
  11314. return object;
  11315. }
  11316. /*
  11317. * Create a callback list using the following parameters:
  11318. *
  11319. * options: an optional list of space-separated options that will change how
  11320. * the callback list behaves or a more traditional option object
  11321. *
  11322. * By default a callback list will act like an event callback list and can be
  11323. * "fired" multiple times.
  11324. *
  11325. * Possible options:
  11326. *
  11327. * once: will ensure the callback list can only be fired once (like a Deferred)
  11328. *
  11329. * memory: will keep track of previous values and will call any callback added
  11330. * after the list has been fired right away with the latest "memorized"
  11331. * values (like a Deferred)
  11332. *
  11333. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11334. *
  11335. * stopOnFalse: interrupt callings when a callback returns false
  11336. *
  11337. */
  11338. jQuery.Callbacks = function( options ) {
  11339. // Convert options from String-formatted to Object-formatted if needed
  11340. // (we check in cache first)
  11341. options = typeof options === "string" ?
  11342. createOptions( options ) :
  11343. jQuery.extend( {}, options );
  11344. var // Flag to know if list is currently firing
  11345. firing,
  11346. // Last fire value for non-forgettable lists
  11347. memory,
  11348. // Flag to know if list was already fired
  11349. fired,
  11350. // Flag to prevent firing
  11351. locked,
  11352. // Actual callback list
  11353. list = [],
  11354. // Queue of execution data for repeatable lists
  11355. queue = [],
  11356. // Index of currently firing callback (modified by add/remove as needed)
  11357. firingIndex = -1,
  11358. // Fire callbacks
  11359. fire = function() {
  11360. // Enforce single-firing
  11361. locked = locked || options.once;
  11362. // Execute callbacks for all pending executions,
  11363. // respecting firingIndex overrides and runtime changes
  11364. fired = firing = true;
  11365. for ( ; queue.length; firingIndex = -1 ) {
  11366. memory = queue.shift();
  11367. while ( ++firingIndex < list.length ) {
  11368. // Run callback and check for early termination
  11369. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11370. options.stopOnFalse ) {
  11371. // Jump to end and forget the data so .add doesn't re-fire
  11372. firingIndex = list.length;
  11373. memory = false;
  11374. }
  11375. }
  11376. }
  11377. // Forget the data if we're done with it
  11378. if ( !options.memory ) {
  11379. memory = false;
  11380. }
  11381. firing = false;
  11382. // Clean up if we're done firing for good
  11383. if ( locked ) {
  11384. // Keep an empty list if we have data for future add calls
  11385. if ( memory ) {
  11386. list = [];
  11387. // Otherwise, this object is spent
  11388. } else {
  11389. list = "";
  11390. }
  11391. }
  11392. },
  11393. // Actual Callbacks object
  11394. self = {
  11395. // Add a callback or a collection of callbacks to the list
  11396. add: function() {
  11397. if ( list ) {
  11398. // If we have memory from a past run, we should fire after adding
  11399. if ( memory && !firing ) {
  11400. firingIndex = list.length - 1;
  11401. queue.push( memory );
  11402. }
  11403. ( function add( args ) {
  11404. jQuery.each( args, function( _, arg ) {
  11405. if ( isFunction( arg ) ) {
  11406. if ( !options.unique || !self.has( arg ) ) {
  11407. list.push( arg );
  11408. }
  11409. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11410. // Inspect recursively
  11411. add( arg );
  11412. }
  11413. } );
  11414. } )( arguments );
  11415. if ( memory && !firing ) {
  11416. fire();
  11417. }
  11418. }
  11419. return this;
  11420. },
  11421. // Remove a callback from the list
  11422. remove: function() {
  11423. jQuery.each( arguments, function( _, arg ) {
  11424. var index;
  11425. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11426. list.splice( index, 1 );
  11427. // Handle firing indexes
  11428. if ( index <= firingIndex ) {
  11429. firingIndex--;
  11430. }
  11431. }
  11432. } );
  11433. return this;
  11434. },
  11435. // Check if a given callback is in the list.
  11436. // If no argument is given, return whether or not list has callbacks attached.
  11437. has: function( fn ) {
  11438. return fn ?
  11439. jQuery.inArray( fn, list ) > -1 :
  11440. list.length > 0;
  11441. },
  11442. // Remove all callbacks from the list
  11443. empty: function() {
  11444. if ( list ) {
  11445. list = [];
  11446. }
  11447. return this;
  11448. },
  11449. // Disable .fire and .add
  11450. // Abort any current/pending executions
  11451. // Clear all callbacks and values
  11452. disable: function() {
  11453. locked = queue = [];
  11454. list = memory = "";
  11455. return this;
  11456. },
  11457. disabled: function() {
  11458. return !list;
  11459. },
  11460. // Disable .fire
  11461. // Also disable .add unless we have memory (since it would have no effect)
  11462. // Abort any pending executions
  11463. lock: function() {
  11464. locked = queue = [];
  11465. if ( !memory && !firing ) {
  11466. list = memory = "";
  11467. }
  11468. return this;
  11469. },
  11470. locked: function() {
  11471. return !!locked;
  11472. },
  11473. // Call all callbacks with the given context and arguments
  11474. fireWith: function( context, args ) {
  11475. if ( !locked ) {
  11476. args = args || [];
  11477. args = [ context, args.slice ? args.slice() : args ];
  11478. queue.push( args );
  11479. if ( !firing ) {
  11480. fire();
  11481. }
  11482. }
  11483. return this;
  11484. },
  11485. // Call all the callbacks with the given arguments
  11486. fire: function() {
  11487. self.fireWith( this, arguments );
  11488. return this;
  11489. },
  11490. // To know if the callbacks have already been called at least once
  11491. fired: function() {
  11492. return !!fired;
  11493. }
  11494. };
  11495. return self;
  11496. };
  11497. function Identity( v ) {
  11498. return v;
  11499. }
  11500. function Thrower( ex ) {
  11501. throw ex;
  11502. }
  11503. function adoptValue( value, resolve, reject, noValue ) {
  11504. var method;
  11505. try {
  11506. // Check for promise aspect first to privilege synchronous behavior
  11507. if ( value && isFunction( ( method = value.promise ) ) ) {
  11508. method.call( value ).done( resolve ).fail( reject );
  11509. // Other thenables
  11510. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11511. method.call( value, resolve, reject );
  11512. // Other non-thenables
  11513. } else {
  11514. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11515. // * false: [ value ].slice( 0 ) => resolve( value )
  11516. // * true: [ value ].slice( 1 ) => resolve()
  11517. resolve.apply( undefined, [ value ].slice( noValue ) );
  11518. }
  11519. // For Promises/A+, convert exceptions into rejections
  11520. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11521. // Deferred#then to conditionally suppress rejection.
  11522. } catch ( value ) {
  11523. // Support: Android 4.0 only
  11524. // Strict mode functions invoked without .call/.apply get global-object context
  11525. reject.apply( undefined, [ value ] );
  11526. }
  11527. }
  11528. jQuery.extend( {
  11529. Deferred: function( func ) {
  11530. var tuples = [
  11531. // action, add listener, callbacks,
  11532. // ... .then handlers, argument index, [final state]
  11533. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11534. jQuery.Callbacks( "memory" ), 2 ],
  11535. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11536. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11537. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11538. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11539. ],
  11540. state = "pending",
  11541. promise = {
  11542. state: function() {
  11543. return state;
  11544. },
  11545. always: function() {
  11546. deferred.done( arguments ).fail( arguments );
  11547. return this;
  11548. },
  11549. "catch": function( fn ) {
  11550. return promise.then( null, fn );
  11551. },
  11552. // Keep pipe for back-compat
  11553. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11554. var fns = arguments;
  11555. return jQuery.Deferred( function( newDefer ) {
  11556. jQuery.each( tuples, function( i, tuple ) {
  11557. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11558. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11559. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11560. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11561. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11562. deferred[ tuple[ 1 ] ]( function() {
  11563. var returned = fn && fn.apply( this, arguments );
  11564. if ( returned && isFunction( returned.promise ) ) {
  11565. returned.promise()
  11566. .progress( newDefer.notify )
  11567. .done( newDefer.resolve )
  11568. .fail( newDefer.reject );
  11569. } else {
  11570. newDefer[ tuple[ 0 ] + "With" ](
  11571. this,
  11572. fn ? [ returned ] : arguments
  11573. );
  11574. }
  11575. } );
  11576. } );
  11577. fns = null;
  11578. } ).promise();
  11579. },
  11580. then: function( onFulfilled, onRejected, onProgress ) {
  11581. var maxDepth = 0;
  11582. function resolve( depth, deferred, handler, special ) {
  11583. return function() {
  11584. var that = this,
  11585. args = arguments,
  11586. mightThrow = function() {
  11587. var returned, then;
  11588. // Support: Promises/A+ section 2.3.3.3.3
  11589. // https://promisesaplus.com/#point-59
  11590. // Ignore double-resolution attempts
  11591. if ( depth < maxDepth ) {
  11592. return;
  11593. }
  11594. returned = handler.apply( that, args );
  11595. // Support: Promises/A+ section 2.3.1
  11596. // https://promisesaplus.com/#point-48
  11597. if ( returned === deferred.promise() ) {
  11598. throw new TypeError( "Thenable self-resolution" );
  11599. }
  11600. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11601. // https://promisesaplus.com/#point-54
  11602. // https://promisesaplus.com/#point-75
  11603. // Retrieve `then` only once
  11604. then = returned &&
  11605. // Support: Promises/A+ section 2.3.4
  11606. // https://promisesaplus.com/#point-64
  11607. // Only check objects and functions for thenability
  11608. ( typeof returned === "object" ||
  11609. typeof returned === "function" ) &&
  11610. returned.then;
  11611. // Handle a returned thenable
  11612. if ( isFunction( then ) ) {
  11613. // Special processors (notify) just wait for resolution
  11614. if ( special ) {
  11615. then.call(
  11616. returned,
  11617. resolve( maxDepth, deferred, Identity, special ),
  11618. resolve( maxDepth, deferred, Thrower, special )
  11619. );
  11620. // Normal processors (resolve) also hook into progress
  11621. } else {
  11622. // ...and disregard older resolution values
  11623. maxDepth++;
  11624. then.call(
  11625. returned,
  11626. resolve( maxDepth, deferred, Identity, special ),
  11627. resolve( maxDepth, deferred, Thrower, special ),
  11628. resolve( maxDepth, deferred, Identity,
  11629. deferred.notifyWith )
  11630. );
  11631. }
  11632. // Handle all other returned values
  11633. } else {
  11634. // Only substitute handlers pass on context
  11635. // and multiple values (non-spec behavior)
  11636. if ( handler !== Identity ) {
  11637. that = undefined;
  11638. args = [ returned ];
  11639. }
  11640. // Process the value(s)
  11641. // Default process is resolve
  11642. ( special || deferred.resolveWith )( that, args );
  11643. }
  11644. },
  11645. // Only normal processors (resolve) catch and reject exceptions
  11646. process = special ?
  11647. mightThrow :
  11648. function() {
  11649. try {
  11650. mightThrow();
  11651. } catch ( e ) {
  11652. if ( jQuery.Deferred.exceptionHook ) {
  11653. jQuery.Deferred.exceptionHook( e,
  11654. process.stackTrace );
  11655. }
  11656. // Support: Promises/A+ section 2.3.3.3.4.1
  11657. // https://promisesaplus.com/#point-61
  11658. // Ignore post-resolution exceptions
  11659. if ( depth + 1 >= maxDepth ) {
  11660. // Only substitute handlers pass on context
  11661. // and multiple values (non-spec behavior)
  11662. if ( handler !== Thrower ) {
  11663. that = undefined;
  11664. args = [ e ];
  11665. }
  11666. deferred.rejectWith( that, args );
  11667. }
  11668. }
  11669. };
  11670. // Support: Promises/A+ section 2.3.3.3.1
  11671. // https://promisesaplus.com/#point-57
  11672. // Re-resolve promises immediately to dodge false rejection from
  11673. // subsequent errors
  11674. if ( depth ) {
  11675. process();
  11676. } else {
  11677. // Call an optional hook to record the stack, in case of exception
  11678. // since it's otherwise lost when execution goes async
  11679. if ( jQuery.Deferred.getStackHook ) {
  11680. process.stackTrace = jQuery.Deferred.getStackHook();
  11681. }
  11682. window.setTimeout( process );
  11683. }
  11684. };
  11685. }
  11686. return jQuery.Deferred( function( newDefer ) {
  11687. // progress_handlers.add( ... )
  11688. tuples[ 0 ][ 3 ].add(
  11689. resolve(
  11690. 0,
  11691. newDefer,
  11692. isFunction( onProgress ) ?
  11693. onProgress :
  11694. Identity,
  11695. newDefer.notifyWith
  11696. )
  11697. );
  11698. // fulfilled_handlers.add( ... )
  11699. tuples[ 1 ][ 3 ].add(
  11700. resolve(
  11701. 0,
  11702. newDefer,
  11703. isFunction( onFulfilled ) ?
  11704. onFulfilled :
  11705. Identity
  11706. )
  11707. );
  11708. // rejected_handlers.add( ... )
  11709. tuples[ 2 ][ 3 ].add(
  11710. resolve(
  11711. 0,
  11712. newDefer,
  11713. isFunction( onRejected ) ?
  11714. onRejected :
  11715. Thrower
  11716. )
  11717. );
  11718. } ).promise();
  11719. },
  11720. // Get a promise for this deferred
  11721. // If obj is provided, the promise aspect is added to the object
  11722. promise: function( obj ) {
  11723. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11724. }
  11725. },
  11726. deferred = {};
  11727. // Add list-specific methods
  11728. jQuery.each( tuples, function( i, tuple ) {
  11729. var list = tuple[ 2 ],
  11730. stateString = tuple[ 5 ];
  11731. // promise.progress = list.add
  11732. // promise.done = list.add
  11733. // promise.fail = list.add
  11734. promise[ tuple[ 1 ] ] = list.add;
  11735. // Handle state
  11736. if ( stateString ) {
  11737. list.add(
  11738. function() {
  11739. // state = "resolved" (i.e., fulfilled)
  11740. // state = "rejected"
  11741. state = stateString;
  11742. },
  11743. // rejected_callbacks.disable
  11744. // fulfilled_callbacks.disable
  11745. tuples[ 3 - i ][ 2 ].disable,
  11746. // rejected_handlers.disable
  11747. // fulfilled_handlers.disable
  11748. tuples[ 3 - i ][ 3 ].disable,
  11749. // progress_callbacks.lock
  11750. tuples[ 0 ][ 2 ].lock,
  11751. // progress_handlers.lock
  11752. tuples[ 0 ][ 3 ].lock
  11753. );
  11754. }
  11755. // progress_handlers.fire
  11756. // fulfilled_handlers.fire
  11757. // rejected_handlers.fire
  11758. list.add( tuple[ 3 ].fire );
  11759. // deferred.notify = function() { deferred.notifyWith(...) }
  11760. // deferred.resolve = function() { deferred.resolveWith(...) }
  11761. // deferred.reject = function() { deferred.rejectWith(...) }
  11762. deferred[ tuple[ 0 ] ] = function() {
  11763. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11764. return this;
  11765. };
  11766. // deferred.notifyWith = list.fireWith
  11767. // deferred.resolveWith = list.fireWith
  11768. // deferred.rejectWith = list.fireWith
  11769. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11770. } );
  11771. // Make the deferred a promise
  11772. promise.promise( deferred );
  11773. // Call given func if any
  11774. if ( func ) {
  11775. func.call( deferred, deferred );
  11776. }
  11777. // All done!
  11778. return deferred;
  11779. },
  11780. // Deferred helper
  11781. when: function( singleValue ) {
  11782. var
  11783. // count of uncompleted subordinates
  11784. remaining = arguments.length,
  11785. // count of unprocessed arguments
  11786. i = remaining,
  11787. // subordinate fulfillment data
  11788. resolveContexts = Array( i ),
  11789. resolveValues = slice.call( arguments ),
  11790. // the master Deferred
  11791. master = jQuery.Deferred(),
  11792. // subordinate callback factory
  11793. updateFunc = function( i ) {
  11794. return function( value ) {
  11795. resolveContexts[ i ] = this;
  11796. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11797. if ( !( --remaining ) ) {
  11798. master.resolveWith( resolveContexts, resolveValues );
  11799. }
  11800. };
  11801. };
  11802. // Single- and empty arguments are adopted like Promise.resolve
  11803. if ( remaining <= 1 ) {
  11804. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11805. !remaining );
  11806. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11807. if ( master.state() === "pending" ||
  11808. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11809. return master.then();
  11810. }
  11811. }
  11812. // Multiple arguments are aggregated like Promise.all array elements
  11813. while ( i-- ) {
  11814. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11815. }
  11816. return master.promise();
  11817. }
  11818. } );
  11819. // These usually indicate a programmer mistake during development,
  11820. // warn about them ASAP rather than swallowing them by default.
  11821. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11822. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11823. // Support: IE 8 - 9 only
  11824. // Console exists when dev tools are open, which can happen at any time
  11825. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11826. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11827. }
  11828. };
  11829. jQuery.readyException = function( error ) {
  11830. window.setTimeout( function() {
  11831. throw error;
  11832. } );
  11833. };
  11834. // The deferred used on DOM ready
  11835. var readyList = jQuery.Deferred();
  11836. jQuery.fn.ready = function( fn ) {
  11837. readyList
  11838. .then( fn )
  11839. // Wrap jQuery.readyException in a function so that the lookup
  11840. // happens at the time of error handling instead of callback
  11841. // registration.
  11842. .catch( function( error ) {
  11843. jQuery.readyException( error );
  11844. } );
  11845. return this;
  11846. };
  11847. jQuery.extend( {
  11848. // Is the DOM ready to be used? Set to true once it occurs.
  11849. isReady: false,
  11850. // A counter to track how many items to wait for before
  11851. // the ready event fires. See #6781
  11852. readyWait: 1,
  11853. // Handle when the DOM is ready
  11854. ready: function( wait ) {
  11855. // Abort if there are pending holds or we're already ready
  11856. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11857. return;
  11858. }
  11859. // Remember that the DOM is ready
  11860. jQuery.isReady = true;
  11861. // If a normal DOM Ready event fired, decrement, and wait if need be
  11862. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11863. return;
  11864. }
  11865. // If there are functions bound, to execute
  11866. readyList.resolveWith( document, [ jQuery ] );
  11867. }
  11868. } );
  11869. jQuery.ready.then = readyList.then;
  11870. // The ready event handler and self cleanup method
  11871. function completed() {
  11872. document.removeEventListener( "DOMContentLoaded", completed );
  11873. window.removeEventListener( "load", completed );
  11874. jQuery.ready();
  11875. }
  11876. // Catch cases where $(document).ready() is called
  11877. // after the browser event has already occurred.
  11878. // Support: IE <=9 - 10 only
  11879. // Older IE sometimes signals "interactive" too soon
  11880. if ( document.readyState === "complete" ||
  11881. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11882. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11883. window.setTimeout( jQuery.ready );
  11884. } else {
  11885. // Use the handy event callback
  11886. document.addEventListener( "DOMContentLoaded", completed );
  11887. // A fallback to window.onload, that will always work
  11888. window.addEventListener( "load", completed );
  11889. }
  11890. // Multifunctional method to get and set values of a collection
  11891. // The value/s can optionally be executed if it's a function
  11892. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11893. var i = 0,
  11894. len = elems.length,
  11895. bulk = key == null;
  11896. // Sets many values
  11897. if ( toType( key ) === "object" ) {
  11898. chainable = true;
  11899. for ( i in key ) {
  11900. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11901. }
  11902. // Sets one value
  11903. } else if ( value !== undefined ) {
  11904. chainable = true;
  11905. if ( !isFunction( value ) ) {
  11906. raw = true;
  11907. }
  11908. if ( bulk ) {
  11909. // Bulk operations run against the entire set
  11910. if ( raw ) {
  11911. fn.call( elems, value );
  11912. fn = null;
  11913. // ...except when executing function values
  11914. } else {
  11915. bulk = fn;
  11916. fn = function( elem, key, value ) {
  11917. return bulk.call( jQuery( elem ), value );
  11918. };
  11919. }
  11920. }
  11921. if ( fn ) {
  11922. for ( ; i < len; i++ ) {
  11923. fn(
  11924. elems[ i ], key, raw ?
  11925. value :
  11926. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11927. );
  11928. }
  11929. }
  11930. }
  11931. if ( chainable ) {
  11932. return elems;
  11933. }
  11934. // Gets
  11935. if ( bulk ) {
  11936. return fn.call( elems );
  11937. }
  11938. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11939. };
  11940. // Matches dashed string for camelizing
  11941. var rmsPrefix = /^-ms-/,
  11942. rdashAlpha = /-([a-z])/g;
  11943. // Used by camelCase as callback to replace()
  11944. function fcamelCase( all, letter ) {
  11945. return letter.toUpperCase();
  11946. }
  11947. // Convert dashed to camelCase; used by the css and data modules
  11948. // Support: IE <=9 - 11, Edge 12 - 15
  11949. // Microsoft forgot to hump their vendor prefix (#9572)
  11950. function camelCase( string ) {
  11951. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11952. }
  11953. var acceptData = function( owner ) {
  11954. // Accepts only:
  11955. // - Node
  11956. // - Node.ELEMENT_NODE
  11957. // - Node.DOCUMENT_NODE
  11958. // - Object
  11959. // - Any
  11960. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11961. };
  11962. function Data() {
  11963. this.expando = jQuery.expando + Data.uid++;
  11964. }
  11965. Data.uid = 1;
  11966. Data.prototype = {
  11967. cache: function( owner ) {
  11968. // Check if the owner object already has a cache
  11969. var value = owner[ this.expando ];
  11970. // If not, create one
  11971. if ( !value ) {
  11972. value = {};
  11973. // We can accept data for non-element nodes in modern browsers,
  11974. // but we should not, see #8335.
  11975. // Always return an empty object.
  11976. if ( acceptData( owner ) ) {
  11977. // If it is a node unlikely to be stringify-ed or looped over
  11978. // use plain assignment
  11979. if ( owner.nodeType ) {
  11980. owner[ this.expando ] = value;
  11981. // Otherwise secure it in a non-enumerable property
  11982. // configurable must be true to allow the property to be
  11983. // deleted when data is removed
  11984. } else {
  11985. Object.defineProperty( owner, this.expando, {
  11986. value: value,
  11987. configurable: true
  11988. } );
  11989. }
  11990. }
  11991. }
  11992. return value;
  11993. },
  11994. set: function( owner, data, value ) {
  11995. var prop,
  11996. cache = this.cache( owner );
  11997. // Handle: [ owner, key, value ] args
  11998. // Always use camelCase key (gh-2257)
  11999. if ( typeof data === "string" ) {
  12000. cache[ camelCase( data ) ] = value;
  12001. // Handle: [ owner, { properties } ] args
  12002. } else {
  12003. // Copy the properties one-by-one to the cache object
  12004. for ( prop in data ) {
  12005. cache[ camelCase( prop ) ] = data[ prop ];
  12006. }
  12007. }
  12008. return cache;
  12009. },
  12010. get: function( owner, key ) {
  12011. return key === undefined ?
  12012. this.cache( owner ) :
  12013. // Always use camelCase key (gh-2257)
  12014. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12015. },
  12016. access: function( owner, key, value ) {
  12017. // In cases where either:
  12018. //
  12019. // 1. No key was specified
  12020. // 2. A string key was specified, but no value provided
  12021. //
  12022. // Take the "read" path and allow the get method to determine
  12023. // which value to return, respectively either:
  12024. //
  12025. // 1. The entire cache object
  12026. // 2. The data stored at the key
  12027. //
  12028. if ( key === undefined ||
  12029. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12030. return this.get( owner, key );
  12031. }
  12032. // When the key is not a string, or both a key and value
  12033. // are specified, set or extend (existing objects) with either:
  12034. //
  12035. // 1. An object of properties
  12036. // 2. A key and value
  12037. //
  12038. this.set( owner, key, value );
  12039. // Since the "set" path can have two possible entry points
  12040. // return the expected data based on which path was taken[*]
  12041. return value !== undefined ? value : key;
  12042. },
  12043. remove: function( owner, key ) {
  12044. var i,
  12045. cache = owner[ this.expando ];
  12046. if ( cache === undefined ) {
  12047. return;
  12048. }
  12049. if ( key !== undefined ) {
  12050. // Support array or space separated string of keys
  12051. if ( Array.isArray( key ) ) {
  12052. // If key is an array of keys...
  12053. // We always set camelCase keys, so remove that.
  12054. key = key.map( camelCase );
  12055. } else {
  12056. key = camelCase( key );
  12057. // If a key with the spaces exists, use it.
  12058. // Otherwise, create an array by matching non-whitespace
  12059. key = key in cache ?
  12060. [ key ] :
  12061. ( key.match( rnothtmlwhite ) || [] );
  12062. }
  12063. i = key.length;
  12064. while ( i-- ) {
  12065. delete cache[ key[ i ] ];
  12066. }
  12067. }
  12068. // Remove the expando if there's no more data
  12069. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12070. // Support: Chrome <=35 - 45
  12071. // Webkit & Blink performance suffers when deleting properties
  12072. // from DOM nodes, so set to undefined instead
  12073. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12074. if ( owner.nodeType ) {
  12075. owner[ this.expando ] = undefined;
  12076. } else {
  12077. delete owner[ this.expando ];
  12078. }
  12079. }
  12080. },
  12081. hasData: function( owner ) {
  12082. var cache = owner[ this.expando ];
  12083. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12084. }
  12085. };
  12086. var dataPriv = new Data();
  12087. var dataUser = new Data();
  12088. // Implementation Summary
  12089. //
  12090. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12091. // 2. Improve the module's maintainability by reducing the storage
  12092. // paths to a single mechanism.
  12093. // 3. Use the same single mechanism to support "private" and "user" data.
  12094. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12095. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12096. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12097. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12098. rmultiDash = /[A-Z]/g;
  12099. function getData( data ) {
  12100. if ( data === "true" ) {
  12101. return true;
  12102. }
  12103. if ( data === "false" ) {
  12104. return false;
  12105. }
  12106. if ( data === "null" ) {
  12107. return null;
  12108. }
  12109. // Only convert to a number if it doesn't change the string
  12110. if ( data === +data + "" ) {
  12111. return +data;
  12112. }
  12113. if ( rbrace.test( data ) ) {
  12114. return JSON.parse( data );
  12115. }
  12116. return data;
  12117. }
  12118. function dataAttr( elem, key, data ) {
  12119. var name;
  12120. // If nothing was found internally, try to fetch any
  12121. // data from the HTML5 data-* attribute
  12122. if ( data === undefined && elem.nodeType === 1 ) {
  12123. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12124. data = elem.getAttribute( name );
  12125. if ( typeof data === "string" ) {
  12126. try {
  12127. data = getData( data );
  12128. } catch ( e ) {}
  12129. // Make sure we set the data so it isn't changed later
  12130. dataUser.set( elem, key, data );
  12131. } else {
  12132. data = undefined;
  12133. }
  12134. }
  12135. return data;
  12136. }
  12137. jQuery.extend( {
  12138. hasData: function( elem ) {
  12139. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12140. },
  12141. data: function( elem, name, data ) {
  12142. return dataUser.access( elem, name, data );
  12143. },
  12144. removeData: function( elem, name ) {
  12145. dataUser.remove( elem, name );
  12146. },
  12147. // TODO: Now that all calls to _data and _removeData have been replaced
  12148. // with direct calls to dataPriv methods, these can be deprecated.
  12149. _data: function( elem, name, data ) {
  12150. return dataPriv.access( elem, name, data );
  12151. },
  12152. _removeData: function( elem, name ) {
  12153. dataPriv.remove( elem, name );
  12154. }
  12155. } );
  12156. jQuery.fn.extend( {
  12157. data: function( key, value ) {
  12158. var i, name, data,
  12159. elem = this[ 0 ],
  12160. attrs = elem && elem.attributes;
  12161. // Gets all values
  12162. if ( key === undefined ) {
  12163. if ( this.length ) {
  12164. data = dataUser.get( elem );
  12165. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12166. i = attrs.length;
  12167. while ( i-- ) {
  12168. // Support: IE 11 only
  12169. // The attrs elements can be null (#14894)
  12170. if ( attrs[ i ] ) {
  12171. name = attrs[ i ].name;
  12172. if ( name.indexOf( "data-" ) === 0 ) {
  12173. name = camelCase( name.slice( 5 ) );
  12174. dataAttr( elem, name, data[ name ] );
  12175. }
  12176. }
  12177. }
  12178. dataPriv.set( elem, "hasDataAttrs", true );
  12179. }
  12180. }
  12181. return data;
  12182. }
  12183. // Sets multiple values
  12184. if ( typeof key === "object" ) {
  12185. return this.each( function() {
  12186. dataUser.set( this, key );
  12187. } );
  12188. }
  12189. return access( this, function( value ) {
  12190. var data;
  12191. // The calling jQuery object (element matches) is not empty
  12192. // (and therefore has an element appears at this[ 0 ]) and the
  12193. // `value` parameter was not undefined. An empty jQuery object
  12194. // will result in `undefined` for elem = this[ 0 ] which will
  12195. // throw an exception if an attempt to read a data cache is made.
  12196. if ( elem && value === undefined ) {
  12197. // Attempt to get data from the cache
  12198. // The key will always be camelCased in Data
  12199. data = dataUser.get( elem, key );
  12200. if ( data !== undefined ) {
  12201. return data;
  12202. }
  12203. // Attempt to "discover" the data in
  12204. // HTML5 custom data-* attrs
  12205. data = dataAttr( elem, key );
  12206. if ( data !== undefined ) {
  12207. return data;
  12208. }
  12209. // We tried really hard, but the data doesn't exist.
  12210. return;
  12211. }
  12212. // Set the data...
  12213. this.each( function() {
  12214. // We always store the camelCased key
  12215. dataUser.set( this, key, value );
  12216. } );
  12217. }, null, value, arguments.length > 1, null, true );
  12218. },
  12219. removeData: function( key ) {
  12220. return this.each( function() {
  12221. dataUser.remove( this, key );
  12222. } );
  12223. }
  12224. } );
  12225. jQuery.extend( {
  12226. queue: function( elem, type, data ) {
  12227. var queue;
  12228. if ( elem ) {
  12229. type = ( type || "fx" ) + "queue";
  12230. queue = dataPriv.get( elem, type );
  12231. // Speed up dequeue by getting out quickly if this is just a lookup
  12232. if ( data ) {
  12233. if ( !queue || Array.isArray( data ) ) {
  12234. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12235. } else {
  12236. queue.push( data );
  12237. }
  12238. }
  12239. return queue || [];
  12240. }
  12241. },
  12242. dequeue: function( elem, type ) {
  12243. type = type || "fx";
  12244. var queue = jQuery.queue( elem, type ),
  12245. startLength = queue.length,
  12246. fn = queue.shift(),
  12247. hooks = jQuery._queueHooks( elem, type ),
  12248. next = function() {
  12249. jQuery.dequeue( elem, type );
  12250. };
  12251. // If the fx queue is dequeued, always remove the progress sentinel
  12252. if ( fn === "inprogress" ) {
  12253. fn = queue.shift();
  12254. startLength--;
  12255. }
  12256. if ( fn ) {
  12257. // Add a progress sentinel to prevent the fx queue from being
  12258. // automatically dequeued
  12259. if ( type === "fx" ) {
  12260. queue.unshift( "inprogress" );
  12261. }
  12262. // Clear up the last queue stop function
  12263. delete hooks.stop;
  12264. fn.call( elem, next, hooks );
  12265. }
  12266. if ( !startLength && hooks ) {
  12267. hooks.empty.fire();
  12268. }
  12269. },
  12270. // Not public - generate a queueHooks object, or return the current one
  12271. _queueHooks: function( elem, type ) {
  12272. var key = type + "queueHooks";
  12273. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12274. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12275. dataPriv.remove( elem, [ type + "queue", key ] );
  12276. } )
  12277. } );
  12278. }
  12279. } );
  12280. jQuery.fn.extend( {
  12281. queue: function( type, data ) {
  12282. var setter = 2;
  12283. if ( typeof type !== "string" ) {
  12284. data = type;
  12285. type = "fx";
  12286. setter--;
  12287. }
  12288. if ( arguments.length < setter ) {
  12289. return jQuery.queue( this[ 0 ], type );
  12290. }
  12291. return data === undefined ?
  12292. this :
  12293. this.each( function() {
  12294. var queue = jQuery.queue( this, type, data );
  12295. // Ensure a hooks for this queue
  12296. jQuery._queueHooks( this, type );
  12297. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12298. jQuery.dequeue( this, type );
  12299. }
  12300. } );
  12301. },
  12302. dequeue: function( type ) {
  12303. return this.each( function() {
  12304. jQuery.dequeue( this, type );
  12305. } );
  12306. },
  12307. clearQueue: function( type ) {
  12308. return this.queue( type || "fx", [] );
  12309. },
  12310. // Get a promise resolved when queues of a certain type
  12311. // are emptied (fx is the type by default)
  12312. promise: function( type, obj ) {
  12313. var tmp,
  12314. count = 1,
  12315. defer = jQuery.Deferred(),
  12316. elements = this,
  12317. i = this.length,
  12318. resolve = function() {
  12319. if ( !( --count ) ) {
  12320. defer.resolveWith( elements, [ elements ] );
  12321. }
  12322. };
  12323. if ( typeof type !== "string" ) {
  12324. obj = type;
  12325. type = undefined;
  12326. }
  12327. type = type || "fx";
  12328. while ( i-- ) {
  12329. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12330. if ( tmp && tmp.empty ) {
  12331. count++;
  12332. tmp.empty.add( resolve );
  12333. }
  12334. }
  12335. resolve();
  12336. return defer.promise( obj );
  12337. }
  12338. } );
  12339. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12340. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12341. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12342. var documentElement = document.documentElement;
  12343. var isAttached = function( elem ) {
  12344. return jQuery.contains( elem.ownerDocument, elem );
  12345. },
  12346. composed = { composed: true };
  12347. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12348. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12349. // Support: iOS 10.0-10.2 only
  12350. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12351. // leading to errors. We need to check for `getRootNode`.
  12352. if ( documentElement.getRootNode ) {
  12353. isAttached = function( elem ) {
  12354. return jQuery.contains( elem.ownerDocument, elem ) ||
  12355. elem.getRootNode( composed ) === elem.ownerDocument;
  12356. };
  12357. }
  12358. var isHiddenWithinTree = function( elem, el ) {
  12359. // isHiddenWithinTree might be called from jQuery#filter function;
  12360. // in that case, element will be second argument
  12361. elem = el || elem;
  12362. // Inline style trumps all
  12363. return elem.style.display === "none" ||
  12364. elem.style.display === "" &&
  12365. // Otherwise, check computed style
  12366. // Support: Firefox <=43 - 45
  12367. // Disconnected elements can have computed display: none, so first confirm that elem is
  12368. // in the document.
  12369. isAttached( elem ) &&
  12370. jQuery.css( elem, "display" ) === "none";
  12371. };
  12372. var swap = function( elem, options, callback, args ) {
  12373. var ret, name,
  12374. old = {};
  12375. // Remember the old values, and insert the new ones
  12376. for ( name in options ) {
  12377. old[ name ] = elem.style[ name ];
  12378. elem.style[ name ] = options[ name ];
  12379. }
  12380. ret = callback.apply( elem, args || [] );
  12381. // Revert the old values
  12382. for ( name in options ) {
  12383. elem.style[ name ] = old[ name ];
  12384. }
  12385. return ret;
  12386. };
  12387. function adjustCSS( elem, prop, valueParts, tween ) {
  12388. var adjusted, scale,
  12389. maxIterations = 20,
  12390. currentValue = tween ?
  12391. function() {
  12392. return tween.cur();
  12393. } :
  12394. function() {
  12395. return jQuery.css( elem, prop, "" );
  12396. },
  12397. initial = currentValue(),
  12398. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12399. // Starting value computation is required for potential unit mismatches
  12400. initialInUnit = elem.nodeType &&
  12401. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12402. rcssNum.exec( jQuery.css( elem, prop ) );
  12403. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12404. // Support: Firefox <=54
  12405. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12406. initial = initial / 2;
  12407. // Trust units reported by jQuery.css
  12408. unit = unit || initialInUnit[ 3 ];
  12409. // Iteratively approximate from a nonzero starting point
  12410. initialInUnit = +initial || 1;
  12411. while ( maxIterations-- ) {
  12412. // Evaluate and update our best guess (doubling guesses that zero out).
  12413. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12414. jQuery.style( elem, prop, initialInUnit + unit );
  12415. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12416. maxIterations = 0;
  12417. }
  12418. initialInUnit = initialInUnit / scale;
  12419. }
  12420. initialInUnit = initialInUnit * 2;
  12421. jQuery.style( elem, prop, initialInUnit + unit );
  12422. // Make sure we update the tween properties later on
  12423. valueParts = valueParts || [];
  12424. }
  12425. if ( valueParts ) {
  12426. initialInUnit = +initialInUnit || +initial || 0;
  12427. // Apply relative offset (+=/-=) if specified
  12428. adjusted = valueParts[ 1 ] ?
  12429. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12430. +valueParts[ 2 ];
  12431. if ( tween ) {
  12432. tween.unit = unit;
  12433. tween.start = initialInUnit;
  12434. tween.end = adjusted;
  12435. }
  12436. }
  12437. return adjusted;
  12438. }
  12439. var defaultDisplayMap = {};
  12440. function getDefaultDisplay( elem ) {
  12441. var temp,
  12442. doc = elem.ownerDocument,
  12443. nodeName = elem.nodeName,
  12444. display = defaultDisplayMap[ nodeName ];
  12445. if ( display ) {
  12446. return display;
  12447. }
  12448. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12449. display = jQuery.css( temp, "display" );
  12450. temp.parentNode.removeChild( temp );
  12451. if ( display === "none" ) {
  12452. display = "block";
  12453. }
  12454. defaultDisplayMap[ nodeName ] = display;
  12455. return display;
  12456. }
  12457. function showHide( elements, show ) {
  12458. var display, elem,
  12459. values = [],
  12460. index = 0,
  12461. length = elements.length;
  12462. // Determine new display value for elements that need to change
  12463. for ( ; index < length; index++ ) {
  12464. elem = elements[ index ];
  12465. if ( !elem.style ) {
  12466. continue;
  12467. }
  12468. display = elem.style.display;
  12469. if ( show ) {
  12470. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12471. // check is required in this first loop unless we have a nonempty display value (either
  12472. // inline or about-to-be-restored)
  12473. if ( display === "none" ) {
  12474. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12475. if ( !values[ index ] ) {
  12476. elem.style.display = "";
  12477. }
  12478. }
  12479. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12480. values[ index ] = getDefaultDisplay( elem );
  12481. }
  12482. } else {
  12483. if ( display !== "none" ) {
  12484. values[ index ] = "none";
  12485. // Remember what we're overwriting
  12486. dataPriv.set( elem, "display", display );
  12487. }
  12488. }
  12489. }
  12490. // Set the display of the elements in a second loop to avoid constant reflow
  12491. for ( index = 0; index < length; index++ ) {
  12492. if ( values[ index ] != null ) {
  12493. elements[ index ].style.display = values[ index ];
  12494. }
  12495. }
  12496. return elements;
  12497. }
  12498. jQuery.fn.extend( {
  12499. show: function() {
  12500. return showHide( this, true );
  12501. },
  12502. hide: function() {
  12503. return showHide( this );
  12504. },
  12505. toggle: function( state ) {
  12506. if ( typeof state === "boolean" ) {
  12507. return state ? this.show() : this.hide();
  12508. }
  12509. return this.each( function() {
  12510. if ( isHiddenWithinTree( this ) ) {
  12511. jQuery( this ).show();
  12512. } else {
  12513. jQuery( this ).hide();
  12514. }
  12515. } );
  12516. }
  12517. } );
  12518. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12519. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12520. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12521. // We have to close these tags to support XHTML (#13200)
  12522. var wrapMap = {
  12523. // Support: IE <=9 only
  12524. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12525. // XHTML parsers do not magically insert elements in the
  12526. // same way that tag soup parsers do. So we cannot shorten
  12527. // this by omitting <tbody> or other required elements.
  12528. thead: [ 1, "<table>", "</table>" ],
  12529. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12530. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12531. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12532. _default: [ 0, "", "" ]
  12533. };
  12534. // Support: IE <=9 only
  12535. wrapMap.optgroup = wrapMap.option;
  12536. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12537. wrapMap.th = wrapMap.td;
  12538. function getAll( context, tag ) {
  12539. // Support: IE <=9 - 11 only
  12540. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12541. var ret;
  12542. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12543. ret = context.getElementsByTagName( tag || "*" );
  12544. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12545. ret = context.querySelectorAll( tag || "*" );
  12546. } else {
  12547. ret = [];
  12548. }
  12549. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12550. return jQuery.merge( [ context ], ret );
  12551. }
  12552. return ret;
  12553. }
  12554. // Mark scripts as having already been evaluated
  12555. function setGlobalEval( elems, refElements ) {
  12556. var i = 0,
  12557. l = elems.length;
  12558. for ( ; i < l; i++ ) {
  12559. dataPriv.set(
  12560. elems[ i ],
  12561. "globalEval",
  12562. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12563. );
  12564. }
  12565. }
  12566. var rhtml = /<|&#?\w+;/;
  12567. function buildFragment( elems, context, scripts, selection, ignored ) {
  12568. var elem, tmp, tag, wrap, attached, j,
  12569. fragment = context.createDocumentFragment(),
  12570. nodes = [],
  12571. i = 0,
  12572. l = elems.length;
  12573. for ( ; i < l; i++ ) {
  12574. elem = elems[ i ];
  12575. if ( elem || elem === 0 ) {
  12576. // Add nodes directly
  12577. if ( toType( elem ) === "object" ) {
  12578. // Support: Android <=4.0 only, PhantomJS 1 only
  12579. // push.apply(_, arraylike) throws on ancient WebKit
  12580. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12581. // Convert non-html into a text node
  12582. } else if ( !rhtml.test( elem ) ) {
  12583. nodes.push( context.createTextNode( elem ) );
  12584. // Convert html into DOM nodes
  12585. } else {
  12586. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12587. // Deserialize a standard representation
  12588. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12589. wrap = wrapMap[ tag ] || wrapMap._default;
  12590. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12591. // Descend through wrappers to the right content
  12592. j = wrap[ 0 ];
  12593. while ( j-- ) {
  12594. tmp = tmp.lastChild;
  12595. }
  12596. // Support: Android <=4.0 only, PhantomJS 1 only
  12597. // push.apply(_, arraylike) throws on ancient WebKit
  12598. jQuery.merge( nodes, tmp.childNodes );
  12599. // Remember the top-level container
  12600. tmp = fragment.firstChild;
  12601. // Ensure the created nodes are orphaned (#12392)
  12602. tmp.textContent = "";
  12603. }
  12604. }
  12605. }
  12606. // Remove wrapper from fragment
  12607. fragment.textContent = "";
  12608. i = 0;
  12609. while ( ( elem = nodes[ i++ ] ) ) {
  12610. // Skip elements already in the context collection (trac-4087)
  12611. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12612. if ( ignored ) {
  12613. ignored.push( elem );
  12614. }
  12615. continue;
  12616. }
  12617. attached = isAttached( elem );
  12618. // Append to fragment
  12619. tmp = getAll( fragment.appendChild( elem ), "script" );
  12620. // Preserve script evaluation history
  12621. if ( attached ) {
  12622. setGlobalEval( tmp );
  12623. }
  12624. // Capture executables
  12625. if ( scripts ) {
  12626. j = 0;
  12627. while ( ( elem = tmp[ j++ ] ) ) {
  12628. if ( rscriptType.test( elem.type || "" ) ) {
  12629. scripts.push( elem );
  12630. }
  12631. }
  12632. }
  12633. }
  12634. return fragment;
  12635. }
  12636. ( function() {
  12637. var fragment = document.createDocumentFragment(),
  12638. div = fragment.appendChild( document.createElement( "div" ) ),
  12639. input = document.createElement( "input" );
  12640. // Support: Android 4.0 - 4.3 only
  12641. // Check state lost if the name is set (#11217)
  12642. // Support: Windows Web Apps (WWA)
  12643. // `name` and `type` must use .setAttribute for WWA (#14901)
  12644. input.setAttribute( "type", "radio" );
  12645. input.setAttribute( "checked", "checked" );
  12646. input.setAttribute( "name", "t" );
  12647. div.appendChild( input );
  12648. // Support: Android <=4.1 only
  12649. // Older WebKit doesn't clone checked state correctly in fragments
  12650. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12651. // Support: IE <=11 only
  12652. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12653. div.innerHTML = "<textarea>x</textarea>";
  12654. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12655. } )();
  12656. var
  12657. rkeyEvent = /^key/,
  12658. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12659. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12660. function returnTrue() {
  12661. return true;
  12662. }
  12663. function returnFalse() {
  12664. return false;
  12665. }
  12666. // Support: IE <=9 - 11+
  12667. // focus() and blur() are asynchronous, except when they are no-op.
  12668. // So expect focus to be synchronous when the element is already active,
  12669. // and blur to be synchronous when the element is not already active.
  12670. // (focus and blur are always synchronous in other supported browsers,
  12671. // this just defines when we can count on it).
  12672. function expectSync( elem, type ) {
  12673. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12674. }
  12675. // Support: IE <=9 only
  12676. // Accessing document.activeElement can throw unexpectedly
  12677. // https://bugs.jquery.com/ticket/13393
  12678. function safeActiveElement() {
  12679. try {
  12680. return document.activeElement;
  12681. } catch ( err ) { }
  12682. }
  12683. function on( elem, types, selector, data, fn, one ) {
  12684. var origFn, type;
  12685. // Types can be a map of types/handlers
  12686. if ( typeof types === "object" ) {
  12687. // ( types-Object, selector, data )
  12688. if ( typeof selector !== "string" ) {
  12689. // ( types-Object, data )
  12690. data = data || selector;
  12691. selector = undefined;
  12692. }
  12693. for ( type in types ) {
  12694. on( elem, type, selector, data, types[ type ], one );
  12695. }
  12696. return elem;
  12697. }
  12698. if ( data == null && fn == null ) {
  12699. // ( types, fn )
  12700. fn = selector;
  12701. data = selector = undefined;
  12702. } else if ( fn == null ) {
  12703. if ( typeof selector === "string" ) {
  12704. // ( types, selector, fn )
  12705. fn = data;
  12706. data = undefined;
  12707. } else {
  12708. // ( types, data, fn )
  12709. fn = data;
  12710. data = selector;
  12711. selector = undefined;
  12712. }
  12713. }
  12714. if ( fn === false ) {
  12715. fn = returnFalse;
  12716. } else if ( !fn ) {
  12717. return elem;
  12718. }
  12719. if ( one === 1 ) {
  12720. origFn = fn;
  12721. fn = function( event ) {
  12722. // Can use an empty set, since event contains the info
  12723. jQuery().off( event );
  12724. return origFn.apply( this, arguments );
  12725. };
  12726. // Use same guid so caller can remove using origFn
  12727. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12728. }
  12729. return elem.each( function() {
  12730. jQuery.event.add( this, types, fn, data, selector );
  12731. } );
  12732. }
  12733. /*
  12734. * Helper functions for managing events -- not part of the public interface.
  12735. * Props to Dean Edwards' addEvent library for many of the ideas.
  12736. */
  12737. jQuery.event = {
  12738. global: {},
  12739. add: function( elem, types, handler, data, selector ) {
  12740. var handleObjIn, eventHandle, tmp,
  12741. events, t, handleObj,
  12742. special, handlers, type, namespaces, origType,
  12743. elemData = dataPriv.get( elem );
  12744. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12745. if ( !elemData ) {
  12746. return;
  12747. }
  12748. // Caller can pass in an object of custom data in lieu of the handler
  12749. if ( handler.handler ) {
  12750. handleObjIn = handler;
  12751. handler = handleObjIn.handler;
  12752. selector = handleObjIn.selector;
  12753. }
  12754. // Ensure that invalid selectors throw exceptions at attach time
  12755. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12756. if ( selector ) {
  12757. jQuery.find.matchesSelector( documentElement, selector );
  12758. }
  12759. // Make sure that the handler has a unique ID, used to find/remove it later
  12760. if ( !handler.guid ) {
  12761. handler.guid = jQuery.guid++;
  12762. }
  12763. // Init the element's event structure and main handler, if this is the first
  12764. if ( !( events = elemData.events ) ) {
  12765. events = elemData.events = {};
  12766. }
  12767. if ( !( eventHandle = elemData.handle ) ) {
  12768. eventHandle = elemData.handle = function( e ) {
  12769. // Discard the second event of a jQuery.event.trigger() and
  12770. // when an event is called after a page has unloaded
  12771. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12772. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12773. };
  12774. }
  12775. // Handle multiple events separated by a space
  12776. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12777. t = types.length;
  12778. while ( t-- ) {
  12779. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12780. type = origType = tmp[ 1 ];
  12781. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12782. // There *must* be a type, no attaching namespace-only handlers
  12783. if ( !type ) {
  12784. continue;
  12785. }
  12786. // If event changes its type, use the special event handlers for the changed type
  12787. special = jQuery.event.special[ type ] || {};
  12788. // If selector defined, determine special event api type, otherwise given type
  12789. type = ( selector ? special.delegateType : special.bindType ) || type;
  12790. // Update special based on newly reset type
  12791. special = jQuery.event.special[ type ] || {};
  12792. // handleObj is passed to all event handlers
  12793. handleObj = jQuery.extend( {
  12794. type: type,
  12795. origType: origType,
  12796. data: data,
  12797. handler: handler,
  12798. guid: handler.guid,
  12799. selector: selector,
  12800. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12801. namespace: namespaces.join( "." )
  12802. }, handleObjIn );
  12803. // Init the event handler queue if we're the first
  12804. if ( !( handlers = events[ type ] ) ) {
  12805. handlers = events[ type ] = [];
  12806. handlers.delegateCount = 0;
  12807. // Only use addEventListener if the special events handler returns false
  12808. if ( !special.setup ||
  12809. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12810. if ( elem.addEventListener ) {
  12811. elem.addEventListener( type, eventHandle );
  12812. }
  12813. }
  12814. }
  12815. if ( special.add ) {
  12816. special.add.call( elem, handleObj );
  12817. if ( !handleObj.handler.guid ) {
  12818. handleObj.handler.guid = handler.guid;
  12819. }
  12820. }
  12821. // Add to the element's handler list, delegates in front
  12822. if ( selector ) {
  12823. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12824. } else {
  12825. handlers.push( handleObj );
  12826. }
  12827. // Keep track of which events have ever been used, for event optimization
  12828. jQuery.event.global[ type ] = true;
  12829. }
  12830. },
  12831. // Detach an event or set of events from an element
  12832. remove: function( elem, types, handler, selector, mappedTypes ) {
  12833. var j, origCount, tmp,
  12834. events, t, handleObj,
  12835. special, handlers, type, namespaces, origType,
  12836. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12837. if ( !elemData || !( events = elemData.events ) ) {
  12838. return;
  12839. }
  12840. // Once for each type.namespace in types; type may be omitted
  12841. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12842. t = types.length;
  12843. while ( t-- ) {
  12844. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12845. type = origType = tmp[ 1 ];
  12846. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12847. // Unbind all events (on this namespace, if provided) for the element
  12848. if ( !type ) {
  12849. for ( type in events ) {
  12850. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12851. }
  12852. continue;
  12853. }
  12854. special = jQuery.event.special[ type ] || {};
  12855. type = ( selector ? special.delegateType : special.bindType ) || type;
  12856. handlers = events[ type ] || [];
  12857. tmp = tmp[ 2 ] &&
  12858. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12859. // Remove matching events
  12860. origCount = j = handlers.length;
  12861. while ( j-- ) {
  12862. handleObj = handlers[ j ];
  12863. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12864. ( !handler || handler.guid === handleObj.guid ) &&
  12865. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12866. ( !selector || selector === handleObj.selector ||
  12867. selector === "**" && handleObj.selector ) ) {
  12868. handlers.splice( j, 1 );
  12869. if ( handleObj.selector ) {
  12870. handlers.delegateCount--;
  12871. }
  12872. if ( special.remove ) {
  12873. special.remove.call( elem, handleObj );
  12874. }
  12875. }
  12876. }
  12877. // Remove generic event handler if we removed something and no more handlers exist
  12878. // (avoids potential for endless recursion during removal of special event handlers)
  12879. if ( origCount && !handlers.length ) {
  12880. if ( !special.teardown ||
  12881. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12882. jQuery.removeEvent( elem, type, elemData.handle );
  12883. }
  12884. delete events[ type ];
  12885. }
  12886. }
  12887. // Remove data and the expando if it's no longer used
  12888. if ( jQuery.isEmptyObject( events ) ) {
  12889. dataPriv.remove( elem, "handle events" );
  12890. }
  12891. },
  12892. dispatch: function( nativeEvent ) {
  12893. // Make a writable jQuery.Event from the native event object
  12894. var event = jQuery.event.fix( nativeEvent );
  12895. var i, j, ret, matched, handleObj, handlerQueue,
  12896. args = new Array( arguments.length ),
  12897. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12898. special = jQuery.event.special[ event.type ] || {};
  12899. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12900. args[ 0 ] = event;
  12901. for ( i = 1; i < arguments.length; i++ ) {
  12902. args[ i ] = arguments[ i ];
  12903. }
  12904. event.delegateTarget = this;
  12905. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12906. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12907. return;
  12908. }
  12909. // Determine handlers
  12910. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12911. // Run delegates first; they may want to stop propagation beneath us
  12912. i = 0;
  12913. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12914. event.currentTarget = matched.elem;
  12915. j = 0;
  12916. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12917. !event.isImmediatePropagationStopped() ) {
  12918. // If the event is namespaced, then each handler is only invoked if it is
  12919. // specially universal or its namespaces are a superset of the event's.
  12920. if ( !event.rnamespace || handleObj.namespace === false ||
  12921. event.rnamespace.test( handleObj.namespace ) ) {
  12922. event.handleObj = handleObj;
  12923. event.data = handleObj.data;
  12924. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12925. handleObj.handler ).apply( matched.elem, args );
  12926. if ( ret !== undefined ) {
  12927. if ( ( event.result = ret ) === false ) {
  12928. event.preventDefault();
  12929. event.stopPropagation();
  12930. }
  12931. }
  12932. }
  12933. }
  12934. }
  12935. // Call the postDispatch hook for the mapped type
  12936. if ( special.postDispatch ) {
  12937. special.postDispatch.call( this, event );
  12938. }
  12939. return event.result;
  12940. },
  12941. handlers: function( event, handlers ) {
  12942. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12943. handlerQueue = [],
  12944. delegateCount = handlers.delegateCount,
  12945. cur = event.target;
  12946. // Find delegate handlers
  12947. if ( delegateCount &&
  12948. // Support: IE <=9
  12949. // Black-hole SVG <use> instance trees (trac-13180)
  12950. cur.nodeType &&
  12951. // Support: Firefox <=42
  12952. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12953. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12954. // Support: IE 11 only
  12955. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12956. !( event.type === "click" && event.button >= 1 ) ) {
  12957. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12958. // Don't check non-elements (#13208)
  12959. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12960. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12961. matchedHandlers = [];
  12962. matchedSelectors = {};
  12963. for ( i = 0; i < delegateCount; i++ ) {
  12964. handleObj = handlers[ i ];
  12965. // Don't conflict with Object.prototype properties (#13203)
  12966. sel = handleObj.selector + " ";
  12967. if ( matchedSelectors[ sel ] === undefined ) {
  12968. matchedSelectors[ sel ] = handleObj.needsContext ?
  12969. jQuery( sel, this ).index( cur ) > -1 :
  12970. jQuery.find( sel, this, null, [ cur ] ).length;
  12971. }
  12972. if ( matchedSelectors[ sel ] ) {
  12973. matchedHandlers.push( handleObj );
  12974. }
  12975. }
  12976. if ( matchedHandlers.length ) {
  12977. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12978. }
  12979. }
  12980. }
  12981. }
  12982. // Add the remaining (directly-bound) handlers
  12983. cur = this;
  12984. if ( delegateCount < handlers.length ) {
  12985. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12986. }
  12987. return handlerQueue;
  12988. },
  12989. addProp: function( name, hook ) {
  12990. Object.defineProperty( jQuery.Event.prototype, name, {
  12991. enumerable: true,
  12992. configurable: true,
  12993. get: isFunction( hook ) ?
  12994. function() {
  12995. if ( this.originalEvent ) {
  12996. return hook( this.originalEvent );
  12997. }
  12998. } :
  12999. function() {
  13000. if ( this.originalEvent ) {
  13001. return this.originalEvent[ name ];
  13002. }
  13003. },
  13004. set: function( value ) {
  13005. Object.defineProperty( this, name, {
  13006. enumerable: true,
  13007. configurable: true,
  13008. writable: true,
  13009. value: value
  13010. } );
  13011. }
  13012. } );
  13013. },
  13014. fix: function( originalEvent ) {
  13015. return originalEvent[ jQuery.expando ] ?
  13016. originalEvent :
  13017. new jQuery.Event( originalEvent );
  13018. },
  13019. special: {
  13020. load: {
  13021. // Prevent triggered image.load events from bubbling to window.load
  13022. noBubble: true
  13023. },
  13024. click: {
  13025. // Utilize native event to ensure correct state for checkable inputs
  13026. setup: function( data ) {
  13027. // For mutual compressibility with _default, replace `this` access with a local var.
  13028. // `|| data` is dead code meant only to preserve the variable through minification.
  13029. var el = this || data;
  13030. // Claim the first handler
  13031. if ( rcheckableType.test( el.type ) &&
  13032. el.click && nodeName( el, "input" ) ) {
  13033. // dataPriv.set( el, "click", ... )
  13034. leverageNative( el, "click", returnTrue );
  13035. }
  13036. // Return false to allow normal processing in the caller
  13037. return false;
  13038. },
  13039. trigger: function( data ) {
  13040. // For mutual compressibility with _default, replace `this` access with a local var.
  13041. // `|| data` is dead code meant only to preserve the variable through minification.
  13042. var el = this || data;
  13043. // Force setup before triggering a click
  13044. if ( rcheckableType.test( el.type ) &&
  13045. el.click && nodeName( el, "input" ) ) {
  13046. leverageNative( el, "click" );
  13047. }
  13048. // Return non-false to allow normal event-path propagation
  13049. return true;
  13050. },
  13051. // For cross-browser consistency, suppress native .click() on links
  13052. // Also prevent it if we're currently inside a leveraged native-event stack
  13053. _default: function( event ) {
  13054. var target = event.target;
  13055. return rcheckableType.test( target.type ) &&
  13056. target.click && nodeName( target, "input" ) &&
  13057. dataPriv.get( target, "click" ) ||
  13058. nodeName( target, "a" );
  13059. }
  13060. },
  13061. beforeunload: {
  13062. postDispatch: function( event ) {
  13063. // Support: Firefox 20+
  13064. // Firefox doesn't alert if the returnValue field is not set.
  13065. if ( event.result !== undefined && event.originalEvent ) {
  13066. event.originalEvent.returnValue = event.result;
  13067. }
  13068. }
  13069. }
  13070. }
  13071. };
  13072. // Ensure the presence of an event listener that handles manually-triggered
  13073. // synthetic events by interrupting progress until reinvoked in response to
  13074. // *native* events that it fires directly, ensuring that state changes have
  13075. // already occurred before other listeners are invoked.
  13076. function leverageNative( el, type, expectSync ) {
  13077. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13078. if ( !expectSync ) {
  13079. if ( dataPriv.get( el, type ) === undefined ) {
  13080. jQuery.event.add( el, type, returnTrue );
  13081. }
  13082. return;
  13083. }
  13084. // Register the controller as a special universal handler for all event namespaces
  13085. dataPriv.set( el, type, false );
  13086. jQuery.event.add( el, type, {
  13087. namespace: false,
  13088. handler: function( event ) {
  13089. var notAsync, result,
  13090. saved = dataPriv.get( this, type );
  13091. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13092. // Interrupt processing of the outer synthetic .trigger()ed event
  13093. // Saved data should be false in such cases, but might be a leftover capture object
  13094. // from an async native handler (gh-4350)
  13095. if ( !saved.length ) {
  13096. // Store arguments for use when handling the inner native event
  13097. // There will always be at least one argument (an event object), so this array
  13098. // will not be confused with a leftover capture object.
  13099. saved = slice.call( arguments );
  13100. dataPriv.set( this, type, saved );
  13101. // Trigger the native event and capture its result
  13102. // Support: IE <=9 - 11+
  13103. // focus() and blur() are asynchronous
  13104. notAsync = expectSync( this, type );
  13105. this[ type ]();
  13106. result = dataPriv.get( this, type );
  13107. if ( saved !== result || notAsync ) {
  13108. dataPriv.set( this, type, false );
  13109. } else {
  13110. result = {};
  13111. }
  13112. if ( saved !== result ) {
  13113. // Cancel the outer synthetic event
  13114. event.stopImmediatePropagation();
  13115. event.preventDefault();
  13116. return result.value;
  13117. }
  13118. // If this is an inner synthetic event for an event with a bubbling surrogate
  13119. // (focus or blur), assume that the surrogate already propagated from triggering the
  13120. // native event and prevent that from happening again here.
  13121. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13122. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13123. // less bad than duplication.
  13124. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13125. event.stopPropagation();
  13126. }
  13127. // If this is a native event triggered above, everything is now in order
  13128. // Fire an inner synthetic event with the original arguments
  13129. } else if ( saved.length ) {
  13130. // ...and capture the result
  13131. dataPriv.set( this, type, {
  13132. value: jQuery.event.trigger(
  13133. // Support: IE <=9 - 11+
  13134. // Extend with the prototype to reset the above stopImmediatePropagation()
  13135. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13136. saved.slice( 1 ),
  13137. this
  13138. )
  13139. } );
  13140. // Abort handling of the native event
  13141. event.stopImmediatePropagation();
  13142. }
  13143. }
  13144. } );
  13145. }
  13146. jQuery.removeEvent = function( elem, type, handle ) {
  13147. // This "if" is needed for plain objects
  13148. if ( elem.removeEventListener ) {
  13149. elem.removeEventListener( type, handle );
  13150. }
  13151. };
  13152. jQuery.Event = function( src, props ) {
  13153. // Allow instantiation without the 'new' keyword
  13154. if ( !( this instanceof jQuery.Event ) ) {
  13155. return new jQuery.Event( src, props );
  13156. }
  13157. // Event object
  13158. if ( src && src.type ) {
  13159. this.originalEvent = src;
  13160. this.type = src.type;
  13161. // Events bubbling up the document may have been marked as prevented
  13162. // by a handler lower down the tree; reflect the correct value.
  13163. this.isDefaultPrevented = src.defaultPrevented ||
  13164. src.defaultPrevented === undefined &&
  13165. // Support: Android <=2.3 only
  13166. src.returnValue === false ?
  13167. returnTrue :
  13168. returnFalse;
  13169. // Create target properties
  13170. // Support: Safari <=6 - 7 only
  13171. // Target should not be a text node (#504, #13143)
  13172. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13173. src.target.parentNode :
  13174. src.target;
  13175. this.currentTarget = src.currentTarget;
  13176. this.relatedTarget = src.relatedTarget;
  13177. // Event type
  13178. } else {
  13179. this.type = src;
  13180. }
  13181. // Put explicitly provided properties onto the event object
  13182. if ( props ) {
  13183. jQuery.extend( this, props );
  13184. }
  13185. // Create a timestamp if incoming event doesn't have one
  13186. this.timeStamp = src && src.timeStamp || Date.now();
  13187. // Mark it as fixed
  13188. this[ jQuery.expando ] = true;
  13189. };
  13190. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13191. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13192. jQuery.Event.prototype = {
  13193. constructor: jQuery.Event,
  13194. isDefaultPrevented: returnFalse,
  13195. isPropagationStopped: returnFalse,
  13196. isImmediatePropagationStopped: returnFalse,
  13197. isSimulated: false,
  13198. preventDefault: function() {
  13199. var e = this.originalEvent;
  13200. this.isDefaultPrevented = returnTrue;
  13201. if ( e && !this.isSimulated ) {
  13202. e.preventDefault();
  13203. }
  13204. },
  13205. stopPropagation: function() {
  13206. var e = this.originalEvent;
  13207. this.isPropagationStopped = returnTrue;
  13208. if ( e && !this.isSimulated ) {
  13209. e.stopPropagation();
  13210. }
  13211. },
  13212. stopImmediatePropagation: function() {
  13213. var e = this.originalEvent;
  13214. this.isImmediatePropagationStopped = returnTrue;
  13215. if ( e && !this.isSimulated ) {
  13216. e.stopImmediatePropagation();
  13217. }
  13218. this.stopPropagation();
  13219. }
  13220. };
  13221. // Includes all common event props including KeyEvent and MouseEvent specific props
  13222. jQuery.each( {
  13223. altKey: true,
  13224. bubbles: true,
  13225. cancelable: true,
  13226. changedTouches: true,
  13227. ctrlKey: true,
  13228. detail: true,
  13229. eventPhase: true,
  13230. metaKey: true,
  13231. pageX: true,
  13232. pageY: true,
  13233. shiftKey: true,
  13234. view: true,
  13235. "char": true,
  13236. code: true,
  13237. charCode: true,
  13238. key: true,
  13239. keyCode: true,
  13240. button: true,
  13241. buttons: true,
  13242. clientX: true,
  13243. clientY: true,
  13244. offsetX: true,
  13245. offsetY: true,
  13246. pointerId: true,
  13247. pointerType: true,
  13248. screenX: true,
  13249. screenY: true,
  13250. targetTouches: true,
  13251. toElement: true,
  13252. touches: true,
  13253. which: function( event ) {
  13254. var button = event.button;
  13255. // Add which for key events
  13256. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13257. return event.charCode != null ? event.charCode : event.keyCode;
  13258. }
  13259. // Add which for click: 1 === left; 2 === middle; 3 === right
  13260. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13261. if ( button & 1 ) {
  13262. return 1;
  13263. }
  13264. if ( button & 2 ) {
  13265. return 3;
  13266. }
  13267. if ( button & 4 ) {
  13268. return 2;
  13269. }
  13270. return 0;
  13271. }
  13272. return event.which;
  13273. }
  13274. }, jQuery.event.addProp );
  13275. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13276. jQuery.event.special[ type ] = {
  13277. // Utilize native event if possible so blur/focus sequence is correct
  13278. setup: function() {
  13279. // Claim the first handler
  13280. // dataPriv.set( this, "focus", ... )
  13281. // dataPriv.set( this, "blur", ... )
  13282. leverageNative( this, type, expectSync );
  13283. // Return false to allow normal processing in the caller
  13284. return false;
  13285. },
  13286. trigger: function() {
  13287. // Force setup before trigger
  13288. leverageNative( this, type );
  13289. // Return non-false to allow normal event-path propagation
  13290. return true;
  13291. },
  13292. delegateType: delegateType
  13293. };
  13294. } );
  13295. // Create mouseenter/leave events using mouseover/out and event-time checks
  13296. // so that event delegation works in jQuery.
  13297. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13298. //
  13299. // Support: Safari 7 only
  13300. // Safari sends mouseenter too often; see:
  13301. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13302. // for the description of the bug (it existed in older Chrome versions as well).
  13303. jQuery.each( {
  13304. mouseenter: "mouseover",
  13305. mouseleave: "mouseout",
  13306. pointerenter: "pointerover",
  13307. pointerleave: "pointerout"
  13308. }, function( orig, fix ) {
  13309. jQuery.event.special[ orig ] = {
  13310. delegateType: fix,
  13311. bindType: fix,
  13312. handle: function( event ) {
  13313. var ret,
  13314. target = this,
  13315. related = event.relatedTarget,
  13316. handleObj = event.handleObj;
  13317. // For mouseenter/leave call the handler if related is outside the target.
  13318. // NB: No relatedTarget if the mouse left/entered the browser window
  13319. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13320. event.type = handleObj.origType;
  13321. ret = handleObj.handler.apply( this, arguments );
  13322. event.type = fix;
  13323. }
  13324. return ret;
  13325. }
  13326. };
  13327. } );
  13328. jQuery.fn.extend( {
  13329. on: function( types, selector, data, fn ) {
  13330. return on( this, types, selector, data, fn );
  13331. },
  13332. one: function( types, selector, data, fn ) {
  13333. return on( this, types, selector, data, fn, 1 );
  13334. },
  13335. off: function( types, selector, fn ) {
  13336. var handleObj, type;
  13337. if ( types && types.preventDefault && types.handleObj ) {
  13338. // ( event ) dispatched jQuery.Event
  13339. handleObj = types.handleObj;
  13340. jQuery( types.delegateTarget ).off(
  13341. handleObj.namespace ?
  13342. handleObj.origType + "." + handleObj.namespace :
  13343. handleObj.origType,
  13344. handleObj.selector,
  13345. handleObj.handler
  13346. );
  13347. return this;
  13348. }
  13349. if ( typeof types === "object" ) {
  13350. // ( types-object [, selector] )
  13351. for ( type in types ) {
  13352. this.off( type, selector, types[ type ] );
  13353. }
  13354. return this;
  13355. }
  13356. if ( selector === false || typeof selector === "function" ) {
  13357. // ( types [, fn] )
  13358. fn = selector;
  13359. selector = undefined;
  13360. }
  13361. if ( fn === false ) {
  13362. fn = returnFalse;
  13363. }
  13364. return this.each( function() {
  13365. jQuery.event.remove( this, types, fn, selector );
  13366. } );
  13367. }
  13368. } );
  13369. var
  13370. /* eslint-disable max-len */
  13371. // See https://github.com/eslint/eslint/issues/3229
  13372. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13373. /* eslint-enable */
  13374. // Support: IE <=10 - 11, Edge 12 - 13 only
  13375. // In IE/Edge using regex groups here causes severe slowdowns.
  13376. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13377. rnoInnerhtml = /<script|<style|<link/i,
  13378. // checked="checked" or checked
  13379. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13380. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13381. // Prefer a tbody over its parent table for containing new rows
  13382. function manipulationTarget( elem, content ) {
  13383. if ( nodeName( elem, "table" ) &&
  13384. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13385. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13386. }
  13387. return elem;
  13388. }
  13389. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13390. function disableScript( elem ) {
  13391. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13392. return elem;
  13393. }
  13394. function restoreScript( elem ) {
  13395. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13396. elem.type = elem.type.slice( 5 );
  13397. } else {
  13398. elem.removeAttribute( "type" );
  13399. }
  13400. return elem;
  13401. }
  13402. function cloneCopyEvent( src, dest ) {
  13403. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13404. if ( dest.nodeType !== 1 ) {
  13405. return;
  13406. }
  13407. // 1. Copy private data: events, handlers, etc.
  13408. if ( dataPriv.hasData( src ) ) {
  13409. pdataOld = dataPriv.access( src );
  13410. pdataCur = dataPriv.set( dest, pdataOld );
  13411. events = pdataOld.events;
  13412. if ( events ) {
  13413. delete pdataCur.handle;
  13414. pdataCur.events = {};
  13415. for ( type in events ) {
  13416. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13417. jQuery.event.add( dest, type, events[ type ][ i ] );
  13418. }
  13419. }
  13420. }
  13421. }
  13422. // 2. Copy user data
  13423. if ( dataUser.hasData( src ) ) {
  13424. udataOld = dataUser.access( src );
  13425. udataCur = jQuery.extend( {}, udataOld );
  13426. dataUser.set( dest, udataCur );
  13427. }
  13428. }
  13429. // Fix IE bugs, see support tests
  13430. function fixInput( src, dest ) {
  13431. var nodeName = dest.nodeName.toLowerCase();
  13432. // Fails to persist the checked state of a cloned checkbox or radio button.
  13433. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13434. dest.checked = src.checked;
  13435. // Fails to return the selected option to the default selected state when cloning options
  13436. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13437. dest.defaultValue = src.defaultValue;
  13438. }
  13439. }
  13440. function domManip( collection, args, callback, ignored ) {
  13441. // Flatten any nested arrays
  13442. args = concat.apply( [], args );
  13443. var fragment, first, scripts, hasScripts, node, doc,
  13444. i = 0,
  13445. l = collection.length,
  13446. iNoClone = l - 1,
  13447. value = args[ 0 ],
  13448. valueIsFunction = isFunction( value );
  13449. // We can't cloneNode fragments that contain checked, in WebKit
  13450. if ( valueIsFunction ||
  13451. ( l > 1 && typeof value === "string" &&
  13452. !support.checkClone && rchecked.test( value ) ) ) {
  13453. return collection.each( function( index ) {
  13454. var self = collection.eq( index );
  13455. if ( valueIsFunction ) {
  13456. args[ 0 ] = value.call( this, index, self.html() );
  13457. }
  13458. domManip( self, args, callback, ignored );
  13459. } );
  13460. }
  13461. if ( l ) {
  13462. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13463. first = fragment.firstChild;
  13464. if ( fragment.childNodes.length === 1 ) {
  13465. fragment = first;
  13466. }
  13467. // Require either new content or an interest in ignored elements to invoke the callback
  13468. if ( first || ignored ) {
  13469. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13470. hasScripts = scripts.length;
  13471. // Use the original fragment for the last item
  13472. // instead of the first because it can end up
  13473. // being emptied incorrectly in certain situations (#8070).
  13474. for ( ; i < l; i++ ) {
  13475. node = fragment;
  13476. if ( i !== iNoClone ) {
  13477. node = jQuery.clone( node, true, true );
  13478. // Keep references to cloned scripts for later restoration
  13479. if ( hasScripts ) {
  13480. // Support: Android <=4.0 only, PhantomJS 1 only
  13481. // push.apply(_, arraylike) throws on ancient WebKit
  13482. jQuery.merge( scripts, getAll( node, "script" ) );
  13483. }
  13484. }
  13485. callback.call( collection[ i ], node, i );
  13486. }
  13487. if ( hasScripts ) {
  13488. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13489. // Reenable scripts
  13490. jQuery.map( scripts, restoreScript );
  13491. // Evaluate executable scripts on first document insertion
  13492. for ( i = 0; i < hasScripts; i++ ) {
  13493. node = scripts[ i ];
  13494. if ( rscriptType.test( node.type || "" ) &&
  13495. !dataPriv.access( node, "globalEval" ) &&
  13496. jQuery.contains( doc, node ) ) {
  13497. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13498. // Optional AJAX dependency, but won't run scripts if not present
  13499. if ( jQuery._evalUrl && !node.noModule ) {
  13500. jQuery._evalUrl( node.src, {
  13501. nonce: node.nonce || node.getAttribute( "nonce" )
  13502. } );
  13503. }
  13504. } else {
  13505. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13506. }
  13507. }
  13508. }
  13509. }
  13510. }
  13511. }
  13512. return collection;
  13513. }
  13514. function remove( elem, selector, keepData ) {
  13515. var node,
  13516. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13517. i = 0;
  13518. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13519. if ( !keepData && node.nodeType === 1 ) {
  13520. jQuery.cleanData( getAll( node ) );
  13521. }
  13522. if ( node.parentNode ) {
  13523. if ( keepData && isAttached( node ) ) {
  13524. setGlobalEval( getAll( node, "script" ) );
  13525. }
  13526. node.parentNode.removeChild( node );
  13527. }
  13528. }
  13529. return elem;
  13530. }
  13531. jQuery.extend( {
  13532. htmlPrefilter: function( html ) {
  13533. return html.replace( rxhtmlTag, "<$1></$2>" );
  13534. },
  13535. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13536. var i, l, srcElements, destElements,
  13537. clone = elem.cloneNode( true ),
  13538. inPage = isAttached( elem );
  13539. // Fix IE cloning issues
  13540. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13541. !jQuery.isXMLDoc( elem ) ) {
  13542. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13543. destElements = getAll( clone );
  13544. srcElements = getAll( elem );
  13545. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13546. fixInput( srcElements[ i ], destElements[ i ] );
  13547. }
  13548. }
  13549. // Copy the events from the original to the clone
  13550. if ( dataAndEvents ) {
  13551. if ( deepDataAndEvents ) {
  13552. srcElements = srcElements || getAll( elem );
  13553. destElements = destElements || getAll( clone );
  13554. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13555. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13556. }
  13557. } else {
  13558. cloneCopyEvent( elem, clone );
  13559. }
  13560. }
  13561. // Preserve script evaluation history
  13562. destElements = getAll( clone, "script" );
  13563. if ( destElements.length > 0 ) {
  13564. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13565. }
  13566. // Return the cloned set
  13567. return clone;
  13568. },
  13569. cleanData: function( elems ) {
  13570. var data, elem, type,
  13571. special = jQuery.event.special,
  13572. i = 0;
  13573. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13574. if ( acceptData( elem ) ) {
  13575. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13576. if ( data.events ) {
  13577. for ( type in data.events ) {
  13578. if ( special[ type ] ) {
  13579. jQuery.event.remove( elem, type );
  13580. // This is a shortcut to avoid jQuery.event.remove's overhead
  13581. } else {
  13582. jQuery.removeEvent( elem, type, data.handle );
  13583. }
  13584. }
  13585. }
  13586. // Support: Chrome <=35 - 45+
  13587. // Assign undefined instead of using delete, see Data#remove
  13588. elem[ dataPriv.expando ] = undefined;
  13589. }
  13590. if ( elem[ dataUser.expando ] ) {
  13591. // Support: Chrome <=35 - 45+
  13592. // Assign undefined instead of using delete, see Data#remove
  13593. elem[ dataUser.expando ] = undefined;
  13594. }
  13595. }
  13596. }
  13597. }
  13598. } );
  13599. jQuery.fn.extend( {
  13600. detach: function( selector ) {
  13601. return remove( this, selector, true );
  13602. },
  13603. remove: function( selector ) {
  13604. return remove( this, selector );
  13605. },
  13606. text: function( value ) {
  13607. return access( this, function( value ) {
  13608. return value === undefined ?
  13609. jQuery.text( this ) :
  13610. this.empty().each( function() {
  13611. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13612. this.textContent = value;
  13613. }
  13614. } );
  13615. }, null, value, arguments.length );
  13616. },
  13617. append: function() {
  13618. return domManip( this, arguments, function( elem ) {
  13619. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13620. var target = manipulationTarget( this, elem );
  13621. target.appendChild( elem );
  13622. }
  13623. } );
  13624. },
  13625. prepend: function() {
  13626. return domManip( this, arguments, function( elem ) {
  13627. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13628. var target = manipulationTarget( this, elem );
  13629. target.insertBefore( elem, target.firstChild );
  13630. }
  13631. } );
  13632. },
  13633. before: function() {
  13634. return domManip( this, arguments, function( elem ) {
  13635. if ( this.parentNode ) {
  13636. this.parentNode.insertBefore( elem, this );
  13637. }
  13638. } );
  13639. },
  13640. after: function() {
  13641. return domManip( this, arguments, function( elem ) {
  13642. if ( this.parentNode ) {
  13643. this.parentNode.insertBefore( elem, this.nextSibling );
  13644. }
  13645. } );
  13646. },
  13647. empty: function() {
  13648. var elem,
  13649. i = 0;
  13650. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13651. if ( elem.nodeType === 1 ) {
  13652. // Prevent memory leaks
  13653. jQuery.cleanData( getAll( elem, false ) );
  13654. // Remove any remaining nodes
  13655. elem.textContent = "";
  13656. }
  13657. }
  13658. return this;
  13659. },
  13660. clone: function( dataAndEvents, deepDataAndEvents ) {
  13661. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13662. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13663. return this.map( function() {
  13664. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13665. } );
  13666. },
  13667. html: function( value ) {
  13668. return access( this, function( value ) {
  13669. var elem = this[ 0 ] || {},
  13670. i = 0,
  13671. l = this.length;
  13672. if ( value === undefined && elem.nodeType === 1 ) {
  13673. return elem.innerHTML;
  13674. }
  13675. // See if we can take a shortcut and just use innerHTML
  13676. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13677. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13678. value = jQuery.htmlPrefilter( value );
  13679. try {
  13680. for ( ; i < l; i++ ) {
  13681. elem = this[ i ] || {};
  13682. // Remove element nodes and prevent memory leaks
  13683. if ( elem.nodeType === 1 ) {
  13684. jQuery.cleanData( getAll( elem, false ) );
  13685. elem.innerHTML = value;
  13686. }
  13687. }
  13688. elem = 0;
  13689. // If using innerHTML throws an exception, use the fallback method
  13690. } catch ( e ) {}
  13691. }
  13692. if ( elem ) {
  13693. this.empty().append( value );
  13694. }
  13695. }, null, value, arguments.length );
  13696. },
  13697. replaceWith: function() {
  13698. var ignored = [];
  13699. // Make the changes, replacing each non-ignored context element with the new content
  13700. return domManip( this, arguments, function( elem ) {
  13701. var parent = this.parentNode;
  13702. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13703. jQuery.cleanData( getAll( this ) );
  13704. if ( parent ) {
  13705. parent.replaceChild( elem, this );
  13706. }
  13707. }
  13708. // Force callback invocation
  13709. }, ignored );
  13710. }
  13711. } );
  13712. jQuery.each( {
  13713. appendTo: "append",
  13714. prependTo: "prepend",
  13715. insertBefore: "before",
  13716. insertAfter: "after",
  13717. replaceAll: "replaceWith"
  13718. }, function( name, original ) {
  13719. jQuery.fn[ name ] = function( selector ) {
  13720. var elems,
  13721. ret = [],
  13722. insert = jQuery( selector ),
  13723. last = insert.length - 1,
  13724. i = 0;
  13725. for ( ; i <= last; i++ ) {
  13726. elems = i === last ? this : this.clone( true );
  13727. jQuery( insert[ i ] )[ original ]( elems );
  13728. // Support: Android <=4.0 only, PhantomJS 1 only
  13729. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13730. push.apply( ret, elems.get() );
  13731. }
  13732. return this.pushStack( ret );
  13733. };
  13734. } );
  13735. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13736. var getStyles = function( elem ) {
  13737. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13738. // IE throws on elements created in popups
  13739. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13740. var view = elem.ownerDocument.defaultView;
  13741. if ( !view || !view.opener ) {
  13742. view = window;
  13743. }
  13744. return view.getComputedStyle( elem );
  13745. };
  13746. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13747. ( function() {
  13748. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13749. // so they're executed at the same time to save the second computation.
  13750. function computeStyleTests() {
  13751. // This is a singleton, we need to execute it only once
  13752. if ( !div ) {
  13753. return;
  13754. }
  13755. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13756. "margin-top:1px;padding:0;border:0";
  13757. div.style.cssText =
  13758. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13759. "margin:auto;border:1px;padding:1px;" +
  13760. "width:60%;top:1%";
  13761. documentElement.appendChild( container ).appendChild( div );
  13762. var divStyle = window.getComputedStyle( div );
  13763. pixelPositionVal = divStyle.top !== "1%";
  13764. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13765. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13766. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13767. // Some styles come back with percentage values, even though they shouldn't
  13768. div.style.right = "60%";
  13769. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13770. // Support: IE 9 - 11 only
  13771. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13772. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13773. // Support: IE 9 only
  13774. // Detect overflow:scroll screwiness (gh-3699)
  13775. // Support: Chrome <=64
  13776. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13777. div.style.position = "absolute";
  13778. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13779. documentElement.removeChild( container );
  13780. // Nullify the div so it wouldn't be stored in the memory and
  13781. // it will also be a sign that checks already performed
  13782. div = null;
  13783. }
  13784. function roundPixelMeasures( measure ) {
  13785. return Math.round( parseFloat( measure ) );
  13786. }
  13787. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13788. reliableMarginLeftVal,
  13789. container = document.createElement( "div" ),
  13790. div = document.createElement( "div" );
  13791. // Finish early in limited (non-browser) environments
  13792. if ( !div.style ) {
  13793. return;
  13794. }
  13795. // Support: IE <=9 - 11 only
  13796. // Style of cloned element affects source element cloned (#8908)
  13797. div.style.backgroundClip = "content-box";
  13798. div.cloneNode( true ).style.backgroundClip = "";
  13799. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13800. jQuery.extend( support, {
  13801. boxSizingReliable: function() {
  13802. computeStyleTests();
  13803. return boxSizingReliableVal;
  13804. },
  13805. pixelBoxStyles: function() {
  13806. computeStyleTests();
  13807. return pixelBoxStylesVal;
  13808. },
  13809. pixelPosition: function() {
  13810. computeStyleTests();
  13811. return pixelPositionVal;
  13812. },
  13813. reliableMarginLeft: function() {
  13814. computeStyleTests();
  13815. return reliableMarginLeftVal;
  13816. },
  13817. scrollboxSize: function() {
  13818. computeStyleTests();
  13819. return scrollboxSizeVal;
  13820. }
  13821. } );
  13822. } )();
  13823. function curCSS( elem, name, computed ) {
  13824. var width, minWidth, maxWidth, ret,
  13825. // Support: Firefox 51+
  13826. // Retrieving style before computed somehow
  13827. // fixes an issue with getting wrong values
  13828. // on detached elements
  13829. style = elem.style;
  13830. computed = computed || getStyles( elem );
  13831. // getPropertyValue is needed for:
  13832. // .css('filter') (IE 9 only, #12537)
  13833. // .css('--customProperty) (#3144)
  13834. if ( computed ) {
  13835. ret = computed.getPropertyValue( name ) || computed[ name ];
  13836. if ( ret === "" && !isAttached( elem ) ) {
  13837. ret = jQuery.style( elem, name );
  13838. }
  13839. // A tribute to the "awesome hack by Dean Edwards"
  13840. // Android Browser returns percentage for some values,
  13841. // but width seems to be reliably pixels.
  13842. // This is against the CSSOM draft spec:
  13843. // https://drafts.csswg.org/cssom/#resolved-values
  13844. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13845. // Remember the original values
  13846. width = style.width;
  13847. minWidth = style.minWidth;
  13848. maxWidth = style.maxWidth;
  13849. // Put in the new values to get a computed value out
  13850. style.minWidth = style.maxWidth = style.width = ret;
  13851. ret = computed.width;
  13852. // Revert the changed values
  13853. style.width = width;
  13854. style.minWidth = minWidth;
  13855. style.maxWidth = maxWidth;
  13856. }
  13857. }
  13858. return ret !== undefined ?
  13859. // Support: IE <=9 - 11 only
  13860. // IE returns zIndex value as an integer.
  13861. ret + "" :
  13862. ret;
  13863. }
  13864. function addGetHookIf( conditionFn, hookFn ) {
  13865. // Define the hook, we'll check on the first run if it's really needed.
  13866. return {
  13867. get: function() {
  13868. if ( conditionFn() ) {
  13869. // Hook not needed (or it's not possible to use it due
  13870. // to missing dependency), remove it.
  13871. delete this.get;
  13872. return;
  13873. }
  13874. // Hook needed; redefine it so that the support test is not executed again.
  13875. return ( this.get = hookFn ).apply( this, arguments );
  13876. }
  13877. };
  13878. }
  13879. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13880. emptyStyle = document.createElement( "div" ).style,
  13881. vendorProps = {};
  13882. // Return a vendor-prefixed property or undefined
  13883. function vendorPropName( name ) {
  13884. // Check for vendor prefixed names
  13885. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13886. i = cssPrefixes.length;
  13887. while ( i-- ) {
  13888. name = cssPrefixes[ i ] + capName;
  13889. if ( name in emptyStyle ) {
  13890. return name;
  13891. }
  13892. }
  13893. }
  13894. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13895. function finalPropName( name ) {
  13896. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13897. if ( final ) {
  13898. return final;
  13899. }
  13900. if ( name in emptyStyle ) {
  13901. return name;
  13902. }
  13903. return vendorProps[ name ] = vendorPropName( name ) || name;
  13904. }
  13905. var
  13906. // Swappable if display is none or starts with table
  13907. // except "table", "table-cell", or "table-caption"
  13908. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13909. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13910. rcustomProp = /^--/,
  13911. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13912. cssNormalTransform = {
  13913. letterSpacing: "0",
  13914. fontWeight: "400"
  13915. };
  13916. function setPositiveNumber( elem, value, subtract ) {
  13917. // Any relative (+/-) values have already been
  13918. // normalized at this point
  13919. var matches = rcssNum.exec( value );
  13920. return matches ?
  13921. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13922. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13923. value;
  13924. }
  13925. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13926. var i = dimension === "width" ? 1 : 0,
  13927. extra = 0,
  13928. delta = 0;
  13929. // Adjustment may not be necessary
  13930. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13931. return 0;
  13932. }
  13933. for ( ; i < 4; i += 2 ) {
  13934. // Both box models exclude margin
  13935. if ( box === "margin" ) {
  13936. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13937. }
  13938. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13939. if ( !isBorderBox ) {
  13940. // Add padding
  13941. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13942. // For "border" or "margin", add border
  13943. if ( box !== "padding" ) {
  13944. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13945. // But still keep track of it otherwise
  13946. } else {
  13947. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13948. }
  13949. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13950. // "padding" or "margin"
  13951. } else {
  13952. // For "content", subtract padding
  13953. if ( box === "content" ) {
  13954. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13955. }
  13956. // For "content" or "padding", subtract border
  13957. if ( box !== "margin" ) {
  13958. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13959. }
  13960. }
  13961. }
  13962. // Account for positive content-box scroll gutter when requested by providing computedVal
  13963. if ( !isBorderBox && computedVal >= 0 ) {
  13964. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13965. // Assuming integer scroll gutter, subtract the rest and round down
  13966. delta += Math.max( 0, Math.ceil(
  13967. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13968. computedVal -
  13969. delta -
  13970. extra -
  13971. 0.5
  13972. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13973. // Use an explicit zero to avoid NaN (gh-3964)
  13974. ) ) || 0;
  13975. }
  13976. return delta;
  13977. }
  13978. function getWidthOrHeight( elem, dimension, extra ) {
  13979. // Start with computed style
  13980. var styles = getStyles( elem ),
  13981. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13982. // Fake content-box until we know it's needed to know the true value.
  13983. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13984. isBorderBox = boxSizingNeeded &&
  13985. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13986. valueIsBorderBox = isBorderBox,
  13987. val = curCSS( elem, dimension, styles ),
  13988. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13989. // Support: Firefox <=54
  13990. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13991. if ( rnumnonpx.test( val ) ) {
  13992. if ( !extra ) {
  13993. return val;
  13994. }
  13995. val = "auto";
  13996. }
  13997. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13998. // This happens for inline elements with no explicit setting (gh-3571)
  13999. // Support: Android <=4.1 - 4.3 only
  14000. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14001. // Support: IE 9-11 only
  14002. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14003. // We use getClientRects() to check for hidden/disconnected.
  14004. // In those cases, the computed value can be trusted to be border-box
  14005. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14006. val === "auto" ||
  14007. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14008. elem.getClientRects().length ) {
  14009. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14010. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14011. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14012. // retrieved value as a content box dimension.
  14013. valueIsBorderBox = offsetProp in elem;
  14014. if ( valueIsBorderBox ) {
  14015. val = elem[ offsetProp ];
  14016. }
  14017. }
  14018. // Normalize "" and auto
  14019. val = parseFloat( val ) || 0;
  14020. // Adjust for the element's box model
  14021. return ( val +
  14022. boxModelAdjustment(
  14023. elem,
  14024. dimension,
  14025. extra || ( isBorderBox ? "border" : "content" ),
  14026. valueIsBorderBox,
  14027. styles,
  14028. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14029. val
  14030. )
  14031. ) + "px";
  14032. }
  14033. jQuery.extend( {
  14034. // Add in style property hooks for overriding the default
  14035. // behavior of getting and setting a style property
  14036. cssHooks: {
  14037. opacity: {
  14038. get: function( elem, computed ) {
  14039. if ( computed ) {
  14040. // We should always get a number back from opacity
  14041. var ret = curCSS( elem, "opacity" );
  14042. return ret === "" ? "1" : ret;
  14043. }
  14044. }
  14045. }
  14046. },
  14047. // Don't automatically add "px" to these possibly-unitless properties
  14048. cssNumber: {
  14049. "animationIterationCount": true,
  14050. "columnCount": true,
  14051. "fillOpacity": true,
  14052. "flexGrow": true,
  14053. "flexShrink": true,
  14054. "fontWeight": true,
  14055. "gridArea": true,
  14056. "gridColumn": true,
  14057. "gridColumnEnd": true,
  14058. "gridColumnStart": true,
  14059. "gridRow": true,
  14060. "gridRowEnd": true,
  14061. "gridRowStart": true,
  14062. "lineHeight": true,
  14063. "opacity": true,
  14064. "order": true,
  14065. "orphans": true,
  14066. "widows": true,
  14067. "zIndex": true,
  14068. "zoom": true
  14069. },
  14070. // Add in properties whose names you wish to fix before
  14071. // setting or getting the value
  14072. cssProps: {},
  14073. // Get and set the style property on a DOM Node
  14074. style: function( elem, name, value, extra ) {
  14075. // Don't set styles on text and comment nodes
  14076. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14077. return;
  14078. }
  14079. // Make sure that we're working with the right name
  14080. var ret, type, hooks,
  14081. origName = camelCase( name ),
  14082. isCustomProp = rcustomProp.test( name ),
  14083. style = elem.style;
  14084. // Make sure that we're working with the right name. We don't
  14085. // want to query the value if it is a CSS custom property
  14086. // since they are user-defined.
  14087. if ( !isCustomProp ) {
  14088. name = finalPropName( origName );
  14089. }
  14090. // Gets hook for the prefixed version, then unprefixed version
  14091. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14092. // Check if we're setting a value
  14093. if ( value !== undefined ) {
  14094. type = typeof value;
  14095. // Convert "+=" or "-=" to relative numbers (#7345)
  14096. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14097. value = adjustCSS( elem, name, ret );
  14098. // Fixes bug #9237
  14099. type = "number";
  14100. }
  14101. // Make sure that null and NaN values aren't set (#7116)
  14102. if ( value == null || value !== value ) {
  14103. return;
  14104. }
  14105. // If a number was passed in, add the unit (except for certain CSS properties)
  14106. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14107. // "px" to a few hardcoded values.
  14108. if ( type === "number" && !isCustomProp ) {
  14109. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14110. }
  14111. // background-* props affect original clone's values
  14112. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14113. style[ name ] = "inherit";
  14114. }
  14115. // If a hook was provided, use that value, otherwise just set the specified value
  14116. if ( !hooks || !( "set" in hooks ) ||
  14117. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14118. if ( isCustomProp ) {
  14119. style.setProperty( name, value );
  14120. } else {
  14121. style[ name ] = value;
  14122. }
  14123. }
  14124. } else {
  14125. // If a hook was provided get the non-computed value from there
  14126. if ( hooks && "get" in hooks &&
  14127. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14128. return ret;
  14129. }
  14130. // Otherwise just get the value from the style object
  14131. return style[ name ];
  14132. }
  14133. },
  14134. css: function( elem, name, extra, styles ) {
  14135. var val, num, hooks,
  14136. origName = camelCase( name ),
  14137. isCustomProp = rcustomProp.test( name );
  14138. // Make sure that we're working with the right name. We don't
  14139. // want to modify the value if it is a CSS custom property
  14140. // since they are user-defined.
  14141. if ( !isCustomProp ) {
  14142. name = finalPropName( origName );
  14143. }
  14144. // Try prefixed name followed by the unprefixed name
  14145. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14146. // If a hook was provided get the computed value from there
  14147. if ( hooks && "get" in hooks ) {
  14148. val = hooks.get( elem, true, extra );
  14149. }
  14150. // Otherwise, if a way to get the computed value exists, use that
  14151. if ( val === undefined ) {
  14152. val = curCSS( elem, name, styles );
  14153. }
  14154. // Convert "normal" to computed value
  14155. if ( val === "normal" && name in cssNormalTransform ) {
  14156. val = cssNormalTransform[ name ];
  14157. }
  14158. // Make numeric if forced or a qualifier was provided and val looks numeric
  14159. if ( extra === "" || extra ) {
  14160. num = parseFloat( val );
  14161. return extra === true || isFinite( num ) ? num || 0 : val;
  14162. }
  14163. return val;
  14164. }
  14165. } );
  14166. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14167. jQuery.cssHooks[ dimension ] = {
  14168. get: function( elem, computed, extra ) {
  14169. if ( computed ) {
  14170. // Certain elements can have dimension info if we invisibly show them
  14171. // but it must have a current display style that would benefit
  14172. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14173. // Support: Safari 8+
  14174. // Table columns in Safari have non-zero offsetWidth & zero
  14175. // getBoundingClientRect().width unless display is changed.
  14176. // Support: IE <=11 only
  14177. // Running getBoundingClientRect on a disconnected node
  14178. // in IE throws an error.
  14179. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14180. swap( elem, cssShow, function() {
  14181. return getWidthOrHeight( elem, dimension, extra );
  14182. } ) :
  14183. getWidthOrHeight( elem, dimension, extra );
  14184. }
  14185. },
  14186. set: function( elem, value, extra ) {
  14187. var matches,
  14188. styles = getStyles( elem ),
  14189. // Only read styles.position if the test has a chance to fail
  14190. // to avoid forcing a reflow.
  14191. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14192. styles.position === "absolute",
  14193. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14194. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14195. isBorderBox = boxSizingNeeded &&
  14196. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14197. subtract = extra ?
  14198. boxModelAdjustment(
  14199. elem,
  14200. dimension,
  14201. extra,
  14202. isBorderBox,
  14203. styles
  14204. ) :
  14205. 0;
  14206. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14207. // faking a content-box to get border and padding (gh-3699)
  14208. if ( isBorderBox && scrollboxSizeBuggy ) {
  14209. subtract -= Math.ceil(
  14210. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14211. parseFloat( styles[ dimension ] ) -
  14212. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14213. 0.5
  14214. );
  14215. }
  14216. // Convert to pixels if value adjustment is needed
  14217. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14218. ( matches[ 3 ] || "px" ) !== "px" ) {
  14219. elem.style[ dimension ] = value;
  14220. value = jQuery.css( elem, dimension );
  14221. }
  14222. return setPositiveNumber( elem, value, subtract );
  14223. }
  14224. };
  14225. } );
  14226. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14227. function( elem, computed ) {
  14228. if ( computed ) {
  14229. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14230. elem.getBoundingClientRect().left -
  14231. swap( elem, { marginLeft: 0 }, function() {
  14232. return elem.getBoundingClientRect().left;
  14233. } )
  14234. ) + "px";
  14235. }
  14236. }
  14237. );
  14238. // These hooks are used by animate to expand properties
  14239. jQuery.each( {
  14240. margin: "",
  14241. padding: "",
  14242. border: "Width"
  14243. }, function( prefix, suffix ) {
  14244. jQuery.cssHooks[ prefix + suffix ] = {
  14245. expand: function( value ) {
  14246. var i = 0,
  14247. expanded = {},
  14248. // Assumes a single number if not a string
  14249. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14250. for ( ; i < 4; i++ ) {
  14251. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14252. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14253. }
  14254. return expanded;
  14255. }
  14256. };
  14257. if ( prefix !== "margin" ) {
  14258. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14259. }
  14260. } );
  14261. jQuery.fn.extend( {
  14262. css: function( name, value ) {
  14263. return access( this, function( elem, name, value ) {
  14264. var styles, len,
  14265. map = {},
  14266. i = 0;
  14267. if ( Array.isArray( name ) ) {
  14268. styles = getStyles( elem );
  14269. len = name.length;
  14270. for ( ; i < len; i++ ) {
  14271. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14272. }
  14273. return map;
  14274. }
  14275. return value !== undefined ?
  14276. jQuery.style( elem, name, value ) :
  14277. jQuery.css( elem, name );
  14278. }, name, value, arguments.length > 1 );
  14279. }
  14280. } );
  14281. function Tween( elem, options, prop, end, easing ) {
  14282. return new Tween.prototype.init( elem, options, prop, end, easing );
  14283. }
  14284. jQuery.Tween = Tween;
  14285. Tween.prototype = {
  14286. constructor: Tween,
  14287. init: function( elem, options, prop, end, easing, unit ) {
  14288. this.elem = elem;
  14289. this.prop = prop;
  14290. this.easing = easing || jQuery.easing._default;
  14291. this.options = options;
  14292. this.start = this.now = this.cur();
  14293. this.end = end;
  14294. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14295. },
  14296. cur: function() {
  14297. var hooks = Tween.propHooks[ this.prop ];
  14298. return hooks && hooks.get ?
  14299. hooks.get( this ) :
  14300. Tween.propHooks._default.get( this );
  14301. },
  14302. run: function( percent ) {
  14303. var eased,
  14304. hooks = Tween.propHooks[ this.prop ];
  14305. if ( this.options.duration ) {
  14306. this.pos = eased = jQuery.easing[ this.easing ](
  14307. percent, this.options.duration * percent, 0, 1, this.options.duration
  14308. );
  14309. } else {
  14310. this.pos = eased = percent;
  14311. }
  14312. this.now = ( this.end - this.start ) * eased + this.start;
  14313. if ( this.options.step ) {
  14314. this.options.step.call( this.elem, this.now, this );
  14315. }
  14316. if ( hooks && hooks.set ) {
  14317. hooks.set( this );
  14318. } else {
  14319. Tween.propHooks._default.set( this );
  14320. }
  14321. return this;
  14322. }
  14323. };
  14324. Tween.prototype.init.prototype = Tween.prototype;
  14325. Tween.propHooks = {
  14326. _default: {
  14327. get: function( tween ) {
  14328. var result;
  14329. // Use a property on the element directly when it is not a DOM element,
  14330. // or when there is no matching style property that exists.
  14331. if ( tween.elem.nodeType !== 1 ||
  14332. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14333. return tween.elem[ tween.prop ];
  14334. }
  14335. // Passing an empty string as a 3rd parameter to .css will automatically
  14336. // attempt a parseFloat and fallback to a string if the parse fails.
  14337. // Simple values such as "10px" are parsed to Float;
  14338. // complex values such as "rotate(1rad)" are returned as-is.
  14339. result = jQuery.css( tween.elem, tween.prop, "" );
  14340. // Empty strings, null, undefined and "auto" are converted to 0.
  14341. return !result || result === "auto" ? 0 : result;
  14342. },
  14343. set: function( tween ) {
  14344. // Use step hook for back compat.
  14345. // Use cssHook if its there.
  14346. // Use .style if available and use plain properties where available.
  14347. if ( jQuery.fx.step[ tween.prop ] ) {
  14348. jQuery.fx.step[ tween.prop ]( tween );
  14349. } else if ( tween.elem.nodeType === 1 && (
  14350. jQuery.cssHooks[ tween.prop ] ||
  14351. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14352. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14353. } else {
  14354. tween.elem[ tween.prop ] = tween.now;
  14355. }
  14356. }
  14357. }
  14358. };
  14359. // Support: IE <=9 only
  14360. // Panic based approach to setting things on disconnected nodes
  14361. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14362. set: function( tween ) {
  14363. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14364. tween.elem[ tween.prop ] = tween.now;
  14365. }
  14366. }
  14367. };
  14368. jQuery.easing = {
  14369. linear: function( p ) {
  14370. return p;
  14371. },
  14372. swing: function( p ) {
  14373. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14374. },
  14375. _default: "swing"
  14376. };
  14377. jQuery.fx = Tween.prototype.init;
  14378. // Back compat <1.8 extension point
  14379. jQuery.fx.step = {};
  14380. var
  14381. fxNow, inProgress,
  14382. rfxtypes = /^(?:toggle|show|hide)$/,
  14383. rrun = /queueHooks$/;
  14384. function schedule() {
  14385. if ( inProgress ) {
  14386. if ( document.hidden === false && window.requestAnimationFrame ) {
  14387. window.requestAnimationFrame( schedule );
  14388. } else {
  14389. window.setTimeout( schedule, jQuery.fx.interval );
  14390. }
  14391. jQuery.fx.tick();
  14392. }
  14393. }
  14394. // Animations created synchronously will run synchronously
  14395. function createFxNow() {
  14396. window.setTimeout( function() {
  14397. fxNow = undefined;
  14398. } );
  14399. return ( fxNow = Date.now() );
  14400. }
  14401. // Generate parameters to create a standard animation
  14402. function genFx( type, includeWidth ) {
  14403. var which,
  14404. i = 0,
  14405. attrs = { height: type };
  14406. // If we include width, step value is 1 to do all cssExpand values,
  14407. // otherwise step value is 2 to skip over Left and Right
  14408. includeWidth = includeWidth ? 1 : 0;
  14409. for ( ; i < 4; i += 2 - includeWidth ) {
  14410. which = cssExpand[ i ];
  14411. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14412. }
  14413. if ( includeWidth ) {
  14414. attrs.opacity = attrs.width = type;
  14415. }
  14416. return attrs;
  14417. }
  14418. function createTween( value, prop, animation ) {
  14419. var tween,
  14420. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14421. index = 0,
  14422. length = collection.length;
  14423. for ( ; index < length; index++ ) {
  14424. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14425. // We're done with this property
  14426. return tween;
  14427. }
  14428. }
  14429. }
  14430. function defaultPrefilter( elem, props, opts ) {
  14431. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14432. isBox = "width" in props || "height" in props,
  14433. anim = this,
  14434. orig = {},
  14435. style = elem.style,
  14436. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14437. dataShow = dataPriv.get( elem, "fxshow" );
  14438. // Queue-skipping animations hijack the fx hooks
  14439. if ( !opts.queue ) {
  14440. hooks = jQuery._queueHooks( elem, "fx" );
  14441. if ( hooks.unqueued == null ) {
  14442. hooks.unqueued = 0;
  14443. oldfire = hooks.empty.fire;
  14444. hooks.empty.fire = function() {
  14445. if ( !hooks.unqueued ) {
  14446. oldfire();
  14447. }
  14448. };
  14449. }
  14450. hooks.unqueued++;
  14451. anim.always( function() {
  14452. // Ensure the complete handler is called before this completes
  14453. anim.always( function() {
  14454. hooks.unqueued--;
  14455. if ( !jQuery.queue( elem, "fx" ).length ) {
  14456. hooks.empty.fire();
  14457. }
  14458. } );
  14459. } );
  14460. }
  14461. // Detect show/hide animations
  14462. for ( prop in props ) {
  14463. value = props[ prop ];
  14464. if ( rfxtypes.test( value ) ) {
  14465. delete props[ prop ];
  14466. toggle = toggle || value === "toggle";
  14467. if ( value === ( hidden ? "hide" : "show" ) ) {
  14468. // Pretend to be hidden if this is a "show" and
  14469. // there is still data from a stopped show/hide
  14470. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14471. hidden = true;
  14472. // Ignore all other no-op show/hide data
  14473. } else {
  14474. continue;
  14475. }
  14476. }
  14477. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14478. }
  14479. }
  14480. // Bail out if this is a no-op like .hide().hide()
  14481. propTween = !jQuery.isEmptyObject( props );
  14482. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14483. return;
  14484. }
  14485. // Restrict "overflow" and "display" styles during box animations
  14486. if ( isBox && elem.nodeType === 1 ) {
  14487. // Support: IE <=9 - 11, Edge 12 - 15
  14488. // Record all 3 overflow attributes because IE does not infer the shorthand
  14489. // from identically-valued overflowX and overflowY and Edge just mirrors
  14490. // the overflowX value there.
  14491. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14492. // Identify a display type, preferring old show/hide data over the CSS cascade
  14493. restoreDisplay = dataShow && dataShow.display;
  14494. if ( restoreDisplay == null ) {
  14495. restoreDisplay = dataPriv.get( elem, "display" );
  14496. }
  14497. display = jQuery.css( elem, "display" );
  14498. if ( display === "none" ) {
  14499. if ( restoreDisplay ) {
  14500. display = restoreDisplay;
  14501. } else {
  14502. // Get nonempty value(s) by temporarily forcing visibility
  14503. showHide( [ elem ], true );
  14504. restoreDisplay = elem.style.display || restoreDisplay;
  14505. display = jQuery.css( elem, "display" );
  14506. showHide( [ elem ] );
  14507. }
  14508. }
  14509. // Animate inline elements as inline-block
  14510. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14511. if ( jQuery.css( elem, "float" ) === "none" ) {
  14512. // Restore the original display value at the end of pure show/hide animations
  14513. if ( !propTween ) {
  14514. anim.done( function() {
  14515. style.display = restoreDisplay;
  14516. } );
  14517. if ( restoreDisplay == null ) {
  14518. display = style.display;
  14519. restoreDisplay = display === "none" ? "" : display;
  14520. }
  14521. }
  14522. style.display = "inline-block";
  14523. }
  14524. }
  14525. }
  14526. if ( opts.overflow ) {
  14527. style.overflow = "hidden";
  14528. anim.always( function() {
  14529. style.overflow = opts.overflow[ 0 ];
  14530. style.overflowX = opts.overflow[ 1 ];
  14531. style.overflowY = opts.overflow[ 2 ];
  14532. } );
  14533. }
  14534. // Implement show/hide animations
  14535. propTween = false;
  14536. for ( prop in orig ) {
  14537. // General show/hide setup for this element animation
  14538. if ( !propTween ) {
  14539. if ( dataShow ) {
  14540. if ( "hidden" in dataShow ) {
  14541. hidden = dataShow.hidden;
  14542. }
  14543. } else {
  14544. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14545. }
  14546. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14547. if ( toggle ) {
  14548. dataShow.hidden = !hidden;
  14549. }
  14550. // Show elements before animating them
  14551. if ( hidden ) {
  14552. showHide( [ elem ], true );
  14553. }
  14554. /* eslint-disable no-loop-func */
  14555. anim.done( function() {
  14556. /* eslint-enable no-loop-func */
  14557. // The final step of a "hide" animation is actually hiding the element
  14558. if ( !hidden ) {
  14559. showHide( [ elem ] );
  14560. }
  14561. dataPriv.remove( elem, "fxshow" );
  14562. for ( prop in orig ) {
  14563. jQuery.style( elem, prop, orig[ prop ] );
  14564. }
  14565. } );
  14566. }
  14567. // Per-property setup
  14568. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14569. if ( !( prop in dataShow ) ) {
  14570. dataShow[ prop ] = propTween.start;
  14571. if ( hidden ) {
  14572. propTween.end = propTween.start;
  14573. propTween.start = 0;
  14574. }
  14575. }
  14576. }
  14577. }
  14578. function propFilter( props, specialEasing ) {
  14579. var index, name, easing, value, hooks;
  14580. // camelCase, specialEasing and expand cssHook pass
  14581. for ( index in props ) {
  14582. name = camelCase( index );
  14583. easing = specialEasing[ name ];
  14584. value = props[ index ];
  14585. if ( Array.isArray( value ) ) {
  14586. easing = value[ 1 ];
  14587. value = props[ index ] = value[ 0 ];
  14588. }
  14589. if ( index !== name ) {
  14590. props[ name ] = value;
  14591. delete props[ index ];
  14592. }
  14593. hooks = jQuery.cssHooks[ name ];
  14594. if ( hooks && "expand" in hooks ) {
  14595. value = hooks.expand( value );
  14596. delete props[ name ];
  14597. // Not quite $.extend, this won't overwrite existing keys.
  14598. // Reusing 'index' because we have the correct "name"
  14599. for ( index in value ) {
  14600. if ( !( index in props ) ) {
  14601. props[ index ] = value[ index ];
  14602. specialEasing[ index ] = easing;
  14603. }
  14604. }
  14605. } else {
  14606. specialEasing[ name ] = easing;
  14607. }
  14608. }
  14609. }
  14610. function Animation( elem, properties, options ) {
  14611. var result,
  14612. stopped,
  14613. index = 0,
  14614. length = Animation.prefilters.length,
  14615. deferred = jQuery.Deferred().always( function() {
  14616. // Don't match elem in the :animated selector
  14617. delete tick.elem;
  14618. } ),
  14619. tick = function() {
  14620. if ( stopped ) {
  14621. return false;
  14622. }
  14623. var currentTime = fxNow || createFxNow(),
  14624. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14625. // Support: Android 2.3 only
  14626. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14627. temp = remaining / animation.duration || 0,
  14628. percent = 1 - temp,
  14629. index = 0,
  14630. length = animation.tweens.length;
  14631. for ( ; index < length; index++ ) {
  14632. animation.tweens[ index ].run( percent );
  14633. }
  14634. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14635. // If there's more to do, yield
  14636. if ( percent < 1 && length ) {
  14637. return remaining;
  14638. }
  14639. // If this was an empty animation, synthesize a final progress notification
  14640. if ( !length ) {
  14641. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14642. }
  14643. // Resolve the animation and report its conclusion
  14644. deferred.resolveWith( elem, [ animation ] );
  14645. return false;
  14646. },
  14647. animation = deferred.promise( {
  14648. elem: elem,
  14649. props: jQuery.extend( {}, properties ),
  14650. opts: jQuery.extend( true, {
  14651. specialEasing: {},
  14652. easing: jQuery.easing._default
  14653. }, options ),
  14654. originalProperties: properties,
  14655. originalOptions: options,
  14656. startTime: fxNow || createFxNow(),
  14657. duration: options.duration,
  14658. tweens: [],
  14659. createTween: function( prop, end ) {
  14660. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14661. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14662. animation.tweens.push( tween );
  14663. return tween;
  14664. },
  14665. stop: function( gotoEnd ) {
  14666. var index = 0,
  14667. // If we are going to the end, we want to run all the tweens
  14668. // otherwise we skip this part
  14669. length = gotoEnd ? animation.tweens.length : 0;
  14670. if ( stopped ) {
  14671. return this;
  14672. }
  14673. stopped = true;
  14674. for ( ; index < length; index++ ) {
  14675. animation.tweens[ index ].run( 1 );
  14676. }
  14677. // Resolve when we played the last frame; otherwise, reject
  14678. if ( gotoEnd ) {
  14679. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14680. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14681. } else {
  14682. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14683. }
  14684. return this;
  14685. }
  14686. } ),
  14687. props = animation.props;
  14688. propFilter( props, animation.opts.specialEasing );
  14689. for ( ; index < length; index++ ) {
  14690. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14691. if ( result ) {
  14692. if ( isFunction( result.stop ) ) {
  14693. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14694. result.stop.bind( result );
  14695. }
  14696. return result;
  14697. }
  14698. }
  14699. jQuery.map( props, createTween, animation );
  14700. if ( isFunction( animation.opts.start ) ) {
  14701. animation.opts.start.call( elem, animation );
  14702. }
  14703. // Attach callbacks from options
  14704. animation
  14705. .progress( animation.opts.progress )
  14706. .done( animation.opts.done, animation.opts.complete )
  14707. .fail( animation.opts.fail )
  14708. .always( animation.opts.always );
  14709. jQuery.fx.timer(
  14710. jQuery.extend( tick, {
  14711. elem: elem,
  14712. anim: animation,
  14713. queue: animation.opts.queue
  14714. } )
  14715. );
  14716. return animation;
  14717. }
  14718. jQuery.Animation = jQuery.extend( Animation, {
  14719. tweeners: {
  14720. "*": [ function( prop, value ) {
  14721. var tween = this.createTween( prop, value );
  14722. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14723. return tween;
  14724. } ]
  14725. },
  14726. tweener: function( props, callback ) {
  14727. if ( isFunction( props ) ) {
  14728. callback = props;
  14729. props = [ "*" ];
  14730. } else {
  14731. props = props.match( rnothtmlwhite );
  14732. }
  14733. var prop,
  14734. index = 0,
  14735. length = props.length;
  14736. for ( ; index < length; index++ ) {
  14737. prop = props[ index ];
  14738. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14739. Animation.tweeners[ prop ].unshift( callback );
  14740. }
  14741. },
  14742. prefilters: [ defaultPrefilter ],
  14743. prefilter: function( callback, prepend ) {
  14744. if ( prepend ) {
  14745. Animation.prefilters.unshift( callback );
  14746. } else {
  14747. Animation.prefilters.push( callback );
  14748. }
  14749. }
  14750. } );
  14751. jQuery.speed = function( speed, easing, fn ) {
  14752. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14753. complete: fn || !fn && easing ||
  14754. isFunction( speed ) && speed,
  14755. duration: speed,
  14756. easing: fn && easing || easing && !isFunction( easing ) && easing
  14757. };
  14758. // Go to the end state if fx are off
  14759. if ( jQuery.fx.off ) {
  14760. opt.duration = 0;
  14761. } else {
  14762. if ( typeof opt.duration !== "number" ) {
  14763. if ( opt.duration in jQuery.fx.speeds ) {
  14764. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14765. } else {
  14766. opt.duration = jQuery.fx.speeds._default;
  14767. }
  14768. }
  14769. }
  14770. // Normalize opt.queue - true/undefined/null -> "fx"
  14771. if ( opt.queue == null || opt.queue === true ) {
  14772. opt.queue = "fx";
  14773. }
  14774. // Queueing
  14775. opt.old = opt.complete;
  14776. opt.complete = function() {
  14777. if ( isFunction( opt.old ) ) {
  14778. opt.old.call( this );
  14779. }
  14780. if ( opt.queue ) {
  14781. jQuery.dequeue( this, opt.queue );
  14782. }
  14783. };
  14784. return opt;
  14785. };
  14786. jQuery.fn.extend( {
  14787. fadeTo: function( speed, to, easing, callback ) {
  14788. // Show any hidden elements after setting opacity to 0
  14789. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14790. // Animate to the value specified
  14791. .end().animate( { opacity: to }, speed, easing, callback );
  14792. },
  14793. animate: function( prop, speed, easing, callback ) {
  14794. var empty = jQuery.isEmptyObject( prop ),
  14795. optall = jQuery.speed( speed, easing, callback ),
  14796. doAnimation = function() {
  14797. // Operate on a copy of prop so per-property easing won't be lost
  14798. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14799. // Empty animations, or finishing resolves immediately
  14800. if ( empty || dataPriv.get( this, "finish" ) ) {
  14801. anim.stop( true );
  14802. }
  14803. };
  14804. doAnimation.finish = doAnimation;
  14805. return empty || optall.queue === false ?
  14806. this.each( doAnimation ) :
  14807. this.queue( optall.queue, doAnimation );
  14808. },
  14809. stop: function( type, clearQueue, gotoEnd ) {
  14810. var stopQueue = function( hooks ) {
  14811. var stop = hooks.stop;
  14812. delete hooks.stop;
  14813. stop( gotoEnd );
  14814. };
  14815. if ( typeof type !== "string" ) {
  14816. gotoEnd = clearQueue;
  14817. clearQueue = type;
  14818. type = undefined;
  14819. }
  14820. if ( clearQueue && type !== false ) {
  14821. this.queue( type || "fx", [] );
  14822. }
  14823. return this.each( function() {
  14824. var dequeue = true,
  14825. index = type != null && type + "queueHooks",
  14826. timers = jQuery.timers,
  14827. data = dataPriv.get( this );
  14828. if ( index ) {
  14829. if ( data[ index ] && data[ index ].stop ) {
  14830. stopQueue( data[ index ] );
  14831. }
  14832. } else {
  14833. for ( index in data ) {
  14834. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14835. stopQueue( data[ index ] );
  14836. }
  14837. }
  14838. }
  14839. for ( index = timers.length; index--; ) {
  14840. if ( timers[ index ].elem === this &&
  14841. ( type == null || timers[ index ].queue === type ) ) {
  14842. timers[ index ].anim.stop( gotoEnd );
  14843. dequeue = false;
  14844. timers.splice( index, 1 );
  14845. }
  14846. }
  14847. // Start the next in the queue if the last step wasn't forced.
  14848. // Timers currently will call their complete callbacks, which
  14849. // will dequeue but only if they were gotoEnd.
  14850. if ( dequeue || !gotoEnd ) {
  14851. jQuery.dequeue( this, type );
  14852. }
  14853. } );
  14854. },
  14855. finish: function( type ) {
  14856. if ( type !== false ) {
  14857. type = type || "fx";
  14858. }
  14859. return this.each( function() {
  14860. var index,
  14861. data = dataPriv.get( this ),
  14862. queue = data[ type + "queue" ],
  14863. hooks = data[ type + "queueHooks" ],
  14864. timers = jQuery.timers,
  14865. length = queue ? queue.length : 0;
  14866. // Enable finishing flag on private data
  14867. data.finish = true;
  14868. // Empty the queue first
  14869. jQuery.queue( this, type, [] );
  14870. if ( hooks && hooks.stop ) {
  14871. hooks.stop.call( this, true );
  14872. }
  14873. // Look for any active animations, and finish them
  14874. for ( index = timers.length; index--; ) {
  14875. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14876. timers[ index ].anim.stop( true );
  14877. timers.splice( index, 1 );
  14878. }
  14879. }
  14880. // Look for any animations in the old queue and finish them
  14881. for ( index = 0; index < length; index++ ) {
  14882. if ( queue[ index ] && queue[ index ].finish ) {
  14883. queue[ index ].finish.call( this );
  14884. }
  14885. }
  14886. // Turn off finishing flag
  14887. delete data.finish;
  14888. } );
  14889. }
  14890. } );
  14891. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14892. var cssFn = jQuery.fn[ name ];
  14893. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14894. return speed == null || typeof speed === "boolean" ?
  14895. cssFn.apply( this, arguments ) :
  14896. this.animate( genFx( name, true ), speed, easing, callback );
  14897. };
  14898. } );
  14899. // Generate shortcuts for custom animations
  14900. jQuery.each( {
  14901. slideDown: genFx( "show" ),
  14902. slideUp: genFx( "hide" ),
  14903. slideToggle: genFx( "toggle" ),
  14904. fadeIn: { opacity: "show" },
  14905. fadeOut: { opacity: "hide" },
  14906. fadeToggle: { opacity: "toggle" }
  14907. }, function( name, props ) {
  14908. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14909. return this.animate( props, speed, easing, callback );
  14910. };
  14911. } );
  14912. jQuery.timers = [];
  14913. jQuery.fx.tick = function() {
  14914. var timer,
  14915. i = 0,
  14916. timers = jQuery.timers;
  14917. fxNow = Date.now();
  14918. for ( ; i < timers.length; i++ ) {
  14919. timer = timers[ i ];
  14920. // Run the timer and safely remove it when done (allowing for external removal)
  14921. if ( !timer() && timers[ i ] === timer ) {
  14922. timers.splice( i--, 1 );
  14923. }
  14924. }
  14925. if ( !timers.length ) {
  14926. jQuery.fx.stop();
  14927. }
  14928. fxNow = undefined;
  14929. };
  14930. jQuery.fx.timer = function( timer ) {
  14931. jQuery.timers.push( timer );
  14932. jQuery.fx.start();
  14933. };
  14934. jQuery.fx.interval = 13;
  14935. jQuery.fx.start = function() {
  14936. if ( inProgress ) {
  14937. return;
  14938. }
  14939. inProgress = true;
  14940. schedule();
  14941. };
  14942. jQuery.fx.stop = function() {
  14943. inProgress = null;
  14944. };
  14945. jQuery.fx.speeds = {
  14946. slow: 600,
  14947. fast: 200,
  14948. // Default speed
  14949. _default: 400
  14950. };
  14951. // Based off of the plugin by Clint Helfers, with permission.
  14952. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14953. jQuery.fn.delay = function( time, type ) {
  14954. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14955. type = type || "fx";
  14956. return this.queue( type, function( next, hooks ) {
  14957. var timeout = window.setTimeout( next, time );
  14958. hooks.stop = function() {
  14959. window.clearTimeout( timeout );
  14960. };
  14961. } );
  14962. };
  14963. ( function() {
  14964. var input = document.createElement( "input" ),
  14965. select = document.createElement( "select" ),
  14966. opt = select.appendChild( document.createElement( "option" ) );
  14967. input.type = "checkbox";
  14968. // Support: Android <=4.3 only
  14969. // Default value for a checkbox should be "on"
  14970. support.checkOn = input.value !== "";
  14971. // Support: IE <=11 only
  14972. // Must access selectedIndex to make default options select
  14973. support.optSelected = opt.selected;
  14974. // Support: IE <=11 only
  14975. // An input loses its value after becoming a radio
  14976. input = document.createElement( "input" );
  14977. input.value = "t";
  14978. input.type = "radio";
  14979. support.radioValue = input.value === "t";
  14980. } )();
  14981. var boolHook,
  14982. attrHandle = jQuery.expr.attrHandle;
  14983. jQuery.fn.extend( {
  14984. attr: function( name, value ) {
  14985. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14986. },
  14987. removeAttr: function( name ) {
  14988. return this.each( function() {
  14989. jQuery.removeAttr( this, name );
  14990. } );
  14991. }
  14992. } );
  14993. jQuery.extend( {
  14994. attr: function( elem, name, value ) {
  14995. var ret, hooks,
  14996. nType = elem.nodeType;
  14997. // Don't get/set attributes on text, comment and attribute nodes
  14998. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14999. return;
  15000. }
  15001. // Fallback to prop when attributes are not supported
  15002. if ( typeof elem.getAttribute === "undefined" ) {
  15003. return jQuery.prop( elem, name, value );
  15004. }
  15005. // Attribute hooks are determined by the lowercase version
  15006. // Grab necessary hook if one is defined
  15007. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15008. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15009. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15010. }
  15011. if ( value !== undefined ) {
  15012. if ( value === null ) {
  15013. jQuery.removeAttr( elem, name );
  15014. return;
  15015. }
  15016. if ( hooks && "set" in hooks &&
  15017. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15018. return ret;
  15019. }
  15020. elem.setAttribute( name, value + "" );
  15021. return value;
  15022. }
  15023. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15024. return ret;
  15025. }
  15026. ret = jQuery.find.attr( elem, name );
  15027. // Non-existent attributes return null, we normalize to undefined
  15028. return ret == null ? undefined : ret;
  15029. },
  15030. attrHooks: {
  15031. type: {
  15032. set: function( elem, value ) {
  15033. if ( !support.radioValue && value === "radio" &&
  15034. nodeName( elem, "input" ) ) {
  15035. var val = elem.value;
  15036. elem.setAttribute( "type", value );
  15037. if ( val ) {
  15038. elem.value = val;
  15039. }
  15040. return value;
  15041. }
  15042. }
  15043. }
  15044. },
  15045. removeAttr: function( elem, value ) {
  15046. var name,
  15047. i = 0,
  15048. // Attribute names can contain non-HTML whitespace characters
  15049. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15050. attrNames = value && value.match( rnothtmlwhite );
  15051. if ( attrNames && elem.nodeType === 1 ) {
  15052. while ( ( name = attrNames[ i++ ] ) ) {
  15053. elem.removeAttribute( name );
  15054. }
  15055. }
  15056. }
  15057. } );
  15058. // Hooks for boolean attributes
  15059. boolHook = {
  15060. set: function( elem, value, name ) {
  15061. if ( value === false ) {
  15062. // Remove boolean attributes when set to false
  15063. jQuery.removeAttr( elem, name );
  15064. } else {
  15065. elem.setAttribute( name, name );
  15066. }
  15067. return name;
  15068. }
  15069. };
  15070. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15071. var getter = attrHandle[ name ] || jQuery.find.attr;
  15072. attrHandle[ name ] = function( elem, name, isXML ) {
  15073. var ret, handle,
  15074. lowercaseName = name.toLowerCase();
  15075. if ( !isXML ) {
  15076. // Avoid an infinite loop by temporarily removing this function from the getter
  15077. handle = attrHandle[ lowercaseName ];
  15078. attrHandle[ lowercaseName ] = ret;
  15079. ret = getter( elem, name, isXML ) != null ?
  15080. lowercaseName :
  15081. null;
  15082. attrHandle[ lowercaseName ] = handle;
  15083. }
  15084. return ret;
  15085. };
  15086. } );
  15087. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15088. rclickable = /^(?:a|area)$/i;
  15089. jQuery.fn.extend( {
  15090. prop: function( name, value ) {
  15091. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15092. },
  15093. removeProp: function( name ) {
  15094. return this.each( function() {
  15095. delete this[ jQuery.propFix[ name ] || name ];
  15096. } );
  15097. }
  15098. } );
  15099. jQuery.extend( {
  15100. prop: function( elem, name, value ) {
  15101. var ret, hooks,
  15102. nType = elem.nodeType;
  15103. // Don't get/set properties on text, comment and attribute nodes
  15104. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15105. return;
  15106. }
  15107. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15108. // Fix name and attach hooks
  15109. name = jQuery.propFix[ name ] || name;
  15110. hooks = jQuery.propHooks[ name ];
  15111. }
  15112. if ( value !== undefined ) {
  15113. if ( hooks && "set" in hooks &&
  15114. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15115. return ret;
  15116. }
  15117. return ( elem[ name ] = value );
  15118. }
  15119. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15120. return ret;
  15121. }
  15122. return elem[ name ];
  15123. },
  15124. propHooks: {
  15125. tabIndex: {
  15126. get: function( elem ) {
  15127. // Support: IE <=9 - 11 only
  15128. // elem.tabIndex doesn't always return the
  15129. // correct value when it hasn't been explicitly set
  15130. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15131. // Use proper attribute retrieval(#12072)
  15132. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15133. if ( tabindex ) {
  15134. return parseInt( tabindex, 10 );
  15135. }
  15136. if (
  15137. rfocusable.test( elem.nodeName ) ||
  15138. rclickable.test( elem.nodeName ) &&
  15139. elem.href
  15140. ) {
  15141. return 0;
  15142. }
  15143. return -1;
  15144. }
  15145. }
  15146. },
  15147. propFix: {
  15148. "for": "htmlFor",
  15149. "class": "className"
  15150. }
  15151. } );
  15152. // Support: IE <=11 only
  15153. // Accessing the selectedIndex property
  15154. // forces the browser to respect setting selected
  15155. // on the option
  15156. // The getter ensures a default option is selected
  15157. // when in an optgroup
  15158. // eslint rule "no-unused-expressions" is disabled for this code
  15159. // since it considers such accessions noop
  15160. if ( !support.optSelected ) {
  15161. jQuery.propHooks.selected = {
  15162. get: function( elem ) {
  15163. /* eslint no-unused-expressions: "off" */
  15164. var parent = elem.parentNode;
  15165. if ( parent && parent.parentNode ) {
  15166. parent.parentNode.selectedIndex;
  15167. }
  15168. return null;
  15169. },
  15170. set: function( elem ) {
  15171. /* eslint no-unused-expressions: "off" */
  15172. var parent = elem.parentNode;
  15173. if ( parent ) {
  15174. parent.selectedIndex;
  15175. if ( parent.parentNode ) {
  15176. parent.parentNode.selectedIndex;
  15177. }
  15178. }
  15179. }
  15180. };
  15181. }
  15182. jQuery.each( [
  15183. "tabIndex",
  15184. "readOnly",
  15185. "maxLength",
  15186. "cellSpacing",
  15187. "cellPadding",
  15188. "rowSpan",
  15189. "colSpan",
  15190. "useMap",
  15191. "frameBorder",
  15192. "contentEditable"
  15193. ], function() {
  15194. jQuery.propFix[ this.toLowerCase() ] = this;
  15195. } );
  15196. // Strip and collapse whitespace according to HTML spec
  15197. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15198. function stripAndCollapse( value ) {
  15199. var tokens = value.match( rnothtmlwhite ) || [];
  15200. return tokens.join( " " );
  15201. }
  15202. function getClass( elem ) {
  15203. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15204. }
  15205. function classesToArray( value ) {
  15206. if ( Array.isArray( value ) ) {
  15207. return value;
  15208. }
  15209. if ( typeof value === "string" ) {
  15210. return value.match( rnothtmlwhite ) || [];
  15211. }
  15212. return [];
  15213. }
  15214. jQuery.fn.extend( {
  15215. addClass: function( value ) {
  15216. var classes, elem, cur, curValue, clazz, j, finalValue,
  15217. i = 0;
  15218. if ( isFunction( value ) ) {
  15219. return this.each( function( j ) {
  15220. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15221. } );
  15222. }
  15223. classes = classesToArray( value );
  15224. if ( classes.length ) {
  15225. while ( ( elem = this[ i++ ] ) ) {
  15226. curValue = getClass( elem );
  15227. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15228. if ( cur ) {
  15229. j = 0;
  15230. while ( ( clazz = classes[ j++ ] ) ) {
  15231. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15232. cur += clazz + " ";
  15233. }
  15234. }
  15235. // Only assign if different to avoid unneeded rendering.
  15236. finalValue = stripAndCollapse( cur );
  15237. if ( curValue !== finalValue ) {
  15238. elem.setAttribute( "class", finalValue );
  15239. }
  15240. }
  15241. }
  15242. }
  15243. return this;
  15244. },
  15245. removeClass: function( value ) {
  15246. var classes, elem, cur, curValue, clazz, j, finalValue,
  15247. i = 0;
  15248. if ( isFunction( value ) ) {
  15249. return this.each( function( j ) {
  15250. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15251. } );
  15252. }
  15253. if ( !arguments.length ) {
  15254. return this.attr( "class", "" );
  15255. }
  15256. classes = classesToArray( value );
  15257. if ( classes.length ) {
  15258. while ( ( elem = this[ i++ ] ) ) {
  15259. curValue = getClass( elem );
  15260. // This expression is here for better compressibility (see addClass)
  15261. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15262. if ( cur ) {
  15263. j = 0;
  15264. while ( ( clazz = classes[ j++ ] ) ) {
  15265. // Remove *all* instances
  15266. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15267. cur = cur.replace( " " + clazz + " ", " " );
  15268. }
  15269. }
  15270. // Only assign if different to avoid unneeded rendering.
  15271. finalValue = stripAndCollapse( cur );
  15272. if ( curValue !== finalValue ) {
  15273. elem.setAttribute( "class", finalValue );
  15274. }
  15275. }
  15276. }
  15277. }
  15278. return this;
  15279. },
  15280. toggleClass: function( value, stateVal ) {
  15281. var type = typeof value,
  15282. isValidValue = type === "string" || Array.isArray( value );
  15283. if ( typeof stateVal === "boolean" && isValidValue ) {
  15284. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15285. }
  15286. if ( isFunction( value ) ) {
  15287. return this.each( function( i ) {
  15288. jQuery( this ).toggleClass(
  15289. value.call( this, i, getClass( this ), stateVal ),
  15290. stateVal
  15291. );
  15292. } );
  15293. }
  15294. return this.each( function() {
  15295. var className, i, self, classNames;
  15296. if ( isValidValue ) {
  15297. // Toggle individual class names
  15298. i = 0;
  15299. self = jQuery( this );
  15300. classNames = classesToArray( value );
  15301. while ( ( className = classNames[ i++ ] ) ) {
  15302. // Check each className given, space separated list
  15303. if ( self.hasClass( className ) ) {
  15304. self.removeClass( className );
  15305. } else {
  15306. self.addClass( className );
  15307. }
  15308. }
  15309. // Toggle whole class name
  15310. } else if ( value === undefined || type === "boolean" ) {
  15311. className = getClass( this );
  15312. if ( className ) {
  15313. // Store className if set
  15314. dataPriv.set( this, "__className__", className );
  15315. }
  15316. // If the element has a class name or if we're passed `false`,
  15317. // then remove the whole classname (if there was one, the above saved it).
  15318. // Otherwise bring back whatever was previously saved (if anything),
  15319. // falling back to the empty string if nothing was stored.
  15320. if ( this.setAttribute ) {
  15321. this.setAttribute( "class",
  15322. className || value === false ?
  15323. "" :
  15324. dataPriv.get( this, "__className__" ) || ""
  15325. );
  15326. }
  15327. }
  15328. } );
  15329. },
  15330. hasClass: function( selector ) {
  15331. var className, elem,
  15332. i = 0;
  15333. className = " " + selector + " ";
  15334. while ( ( elem = this[ i++ ] ) ) {
  15335. if ( elem.nodeType === 1 &&
  15336. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15337. return true;
  15338. }
  15339. }
  15340. return false;
  15341. }
  15342. } );
  15343. var rreturn = /\r/g;
  15344. jQuery.fn.extend( {
  15345. val: function( value ) {
  15346. var hooks, ret, valueIsFunction,
  15347. elem = this[ 0 ];
  15348. if ( !arguments.length ) {
  15349. if ( elem ) {
  15350. hooks = jQuery.valHooks[ elem.type ] ||
  15351. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15352. if ( hooks &&
  15353. "get" in hooks &&
  15354. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15355. ) {
  15356. return ret;
  15357. }
  15358. ret = elem.value;
  15359. // Handle most common string cases
  15360. if ( typeof ret === "string" ) {
  15361. return ret.replace( rreturn, "" );
  15362. }
  15363. // Handle cases where value is null/undef or number
  15364. return ret == null ? "" : ret;
  15365. }
  15366. return;
  15367. }
  15368. valueIsFunction = isFunction( value );
  15369. return this.each( function( i ) {
  15370. var val;
  15371. if ( this.nodeType !== 1 ) {
  15372. return;
  15373. }
  15374. if ( valueIsFunction ) {
  15375. val = value.call( this, i, jQuery( this ).val() );
  15376. } else {
  15377. val = value;
  15378. }
  15379. // Treat null/undefined as ""; convert numbers to string
  15380. if ( val == null ) {
  15381. val = "";
  15382. } else if ( typeof val === "number" ) {
  15383. val += "";
  15384. } else if ( Array.isArray( val ) ) {
  15385. val = jQuery.map( val, function( value ) {
  15386. return value == null ? "" : value + "";
  15387. } );
  15388. }
  15389. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15390. // If set returns undefined, fall back to normal setting
  15391. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15392. this.value = val;
  15393. }
  15394. } );
  15395. }
  15396. } );
  15397. jQuery.extend( {
  15398. valHooks: {
  15399. option: {
  15400. get: function( elem ) {
  15401. var val = jQuery.find.attr( elem, "value" );
  15402. return val != null ?
  15403. val :
  15404. // Support: IE <=10 - 11 only
  15405. // option.text throws exceptions (#14686, #14858)
  15406. // Strip and collapse whitespace
  15407. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15408. stripAndCollapse( jQuery.text( elem ) );
  15409. }
  15410. },
  15411. select: {
  15412. get: function( elem ) {
  15413. var value, option, i,
  15414. options = elem.options,
  15415. index = elem.selectedIndex,
  15416. one = elem.type === "select-one",
  15417. values = one ? null : [],
  15418. max = one ? index + 1 : options.length;
  15419. if ( index < 0 ) {
  15420. i = max;
  15421. } else {
  15422. i = one ? index : 0;
  15423. }
  15424. // Loop through all the selected options
  15425. for ( ; i < max; i++ ) {
  15426. option = options[ i ];
  15427. // Support: IE <=9 only
  15428. // IE8-9 doesn't update selected after form reset (#2551)
  15429. if ( ( option.selected || i === index ) &&
  15430. // Don't return options that are disabled or in a disabled optgroup
  15431. !option.disabled &&
  15432. ( !option.parentNode.disabled ||
  15433. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15434. // Get the specific value for the option
  15435. value = jQuery( option ).val();
  15436. // We don't need an array for one selects
  15437. if ( one ) {
  15438. return value;
  15439. }
  15440. // Multi-Selects return an array
  15441. values.push( value );
  15442. }
  15443. }
  15444. return values;
  15445. },
  15446. set: function( elem, value ) {
  15447. var optionSet, option,
  15448. options = elem.options,
  15449. values = jQuery.makeArray( value ),
  15450. i = options.length;
  15451. while ( i-- ) {
  15452. option = options[ i ];
  15453. /* eslint-disable no-cond-assign */
  15454. if ( option.selected =
  15455. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15456. ) {
  15457. optionSet = true;
  15458. }
  15459. /* eslint-enable no-cond-assign */
  15460. }
  15461. // Force browsers to behave consistently when non-matching value is set
  15462. if ( !optionSet ) {
  15463. elem.selectedIndex = -1;
  15464. }
  15465. return values;
  15466. }
  15467. }
  15468. }
  15469. } );
  15470. // Radios and checkboxes getter/setter
  15471. jQuery.each( [ "radio", "checkbox" ], function() {
  15472. jQuery.valHooks[ this ] = {
  15473. set: function( elem, value ) {
  15474. if ( Array.isArray( value ) ) {
  15475. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15476. }
  15477. }
  15478. };
  15479. if ( !support.checkOn ) {
  15480. jQuery.valHooks[ this ].get = function( elem ) {
  15481. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15482. };
  15483. }
  15484. } );
  15485. // Return jQuery for attributes-only inclusion
  15486. support.focusin = "onfocusin" in window;
  15487. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15488. stopPropagationCallback = function( e ) {
  15489. e.stopPropagation();
  15490. };
  15491. jQuery.extend( jQuery.event, {
  15492. trigger: function( event, data, elem, onlyHandlers ) {
  15493. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15494. eventPath = [ elem || document ],
  15495. type = hasOwn.call( event, "type" ) ? event.type : event,
  15496. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15497. cur = lastElement = tmp = elem = elem || document;
  15498. // Don't do events on text and comment nodes
  15499. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15500. return;
  15501. }
  15502. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15503. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15504. return;
  15505. }
  15506. if ( type.indexOf( "." ) > -1 ) {
  15507. // Namespaced trigger; create a regexp to match event type in handle()
  15508. namespaces = type.split( "." );
  15509. type = namespaces.shift();
  15510. namespaces.sort();
  15511. }
  15512. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15513. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15514. event = event[ jQuery.expando ] ?
  15515. event :
  15516. new jQuery.Event( type, typeof event === "object" && event );
  15517. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15518. event.isTrigger = onlyHandlers ? 2 : 3;
  15519. event.namespace = namespaces.join( "." );
  15520. event.rnamespace = event.namespace ?
  15521. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15522. null;
  15523. // Clean up the event in case it is being reused
  15524. event.result = undefined;
  15525. if ( !event.target ) {
  15526. event.target = elem;
  15527. }
  15528. // Clone any incoming data and prepend the event, creating the handler arg list
  15529. data = data == null ?
  15530. [ event ] :
  15531. jQuery.makeArray( data, [ event ] );
  15532. // Allow special events to draw outside the lines
  15533. special = jQuery.event.special[ type ] || {};
  15534. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15535. return;
  15536. }
  15537. // Determine event propagation path in advance, per W3C events spec (#9951)
  15538. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15539. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15540. bubbleType = special.delegateType || type;
  15541. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15542. cur = cur.parentNode;
  15543. }
  15544. for ( ; cur; cur = cur.parentNode ) {
  15545. eventPath.push( cur );
  15546. tmp = cur;
  15547. }
  15548. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15549. if ( tmp === ( elem.ownerDocument || document ) ) {
  15550. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15551. }
  15552. }
  15553. // Fire handlers on the event path
  15554. i = 0;
  15555. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15556. lastElement = cur;
  15557. event.type = i > 1 ?
  15558. bubbleType :
  15559. special.bindType || type;
  15560. // jQuery handler
  15561. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15562. dataPriv.get( cur, "handle" );
  15563. if ( handle ) {
  15564. handle.apply( cur, data );
  15565. }
  15566. // Native handler
  15567. handle = ontype && cur[ ontype ];
  15568. if ( handle && handle.apply && acceptData( cur ) ) {
  15569. event.result = handle.apply( cur, data );
  15570. if ( event.result === false ) {
  15571. event.preventDefault();
  15572. }
  15573. }
  15574. }
  15575. event.type = type;
  15576. // If nobody prevented the default action, do it now
  15577. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15578. if ( ( !special._default ||
  15579. special._default.apply( eventPath.pop(), data ) === false ) &&
  15580. acceptData( elem ) ) {
  15581. // Call a native DOM method on the target with the same name as the event.
  15582. // Don't do default actions on window, that's where global variables be (#6170)
  15583. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15584. // Don't re-trigger an onFOO event when we call its FOO() method
  15585. tmp = elem[ ontype ];
  15586. if ( tmp ) {
  15587. elem[ ontype ] = null;
  15588. }
  15589. // Prevent re-triggering of the same event, since we already bubbled it above
  15590. jQuery.event.triggered = type;
  15591. if ( event.isPropagationStopped() ) {
  15592. lastElement.addEventListener( type, stopPropagationCallback );
  15593. }
  15594. elem[ type ]();
  15595. if ( event.isPropagationStopped() ) {
  15596. lastElement.removeEventListener( type, stopPropagationCallback );
  15597. }
  15598. jQuery.event.triggered = undefined;
  15599. if ( tmp ) {
  15600. elem[ ontype ] = tmp;
  15601. }
  15602. }
  15603. }
  15604. }
  15605. return event.result;
  15606. },
  15607. // Piggyback on a donor event to simulate a different one
  15608. // Used only for `focus(in | out)` events
  15609. simulate: function( type, elem, event ) {
  15610. var e = jQuery.extend(
  15611. new jQuery.Event(),
  15612. event,
  15613. {
  15614. type: type,
  15615. isSimulated: true
  15616. }
  15617. );
  15618. jQuery.event.trigger( e, null, elem );
  15619. }
  15620. } );
  15621. jQuery.fn.extend( {
  15622. trigger: function( type, data ) {
  15623. return this.each( function() {
  15624. jQuery.event.trigger( type, data, this );
  15625. } );
  15626. },
  15627. triggerHandler: function( type, data ) {
  15628. var elem = this[ 0 ];
  15629. if ( elem ) {
  15630. return jQuery.event.trigger( type, data, elem, true );
  15631. }
  15632. }
  15633. } );
  15634. // Support: Firefox <=44
  15635. // Firefox doesn't have focus(in | out) events
  15636. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15637. //
  15638. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15639. // focus(in | out) events fire after focus & blur events,
  15640. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15641. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15642. if ( !support.focusin ) {
  15643. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15644. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15645. var handler = function( event ) {
  15646. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15647. };
  15648. jQuery.event.special[ fix ] = {
  15649. setup: function() {
  15650. var doc = this.ownerDocument || this,
  15651. attaches = dataPriv.access( doc, fix );
  15652. if ( !attaches ) {
  15653. doc.addEventListener( orig, handler, true );
  15654. }
  15655. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15656. },
  15657. teardown: function() {
  15658. var doc = this.ownerDocument || this,
  15659. attaches = dataPriv.access( doc, fix ) - 1;
  15660. if ( !attaches ) {
  15661. doc.removeEventListener( orig, handler, true );
  15662. dataPriv.remove( doc, fix );
  15663. } else {
  15664. dataPriv.access( doc, fix, attaches );
  15665. }
  15666. }
  15667. };
  15668. } );
  15669. }
  15670. var location = window.location;
  15671. var nonce = Date.now();
  15672. var rquery = ( /\?/ );
  15673. // Cross-browser xml parsing
  15674. jQuery.parseXML = function( data ) {
  15675. var xml;
  15676. if ( !data || typeof data !== "string" ) {
  15677. return null;
  15678. }
  15679. // Support: IE 9 - 11 only
  15680. // IE throws on parseFromString with invalid input.
  15681. try {
  15682. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15683. } catch ( e ) {
  15684. xml = undefined;
  15685. }
  15686. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15687. jQuery.error( "Invalid XML: " + data );
  15688. }
  15689. return xml;
  15690. };
  15691. var
  15692. rbracket = /\[\]$/,
  15693. rCRLF = /\r?\n/g,
  15694. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15695. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15696. function buildParams( prefix, obj, traditional, add ) {
  15697. var name;
  15698. if ( Array.isArray( obj ) ) {
  15699. // Serialize array item.
  15700. jQuery.each( obj, function( i, v ) {
  15701. if ( traditional || rbracket.test( prefix ) ) {
  15702. // Treat each array item as a scalar.
  15703. add( prefix, v );
  15704. } else {
  15705. // Item is non-scalar (array or object), encode its numeric index.
  15706. buildParams(
  15707. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15708. v,
  15709. traditional,
  15710. add
  15711. );
  15712. }
  15713. } );
  15714. } else if ( !traditional && toType( obj ) === "object" ) {
  15715. // Serialize object item.
  15716. for ( name in obj ) {
  15717. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15718. }
  15719. } else {
  15720. // Serialize scalar item.
  15721. add( prefix, obj );
  15722. }
  15723. }
  15724. // Serialize an array of form elements or a set of
  15725. // key/values into a query string
  15726. jQuery.param = function( a, traditional ) {
  15727. var prefix,
  15728. s = [],
  15729. add = function( key, valueOrFunction ) {
  15730. // If value is a function, invoke it and use its return value
  15731. var value = isFunction( valueOrFunction ) ?
  15732. valueOrFunction() :
  15733. valueOrFunction;
  15734. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15735. encodeURIComponent( value == null ? "" : value );
  15736. };
  15737. if ( a == null ) {
  15738. return "";
  15739. }
  15740. // If an array was passed in, assume that it is an array of form elements.
  15741. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15742. // Serialize the form elements
  15743. jQuery.each( a, function() {
  15744. add( this.name, this.value );
  15745. } );
  15746. } else {
  15747. // If traditional, encode the "old" way (the way 1.3.2 or older
  15748. // did it), otherwise encode params recursively.
  15749. for ( prefix in a ) {
  15750. buildParams( prefix, a[ prefix ], traditional, add );
  15751. }
  15752. }
  15753. // Return the resulting serialization
  15754. return s.join( "&" );
  15755. };
  15756. jQuery.fn.extend( {
  15757. serialize: function() {
  15758. return jQuery.param( this.serializeArray() );
  15759. },
  15760. serializeArray: function() {
  15761. return this.map( function() {
  15762. // Can add propHook for "elements" to filter or add form elements
  15763. var elements = jQuery.prop( this, "elements" );
  15764. return elements ? jQuery.makeArray( elements ) : this;
  15765. } )
  15766. .filter( function() {
  15767. var type = this.type;
  15768. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15769. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15770. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15771. ( this.checked || !rcheckableType.test( type ) );
  15772. } )
  15773. .map( function( i, elem ) {
  15774. var val = jQuery( this ).val();
  15775. if ( val == null ) {
  15776. return null;
  15777. }
  15778. if ( Array.isArray( val ) ) {
  15779. return jQuery.map( val, function( val ) {
  15780. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15781. } );
  15782. }
  15783. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15784. } ).get();
  15785. }
  15786. } );
  15787. var
  15788. r20 = /%20/g,
  15789. rhash = /#.*$/,
  15790. rantiCache = /([?&])_=[^&]*/,
  15791. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15792. // #7653, #8125, #8152: local protocol detection
  15793. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15794. rnoContent = /^(?:GET|HEAD)$/,
  15795. rprotocol = /^\/\//,
  15796. /* Prefilters
  15797. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15798. * 2) These are called:
  15799. * - BEFORE asking for a transport
  15800. * - AFTER param serialization (s.data is a string if s.processData is true)
  15801. * 3) key is the dataType
  15802. * 4) the catchall symbol "*" can be used
  15803. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15804. */
  15805. prefilters = {},
  15806. /* Transports bindings
  15807. * 1) key is the dataType
  15808. * 2) the catchall symbol "*" can be used
  15809. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15810. */
  15811. transports = {},
  15812. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15813. allTypes = "*/".concat( "*" ),
  15814. // Anchor tag for parsing the document origin
  15815. originAnchor = document.createElement( "a" );
  15816. originAnchor.href = location.href;
  15817. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15818. function addToPrefiltersOrTransports( structure ) {
  15819. // dataTypeExpression is optional and defaults to "*"
  15820. return function( dataTypeExpression, func ) {
  15821. if ( typeof dataTypeExpression !== "string" ) {
  15822. func = dataTypeExpression;
  15823. dataTypeExpression = "*";
  15824. }
  15825. var dataType,
  15826. i = 0,
  15827. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15828. if ( isFunction( func ) ) {
  15829. // For each dataType in the dataTypeExpression
  15830. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15831. // Prepend if requested
  15832. if ( dataType[ 0 ] === "+" ) {
  15833. dataType = dataType.slice( 1 ) || "*";
  15834. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15835. // Otherwise append
  15836. } else {
  15837. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15838. }
  15839. }
  15840. }
  15841. };
  15842. }
  15843. // Base inspection function for prefilters and transports
  15844. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15845. var inspected = {},
  15846. seekingTransport = ( structure === transports );
  15847. function inspect( dataType ) {
  15848. var selected;
  15849. inspected[ dataType ] = true;
  15850. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15851. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15852. if ( typeof dataTypeOrTransport === "string" &&
  15853. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15854. options.dataTypes.unshift( dataTypeOrTransport );
  15855. inspect( dataTypeOrTransport );
  15856. return false;
  15857. } else if ( seekingTransport ) {
  15858. return !( selected = dataTypeOrTransport );
  15859. }
  15860. } );
  15861. return selected;
  15862. }
  15863. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15864. }
  15865. // A special extend for ajax options
  15866. // that takes "flat" options (not to be deep extended)
  15867. // Fixes #9887
  15868. function ajaxExtend( target, src ) {
  15869. var key, deep,
  15870. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15871. for ( key in src ) {
  15872. if ( src[ key ] !== undefined ) {
  15873. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15874. }
  15875. }
  15876. if ( deep ) {
  15877. jQuery.extend( true, target, deep );
  15878. }
  15879. return target;
  15880. }
  15881. /* Handles responses to an ajax request:
  15882. * - finds the right dataType (mediates between content-type and expected dataType)
  15883. * - returns the corresponding response
  15884. */
  15885. function ajaxHandleResponses( s, jqXHR, responses ) {
  15886. var ct, type, finalDataType, firstDataType,
  15887. contents = s.contents,
  15888. dataTypes = s.dataTypes;
  15889. // Remove auto dataType and get content-type in the process
  15890. while ( dataTypes[ 0 ] === "*" ) {
  15891. dataTypes.shift();
  15892. if ( ct === undefined ) {
  15893. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15894. }
  15895. }
  15896. // Check if we're dealing with a known content-type
  15897. if ( ct ) {
  15898. for ( type in contents ) {
  15899. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15900. dataTypes.unshift( type );
  15901. break;
  15902. }
  15903. }
  15904. }
  15905. // Check to see if we have a response for the expected dataType
  15906. if ( dataTypes[ 0 ] in responses ) {
  15907. finalDataType = dataTypes[ 0 ];
  15908. } else {
  15909. // Try convertible dataTypes
  15910. for ( type in responses ) {
  15911. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15912. finalDataType = type;
  15913. break;
  15914. }
  15915. if ( !firstDataType ) {
  15916. firstDataType = type;
  15917. }
  15918. }
  15919. // Or just use first one
  15920. finalDataType = finalDataType || firstDataType;
  15921. }
  15922. // If we found a dataType
  15923. // We add the dataType to the list if needed
  15924. // and return the corresponding response
  15925. if ( finalDataType ) {
  15926. if ( finalDataType !== dataTypes[ 0 ] ) {
  15927. dataTypes.unshift( finalDataType );
  15928. }
  15929. return responses[ finalDataType ];
  15930. }
  15931. }
  15932. /* Chain conversions given the request and the original response
  15933. * Also sets the responseXXX fields on the jqXHR instance
  15934. */
  15935. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15936. var conv2, current, conv, tmp, prev,
  15937. converters = {},
  15938. // Work with a copy of dataTypes in case we need to modify it for conversion
  15939. dataTypes = s.dataTypes.slice();
  15940. // Create converters map with lowercased keys
  15941. if ( dataTypes[ 1 ] ) {
  15942. for ( conv in s.converters ) {
  15943. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15944. }
  15945. }
  15946. current = dataTypes.shift();
  15947. // Convert to each sequential dataType
  15948. while ( current ) {
  15949. if ( s.responseFields[ current ] ) {
  15950. jqXHR[ s.responseFields[ current ] ] = response;
  15951. }
  15952. // Apply the dataFilter if provided
  15953. if ( !prev && isSuccess && s.dataFilter ) {
  15954. response = s.dataFilter( response, s.dataType );
  15955. }
  15956. prev = current;
  15957. current = dataTypes.shift();
  15958. if ( current ) {
  15959. // There's only work to do if current dataType is non-auto
  15960. if ( current === "*" ) {
  15961. current = prev;
  15962. // Convert response if prev dataType is non-auto and differs from current
  15963. } else if ( prev !== "*" && prev !== current ) {
  15964. // Seek a direct converter
  15965. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15966. // If none found, seek a pair
  15967. if ( !conv ) {
  15968. for ( conv2 in converters ) {
  15969. // If conv2 outputs current
  15970. tmp = conv2.split( " " );
  15971. if ( tmp[ 1 ] === current ) {
  15972. // If prev can be converted to accepted input
  15973. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15974. converters[ "* " + tmp[ 0 ] ];
  15975. if ( conv ) {
  15976. // Condense equivalence converters
  15977. if ( conv === true ) {
  15978. conv = converters[ conv2 ];
  15979. // Otherwise, insert the intermediate dataType
  15980. } else if ( converters[ conv2 ] !== true ) {
  15981. current = tmp[ 0 ];
  15982. dataTypes.unshift( tmp[ 1 ] );
  15983. }
  15984. break;
  15985. }
  15986. }
  15987. }
  15988. }
  15989. // Apply converter (if not an equivalence)
  15990. if ( conv !== true ) {
  15991. // Unless errors are allowed to bubble, catch and return them
  15992. if ( conv && s.throws ) {
  15993. response = conv( response );
  15994. } else {
  15995. try {
  15996. response = conv( response );
  15997. } catch ( e ) {
  15998. return {
  15999. state: "parsererror",
  16000. error: conv ? e : "No conversion from " + prev + " to " + current
  16001. };
  16002. }
  16003. }
  16004. }
  16005. }
  16006. }
  16007. }
  16008. return { state: "success", data: response };
  16009. }
  16010. jQuery.extend( {
  16011. // Counter for holding the number of active queries
  16012. active: 0,
  16013. // Last-Modified header cache for next request
  16014. lastModified: {},
  16015. etag: {},
  16016. ajaxSettings: {
  16017. url: location.href,
  16018. type: "GET",
  16019. isLocal: rlocalProtocol.test( location.protocol ),
  16020. global: true,
  16021. processData: true,
  16022. async: true,
  16023. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16024. /*
  16025. timeout: 0,
  16026. data: null,
  16027. dataType: null,
  16028. username: null,
  16029. password: null,
  16030. cache: null,
  16031. throws: false,
  16032. traditional: false,
  16033. headers: {},
  16034. */
  16035. accepts: {
  16036. "*": allTypes,
  16037. text: "text/plain",
  16038. html: "text/html",
  16039. xml: "application/xml, text/xml",
  16040. json: "application/json, text/javascript"
  16041. },
  16042. contents: {
  16043. xml: /\bxml\b/,
  16044. html: /\bhtml/,
  16045. json: /\bjson\b/
  16046. },
  16047. responseFields: {
  16048. xml: "responseXML",
  16049. text: "responseText",
  16050. json: "responseJSON"
  16051. },
  16052. // Data converters
  16053. // Keys separate source (or catchall "*") and destination types with a single space
  16054. converters: {
  16055. // Convert anything to text
  16056. "* text": String,
  16057. // Text to html (true = no transformation)
  16058. "text html": true,
  16059. // Evaluate text as a json expression
  16060. "text json": JSON.parse,
  16061. // Parse text as xml
  16062. "text xml": jQuery.parseXML
  16063. },
  16064. // For options that shouldn't be deep extended:
  16065. // you can add your own custom options here if
  16066. // and when you create one that shouldn't be
  16067. // deep extended (see ajaxExtend)
  16068. flatOptions: {
  16069. url: true,
  16070. context: true
  16071. }
  16072. },
  16073. // Creates a full fledged settings object into target
  16074. // with both ajaxSettings and settings fields.
  16075. // If target is omitted, writes into ajaxSettings.
  16076. ajaxSetup: function( target, settings ) {
  16077. return settings ?
  16078. // Building a settings object
  16079. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16080. // Extending ajaxSettings
  16081. ajaxExtend( jQuery.ajaxSettings, target );
  16082. },
  16083. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16084. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16085. // Main method
  16086. ajax: function( url, options ) {
  16087. // If url is an object, simulate pre-1.5 signature
  16088. if ( typeof url === "object" ) {
  16089. options = url;
  16090. url = undefined;
  16091. }
  16092. // Force options to be an object
  16093. options = options || {};
  16094. var transport,
  16095. // URL without anti-cache param
  16096. cacheURL,
  16097. // Response headers
  16098. responseHeadersString,
  16099. responseHeaders,
  16100. // timeout handle
  16101. timeoutTimer,
  16102. // Url cleanup var
  16103. urlAnchor,
  16104. // Request state (becomes false upon send and true upon completion)
  16105. completed,
  16106. // To know if global events are to be dispatched
  16107. fireGlobals,
  16108. // Loop variable
  16109. i,
  16110. // uncached part of the url
  16111. uncached,
  16112. // Create the final options object
  16113. s = jQuery.ajaxSetup( {}, options ),
  16114. // Callbacks context
  16115. callbackContext = s.context || s,
  16116. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16117. globalEventContext = s.context &&
  16118. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16119. jQuery( callbackContext ) :
  16120. jQuery.event,
  16121. // Deferreds
  16122. deferred = jQuery.Deferred(),
  16123. completeDeferred = jQuery.Callbacks( "once memory" ),
  16124. // Status-dependent callbacks
  16125. statusCode = s.statusCode || {},
  16126. // Headers (they are sent all at once)
  16127. requestHeaders = {},
  16128. requestHeadersNames = {},
  16129. // Default abort message
  16130. strAbort = "canceled",
  16131. // Fake xhr
  16132. jqXHR = {
  16133. readyState: 0,
  16134. // Builds headers hashtable if needed
  16135. getResponseHeader: function( key ) {
  16136. var match;
  16137. if ( completed ) {
  16138. if ( !responseHeaders ) {
  16139. responseHeaders = {};
  16140. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16141. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16142. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16143. .concat( match[ 2 ] );
  16144. }
  16145. }
  16146. match = responseHeaders[ key.toLowerCase() + " " ];
  16147. }
  16148. return match == null ? null : match.join( ", " );
  16149. },
  16150. // Raw string
  16151. getAllResponseHeaders: function() {
  16152. return completed ? responseHeadersString : null;
  16153. },
  16154. // Caches the header
  16155. setRequestHeader: function( name, value ) {
  16156. if ( completed == null ) {
  16157. name = requestHeadersNames[ name.toLowerCase() ] =
  16158. requestHeadersNames[ name.toLowerCase() ] || name;
  16159. requestHeaders[ name ] = value;
  16160. }
  16161. return this;
  16162. },
  16163. // Overrides response content-type header
  16164. overrideMimeType: function( type ) {
  16165. if ( completed == null ) {
  16166. s.mimeType = type;
  16167. }
  16168. return this;
  16169. },
  16170. // Status-dependent callbacks
  16171. statusCode: function( map ) {
  16172. var code;
  16173. if ( map ) {
  16174. if ( completed ) {
  16175. // Execute the appropriate callbacks
  16176. jqXHR.always( map[ jqXHR.status ] );
  16177. } else {
  16178. // Lazy-add the new callbacks in a way that preserves old ones
  16179. for ( code in map ) {
  16180. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16181. }
  16182. }
  16183. }
  16184. return this;
  16185. },
  16186. // Cancel the request
  16187. abort: function( statusText ) {
  16188. var finalText = statusText || strAbort;
  16189. if ( transport ) {
  16190. transport.abort( finalText );
  16191. }
  16192. done( 0, finalText );
  16193. return this;
  16194. }
  16195. };
  16196. // Attach deferreds
  16197. deferred.promise( jqXHR );
  16198. // Add protocol if not provided (prefilters might expect it)
  16199. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16200. // We also use the url parameter if available
  16201. s.url = ( ( url || s.url || location.href ) + "" )
  16202. .replace( rprotocol, location.protocol + "//" );
  16203. // Alias method option to type as per ticket #12004
  16204. s.type = options.method || options.type || s.method || s.type;
  16205. // Extract dataTypes list
  16206. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16207. // A cross-domain request is in order when the origin doesn't match the current origin.
  16208. if ( s.crossDomain == null ) {
  16209. urlAnchor = document.createElement( "a" );
  16210. // Support: IE <=8 - 11, Edge 12 - 15
  16211. // IE throws exception on accessing the href property if url is malformed,
  16212. // e.g. http://example.com:80x/
  16213. try {
  16214. urlAnchor.href = s.url;
  16215. // Support: IE <=8 - 11 only
  16216. // Anchor's host property isn't correctly set when s.url is relative
  16217. urlAnchor.href = urlAnchor.href;
  16218. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16219. urlAnchor.protocol + "//" + urlAnchor.host;
  16220. } catch ( e ) {
  16221. // If there is an error parsing the URL, assume it is crossDomain,
  16222. // it can be rejected by the transport if it is invalid
  16223. s.crossDomain = true;
  16224. }
  16225. }
  16226. // Convert data if not already a string
  16227. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16228. s.data = jQuery.param( s.data, s.traditional );
  16229. }
  16230. // Apply prefilters
  16231. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16232. // If request was aborted inside a prefilter, stop there
  16233. if ( completed ) {
  16234. return jqXHR;
  16235. }
  16236. // We can fire global events as of now if asked to
  16237. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16238. fireGlobals = jQuery.event && s.global;
  16239. // Watch for a new set of requests
  16240. if ( fireGlobals && jQuery.active++ === 0 ) {
  16241. jQuery.event.trigger( "ajaxStart" );
  16242. }
  16243. // Uppercase the type
  16244. s.type = s.type.toUpperCase();
  16245. // Determine if request has content
  16246. s.hasContent = !rnoContent.test( s.type );
  16247. // Save the URL in case we're toying with the If-Modified-Since
  16248. // and/or If-None-Match header later on
  16249. // Remove hash to simplify url manipulation
  16250. cacheURL = s.url.replace( rhash, "" );
  16251. // More options handling for requests with no content
  16252. if ( !s.hasContent ) {
  16253. // Remember the hash so we can put it back
  16254. uncached = s.url.slice( cacheURL.length );
  16255. // If data is available and should be processed, append data to url
  16256. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16257. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16258. // #9682: remove data so that it's not used in an eventual retry
  16259. delete s.data;
  16260. }
  16261. // Add or update anti-cache param if needed
  16262. if ( s.cache === false ) {
  16263. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16264. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16265. }
  16266. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16267. s.url = cacheURL + uncached;
  16268. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16269. } else if ( s.data && s.processData &&
  16270. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16271. s.data = s.data.replace( r20, "+" );
  16272. }
  16273. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16274. if ( s.ifModified ) {
  16275. if ( jQuery.lastModified[ cacheURL ] ) {
  16276. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16277. }
  16278. if ( jQuery.etag[ cacheURL ] ) {
  16279. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16280. }
  16281. }
  16282. // Set the correct header, if data is being sent
  16283. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16284. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16285. }
  16286. // Set the Accepts header for the server, depending on the dataType
  16287. jqXHR.setRequestHeader(
  16288. "Accept",
  16289. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16290. s.accepts[ s.dataTypes[ 0 ] ] +
  16291. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16292. s.accepts[ "*" ]
  16293. );
  16294. // Check for headers option
  16295. for ( i in s.headers ) {
  16296. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16297. }
  16298. // Allow custom headers/mimetypes and early abort
  16299. if ( s.beforeSend &&
  16300. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16301. // Abort if not done already and return
  16302. return jqXHR.abort();
  16303. }
  16304. // Aborting is no longer a cancellation
  16305. strAbort = "abort";
  16306. // Install callbacks on deferreds
  16307. completeDeferred.add( s.complete );
  16308. jqXHR.done( s.success );
  16309. jqXHR.fail( s.error );
  16310. // Get transport
  16311. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16312. // If no transport, we auto-abort
  16313. if ( !transport ) {
  16314. done( -1, "No Transport" );
  16315. } else {
  16316. jqXHR.readyState = 1;
  16317. // Send global event
  16318. if ( fireGlobals ) {
  16319. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16320. }
  16321. // If request was aborted inside ajaxSend, stop there
  16322. if ( completed ) {
  16323. return jqXHR;
  16324. }
  16325. // Timeout
  16326. if ( s.async && s.timeout > 0 ) {
  16327. timeoutTimer = window.setTimeout( function() {
  16328. jqXHR.abort( "timeout" );
  16329. }, s.timeout );
  16330. }
  16331. try {
  16332. completed = false;
  16333. transport.send( requestHeaders, done );
  16334. } catch ( e ) {
  16335. // Rethrow post-completion exceptions
  16336. if ( completed ) {
  16337. throw e;
  16338. }
  16339. // Propagate others as results
  16340. done( -1, e );
  16341. }
  16342. }
  16343. // Callback for when everything is done
  16344. function done( status, nativeStatusText, responses, headers ) {
  16345. var isSuccess, success, error, response, modified,
  16346. statusText = nativeStatusText;
  16347. // Ignore repeat invocations
  16348. if ( completed ) {
  16349. return;
  16350. }
  16351. completed = true;
  16352. // Clear timeout if it exists
  16353. if ( timeoutTimer ) {
  16354. window.clearTimeout( timeoutTimer );
  16355. }
  16356. // Dereference transport for early garbage collection
  16357. // (no matter how long the jqXHR object will be used)
  16358. transport = undefined;
  16359. // Cache response headers
  16360. responseHeadersString = headers || "";
  16361. // Set readyState
  16362. jqXHR.readyState = status > 0 ? 4 : 0;
  16363. // Determine if successful
  16364. isSuccess = status >= 200 && status < 300 || status === 304;
  16365. // Get response data
  16366. if ( responses ) {
  16367. response = ajaxHandleResponses( s, jqXHR, responses );
  16368. }
  16369. // Convert no matter what (that way responseXXX fields are always set)
  16370. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16371. // If successful, handle type chaining
  16372. if ( isSuccess ) {
  16373. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16374. if ( s.ifModified ) {
  16375. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16376. if ( modified ) {
  16377. jQuery.lastModified[ cacheURL ] = modified;
  16378. }
  16379. modified = jqXHR.getResponseHeader( "etag" );
  16380. if ( modified ) {
  16381. jQuery.etag[ cacheURL ] = modified;
  16382. }
  16383. }
  16384. // if no content
  16385. if ( status === 204 || s.type === "HEAD" ) {
  16386. statusText = "nocontent";
  16387. // if not modified
  16388. } else if ( status === 304 ) {
  16389. statusText = "notmodified";
  16390. // If we have data, let's convert it
  16391. } else {
  16392. statusText = response.state;
  16393. success = response.data;
  16394. error = response.error;
  16395. isSuccess = !error;
  16396. }
  16397. } else {
  16398. // Extract error from statusText and normalize for non-aborts
  16399. error = statusText;
  16400. if ( status || !statusText ) {
  16401. statusText = "error";
  16402. if ( status < 0 ) {
  16403. status = 0;
  16404. }
  16405. }
  16406. }
  16407. // Set data for the fake xhr object
  16408. jqXHR.status = status;
  16409. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16410. // Success/Error
  16411. if ( isSuccess ) {
  16412. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16413. } else {
  16414. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16415. }
  16416. // Status-dependent callbacks
  16417. jqXHR.statusCode( statusCode );
  16418. statusCode = undefined;
  16419. if ( fireGlobals ) {
  16420. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16421. [ jqXHR, s, isSuccess ? success : error ] );
  16422. }
  16423. // Complete
  16424. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16425. if ( fireGlobals ) {
  16426. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16427. // Handle the global AJAX counter
  16428. if ( !( --jQuery.active ) ) {
  16429. jQuery.event.trigger( "ajaxStop" );
  16430. }
  16431. }
  16432. }
  16433. return jqXHR;
  16434. },
  16435. getJSON: function( url, data, callback ) {
  16436. return jQuery.get( url, data, callback, "json" );
  16437. },
  16438. getScript: function( url, callback ) {
  16439. return jQuery.get( url, undefined, callback, "script" );
  16440. }
  16441. } );
  16442. jQuery.each( [ "get", "post" ], function( i, method ) {
  16443. jQuery[ method ] = function( url, data, callback, type ) {
  16444. // Shift arguments if data argument was omitted
  16445. if ( isFunction( data ) ) {
  16446. type = type || callback;
  16447. callback = data;
  16448. data = undefined;
  16449. }
  16450. // The url can be an options object (which then must have .url)
  16451. return jQuery.ajax( jQuery.extend( {
  16452. url: url,
  16453. type: method,
  16454. dataType: type,
  16455. data: data,
  16456. success: callback
  16457. }, jQuery.isPlainObject( url ) && url ) );
  16458. };
  16459. } );
  16460. jQuery._evalUrl = function( url, options ) {
  16461. return jQuery.ajax( {
  16462. url: url,
  16463. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16464. type: "GET",
  16465. dataType: "script",
  16466. cache: true,
  16467. async: false,
  16468. global: false,
  16469. // Only evaluate the response if it is successful (gh-4126)
  16470. // dataFilter is not invoked for failure responses, so using it instead
  16471. // of the default converter is kludgy but it works.
  16472. converters: {
  16473. "text script": function() {}
  16474. },
  16475. dataFilter: function( response ) {
  16476. jQuery.globalEval( response, options );
  16477. }
  16478. } );
  16479. };
  16480. jQuery.fn.extend( {
  16481. wrapAll: function( html ) {
  16482. var wrap;
  16483. if ( this[ 0 ] ) {
  16484. if ( isFunction( html ) ) {
  16485. html = html.call( this[ 0 ] );
  16486. }
  16487. // The elements to wrap the target around
  16488. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16489. if ( this[ 0 ].parentNode ) {
  16490. wrap.insertBefore( this[ 0 ] );
  16491. }
  16492. wrap.map( function() {
  16493. var elem = this;
  16494. while ( elem.firstElementChild ) {
  16495. elem = elem.firstElementChild;
  16496. }
  16497. return elem;
  16498. } ).append( this );
  16499. }
  16500. return this;
  16501. },
  16502. wrapInner: function( html ) {
  16503. if ( isFunction( html ) ) {
  16504. return this.each( function( i ) {
  16505. jQuery( this ).wrapInner( html.call( this, i ) );
  16506. } );
  16507. }
  16508. return this.each( function() {
  16509. var self = jQuery( this ),
  16510. contents = self.contents();
  16511. if ( contents.length ) {
  16512. contents.wrapAll( html );
  16513. } else {
  16514. self.append( html );
  16515. }
  16516. } );
  16517. },
  16518. wrap: function( html ) {
  16519. var htmlIsFunction = isFunction( html );
  16520. return this.each( function( i ) {
  16521. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16522. } );
  16523. },
  16524. unwrap: function( selector ) {
  16525. this.parent( selector ).not( "body" ).each( function() {
  16526. jQuery( this ).replaceWith( this.childNodes );
  16527. } );
  16528. return this;
  16529. }
  16530. } );
  16531. jQuery.expr.pseudos.hidden = function( elem ) {
  16532. return !jQuery.expr.pseudos.visible( elem );
  16533. };
  16534. jQuery.expr.pseudos.visible = function( elem ) {
  16535. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16536. };
  16537. jQuery.ajaxSettings.xhr = function() {
  16538. try {
  16539. return new window.XMLHttpRequest();
  16540. } catch ( e ) {}
  16541. };
  16542. var xhrSuccessStatus = {
  16543. // File protocol always yields status code 0, assume 200
  16544. 0: 200,
  16545. // Support: IE <=9 only
  16546. // #1450: sometimes IE returns 1223 when it should be 204
  16547. 1223: 204
  16548. },
  16549. xhrSupported = jQuery.ajaxSettings.xhr();
  16550. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16551. support.ajax = xhrSupported = !!xhrSupported;
  16552. jQuery.ajaxTransport( function( options ) {
  16553. var callback, errorCallback;
  16554. // Cross domain only allowed if supported through XMLHttpRequest
  16555. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16556. return {
  16557. send: function( headers, complete ) {
  16558. var i,
  16559. xhr = options.xhr();
  16560. xhr.open(
  16561. options.type,
  16562. options.url,
  16563. options.async,
  16564. options.username,
  16565. options.password
  16566. );
  16567. // Apply custom fields if provided
  16568. if ( options.xhrFields ) {
  16569. for ( i in options.xhrFields ) {
  16570. xhr[ i ] = options.xhrFields[ i ];
  16571. }
  16572. }
  16573. // Override mime type if needed
  16574. if ( options.mimeType && xhr.overrideMimeType ) {
  16575. xhr.overrideMimeType( options.mimeType );
  16576. }
  16577. // X-Requested-With header
  16578. // For cross-domain requests, seeing as conditions for a preflight are
  16579. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16580. // (it can always be set on a per-request basis or even using ajaxSetup)
  16581. // For same-domain requests, won't change header if already provided.
  16582. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16583. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16584. }
  16585. // Set headers
  16586. for ( i in headers ) {
  16587. xhr.setRequestHeader( i, headers[ i ] );
  16588. }
  16589. // Callback
  16590. callback = function( type ) {
  16591. return function() {
  16592. if ( callback ) {
  16593. callback = errorCallback = xhr.onload =
  16594. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16595. xhr.onreadystatechange = null;
  16596. if ( type === "abort" ) {
  16597. xhr.abort();
  16598. } else if ( type === "error" ) {
  16599. // Support: IE <=9 only
  16600. // On a manual native abort, IE9 throws
  16601. // errors on any property access that is not readyState
  16602. if ( typeof xhr.status !== "number" ) {
  16603. complete( 0, "error" );
  16604. } else {
  16605. complete(
  16606. // File: protocol always yields status 0; see #8605, #14207
  16607. xhr.status,
  16608. xhr.statusText
  16609. );
  16610. }
  16611. } else {
  16612. complete(
  16613. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16614. xhr.statusText,
  16615. // Support: IE <=9 only
  16616. // IE9 has no XHR2 but throws on binary (trac-11426)
  16617. // For XHR2 non-text, let the caller handle it (gh-2498)
  16618. ( xhr.responseType || "text" ) !== "text" ||
  16619. typeof xhr.responseText !== "string" ?
  16620. { binary: xhr.response } :
  16621. { text: xhr.responseText },
  16622. xhr.getAllResponseHeaders()
  16623. );
  16624. }
  16625. }
  16626. };
  16627. };
  16628. // Listen to events
  16629. xhr.onload = callback();
  16630. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16631. // Support: IE 9 only
  16632. // Use onreadystatechange to replace onabort
  16633. // to handle uncaught aborts
  16634. if ( xhr.onabort !== undefined ) {
  16635. xhr.onabort = errorCallback;
  16636. } else {
  16637. xhr.onreadystatechange = function() {
  16638. // Check readyState before timeout as it changes
  16639. if ( xhr.readyState === 4 ) {
  16640. // Allow onerror to be called first,
  16641. // but that will not handle a native abort
  16642. // Also, save errorCallback to a variable
  16643. // as xhr.onerror cannot be accessed
  16644. window.setTimeout( function() {
  16645. if ( callback ) {
  16646. errorCallback();
  16647. }
  16648. } );
  16649. }
  16650. };
  16651. }
  16652. // Create the abort callback
  16653. callback = callback( "abort" );
  16654. try {
  16655. // Do send the request (this may raise an exception)
  16656. xhr.send( options.hasContent && options.data || null );
  16657. } catch ( e ) {
  16658. // #14683: Only rethrow if this hasn't been notified as an error yet
  16659. if ( callback ) {
  16660. throw e;
  16661. }
  16662. }
  16663. },
  16664. abort: function() {
  16665. if ( callback ) {
  16666. callback();
  16667. }
  16668. }
  16669. };
  16670. }
  16671. } );
  16672. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16673. jQuery.ajaxPrefilter( function( s ) {
  16674. if ( s.crossDomain ) {
  16675. s.contents.script = false;
  16676. }
  16677. } );
  16678. // Install script dataType
  16679. jQuery.ajaxSetup( {
  16680. accepts: {
  16681. script: "text/javascript, application/javascript, " +
  16682. "application/ecmascript, application/x-ecmascript"
  16683. },
  16684. contents: {
  16685. script: /\b(?:java|ecma)script\b/
  16686. },
  16687. converters: {
  16688. "text script": function( text ) {
  16689. jQuery.globalEval( text );
  16690. return text;
  16691. }
  16692. }
  16693. } );
  16694. // Handle cache's special case and crossDomain
  16695. jQuery.ajaxPrefilter( "script", function( s ) {
  16696. if ( s.cache === undefined ) {
  16697. s.cache = false;
  16698. }
  16699. if ( s.crossDomain ) {
  16700. s.type = "GET";
  16701. }
  16702. } );
  16703. // Bind script tag hack transport
  16704. jQuery.ajaxTransport( "script", function( s ) {
  16705. // This transport only deals with cross domain or forced-by-attrs requests
  16706. if ( s.crossDomain || s.scriptAttrs ) {
  16707. var script, callback;
  16708. return {
  16709. send: function( _, complete ) {
  16710. script = jQuery( "<script>" )
  16711. .attr( s.scriptAttrs || {} )
  16712. .prop( { charset: s.scriptCharset, src: s.url } )
  16713. .on( "load error", callback = function( evt ) {
  16714. script.remove();
  16715. callback = null;
  16716. if ( evt ) {
  16717. complete( evt.type === "error" ? 404 : 200, evt.type );
  16718. }
  16719. } );
  16720. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16721. document.head.appendChild( script[ 0 ] );
  16722. },
  16723. abort: function() {
  16724. if ( callback ) {
  16725. callback();
  16726. }
  16727. }
  16728. };
  16729. }
  16730. } );
  16731. var oldCallbacks = [],
  16732. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16733. // Default jsonp settings
  16734. jQuery.ajaxSetup( {
  16735. jsonp: "callback",
  16736. jsonpCallback: function() {
  16737. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16738. this[ callback ] = true;
  16739. return callback;
  16740. }
  16741. } );
  16742. // Detect, normalize options and install callbacks for jsonp requests
  16743. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16744. var callbackName, overwritten, responseContainer,
  16745. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16746. "url" :
  16747. typeof s.data === "string" &&
  16748. ( s.contentType || "" )
  16749. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16750. rjsonp.test( s.data ) && "data"
  16751. );
  16752. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16753. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16754. // Get callback name, remembering preexisting value associated with it
  16755. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16756. s.jsonpCallback() :
  16757. s.jsonpCallback;
  16758. // Insert callback into url or form data
  16759. if ( jsonProp ) {
  16760. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16761. } else if ( s.jsonp !== false ) {
  16762. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16763. }
  16764. // Use data converter to retrieve json after script execution
  16765. s.converters[ "script json" ] = function() {
  16766. if ( !responseContainer ) {
  16767. jQuery.error( callbackName + " was not called" );
  16768. }
  16769. return responseContainer[ 0 ];
  16770. };
  16771. // Force json dataType
  16772. s.dataTypes[ 0 ] = "json";
  16773. // Install callback
  16774. overwritten = window[ callbackName ];
  16775. window[ callbackName ] = function() {
  16776. responseContainer = arguments;
  16777. };
  16778. // Clean-up function (fires after converters)
  16779. jqXHR.always( function() {
  16780. // If previous value didn't exist - remove it
  16781. if ( overwritten === undefined ) {
  16782. jQuery( window ).removeProp( callbackName );
  16783. // Otherwise restore preexisting value
  16784. } else {
  16785. window[ callbackName ] = overwritten;
  16786. }
  16787. // Save back as free
  16788. if ( s[ callbackName ] ) {
  16789. // Make sure that re-using the options doesn't screw things around
  16790. s.jsonpCallback = originalSettings.jsonpCallback;
  16791. // Save the callback name for future use
  16792. oldCallbacks.push( callbackName );
  16793. }
  16794. // Call if it was a function and we have a response
  16795. if ( responseContainer && isFunction( overwritten ) ) {
  16796. overwritten( responseContainer[ 0 ] );
  16797. }
  16798. responseContainer = overwritten = undefined;
  16799. } );
  16800. // Delegate to script
  16801. return "script";
  16802. }
  16803. } );
  16804. // Support: Safari 8 only
  16805. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16806. // collapse sibling forms: the second one becomes a child of the first one.
  16807. // Because of that, this security measure has to be disabled in Safari 8.
  16808. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16809. support.createHTMLDocument = ( function() {
  16810. var body = document.implementation.createHTMLDocument( "" ).body;
  16811. body.innerHTML = "<form></form><form></form>";
  16812. return body.childNodes.length === 2;
  16813. } )();
  16814. // Argument "data" should be string of html
  16815. // context (optional): If specified, the fragment will be created in this context,
  16816. // defaults to document
  16817. // keepScripts (optional): If true, will include scripts passed in the html string
  16818. jQuery.parseHTML = function( data, context, keepScripts ) {
  16819. if ( typeof data !== "string" ) {
  16820. return [];
  16821. }
  16822. if ( typeof context === "boolean" ) {
  16823. keepScripts = context;
  16824. context = false;
  16825. }
  16826. var base, parsed, scripts;
  16827. if ( !context ) {
  16828. // Stop scripts or inline event handlers from being executed immediately
  16829. // by using document.implementation
  16830. if ( support.createHTMLDocument ) {
  16831. context = document.implementation.createHTMLDocument( "" );
  16832. // Set the base href for the created document
  16833. // so any parsed elements with URLs
  16834. // are based on the document's URL (gh-2965)
  16835. base = context.createElement( "base" );
  16836. base.href = document.location.href;
  16837. context.head.appendChild( base );
  16838. } else {
  16839. context = document;
  16840. }
  16841. }
  16842. parsed = rsingleTag.exec( data );
  16843. scripts = !keepScripts && [];
  16844. // Single tag
  16845. if ( parsed ) {
  16846. return [ context.createElement( parsed[ 1 ] ) ];
  16847. }
  16848. parsed = buildFragment( [ data ], context, scripts );
  16849. if ( scripts && scripts.length ) {
  16850. jQuery( scripts ).remove();
  16851. }
  16852. return jQuery.merge( [], parsed.childNodes );
  16853. };
  16854. /**
  16855. * Load a url into a page
  16856. */
  16857. jQuery.fn.load = function( url, params, callback ) {
  16858. var selector, type, response,
  16859. self = this,
  16860. off = url.indexOf( " " );
  16861. if ( off > -1 ) {
  16862. selector = stripAndCollapse( url.slice( off ) );
  16863. url = url.slice( 0, off );
  16864. }
  16865. // If it's a function
  16866. if ( isFunction( params ) ) {
  16867. // We assume that it's the callback
  16868. callback = params;
  16869. params = undefined;
  16870. // Otherwise, build a param string
  16871. } else if ( params && typeof params === "object" ) {
  16872. type = "POST";
  16873. }
  16874. // If we have elements to modify, make the request
  16875. if ( self.length > 0 ) {
  16876. jQuery.ajax( {
  16877. url: url,
  16878. // If "type" variable is undefined, then "GET" method will be used.
  16879. // Make value of this field explicit since
  16880. // user can override it through ajaxSetup method
  16881. type: type || "GET",
  16882. dataType: "html",
  16883. data: params
  16884. } ).done( function( responseText ) {
  16885. // Save response for use in complete callback
  16886. response = arguments;
  16887. self.html( selector ?
  16888. // If a selector was specified, locate the right elements in a dummy div
  16889. // Exclude scripts to avoid IE 'Permission Denied' errors
  16890. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16891. // Otherwise use the full result
  16892. responseText );
  16893. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16894. // but they are ignored because response was set above.
  16895. // If it fails, this function gets "jqXHR", "status", "error"
  16896. } ).always( callback && function( jqXHR, status ) {
  16897. self.each( function() {
  16898. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16899. } );
  16900. } );
  16901. }
  16902. return this;
  16903. };
  16904. // Attach a bunch of functions for handling common AJAX events
  16905. jQuery.each( [
  16906. "ajaxStart",
  16907. "ajaxStop",
  16908. "ajaxComplete",
  16909. "ajaxError",
  16910. "ajaxSuccess",
  16911. "ajaxSend"
  16912. ], function( i, type ) {
  16913. jQuery.fn[ type ] = function( fn ) {
  16914. return this.on( type, fn );
  16915. };
  16916. } );
  16917. jQuery.expr.pseudos.animated = function( elem ) {
  16918. return jQuery.grep( jQuery.timers, function( fn ) {
  16919. return elem === fn.elem;
  16920. } ).length;
  16921. };
  16922. jQuery.offset = {
  16923. setOffset: function( elem, options, i ) {
  16924. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16925. position = jQuery.css( elem, "position" ),
  16926. curElem = jQuery( elem ),
  16927. props = {};
  16928. // Set position first, in-case top/left are set even on static elem
  16929. if ( position === "static" ) {
  16930. elem.style.position = "relative";
  16931. }
  16932. curOffset = curElem.offset();
  16933. curCSSTop = jQuery.css( elem, "top" );
  16934. curCSSLeft = jQuery.css( elem, "left" );
  16935. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16936. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16937. // Need to be able to calculate position if either
  16938. // top or left is auto and position is either absolute or fixed
  16939. if ( calculatePosition ) {
  16940. curPosition = curElem.position();
  16941. curTop = curPosition.top;
  16942. curLeft = curPosition.left;
  16943. } else {
  16944. curTop = parseFloat( curCSSTop ) || 0;
  16945. curLeft = parseFloat( curCSSLeft ) || 0;
  16946. }
  16947. if ( isFunction( options ) ) {
  16948. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16949. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16950. }
  16951. if ( options.top != null ) {
  16952. props.top = ( options.top - curOffset.top ) + curTop;
  16953. }
  16954. if ( options.left != null ) {
  16955. props.left = ( options.left - curOffset.left ) + curLeft;
  16956. }
  16957. if ( "using" in options ) {
  16958. options.using.call( elem, props );
  16959. } else {
  16960. curElem.css( props );
  16961. }
  16962. }
  16963. };
  16964. jQuery.fn.extend( {
  16965. // offset() relates an element's border box to the document origin
  16966. offset: function( options ) {
  16967. // Preserve chaining for setter
  16968. if ( arguments.length ) {
  16969. return options === undefined ?
  16970. this :
  16971. this.each( function( i ) {
  16972. jQuery.offset.setOffset( this, options, i );
  16973. } );
  16974. }
  16975. var rect, win,
  16976. elem = this[ 0 ];
  16977. if ( !elem ) {
  16978. return;
  16979. }
  16980. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16981. // Support: IE <=11 only
  16982. // Running getBoundingClientRect on a
  16983. // disconnected node in IE throws an error
  16984. if ( !elem.getClientRects().length ) {
  16985. return { top: 0, left: 0 };
  16986. }
  16987. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16988. rect = elem.getBoundingClientRect();
  16989. win = elem.ownerDocument.defaultView;
  16990. return {
  16991. top: rect.top + win.pageYOffset,
  16992. left: rect.left + win.pageXOffset
  16993. };
  16994. },
  16995. // position() relates an element's margin box to its offset parent's padding box
  16996. // This corresponds to the behavior of CSS absolute positioning
  16997. position: function() {
  16998. if ( !this[ 0 ] ) {
  16999. return;
  17000. }
  17001. var offsetParent, offset, doc,
  17002. elem = this[ 0 ],
  17003. parentOffset = { top: 0, left: 0 };
  17004. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17005. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17006. // Assume position:fixed implies availability of getBoundingClientRect
  17007. offset = elem.getBoundingClientRect();
  17008. } else {
  17009. offset = this.offset();
  17010. // Account for the *real* offset parent, which can be the document or its root element
  17011. // when a statically positioned element is identified
  17012. doc = elem.ownerDocument;
  17013. offsetParent = elem.offsetParent || doc.documentElement;
  17014. while ( offsetParent &&
  17015. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17016. jQuery.css( offsetParent, "position" ) === "static" ) {
  17017. offsetParent = offsetParent.parentNode;
  17018. }
  17019. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17020. // Incorporate borders into its offset, since they are outside its content origin
  17021. parentOffset = jQuery( offsetParent ).offset();
  17022. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17023. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17024. }
  17025. }
  17026. // Subtract parent offsets and element margins
  17027. return {
  17028. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17029. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17030. };
  17031. },
  17032. // This method will return documentElement in the following cases:
  17033. // 1) For the element inside the iframe without offsetParent, this method will return
  17034. // documentElement of the parent window
  17035. // 2) For the hidden or detached element
  17036. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17037. //
  17038. // but those exceptions were never presented as a real life use-cases
  17039. // and might be considered as more preferable results.
  17040. //
  17041. // This logic, however, is not guaranteed and can change at any point in the future
  17042. offsetParent: function() {
  17043. return this.map( function() {
  17044. var offsetParent = this.offsetParent;
  17045. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17046. offsetParent = offsetParent.offsetParent;
  17047. }
  17048. return offsetParent || documentElement;
  17049. } );
  17050. }
  17051. } );
  17052. // Create scrollLeft and scrollTop methods
  17053. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17054. var top = "pageYOffset" === prop;
  17055. jQuery.fn[ method ] = function( val ) {
  17056. return access( this, function( elem, method, val ) {
  17057. // Coalesce documents and windows
  17058. var win;
  17059. if ( isWindow( elem ) ) {
  17060. win = elem;
  17061. } else if ( elem.nodeType === 9 ) {
  17062. win = elem.defaultView;
  17063. }
  17064. if ( val === undefined ) {
  17065. return win ? win[ prop ] : elem[ method ];
  17066. }
  17067. if ( win ) {
  17068. win.scrollTo(
  17069. !top ? val : win.pageXOffset,
  17070. top ? val : win.pageYOffset
  17071. );
  17072. } else {
  17073. elem[ method ] = val;
  17074. }
  17075. }, method, val, arguments.length );
  17076. };
  17077. } );
  17078. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17079. // Add the top/left cssHooks using jQuery.fn.position
  17080. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17081. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17082. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17083. // rather than make the css module depend on the offset module, just check for it here
  17084. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17085. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17086. function( elem, computed ) {
  17087. if ( computed ) {
  17088. computed = curCSS( elem, prop );
  17089. // If curCSS returns percentage, fallback to offset
  17090. return rnumnonpx.test( computed ) ?
  17091. jQuery( elem ).position()[ prop ] + "px" :
  17092. computed;
  17093. }
  17094. }
  17095. );
  17096. } );
  17097. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17098. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17099. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17100. function( defaultExtra, funcName ) {
  17101. // Margin is only for outerHeight, outerWidth
  17102. jQuery.fn[ funcName ] = function( margin, value ) {
  17103. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17104. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17105. return access( this, function( elem, type, value ) {
  17106. var doc;
  17107. if ( isWindow( elem ) ) {
  17108. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17109. return funcName.indexOf( "outer" ) === 0 ?
  17110. elem[ "inner" + name ] :
  17111. elem.document.documentElement[ "client" + name ];
  17112. }
  17113. // Get document width or height
  17114. if ( elem.nodeType === 9 ) {
  17115. doc = elem.documentElement;
  17116. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17117. // whichever is greatest
  17118. return Math.max(
  17119. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17120. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17121. doc[ "client" + name ]
  17122. );
  17123. }
  17124. return value === undefined ?
  17125. // Get width or height on the element, requesting but not forcing parseFloat
  17126. jQuery.css( elem, type, extra ) :
  17127. // Set width or height on the element
  17128. jQuery.style( elem, type, value, extra );
  17129. }, type, chainable ? margin : undefined, chainable );
  17130. };
  17131. } );
  17132. } );
  17133. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17134. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17135. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17136. function( i, name ) {
  17137. // Handle event binding
  17138. jQuery.fn[ name ] = function( data, fn ) {
  17139. return arguments.length > 0 ?
  17140. this.on( name, null, data, fn ) :
  17141. this.trigger( name );
  17142. };
  17143. } );
  17144. jQuery.fn.extend( {
  17145. hover: function( fnOver, fnOut ) {
  17146. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17147. }
  17148. } );
  17149. jQuery.fn.extend( {
  17150. bind: function( types, data, fn ) {
  17151. return this.on( types, null, data, fn );
  17152. },
  17153. unbind: function( types, fn ) {
  17154. return this.off( types, null, fn );
  17155. },
  17156. delegate: function( selector, types, data, fn ) {
  17157. return this.on( types, selector, data, fn );
  17158. },
  17159. undelegate: function( selector, types, fn ) {
  17160. // ( namespace ) or ( selector, types [, fn] )
  17161. return arguments.length === 1 ?
  17162. this.off( selector, "**" ) :
  17163. this.off( types, selector || "**", fn );
  17164. }
  17165. } );
  17166. // Bind a function to a context, optionally partially applying any
  17167. // arguments.
  17168. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17169. // However, it is not slated for removal any time soon
  17170. jQuery.proxy = function( fn, context ) {
  17171. var tmp, args, proxy;
  17172. if ( typeof context === "string" ) {
  17173. tmp = fn[ context ];
  17174. context = fn;
  17175. fn = tmp;
  17176. }
  17177. // Quick check to determine if target is callable, in the spec
  17178. // this throws a TypeError, but we will just return undefined.
  17179. if ( !isFunction( fn ) ) {
  17180. return undefined;
  17181. }
  17182. // Simulated bind
  17183. args = slice.call( arguments, 2 );
  17184. proxy = function() {
  17185. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17186. };
  17187. // Set the guid of unique handler to the same of original handler, so it can be removed
  17188. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17189. return proxy;
  17190. };
  17191. jQuery.holdReady = function( hold ) {
  17192. if ( hold ) {
  17193. jQuery.readyWait++;
  17194. } else {
  17195. jQuery.ready( true );
  17196. }
  17197. };
  17198. jQuery.isArray = Array.isArray;
  17199. jQuery.parseJSON = JSON.parse;
  17200. jQuery.nodeName = nodeName;
  17201. jQuery.isFunction = isFunction;
  17202. jQuery.isWindow = isWindow;
  17203. jQuery.camelCase = camelCase;
  17204. jQuery.type = toType;
  17205. jQuery.now = Date.now;
  17206. jQuery.isNumeric = function( obj ) {
  17207. // As of jQuery 3.0, isNumeric is limited to
  17208. // strings and numbers (primitives or objects)
  17209. // that can be coerced to finite numbers (gh-2662)
  17210. var type = jQuery.type( obj );
  17211. return ( type === "number" || type === "string" ) &&
  17212. // parseFloat NaNs numeric-cast false positives ("")
  17213. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17214. // subtraction forces infinities to NaN
  17215. !isNaN( obj - parseFloat( obj ) );
  17216. };
  17217. // Register as a named AMD module, since jQuery can be concatenated with other
  17218. // files that may use define, but not via a proper concatenation script that
  17219. // understands anonymous AMD modules. A named AMD is safest and most robust
  17220. // way to register. Lowercase jquery is used because AMD module names are
  17221. // derived from file names, and jQuery is normally delivered in a lowercase
  17222. // file name. Do this after creating the global so that if an AMD module wants
  17223. // to call noConflict to hide this version of jQuery, it will work.
  17224. // Note that for maximum portability, libraries that are not jQuery should
  17225. // declare themselves as anonymous modules, and avoid setting a global if an
  17226. // AMD loader is present. jQuery is a special case. For more information, see
  17227. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17228. if ( true ) {
  17229. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17230. return jQuery;
  17231. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17232. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17233. }
  17234. var
  17235. // Map over jQuery in case of overwrite
  17236. _jQuery = window.jQuery,
  17237. // Map over the $ in case of overwrite
  17238. _$ = window.$;
  17239. jQuery.noConflict = function( deep ) {
  17240. if ( window.$ === jQuery ) {
  17241. window.$ = _$;
  17242. }
  17243. if ( deep && window.jQuery === jQuery ) {
  17244. window.jQuery = _jQuery;
  17245. }
  17246. return jQuery;
  17247. };
  17248. // Expose jQuery and $ identifiers, even in AMD
  17249. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17250. // and CommonJS for browser emulators (#13566)
  17251. if ( !noGlobal ) {
  17252. window.jQuery = window.$ = jQuery;
  17253. }
  17254. return jQuery;
  17255. } );
  17256. /***/ }),
  17257. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17258. /*!************************************************!*\
  17259. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17260. \************************************************/
  17261. /*! exports provided: default */
  17262. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17263. "use strict";
  17264. __webpack_require__.r(__webpack_exports__);
  17265. var classCallCheck = function (instance, Constructor) {
  17266. if (!(instance instanceof Constructor)) {
  17267. throw new TypeError("Cannot call a class as a function");
  17268. }
  17269. };
  17270. var createClass = function () {
  17271. function defineProperties(target, props) {
  17272. for (var i = 0; i < props.length; i++) {
  17273. var descriptor = props[i];
  17274. descriptor.enumerable = descriptor.enumerable || false;
  17275. descriptor.configurable = true;
  17276. if ("value" in descriptor) descriptor.writable = true;
  17277. Object.defineProperty(target, descriptor.key, descriptor);
  17278. }
  17279. }
  17280. return function (Constructor, protoProps, staticProps) {
  17281. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17282. if (staticProps) defineProperties(Constructor, staticProps);
  17283. return Constructor;
  17284. };
  17285. }();
  17286. var _extends = Object.assign || function (target) {
  17287. for (var i = 1; i < arguments.length; i++) {
  17288. var source = arguments[i];
  17289. for (var key in source) {
  17290. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17291. target[key] = source[key];
  17292. }
  17293. }
  17294. }
  17295. return target;
  17296. };
  17297. var inherits = function (subClass, superClass) {
  17298. if (typeof superClass !== "function" && superClass !== null) {
  17299. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17300. }
  17301. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17302. constructor: {
  17303. value: subClass,
  17304. enumerable: false,
  17305. writable: true,
  17306. configurable: true
  17307. }
  17308. });
  17309. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17310. };
  17311. var possibleConstructorReturn = function (self, call) {
  17312. if (!self) {
  17313. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17314. }
  17315. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17316. };
  17317. var Connector = function () {
  17318. /**
  17319. * Create a new class instance.
  17320. */
  17321. function Connector(options) {
  17322. classCallCheck(this, Connector);
  17323. /**
  17324. * Default connector options.
  17325. */
  17326. this._defaultOptions = {
  17327. auth: {
  17328. headers: {}
  17329. },
  17330. authEndpoint: '/broadcasting/auth',
  17331. broadcaster: 'pusher',
  17332. csrfToken: null,
  17333. host: null,
  17334. key: null,
  17335. namespace: 'App.Events'
  17336. };
  17337. this.setOptions(options);
  17338. this.connect();
  17339. }
  17340. /**
  17341. * Merge the custom options with the defaults.
  17342. */
  17343. createClass(Connector, [{
  17344. key: 'setOptions',
  17345. value: function setOptions(options) {
  17346. this.options = _extends(this._defaultOptions, options);
  17347. if (this.csrfToken()) {
  17348. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17349. }
  17350. return options;
  17351. }
  17352. /**
  17353. * Extract the CSRF token from the page.
  17354. */
  17355. }, {
  17356. key: 'csrfToken',
  17357. value: function csrfToken() {
  17358. var selector = void 0;
  17359. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17360. return window['Laravel'].csrfToken;
  17361. } else if (this.options.csrfToken) {
  17362. return this.options.csrfToken;
  17363. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17364. return selector.getAttribute('content');
  17365. }
  17366. return null;
  17367. }
  17368. }]);
  17369. return Connector;
  17370. }();
  17371. /**
  17372. * This class represents a basic channel.
  17373. */
  17374. var Channel = function () {
  17375. function Channel() {
  17376. classCallCheck(this, Channel);
  17377. }
  17378. createClass(Channel, [{
  17379. key: 'listenForWhisper',
  17380. /**
  17381. * Listen for a whisper event on the channel instance.
  17382. */
  17383. value: function listenForWhisper(event, callback) {
  17384. return this.listen('.client-' + event, callback);
  17385. }
  17386. /**
  17387. * Listen for an event on the channel instance.
  17388. */
  17389. }, {
  17390. key: 'notification',
  17391. value: function notification(callback) {
  17392. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17393. }
  17394. /**
  17395. * Stop listening for a whispser event on the channel instance.
  17396. */
  17397. }, {
  17398. key: 'stopListeningForWhisper',
  17399. value: function stopListeningForWhisper(event) {
  17400. return this.stopListening('.client-' + event);
  17401. }
  17402. }]);
  17403. return Channel;
  17404. }();
  17405. /**
  17406. * Event name formatter
  17407. */
  17408. var EventFormatter = function () {
  17409. /**
  17410. * Create a new class instance.
  17411. */
  17412. function EventFormatter(namespace) {
  17413. classCallCheck(this, EventFormatter);
  17414. this.setNamespace(namespace);
  17415. }
  17416. /**
  17417. * Format the given event name.
  17418. */
  17419. createClass(EventFormatter, [{
  17420. key: 'format',
  17421. value: function format(event) {
  17422. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17423. return event.substr(1);
  17424. } else if (this.namespace) {
  17425. event = this.namespace + '.' + event;
  17426. }
  17427. return event.replace(/\./g, '\\');
  17428. }
  17429. /**
  17430. * Set the event namespace.
  17431. */
  17432. }, {
  17433. key: 'setNamespace',
  17434. value: function setNamespace(value) {
  17435. this.namespace = value;
  17436. }
  17437. }]);
  17438. return EventFormatter;
  17439. }();
  17440. /**
  17441. * This class represents a Pusher channel.
  17442. */
  17443. var PusherChannel = function (_Channel) {
  17444. inherits(PusherChannel, _Channel);
  17445. /**
  17446. * Create a new class instance.
  17447. */
  17448. function PusherChannel(pusher, name, options) {
  17449. classCallCheck(this, PusherChannel);
  17450. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17451. _this.name = name;
  17452. _this.pusher = pusher;
  17453. _this.options = options;
  17454. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17455. _this.subscribe();
  17456. return _this;
  17457. }
  17458. /**
  17459. * Subscribe to a Pusher channel.
  17460. */
  17461. createClass(PusherChannel, [{
  17462. key: 'subscribe',
  17463. value: function subscribe() {
  17464. this.subscription = this.pusher.subscribe(this.name);
  17465. }
  17466. /**
  17467. * Unsubscribe from a Pusher channel.
  17468. */
  17469. }, {
  17470. key: 'unsubscribe',
  17471. value: function unsubscribe() {
  17472. this.pusher.unsubscribe(this.name);
  17473. }
  17474. /**
  17475. * Listen for an event on the channel instance.
  17476. */
  17477. }, {
  17478. key: 'listen',
  17479. value: function listen(event, callback) {
  17480. this.on(this.eventFormatter.format(event), callback);
  17481. return this;
  17482. }
  17483. /**
  17484. * Stop listening for an event on the channel instance.
  17485. */
  17486. }, {
  17487. key: 'stopListening',
  17488. value: function stopListening(event) {
  17489. this.subscription.unbind(this.eventFormatter.format(event));
  17490. return this;
  17491. }
  17492. /**
  17493. * Bind a channel to an event.
  17494. */
  17495. }, {
  17496. key: 'on',
  17497. value: function on(event, callback) {
  17498. this.subscription.bind(event, callback);
  17499. return this;
  17500. }
  17501. }]);
  17502. return PusherChannel;
  17503. }(Channel);
  17504. /**
  17505. * This class represents a Pusher private channel.
  17506. */
  17507. var PusherPrivateChannel = function (_PusherChannel) {
  17508. inherits(PusherPrivateChannel, _PusherChannel);
  17509. function PusherPrivateChannel() {
  17510. classCallCheck(this, PusherPrivateChannel);
  17511. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17512. }
  17513. createClass(PusherPrivateChannel, [{
  17514. key: 'whisper',
  17515. /**
  17516. * Trigger client event on the channel.
  17517. */
  17518. value: function whisper(eventName, data) {
  17519. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17520. return this;
  17521. }
  17522. }]);
  17523. return PusherPrivateChannel;
  17524. }(PusherChannel);
  17525. /**
  17526. * This class represents a Pusher presence channel.
  17527. */
  17528. var PusherPresenceChannel = function (_PusherChannel) {
  17529. inherits(PusherPresenceChannel, _PusherChannel);
  17530. function PusherPresenceChannel() {
  17531. classCallCheck(this, PusherPresenceChannel);
  17532. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17533. }
  17534. createClass(PusherPresenceChannel, [{
  17535. key: 'here',
  17536. /**
  17537. * Register a callback to be called anytime the member list changes.
  17538. */
  17539. value: function here(callback) {
  17540. this.on('pusher:subscription_succeeded', function (data) {
  17541. callback(Object.keys(data.members).map(function (k) {
  17542. return data.members[k];
  17543. }));
  17544. });
  17545. return this;
  17546. }
  17547. /**
  17548. * Listen for someone joining the channel.
  17549. */
  17550. }, {
  17551. key: 'joining',
  17552. value: function joining(callback) {
  17553. this.on('pusher:member_added', function (member) {
  17554. callback(member.info);
  17555. });
  17556. return this;
  17557. }
  17558. /**
  17559. * Listen for someone leaving the channel.
  17560. */
  17561. }, {
  17562. key: 'leaving',
  17563. value: function leaving(callback) {
  17564. this.on('pusher:member_removed', function (member) {
  17565. callback(member.info);
  17566. });
  17567. return this;
  17568. }
  17569. /**
  17570. * Trigger client event on the channel.
  17571. */
  17572. }, {
  17573. key: 'whisper',
  17574. value: function whisper(eventName, data) {
  17575. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17576. return this;
  17577. }
  17578. }]);
  17579. return PusherPresenceChannel;
  17580. }(PusherChannel);
  17581. /**
  17582. * This class represents a Socket.io channel.
  17583. */
  17584. var SocketIoChannel = function (_Channel) {
  17585. inherits(SocketIoChannel, _Channel);
  17586. /**
  17587. * Create a new class instance.
  17588. */
  17589. function SocketIoChannel(socket, name, options) {
  17590. classCallCheck(this, SocketIoChannel);
  17591. /**
  17592. * The event callbacks applied to the channel.
  17593. */
  17594. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17595. _this.events = {};
  17596. _this.name = name;
  17597. _this.socket = socket;
  17598. _this.options = options;
  17599. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17600. _this.subscribe();
  17601. _this.configureReconnector();
  17602. return _this;
  17603. }
  17604. /**
  17605. * Subscribe to a Socket.io channel.
  17606. */
  17607. createClass(SocketIoChannel, [{
  17608. key: 'subscribe',
  17609. value: function subscribe() {
  17610. this.socket.emit('subscribe', {
  17611. channel: this.name,
  17612. auth: this.options.auth || {}
  17613. });
  17614. }
  17615. /**
  17616. * Unsubscribe from channel and ubind event callbacks.
  17617. */
  17618. }, {
  17619. key: 'unsubscribe',
  17620. value: function unsubscribe() {
  17621. this.unbind();
  17622. this.socket.emit('unsubscribe', {
  17623. channel: this.name,
  17624. auth: this.options.auth || {}
  17625. });
  17626. }
  17627. /**
  17628. * Listen for an event on the channel instance.
  17629. */
  17630. }, {
  17631. key: 'listen',
  17632. value: function listen(event, callback) {
  17633. this.on(this.eventFormatter.format(event), callback);
  17634. return this;
  17635. }
  17636. /**
  17637. * Stop listening for an event on the channel instance.
  17638. */
  17639. }, {
  17640. key: 'stopListening',
  17641. value: function stopListening(event) {
  17642. var name = this.eventFormatter.format(event);
  17643. this.socket.removeListener(name);
  17644. delete this.events[name];
  17645. return this;
  17646. }
  17647. /**
  17648. * Bind the channel's socket to an event and store the callback.
  17649. */
  17650. }, {
  17651. key: 'on',
  17652. value: function on(event, callback) {
  17653. var _this2 = this;
  17654. var listener = function listener(channel, data) {
  17655. if (_this2.name == channel) {
  17656. callback(data);
  17657. }
  17658. };
  17659. this.socket.on(event, listener);
  17660. this.bind(event, listener);
  17661. }
  17662. /**
  17663. * Attach a 'reconnect' listener and bind the event.
  17664. */
  17665. }, {
  17666. key: 'configureReconnector',
  17667. value: function configureReconnector() {
  17668. var _this3 = this;
  17669. var listener = function listener() {
  17670. _this3.subscribe();
  17671. };
  17672. this.socket.on('reconnect', listener);
  17673. this.bind('reconnect', listener);
  17674. }
  17675. /**
  17676. * Bind the channel's socket to an event and store the callback.
  17677. */
  17678. }, {
  17679. key: 'bind',
  17680. value: function bind(event, callback) {
  17681. this.events[event] = this.events[event] || [];
  17682. this.events[event].push(callback);
  17683. }
  17684. /**
  17685. * Unbind the channel's socket from all stored event callbacks.
  17686. */
  17687. }, {
  17688. key: 'unbind',
  17689. value: function unbind() {
  17690. var _this4 = this;
  17691. Object.keys(this.events).forEach(function (event) {
  17692. _this4.events[event].forEach(function (callback) {
  17693. _this4.socket.removeListener(event, callback);
  17694. });
  17695. delete _this4.events[event];
  17696. });
  17697. }
  17698. }]);
  17699. return SocketIoChannel;
  17700. }(Channel);
  17701. /**
  17702. * This class represents a Socket.io presence channel.
  17703. */
  17704. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17705. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17706. function SocketIoPrivateChannel() {
  17707. classCallCheck(this, SocketIoPrivateChannel);
  17708. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17709. }
  17710. createClass(SocketIoPrivateChannel, [{
  17711. key: 'whisper',
  17712. /**
  17713. * Trigger client event on the channel.
  17714. */
  17715. value: function whisper(eventName, data) {
  17716. this.socket.emit('client event', {
  17717. channel: this.name,
  17718. event: 'client-' + eventName,
  17719. data: data
  17720. });
  17721. return this;
  17722. }
  17723. }]);
  17724. return SocketIoPrivateChannel;
  17725. }(SocketIoChannel);
  17726. /**
  17727. * This class represents a Socket.io presence channel.
  17728. */
  17729. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17730. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17731. function SocketIoPresenceChannel() {
  17732. classCallCheck(this, SocketIoPresenceChannel);
  17733. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17734. }
  17735. createClass(SocketIoPresenceChannel, [{
  17736. key: 'here',
  17737. /**
  17738. * Register a callback to be called anytime the member list changes.
  17739. */
  17740. value: function here(callback) {
  17741. this.on('presence:subscribed', function (members) {
  17742. callback(members.map(function (m) {
  17743. return m.user_info;
  17744. }));
  17745. });
  17746. return this;
  17747. }
  17748. /**
  17749. * Listen for someone joining the channel.
  17750. */
  17751. }, {
  17752. key: 'joining',
  17753. value: function joining(callback) {
  17754. this.on('presence:joining', function (member) {
  17755. return callback(member.user_info);
  17756. });
  17757. return this;
  17758. }
  17759. /**
  17760. * Listen for someone leaving the channel.
  17761. */
  17762. }, {
  17763. key: 'leaving',
  17764. value: function leaving(callback) {
  17765. this.on('presence:leaving', function (member) {
  17766. return callback(member.user_info);
  17767. });
  17768. return this;
  17769. }
  17770. }]);
  17771. return SocketIoPresenceChannel;
  17772. }(SocketIoPrivateChannel);
  17773. /**
  17774. * This class represents a null channel.
  17775. */
  17776. var NullChannel = function (_Channel) {
  17777. inherits(NullChannel, _Channel);
  17778. function NullChannel() {
  17779. classCallCheck(this, NullChannel);
  17780. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17781. }
  17782. createClass(NullChannel, [{
  17783. key: 'subscribe',
  17784. /**
  17785. * Subscribe to a channel.
  17786. */
  17787. value: function subscribe() {}
  17788. //
  17789. /**
  17790. * Unsubscribe from a channel.
  17791. */
  17792. }, {
  17793. key: 'unsubscribe',
  17794. value: function unsubscribe() {}
  17795. //
  17796. /**
  17797. * Listen for an event on the channel instance.
  17798. */
  17799. }, {
  17800. key: 'listen',
  17801. value: function listen(event, callback) {
  17802. return this;
  17803. }
  17804. /**
  17805. * Stop listening for an event on the channel instance.
  17806. */
  17807. }, {
  17808. key: 'stopListening',
  17809. value: function stopListening(event) {
  17810. return this;
  17811. }
  17812. /**
  17813. * Bind a channel to an event.
  17814. */
  17815. }, {
  17816. key: 'on',
  17817. value: function on(event, callback) {
  17818. return this;
  17819. }
  17820. }]);
  17821. return NullChannel;
  17822. }(Channel);
  17823. /**
  17824. * This class represents a null private channel.
  17825. */
  17826. var NullPrivateChannel = function (_NullChannel) {
  17827. inherits(NullPrivateChannel, _NullChannel);
  17828. function NullPrivateChannel() {
  17829. classCallCheck(this, NullPrivateChannel);
  17830. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17831. }
  17832. createClass(NullPrivateChannel, [{
  17833. key: 'whisper',
  17834. /**
  17835. * Trigger client event on the channel.
  17836. */
  17837. value: function whisper(eventName, data) {
  17838. return this;
  17839. }
  17840. }]);
  17841. return NullPrivateChannel;
  17842. }(NullChannel);
  17843. /**
  17844. * This class represents a null presence channel.
  17845. */
  17846. var NullPresenceChannel = function (_NullChannel) {
  17847. inherits(NullPresenceChannel, _NullChannel);
  17848. function NullPresenceChannel() {
  17849. classCallCheck(this, NullPresenceChannel);
  17850. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17851. }
  17852. createClass(NullPresenceChannel, [{
  17853. key: 'here',
  17854. /**
  17855. * Register a callback to be called anytime the member list changes.
  17856. */
  17857. value: function here(callback) {
  17858. return this;
  17859. }
  17860. /**
  17861. * Listen for someone joining the channel.
  17862. */
  17863. }, {
  17864. key: 'joining',
  17865. value: function joining(callback) {
  17866. return this;
  17867. }
  17868. /**
  17869. * Listen for someone leaving the channel.
  17870. */
  17871. }, {
  17872. key: 'leaving',
  17873. value: function leaving(callback) {
  17874. return this;
  17875. }
  17876. /**
  17877. * Trigger client event on the channel.
  17878. */
  17879. }, {
  17880. key: 'whisper',
  17881. value: function whisper(eventName, data) {
  17882. return this;
  17883. }
  17884. }]);
  17885. return NullPresenceChannel;
  17886. }(NullChannel);
  17887. /**
  17888. * This class creates a connector to Pusher.
  17889. */
  17890. var PusherConnector = function (_Connector) {
  17891. inherits(PusherConnector, _Connector);
  17892. function PusherConnector() {
  17893. classCallCheck(this, PusherConnector);
  17894. /**
  17895. * All of the subscribed channel names.
  17896. */
  17897. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17898. _this.channels = {};
  17899. return _this;
  17900. }
  17901. /**
  17902. * Create a fresh Pusher connection.
  17903. */
  17904. createClass(PusherConnector, [{
  17905. key: 'connect',
  17906. value: function connect() {
  17907. if (typeof this.options.client !== 'undefined') {
  17908. this.pusher = this.options.client;
  17909. } else {
  17910. this.pusher = new Pusher(this.options.key, this.options);
  17911. }
  17912. }
  17913. /**
  17914. * Listen for an event on a channel instance.
  17915. */
  17916. }, {
  17917. key: 'listen',
  17918. value: function listen(name, event, callback) {
  17919. return this.channel(name).listen(event, callback);
  17920. }
  17921. /**
  17922. * Get a channel instance by name.
  17923. */
  17924. }, {
  17925. key: 'channel',
  17926. value: function channel(name) {
  17927. if (!this.channels[name]) {
  17928. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17929. }
  17930. return this.channels[name];
  17931. }
  17932. /**
  17933. * Get a private channel instance by name.
  17934. */
  17935. }, {
  17936. key: 'privateChannel',
  17937. value: function privateChannel(name) {
  17938. if (!this.channels['private-' + name]) {
  17939. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17940. }
  17941. return this.channels['private-' + name];
  17942. }
  17943. /**
  17944. * Get a presence channel instance by name.
  17945. */
  17946. }, {
  17947. key: 'presenceChannel',
  17948. value: function presenceChannel(name) {
  17949. if (!this.channels['presence-' + name]) {
  17950. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17951. }
  17952. return this.channels['presence-' + name];
  17953. }
  17954. /**
  17955. * Leave the given channel, as well as its private and presence variants.
  17956. */
  17957. }, {
  17958. key: 'leave',
  17959. value: function leave(name) {
  17960. var _this2 = this;
  17961. var channels = [name, 'private-' + name, 'presence-' + name];
  17962. channels.forEach(function (name, index) {
  17963. _this2.leaveChannel(name);
  17964. });
  17965. }
  17966. /**
  17967. * Leave the given channel.
  17968. */
  17969. }, {
  17970. key: 'leaveChannel',
  17971. value: function leaveChannel(name) {
  17972. if (this.channels[name]) {
  17973. this.channels[name].unsubscribe();
  17974. delete this.channels[name];
  17975. }
  17976. }
  17977. /**
  17978. * Get the socket ID for the connection.
  17979. */
  17980. }, {
  17981. key: 'socketId',
  17982. value: function socketId() {
  17983. return this.pusher.connection.socket_id;
  17984. }
  17985. /**
  17986. * Disconnect Pusher connection.
  17987. */
  17988. }, {
  17989. key: 'disconnect',
  17990. value: function disconnect() {
  17991. this.pusher.disconnect();
  17992. }
  17993. }]);
  17994. return PusherConnector;
  17995. }(Connector);
  17996. /**
  17997. * This class creates a connnector to a Socket.io server.
  17998. */
  17999. var SocketIoConnector = function (_Connector) {
  18000. inherits(SocketIoConnector, _Connector);
  18001. function SocketIoConnector() {
  18002. classCallCheck(this, SocketIoConnector);
  18003. /**
  18004. * All of the subscribed channel names.
  18005. */
  18006. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18007. _this.channels = {};
  18008. return _this;
  18009. }
  18010. /**
  18011. * Create a fresh Socket.io connection.
  18012. */
  18013. createClass(SocketIoConnector, [{
  18014. key: 'connect',
  18015. value: function connect() {
  18016. var io = this.getSocketIO();
  18017. this.socket = io(this.options.host, this.options);
  18018. return this.socket;
  18019. }
  18020. /**
  18021. * Get socket.io module from global scope or options.
  18022. */
  18023. }, {
  18024. key: 'getSocketIO',
  18025. value: function getSocketIO() {
  18026. if (typeof this.options.client !== 'undefined') {
  18027. return this.options.client;
  18028. }
  18029. if (typeof io !== 'undefined') {
  18030. return io;
  18031. }
  18032. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18033. }
  18034. /**
  18035. * Listen for an event on a channel instance.
  18036. */
  18037. }, {
  18038. key: 'listen',
  18039. value: function listen(name, event, callback) {
  18040. return this.channel(name).listen(event, callback);
  18041. }
  18042. /**
  18043. * Get a channel instance by name.
  18044. */
  18045. }, {
  18046. key: 'channel',
  18047. value: function channel(name) {
  18048. if (!this.channels[name]) {
  18049. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18050. }
  18051. return this.channels[name];
  18052. }
  18053. /**
  18054. * Get a private channel instance by name.
  18055. */
  18056. }, {
  18057. key: 'privateChannel',
  18058. value: function privateChannel(name) {
  18059. if (!this.channels['private-' + name]) {
  18060. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18061. }
  18062. return this.channels['private-' + name];
  18063. }
  18064. /**
  18065. * Get a presence channel instance by name.
  18066. */
  18067. }, {
  18068. key: 'presenceChannel',
  18069. value: function presenceChannel(name) {
  18070. if (!this.channels['presence-' + name]) {
  18071. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18072. }
  18073. return this.channels['presence-' + name];
  18074. }
  18075. /**
  18076. * Leave the given channel, as well as its private and presence variants.
  18077. */
  18078. }, {
  18079. key: 'leave',
  18080. value: function leave(name) {
  18081. var _this2 = this;
  18082. var channels = [name, 'private-' + name, 'presence-' + name];
  18083. channels.forEach(function (name) {
  18084. _this2.leaveChannel(name);
  18085. });
  18086. }
  18087. /**
  18088. * Leave the given channel.
  18089. */
  18090. }, {
  18091. key: 'leaveChannel',
  18092. value: function leaveChannel(name) {
  18093. if (this.channels[name]) {
  18094. this.channels[name].unsubscribe();
  18095. delete this.channels[name];
  18096. }
  18097. }
  18098. /**
  18099. * Get the socket ID for the connection.
  18100. */
  18101. }, {
  18102. key: 'socketId',
  18103. value: function socketId() {
  18104. return this.socket.id;
  18105. }
  18106. /**
  18107. * Disconnect Socketio connection.
  18108. */
  18109. }, {
  18110. key: 'disconnect',
  18111. value: function disconnect() {
  18112. this.socket.disconnect();
  18113. }
  18114. }]);
  18115. return SocketIoConnector;
  18116. }(Connector);
  18117. /**
  18118. * This class creates a null connector.
  18119. */
  18120. var NullConnector = function (_Connector) {
  18121. inherits(NullConnector, _Connector);
  18122. function NullConnector() {
  18123. classCallCheck(this, NullConnector);
  18124. /**
  18125. * All of the subscribed channel names.
  18126. */
  18127. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18128. _this.channels = {};
  18129. return _this;
  18130. }
  18131. /**
  18132. * Create a fresh connection.
  18133. */
  18134. createClass(NullConnector, [{
  18135. key: 'connect',
  18136. value: function connect() {}
  18137. //
  18138. /**
  18139. * Listen for an event on a channel instance.
  18140. */
  18141. }, {
  18142. key: 'listen',
  18143. value: function listen(name, event, callback) {
  18144. return new NullChannel();
  18145. }
  18146. /**
  18147. * Get a channel instance by name.
  18148. */
  18149. }, {
  18150. key: 'channel',
  18151. value: function channel(name) {
  18152. return new NullChannel();
  18153. }
  18154. /**
  18155. * Get a private channel instance by name.
  18156. */
  18157. }, {
  18158. key: 'privateChannel',
  18159. value: function privateChannel(name) {
  18160. return new NullPrivateChannel();
  18161. }
  18162. /**
  18163. * Get a presence channel instance by name.
  18164. */
  18165. }, {
  18166. key: 'presenceChannel',
  18167. value: function presenceChannel(name) {
  18168. return new NullPresenceChannel();
  18169. }
  18170. /**
  18171. * Leave the given channel, as well as its private and presence variants.
  18172. */
  18173. }, {
  18174. key: 'leave',
  18175. value: function leave(name) {}
  18176. //
  18177. /**
  18178. * Leave the given channel.
  18179. */
  18180. }, {
  18181. key: 'leaveChannel',
  18182. value: function leaveChannel(name) {}
  18183. //
  18184. /**
  18185. * Get the socket ID for the connection.
  18186. */
  18187. }, {
  18188. key: 'socketId',
  18189. value: function socketId() {
  18190. return 'fake-socket-id';
  18191. }
  18192. /**
  18193. * Disconnect the connection.
  18194. */
  18195. }, {
  18196. key: 'disconnect',
  18197. value: function disconnect() {
  18198. //
  18199. }
  18200. }]);
  18201. return NullConnector;
  18202. }(Connector);
  18203. /**
  18204. * This class is the primary API for interacting with broadcasting.
  18205. */
  18206. var Echo = function () {
  18207. /**
  18208. * Create a new class instance.
  18209. */
  18210. function Echo(options) {
  18211. classCallCheck(this, Echo);
  18212. this.options = options;
  18213. this.connect();
  18214. if (!this.options.withoutInterceptors) {
  18215. this.registerInterceptors();
  18216. }
  18217. }
  18218. /**
  18219. * Get a channel instance by name.
  18220. */
  18221. createClass(Echo, [{
  18222. key: 'channel',
  18223. value: function channel(_channel) {
  18224. return this.connector.channel(_channel);
  18225. }
  18226. /**
  18227. * Create a new connection.
  18228. */
  18229. }, {
  18230. key: 'connect',
  18231. value: function connect() {
  18232. if (this.options.broadcaster == 'pusher') {
  18233. this.connector = new PusherConnector(this.options);
  18234. } else if (this.options.broadcaster == 'socket.io') {
  18235. this.connector = new SocketIoConnector(this.options);
  18236. } else if (this.options.broadcaster == 'null') {
  18237. this.connector = new NullConnector(this.options);
  18238. } else if (typeof this.options.broadcaster == 'function') {
  18239. this.connector = new this.options.broadcaster(this.options);
  18240. }
  18241. }
  18242. /**
  18243. * Disconnect from the Echo server.
  18244. */
  18245. }, {
  18246. key: 'disconnect',
  18247. value: function disconnect() {
  18248. this.connector.disconnect();
  18249. }
  18250. /**
  18251. * Get a presence channel instance by name.
  18252. */
  18253. }, {
  18254. key: 'join',
  18255. value: function join(channel) {
  18256. return this.connector.presenceChannel(channel);
  18257. }
  18258. /**
  18259. * Leave the given channel, as well as its private and presence variants.
  18260. */
  18261. }, {
  18262. key: 'leave',
  18263. value: function leave(channel) {
  18264. this.connector.leave(channel);
  18265. }
  18266. /**
  18267. * Leave the given channel.
  18268. */
  18269. }, {
  18270. key: 'leaveChannel',
  18271. value: function leaveChannel(channel) {
  18272. this.connector.leaveChannel(channel);
  18273. }
  18274. /**
  18275. * Listen for an event on a channel instance.
  18276. */
  18277. }, {
  18278. key: 'listen',
  18279. value: function listen(channel, event, callback) {
  18280. return this.connector.listen(channel, event, callback);
  18281. }
  18282. /**
  18283. * Get a private channel instance by name.
  18284. */
  18285. }, {
  18286. key: 'private',
  18287. value: function _private(channel) {
  18288. return this.connector.privateChannel(channel);
  18289. }
  18290. /**
  18291. * Get the Socket ID for the connection.
  18292. */
  18293. }, {
  18294. key: 'socketId',
  18295. value: function socketId() {
  18296. return this.connector.socketId();
  18297. }
  18298. /**
  18299. * Register 3rd party request interceptiors. These are used to automatically
  18300. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18301. */
  18302. }, {
  18303. key: 'registerInterceptors',
  18304. value: function registerInterceptors() {
  18305. if (typeof Vue === 'function' && Vue.http) {
  18306. this.registerVueRequestInterceptor();
  18307. }
  18308. if (typeof axios === 'function') {
  18309. this.registerAxiosRequestInterceptor();
  18310. }
  18311. if (typeof jQuery === 'function') {
  18312. this.registerjQueryAjaxSetup();
  18313. }
  18314. }
  18315. /**
  18316. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18317. */
  18318. }, {
  18319. key: 'registerVueRequestInterceptor',
  18320. value: function registerVueRequestInterceptor() {
  18321. var _this = this;
  18322. Vue.http.interceptors.push(function (request, next) {
  18323. if (_this.socketId()) {
  18324. request.headers.set('X-Socket-ID', _this.socketId());
  18325. }
  18326. next();
  18327. });
  18328. }
  18329. /**
  18330. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18331. */
  18332. }, {
  18333. key: 'registerAxiosRequestInterceptor',
  18334. value: function registerAxiosRequestInterceptor() {
  18335. var _this2 = this;
  18336. axios.interceptors.request.use(function (config) {
  18337. if (_this2.socketId()) {
  18338. config.headers['X-Socket-Id'] = _this2.socketId();
  18339. }
  18340. return config;
  18341. });
  18342. }
  18343. /**
  18344. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18345. */
  18346. }, {
  18347. key: 'registerjQueryAjaxSetup',
  18348. value: function registerjQueryAjaxSetup() {
  18349. var _this3 = this;
  18350. if (typeof jQuery.ajax != 'undefined') {
  18351. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18352. if (_this3.socketId()) {
  18353. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18354. }
  18355. });
  18356. }
  18357. }
  18358. }]);
  18359. return Echo;
  18360. }();
  18361. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18362. /***/ }),
  18363. /***/ "./node_modules/lodash/lodash.js":
  18364. /*!***************************************!*\
  18365. !*** ./node_modules/lodash/lodash.js ***!
  18366. \***************************************/
  18367. /*! no static exports found */
  18368. /***/ (function(module, exports, __webpack_require__) {
  18369. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18370. * @license
  18371. * Lodash <https://lodash.com/>
  18372. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18373. * Released under MIT license <https://lodash.com/license>
  18374. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18375. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18376. */
  18377. ;(function() {
  18378. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18379. var undefined;
  18380. /** Used as the semantic version number. */
  18381. var VERSION = '4.17.15';
  18382. /** Used as the size to enable large array optimizations. */
  18383. var LARGE_ARRAY_SIZE = 200;
  18384. /** Error message constants. */
  18385. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18386. FUNC_ERROR_TEXT = 'Expected a function';
  18387. /** Used to stand-in for `undefined` hash values. */
  18388. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18389. /** Used as the maximum memoize cache size. */
  18390. var MAX_MEMOIZE_SIZE = 500;
  18391. /** Used as the internal argument placeholder. */
  18392. var PLACEHOLDER = '__lodash_placeholder__';
  18393. /** Used to compose bitmasks for cloning. */
  18394. var CLONE_DEEP_FLAG = 1,
  18395. CLONE_FLAT_FLAG = 2,
  18396. CLONE_SYMBOLS_FLAG = 4;
  18397. /** Used to compose bitmasks for value comparisons. */
  18398. var COMPARE_PARTIAL_FLAG = 1,
  18399. COMPARE_UNORDERED_FLAG = 2;
  18400. /** Used to compose bitmasks for function metadata. */
  18401. var WRAP_BIND_FLAG = 1,
  18402. WRAP_BIND_KEY_FLAG = 2,
  18403. WRAP_CURRY_BOUND_FLAG = 4,
  18404. WRAP_CURRY_FLAG = 8,
  18405. WRAP_CURRY_RIGHT_FLAG = 16,
  18406. WRAP_PARTIAL_FLAG = 32,
  18407. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18408. WRAP_ARY_FLAG = 128,
  18409. WRAP_REARG_FLAG = 256,
  18410. WRAP_FLIP_FLAG = 512;
  18411. /** Used as default options for `_.truncate`. */
  18412. var DEFAULT_TRUNC_LENGTH = 30,
  18413. DEFAULT_TRUNC_OMISSION = '...';
  18414. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18415. var HOT_COUNT = 800,
  18416. HOT_SPAN = 16;
  18417. /** Used to indicate the type of lazy iteratees. */
  18418. var LAZY_FILTER_FLAG = 1,
  18419. LAZY_MAP_FLAG = 2,
  18420. LAZY_WHILE_FLAG = 3;
  18421. /** Used as references for various `Number` constants. */
  18422. var INFINITY = 1 / 0,
  18423. MAX_SAFE_INTEGER = 9007199254740991,
  18424. MAX_INTEGER = 1.7976931348623157e+308,
  18425. NAN = 0 / 0;
  18426. /** Used as references for the maximum length and index of an array. */
  18427. var MAX_ARRAY_LENGTH = 4294967295,
  18428. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18429. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18430. /** Used to associate wrap methods with their bit flags. */
  18431. var wrapFlags = [
  18432. ['ary', WRAP_ARY_FLAG],
  18433. ['bind', WRAP_BIND_FLAG],
  18434. ['bindKey', WRAP_BIND_KEY_FLAG],
  18435. ['curry', WRAP_CURRY_FLAG],
  18436. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18437. ['flip', WRAP_FLIP_FLAG],
  18438. ['partial', WRAP_PARTIAL_FLAG],
  18439. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18440. ['rearg', WRAP_REARG_FLAG]
  18441. ];
  18442. /** `Object#toString` result references. */
  18443. var argsTag = '[object Arguments]',
  18444. arrayTag = '[object Array]',
  18445. asyncTag = '[object AsyncFunction]',
  18446. boolTag = '[object Boolean]',
  18447. dateTag = '[object Date]',
  18448. domExcTag = '[object DOMException]',
  18449. errorTag = '[object Error]',
  18450. funcTag = '[object Function]',
  18451. genTag = '[object GeneratorFunction]',
  18452. mapTag = '[object Map]',
  18453. numberTag = '[object Number]',
  18454. nullTag = '[object Null]',
  18455. objectTag = '[object Object]',
  18456. promiseTag = '[object Promise]',
  18457. proxyTag = '[object Proxy]',
  18458. regexpTag = '[object RegExp]',
  18459. setTag = '[object Set]',
  18460. stringTag = '[object String]',
  18461. symbolTag = '[object Symbol]',
  18462. undefinedTag = '[object Undefined]',
  18463. weakMapTag = '[object WeakMap]',
  18464. weakSetTag = '[object WeakSet]';
  18465. var arrayBufferTag = '[object ArrayBuffer]',
  18466. dataViewTag = '[object DataView]',
  18467. float32Tag = '[object Float32Array]',
  18468. float64Tag = '[object Float64Array]',
  18469. int8Tag = '[object Int8Array]',
  18470. int16Tag = '[object Int16Array]',
  18471. int32Tag = '[object Int32Array]',
  18472. uint8Tag = '[object Uint8Array]',
  18473. uint8ClampedTag = '[object Uint8ClampedArray]',
  18474. uint16Tag = '[object Uint16Array]',
  18475. uint32Tag = '[object Uint32Array]';
  18476. /** Used to match empty string literals in compiled template source. */
  18477. var reEmptyStringLeading = /\b__p \+= '';/g,
  18478. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18479. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18480. /** Used to match HTML entities and HTML characters. */
  18481. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18482. reUnescapedHtml = /[&<>"']/g,
  18483. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18484. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18485. /** Used to match template delimiters. */
  18486. var reEscape = /<%-([\s\S]+?)%>/g,
  18487. reEvaluate = /<%([\s\S]+?)%>/g,
  18488. reInterpolate = /<%=([\s\S]+?)%>/g;
  18489. /** Used to match property names within property paths. */
  18490. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18491. reIsPlainProp = /^\w*$/,
  18492. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18493. /**
  18494. * Used to match `RegExp`
  18495. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18496. */
  18497. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18498. reHasRegExpChar = RegExp(reRegExpChar.source);
  18499. /** Used to match leading and trailing whitespace. */
  18500. var reTrim = /^\s+|\s+$/g,
  18501. reTrimStart = /^\s+/,
  18502. reTrimEnd = /\s+$/;
  18503. /** Used to match wrap detail comments. */
  18504. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18505. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18506. reSplitDetails = /,? & /;
  18507. /** Used to match words composed of alphanumeric characters. */
  18508. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18509. /** Used to match backslashes in property paths. */
  18510. var reEscapeChar = /\\(\\)?/g;
  18511. /**
  18512. * Used to match
  18513. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18514. */
  18515. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18516. /** Used to match `RegExp` flags from their coerced string values. */
  18517. var reFlags = /\w*$/;
  18518. /** Used to detect bad signed hexadecimal string values. */
  18519. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18520. /** Used to detect binary string values. */
  18521. var reIsBinary = /^0b[01]+$/i;
  18522. /** Used to detect host constructors (Safari). */
  18523. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18524. /** Used to detect octal string values. */
  18525. var reIsOctal = /^0o[0-7]+$/i;
  18526. /** Used to detect unsigned integer values. */
  18527. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18528. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18529. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18530. /** Used to ensure capturing order of template delimiters. */
  18531. var reNoMatch = /($^)/;
  18532. /** Used to match unescaped characters in compiled string literals. */
  18533. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18534. /** Used to compose unicode character classes. */
  18535. var rsAstralRange = '\\ud800-\\udfff',
  18536. rsComboMarksRange = '\\u0300-\\u036f',
  18537. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18538. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18539. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18540. rsDingbatRange = '\\u2700-\\u27bf',
  18541. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18542. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18543. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18544. rsPunctuationRange = '\\u2000-\\u206f',
  18545. 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',
  18546. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18547. rsVarRange = '\\ufe0e\\ufe0f',
  18548. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18549. /** Used to compose unicode capture groups. */
  18550. var rsApos = "['\u2019]",
  18551. rsAstral = '[' + rsAstralRange + ']',
  18552. rsBreak = '[' + rsBreakRange + ']',
  18553. rsCombo = '[' + rsComboRange + ']',
  18554. rsDigits = '\\d+',
  18555. rsDingbat = '[' + rsDingbatRange + ']',
  18556. rsLower = '[' + rsLowerRange + ']',
  18557. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18558. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18559. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18560. rsNonAstral = '[^' + rsAstralRange + ']',
  18561. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18562. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18563. rsUpper = '[' + rsUpperRange + ']',
  18564. rsZWJ = '\\u200d';
  18565. /** Used to compose unicode regexes. */
  18566. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18567. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18568. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18569. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18570. reOptMod = rsModifier + '?',
  18571. rsOptVar = '[' + rsVarRange + ']?',
  18572. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18573. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18574. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18575. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18576. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18577. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18578. /** Used to match apostrophes. */
  18579. var reApos = RegExp(rsApos, 'g');
  18580. /**
  18581. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18582. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18583. */
  18584. var reComboMark = RegExp(rsCombo, 'g');
  18585. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18586. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18587. /** Used to match complex or compound words. */
  18588. var reUnicodeWord = RegExp([
  18589. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18590. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18591. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18592. rsUpper + '+' + rsOptContrUpper,
  18593. rsOrdUpper,
  18594. rsOrdLower,
  18595. rsDigits,
  18596. rsEmoji
  18597. ].join('|'), 'g');
  18598. /** 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/). */
  18599. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18600. /** Used to detect strings that need a more robust regexp to match words. */
  18601. 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 ]/;
  18602. /** Used to assign default `context` object properties. */
  18603. var contextProps = [
  18604. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18605. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18606. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18607. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18608. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18609. ];
  18610. /** Used to make template sourceURLs easier to identify. */
  18611. var templateCounter = -1;
  18612. /** Used to identify `toStringTag` values of typed arrays. */
  18613. var typedArrayTags = {};
  18614. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18615. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18616. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18617. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18618. typedArrayTags[uint32Tag] = true;
  18619. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18620. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18621. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18622. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18623. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18624. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18625. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18626. typedArrayTags[weakMapTag] = false;
  18627. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18628. var cloneableTags = {};
  18629. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18630. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18631. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18632. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18633. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18634. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18635. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18636. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18637. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18638. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18639. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18640. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18641. cloneableTags[weakMapTag] = false;
  18642. /** Used to map Latin Unicode letters to basic Latin letters. */
  18643. var deburredLetters = {
  18644. // Latin-1 Supplement block.
  18645. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18646. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18647. '\xc7': 'C', '\xe7': 'c',
  18648. '\xd0': 'D', '\xf0': 'd',
  18649. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18650. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18651. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18652. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18653. '\xd1': 'N', '\xf1': 'n',
  18654. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18655. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18656. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18657. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18658. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18659. '\xc6': 'Ae', '\xe6': 'ae',
  18660. '\xde': 'Th', '\xfe': 'th',
  18661. '\xdf': 'ss',
  18662. // Latin Extended-A block.
  18663. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18664. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18665. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18666. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18667. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18668. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18669. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18670. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18671. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18672. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18673. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18674. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18675. '\u0134': 'J', '\u0135': 'j',
  18676. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18677. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18678. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18679. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18680. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18681. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18682. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18683. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18684. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18685. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18686. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18687. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18688. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18689. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18690. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18691. '\u0174': 'W', '\u0175': 'w',
  18692. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18693. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18694. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18695. '\u0132': 'IJ', '\u0133': 'ij',
  18696. '\u0152': 'Oe', '\u0153': 'oe',
  18697. '\u0149': "'n", '\u017f': 's'
  18698. };
  18699. /** Used to map characters to HTML entities. */
  18700. var htmlEscapes = {
  18701. '&': '&amp;',
  18702. '<': '&lt;',
  18703. '>': '&gt;',
  18704. '"': '&quot;',
  18705. "'": '&#39;'
  18706. };
  18707. /** Used to map HTML entities to characters. */
  18708. var htmlUnescapes = {
  18709. '&amp;': '&',
  18710. '&lt;': '<',
  18711. '&gt;': '>',
  18712. '&quot;': '"',
  18713. '&#39;': "'"
  18714. };
  18715. /** Used to escape characters for inclusion in compiled string literals. */
  18716. var stringEscapes = {
  18717. '\\': '\\',
  18718. "'": "'",
  18719. '\n': 'n',
  18720. '\r': 'r',
  18721. '\u2028': 'u2028',
  18722. '\u2029': 'u2029'
  18723. };
  18724. /** Built-in method references without a dependency on `root`. */
  18725. var freeParseFloat = parseFloat,
  18726. freeParseInt = parseInt;
  18727. /** Detect free variable `global` from Node.js. */
  18728. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18729. /** Detect free variable `self`. */
  18730. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18731. /** Used as a reference to the global object. */
  18732. var root = freeGlobal || freeSelf || Function('return this')();
  18733. /** Detect free variable `exports`. */
  18734. var freeExports = true && exports && !exports.nodeType && exports;
  18735. /** Detect free variable `module`. */
  18736. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18737. /** Detect the popular CommonJS extension `module.exports`. */
  18738. var moduleExports = freeModule && freeModule.exports === freeExports;
  18739. /** Detect free variable `process` from Node.js. */
  18740. var freeProcess = moduleExports && freeGlobal.process;
  18741. /** Used to access faster Node.js helpers. */
  18742. var nodeUtil = (function() {
  18743. try {
  18744. // Use `util.types` for Node.js 10+.
  18745. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18746. if (types) {
  18747. return types;
  18748. }
  18749. // Legacy `process.binding('util')` for Node.js < 10.
  18750. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18751. } catch (e) {}
  18752. }());
  18753. /* Node.js helper references. */
  18754. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18755. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18756. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18757. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18758. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18759. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18760. /*--------------------------------------------------------------------------*/
  18761. /**
  18762. * A faster alternative to `Function#apply`, this function invokes `func`
  18763. * with the `this` binding of `thisArg` and the arguments of `args`.
  18764. *
  18765. * @private
  18766. * @param {Function} func The function to invoke.
  18767. * @param {*} thisArg The `this` binding of `func`.
  18768. * @param {Array} args The arguments to invoke `func` with.
  18769. * @returns {*} Returns the result of `func`.
  18770. */
  18771. function apply(func, thisArg, args) {
  18772. switch (args.length) {
  18773. case 0: return func.call(thisArg);
  18774. case 1: return func.call(thisArg, args[0]);
  18775. case 2: return func.call(thisArg, args[0], args[1]);
  18776. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18777. }
  18778. return func.apply(thisArg, args);
  18779. }
  18780. /**
  18781. * A specialized version of `baseAggregator` for arrays.
  18782. *
  18783. * @private
  18784. * @param {Array} [array] The array to iterate over.
  18785. * @param {Function} setter The function to set `accumulator` values.
  18786. * @param {Function} iteratee The iteratee to transform keys.
  18787. * @param {Object} accumulator The initial aggregated object.
  18788. * @returns {Function} Returns `accumulator`.
  18789. */
  18790. function arrayAggregator(array, setter, iteratee, accumulator) {
  18791. var index = -1,
  18792. length = array == null ? 0 : array.length;
  18793. while (++index < length) {
  18794. var value = array[index];
  18795. setter(accumulator, value, iteratee(value), array);
  18796. }
  18797. return accumulator;
  18798. }
  18799. /**
  18800. * A specialized version of `_.forEach` for arrays without support for
  18801. * iteratee shorthands.
  18802. *
  18803. * @private
  18804. * @param {Array} [array] The array to iterate over.
  18805. * @param {Function} iteratee The function invoked per iteration.
  18806. * @returns {Array} Returns `array`.
  18807. */
  18808. function arrayEach(array, iteratee) {
  18809. var index = -1,
  18810. length = array == null ? 0 : array.length;
  18811. while (++index < length) {
  18812. if (iteratee(array[index], index, array) === false) {
  18813. break;
  18814. }
  18815. }
  18816. return array;
  18817. }
  18818. /**
  18819. * A specialized version of `_.forEachRight` for arrays without support for
  18820. * iteratee shorthands.
  18821. *
  18822. * @private
  18823. * @param {Array} [array] The array to iterate over.
  18824. * @param {Function} iteratee The function invoked per iteration.
  18825. * @returns {Array} Returns `array`.
  18826. */
  18827. function arrayEachRight(array, iteratee) {
  18828. var length = array == null ? 0 : array.length;
  18829. while (length--) {
  18830. if (iteratee(array[length], length, array) === false) {
  18831. break;
  18832. }
  18833. }
  18834. return array;
  18835. }
  18836. /**
  18837. * A specialized version of `_.every` for arrays without support for
  18838. * iteratee shorthands.
  18839. *
  18840. * @private
  18841. * @param {Array} [array] The array to iterate over.
  18842. * @param {Function} predicate The function invoked per iteration.
  18843. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18844. * else `false`.
  18845. */
  18846. function arrayEvery(array, predicate) {
  18847. var index = -1,
  18848. length = array == null ? 0 : array.length;
  18849. while (++index < length) {
  18850. if (!predicate(array[index], index, array)) {
  18851. return false;
  18852. }
  18853. }
  18854. return true;
  18855. }
  18856. /**
  18857. * A specialized version of `_.filter` for arrays without support for
  18858. * iteratee shorthands.
  18859. *
  18860. * @private
  18861. * @param {Array} [array] The array to iterate over.
  18862. * @param {Function} predicate The function invoked per iteration.
  18863. * @returns {Array} Returns the new filtered array.
  18864. */
  18865. function arrayFilter(array, predicate) {
  18866. var index = -1,
  18867. length = array == null ? 0 : array.length,
  18868. resIndex = 0,
  18869. result = [];
  18870. while (++index < length) {
  18871. var value = array[index];
  18872. if (predicate(value, index, array)) {
  18873. result[resIndex++] = value;
  18874. }
  18875. }
  18876. return result;
  18877. }
  18878. /**
  18879. * A specialized version of `_.includes` for arrays without support for
  18880. * specifying an index to search from.
  18881. *
  18882. * @private
  18883. * @param {Array} [array] The array to inspect.
  18884. * @param {*} target The value to search for.
  18885. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18886. */
  18887. function arrayIncludes(array, value) {
  18888. var length = array == null ? 0 : array.length;
  18889. return !!length && baseIndexOf(array, value, 0) > -1;
  18890. }
  18891. /**
  18892. * This function is like `arrayIncludes` except that it accepts a comparator.
  18893. *
  18894. * @private
  18895. * @param {Array} [array] The array to inspect.
  18896. * @param {*} target The value to search for.
  18897. * @param {Function} comparator The comparator invoked per element.
  18898. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18899. */
  18900. function arrayIncludesWith(array, value, comparator) {
  18901. var index = -1,
  18902. length = array == null ? 0 : array.length;
  18903. while (++index < length) {
  18904. if (comparator(value, array[index])) {
  18905. return true;
  18906. }
  18907. }
  18908. return false;
  18909. }
  18910. /**
  18911. * A specialized version of `_.map` for arrays without support for iteratee
  18912. * shorthands.
  18913. *
  18914. * @private
  18915. * @param {Array} [array] The array to iterate over.
  18916. * @param {Function} iteratee The function invoked per iteration.
  18917. * @returns {Array} Returns the new mapped array.
  18918. */
  18919. function arrayMap(array, iteratee) {
  18920. var index = -1,
  18921. length = array == null ? 0 : array.length,
  18922. result = Array(length);
  18923. while (++index < length) {
  18924. result[index] = iteratee(array[index], index, array);
  18925. }
  18926. return result;
  18927. }
  18928. /**
  18929. * Appends the elements of `values` to `array`.
  18930. *
  18931. * @private
  18932. * @param {Array} array The array to modify.
  18933. * @param {Array} values The values to append.
  18934. * @returns {Array} Returns `array`.
  18935. */
  18936. function arrayPush(array, values) {
  18937. var index = -1,
  18938. length = values.length,
  18939. offset = array.length;
  18940. while (++index < length) {
  18941. array[offset + index] = values[index];
  18942. }
  18943. return array;
  18944. }
  18945. /**
  18946. * A specialized version of `_.reduce` for arrays without support for
  18947. * iteratee shorthands.
  18948. *
  18949. * @private
  18950. * @param {Array} [array] The array to iterate over.
  18951. * @param {Function} iteratee The function invoked per iteration.
  18952. * @param {*} [accumulator] The initial value.
  18953. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18954. * the initial value.
  18955. * @returns {*} Returns the accumulated value.
  18956. */
  18957. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18958. var index = -1,
  18959. length = array == null ? 0 : array.length;
  18960. if (initAccum && length) {
  18961. accumulator = array[++index];
  18962. }
  18963. while (++index < length) {
  18964. accumulator = iteratee(accumulator, array[index], index, array);
  18965. }
  18966. return accumulator;
  18967. }
  18968. /**
  18969. * A specialized version of `_.reduceRight` for arrays without support for
  18970. * iteratee shorthands.
  18971. *
  18972. * @private
  18973. * @param {Array} [array] The array to iterate over.
  18974. * @param {Function} iteratee The function invoked per iteration.
  18975. * @param {*} [accumulator] The initial value.
  18976. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18977. * the initial value.
  18978. * @returns {*} Returns the accumulated value.
  18979. */
  18980. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18981. var length = array == null ? 0 : array.length;
  18982. if (initAccum && length) {
  18983. accumulator = array[--length];
  18984. }
  18985. while (length--) {
  18986. accumulator = iteratee(accumulator, array[length], length, array);
  18987. }
  18988. return accumulator;
  18989. }
  18990. /**
  18991. * A specialized version of `_.some` for arrays without support for iteratee
  18992. * shorthands.
  18993. *
  18994. * @private
  18995. * @param {Array} [array] The array to iterate over.
  18996. * @param {Function} predicate The function invoked per iteration.
  18997. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18998. * else `false`.
  18999. */
  19000. function arraySome(array, predicate) {
  19001. var index = -1,
  19002. length = array == null ? 0 : array.length;
  19003. while (++index < length) {
  19004. if (predicate(array[index], index, array)) {
  19005. return true;
  19006. }
  19007. }
  19008. return false;
  19009. }
  19010. /**
  19011. * Gets the size of an ASCII `string`.
  19012. *
  19013. * @private
  19014. * @param {string} string The string inspect.
  19015. * @returns {number} Returns the string size.
  19016. */
  19017. var asciiSize = baseProperty('length');
  19018. /**
  19019. * Converts an ASCII `string` to an array.
  19020. *
  19021. * @private
  19022. * @param {string} string The string to convert.
  19023. * @returns {Array} Returns the converted array.
  19024. */
  19025. function asciiToArray(string) {
  19026. return string.split('');
  19027. }
  19028. /**
  19029. * Splits an ASCII `string` into an array of its words.
  19030. *
  19031. * @private
  19032. * @param {string} The string to inspect.
  19033. * @returns {Array} Returns the words of `string`.
  19034. */
  19035. function asciiWords(string) {
  19036. return string.match(reAsciiWord) || [];
  19037. }
  19038. /**
  19039. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19040. * without support for iteratee shorthands, which iterates over `collection`
  19041. * using `eachFunc`.
  19042. *
  19043. * @private
  19044. * @param {Array|Object} collection The collection to inspect.
  19045. * @param {Function} predicate The function invoked per iteration.
  19046. * @param {Function} eachFunc The function to iterate over `collection`.
  19047. * @returns {*} Returns the found element or its key, else `undefined`.
  19048. */
  19049. function baseFindKey(collection, predicate, eachFunc) {
  19050. var result;
  19051. eachFunc(collection, function(value, key, collection) {
  19052. if (predicate(value, key, collection)) {
  19053. result = key;
  19054. return false;
  19055. }
  19056. });
  19057. return result;
  19058. }
  19059. /**
  19060. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19061. * support for iteratee shorthands.
  19062. *
  19063. * @private
  19064. * @param {Array} array The array to inspect.
  19065. * @param {Function} predicate The function invoked per iteration.
  19066. * @param {number} fromIndex The index to search from.
  19067. * @param {boolean} [fromRight] Specify iterating from right to left.
  19068. * @returns {number} Returns the index of the matched value, else `-1`.
  19069. */
  19070. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19071. var length = array.length,
  19072. index = fromIndex + (fromRight ? 1 : -1);
  19073. while ((fromRight ? index-- : ++index < length)) {
  19074. if (predicate(array[index], index, array)) {
  19075. return index;
  19076. }
  19077. }
  19078. return -1;
  19079. }
  19080. /**
  19081. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19082. *
  19083. * @private
  19084. * @param {Array} array The array to inspect.
  19085. * @param {*} value The value to search for.
  19086. * @param {number} fromIndex The index to search from.
  19087. * @returns {number} Returns the index of the matched value, else `-1`.
  19088. */
  19089. function baseIndexOf(array, value, fromIndex) {
  19090. return value === value
  19091. ? strictIndexOf(array, value, fromIndex)
  19092. : baseFindIndex(array, baseIsNaN, fromIndex);
  19093. }
  19094. /**
  19095. * This function is like `baseIndexOf` except that it accepts a comparator.
  19096. *
  19097. * @private
  19098. * @param {Array} array The array to inspect.
  19099. * @param {*} value The value to search for.
  19100. * @param {number} fromIndex The index to search from.
  19101. * @param {Function} comparator The comparator invoked per element.
  19102. * @returns {number} Returns the index of the matched value, else `-1`.
  19103. */
  19104. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19105. var index = fromIndex - 1,
  19106. length = array.length;
  19107. while (++index < length) {
  19108. if (comparator(array[index], value)) {
  19109. return index;
  19110. }
  19111. }
  19112. return -1;
  19113. }
  19114. /**
  19115. * The base implementation of `_.isNaN` without support for number objects.
  19116. *
  19117. * @private
  19118. * @param {*} value The value to check.
  19119. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19120. */
  19121. function baseIsNaN(value) {
  19122. return value !== value;
  19123. }
  19124. /**
  19125. * The base implementation of `_.mean` and `_.meanBy` without support for
  19126. * iteratee shorthands.
  19127. *
  19128. * @private
  19129. * @param {Array} array The array to iterate over.
  19130. * @param {Function} iteratee The function invoked per iteration.
  19131. * @returns {number} Returns the mean.
  19132. */
  19133. function baseMean(array, iteratee) {
  19134. var length = array == null ? 0 : array.length;
  19135. return length ? (baseSum(array, iteratee) / length) : NAN;
  19136. }
  19137. /**
  19138. * The base implementation of `_.property` without support for deep paths.
  19139. *
  19140. * @private
  19141. * @param {string} key The key of the property to get.
  19142. * @returns {Function} Returns the new accessor function.
  19143. */
  19144. function baseProperty(key) {
  19145. return function(object) {
  19146. return object == null ? undefined : object[key];
  19147. };
  19148. }
  19149. /**
  19150. * The base implementation of `_.propertyOf` without support for deep paths.
  19151. *
  19152. * @private
  19153. * @param {Object} object The object to query.
  19154. * @returns {Function} Returns the new accessor function.
  19155. */
  19156. function basePropertyOf(object) {
  19157. return function(key) {
  19158. return object == null ? undefined : object[key];
  19159. };
  19160. }
  19161. /**
  19162. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19163. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19164. *
  19165. * @private
  19166. * @param {Array|Object} collection The collection to iterate over.
  19167. * @param {Function} iteratee The function invoked per iteration.
  19168. * @param {*} accumulator The initial value.
  19169. * @param {boolean} initAccum Specify using the first or last element of
  19170. * `collection` as the initial value.
  19171. * @param {Function} eachFunc The function to iterate over `collection`.
  19172. * @returns {*} Returns the accumulated value.
  19173. */
  19174. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19175. eachFunc(collection, function(value, index, collection) {
  19176. accumulator = initAccum
  19177. ? (initAccum = false, value)
  19178. : iteratee(accumulator, value, index, collection);
  19179. });
  19180. return accumulator;
  19181. }
  19182. /**
  19183. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19184. * sort order of `array` and replaces criteria objects with their corresponding
  19185. * values.
  19186. *
  19187. * @private
  19188. * @param {Array} array The array to sort.
  19189. * @param {Function} comparer The function to define sort order.
  19190. * @returns {Array} Returns `array`.
  19191. */
  19192. function baseSortBy(array, comparer) {
  19193. var length = array.length;
  19194. array.sort(comparer);
  19195. while (length--) {
  19196. array[length] = array[length].value;
  19197. }
  19198. return array;
  19199. }
  19200. /**
  19201. * The base implementation of `_.sum` and `_.sumBy` without support for
  19202. * iteratee shorthands.
  19203. *
  19204. * @private
  19205. * @param {Array} array The array to iterate over.
  19206. * @param {Function} iteratee The function invoked per iteration.
  19207. * @returns {number} Returns the sum.
  19208. */
  19209. function baseSum(array, iteratee) {
  19210. var result,
  19211. index = -1,
  19212. length = array.length;
  19213. while (++index < length) {
  19214. var current = iteratee(array[index]);
  19215. if (current !== undefined) {
  19216. result = result === undefined ? current : (result + current);
  19217. }
  19218. }
  19219. return result;
  19220. }
  19221. /**
  19222. * The base implementation of `_.times` without support for iteratee shorthands
  19223. * or max array length checks.
  19224. *
  19225. * @private
  19226. * @param {number} n The number of times to invoke `iteratee`.
  19227. * @param {Function} iteratee The function invoked per iteration.
  19228. * @returns {Array} Returns the array of results.
  19229. */
  19230. function baseTimes(n, iteratee) {
  19231. var index = -1,
  19232. result = Array(n);
  19233. while (++index < n) {
  19234. result[index] = iteratee(index);
  19235. }
  19236. return result;
  19237. }
  19238. /**
  19239. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19240. * of key-value pairs for `object` corresponding to the property names of `props`.
  19241. *
  19242. * @private
  19243. * @param {Object} object The object to query.
  19244. * @param {Array} props The property names to get values for.
  19245. * @returns {Object} Returns the key-value pairs.
  19246. */
  19247. function baseToPairs(object, props) {
  19248. return arrayMap(props, function(key) {
  19249. return [key, object[key]];
  19250. });
  19251. }
  19252. /**
  19253. * The base implementation of `_.unary` without support for storing metadata.
  19254. *
  19255. * @private
  19256. * @param {Function} func The function to cap arguments for.
  19257. * @returns {Function} Returns the new capped function.
  19258. */
  19259. function baseUnary(func) {
  19260. return function(value) {
  19261. return func(value);
  19262. };
  19263. }
  19264. /**
  19265. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19266. * array of `object` property values corresponding to the property names
  19267. * 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 array of property values.
  19273. */
  19274. function baseValues(object, props) {
  19275. return arrayMap(props, function(key) {
  19276. return object[key];
  19277. });
  19278. }
  19279. /**
  19280. * Checks if a `cache` value for `key` exists.
  19281. *
  19282. * @private
  19283. * @param {Object} cache The cache to query.
  19284. * @param {string} key The key of the entry to check.
  19285. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19286. */
  19287. function cacheHas(cache, key) {
  19288. return cache.has(key);
  19289. }
  19290. /**
  19291. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19292. * that is not found in the character symbols.
  19293. *
  19294. * @private
  19295. * @param {Array} strSymbols The string symbols to inspect.
  19296. * @param {Array} chrSymbols The character symbols to find.
  19297. * @returns {number} Returns the index of the first unmatched string symbol.
  19298. */
  19299. function charsStartIndex(strSymbols, chrSymbols) {
  19300. var index = -1,
  19301. length = strSymbols.length;
  19302. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19303. return index;
  19304. }
  19305. /**
  19306. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19307. * that is not found in the character symbols.
  19308. *
  19309. * @private
  19310. * @param {Array} strSymbols The string symbols to inspect.
  19311. * @param {Array} chrSymbols The character symbols to find.
  19312. * @returns {number} Returns the index of the last unmatched string symbol.
  19313. */
  19314. function charsEndIndex(strSymbols, chrSymbols) {
  19315. var index = strSymbols.length;
  19316. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19317. return index;
  19318. }
  19319. /**
  19320. * Gets the number of `placeholder` occurrences in `array`.
  19321. *
  19322. * @private
  19323. * @param {Array} array The array to inspect.
  19324. * @param {*} placeholder The placeholder to search for.
  19325. * @returns {number} Returns the placeholder count.
  19326. */
  19327. function countHolders(array, placeholder) {
  19328. var length = array.length,
  19329. result = 0;
  19330. while (length--) {
  19331. if (array[length] === placeholder) {
  19332. ++result;
  19333. }
  19334. }
  19335. return result;
  19336. }
  19337. /**
  19338. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19339. * letters to basic Latin letters.
  19340. *
  19341. * @private
  19342. * @param {string} letter The matched letter to deburr.
  19343. * @returns {string} Returns the deburred letter.
  19344. */
  19345. var deburrLetter = basePropertyOf(deburredLetters);
  19346. /**
  19347. * Used by `_.escape` to convert characters to HTML entities.
  19348. *
  19349. * @private
  19350. * @param {string} chr The matched character to escape.
  19351. * @returns {string} Returns the escaped character.
  19352. */
  19353. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19354. /**
  19355. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19356. *
  19357. * @private
  19358. * @param {string} chr The matched character to escape.
  19359. * @returns {string} Returns the escaped character.
  19360. */
  19361. function escapeStringChar(chr) {
  19362. return '\\' + stringEscapes[chr];
  19363. }
  19364. /**
  19365. * Gets the value at `key` of `object`.
  19366. *
  19367. * @private
  19368. * @param {Object} [object] The object to query.
  19369. * @param {string} key The key of the property to get.
  19370. * @returns {*} Returns the property value.
  19371. */
  19372. function getValue(object, key) {
  19373. return object == null ? undefined : object[key];
  19374. }
  19375. /**
  19376. * Checks if `string` contains Unicode symbols.
  19377. *
  19378. * @private
  19379. * @param {string} string The string to inspect.
  19380. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19381. */
  19382. function hasUnicode(string) {
  19383. return reHasUnicode.test(string);
  19384. }
  19385. /**
  19386. * Checks if `string` contains a word composed of Unicode symbols.
  19387. *
  19388. * @private
  19389. * @param {string} string The string to inspect.
  19390. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19391. */
  19392. function hasUnicodeWord(string) {
  19393. return reHasUnicodeWord.test(string);
  19394. }
  19395. /**
  19396. * Converts `iterator` to an array.
  19397. *
  19398. * @private
  19399. * @param {Object} iterator The iterator to convert.
  19400. * @returns {Array} Returns the converted array.
  19401. */
  19402. function iteratorToArray(iterator) {
  19403. var data,
  19404. result = [];
  19405. while (!(data = iterator.next()).done) {
  19406. result.push(data.value);
  19407. }
  19408. return result;
  19409. }
  19410. /**
  19411. * Converts `map` to its key-value pairs.
  19412. *
  19413. * @private
  19414. * @param {Object} map The map to convert.
  19415. * @returns {Array} Returns the key-value pairs.
  19416. */
  19417. function mapToArray(map) {
  19418. var index = -1,
  19419. result = Array(map.size);
  19420. map.forEach(function(value, key) {
  19421. result[++index] = [key, value];
  19422. });
  19423. return result;
  19424. }
  19425. /**
  19426. * Creates a unary function that invokes `func` with its argument transformed.
  19427. *
  19428. * @private
  19429. * @param {Function} func The function to wrap.
  19430. * @param {Function} transform The argument transform.
  19431. * @returns {Function} Returns the new function.
  19432. */
  19433. function overArg(func, transform) {
  19434. return function(arg) {
  19435. return func(transform(arg));
  19436. };
  19437. }
  19438. /**
  19439. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19440. * and returns an array of their indexes.
  19441. *
  19442. * @private
  19443. * @param {Array} array The array to modify.
  19444. * @param {*} placeholder The placeholder to replace.
  19445. * @returns {Array} Returns the new array of placeholder indexes.
  19446. */
  19447. function replaceHolders(array, placeholder) {
  19448. var index = -1,
  19449. length = array.length,
  19450. resIndex = 0,
  19451. result = [];
  19452. while (++index < length) {
  19453. var value = array[index];
  19454. if (value === placeholder || value === PLACEHOLDER) {
  19455. array[index] = PLACEHOLDER;
  19456. result[resIndex++] = index;
  19457. }
  19458. }
  19459. return result;
  19460. }
  19461. /**
  19462. * Converts `set` to an array of its values.
  19463. *
  19464. * @private
  19465. * @param {Object} set The set to convert.
  19466. * @returns {Array} Returns the values.
  19467. */
  19468. function setToArray(set) {
  19469. var index = -1,
  19470. result = Array(set.size);
  19471. set.forEach(function(value) {
  19472. result[++index] = value;
  19473. });
  19474. return result;
  19475. }
  19476. /**
  19477. * Converts `set` to its value-value pairs.
  19478. *
  19479. * @private
  19480. * @param {Object} set The set to convert.
  19481. * @returns {Array} Returns the value-value pairs.
  19482. */
  19483. function setToPairs(set) {
  19484. var index = -1,
  19485. result = Array(set.size);
  19486. set.forEach(function(value) {
  19487. result[++index] = [value, value];
  19488. });
  19489. return result;
  19490. }
  19491. /**
  19492. * A specialized version of `_.indexOf` which performs strict equality
  19493. * comparisons of values, i.e. `===`.
  19494. *
  19495. * @private
  19496. * @param {Array} array The array to inspect.
  19497. * @param {*} value The value to search for.
  19498. * @param {number} fromIndex The index to search from.
  19499. * @returns {number} Returns the index of the matched value, else `-1`.
  19500. */
  19501. function strictIndexOf(array, value, fromIndex) {
  19502. var index = fromIndex - 1,
  19503. length = array.length;
  19504. while (++index < length) {
  19505. if (array[index] === value) {
  19506. return index;
  19507. }
  19508. }
  19509. return -1;
  19510. }
  19511. /**
  19512. * A specialized version of `_.lastIndexOf` which performs strict equality
  19513. * comparisons of values, i.e. `===`.
  19514. *
  19515. * @private
  19516. * @param {Array} array The array to inspect.
  19517. * @param {*} value The value to search for.
  19518. * @param {number} fromIndex The index to search from.
  19519. * @returns {number} Returns the index of the matched value, else `-1`.
  19520. */
  19521. function strictLastIndexOf(array, value, fromIndex) {
  19522. var index = fromIndex + 1;
  19523. while (index--) {
  19524. if (array[index] === value) {
  19525. return index;
  19526. }
  19527. }
  19528. return index;
  19529. }
  19530. /**
  19531. * Gets the number of symbols in `string`.
  19532. *
  19533. * @private
  19534. * @param {string} string The string to inspect.
  19535. * @returns {number} Returns the string size.
  19536. */
  19537. function stringSize(string) {
  19538. return hasUnicode(string)
  19539. ? unicodeSize(string)
  19540. : asciiSize(string);
  19541. }
  19542. /**
  19543. * Converts `string` to an array.
  19544. *
  19545. * @private
  19546. * @param {string} string The string to convert.
  19547. * @returns {Array} Returns the converted array.
  19548. */
  19549. function stringToArray(string) {
  19550. return hasUnicode(string)
  19551. ? unicodeToArray(string)
  19552. : asciiToArray(string);
  19553. }
  19554. /**
  19555. * Used by `_.unescape` to convert HTML entities to characters.
  19556. *
  19557. * @private
  19558. * @param {string} chr The matched character to unescape.
  19559. * @returns {string} Returns the unescaped character.
  19560. */
  19561. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19562. /**
  19563. * Gets the size of a Unicode `string`.
  19564. *
  19565. * @private
  19566. * @param {string} string The string inspect.
  19567. * @returns {number} Returns the string size.
  19568. */
  19569. function unicodeSize(string) {
  19570. var result = reUnicode.lastIndex = 0;
  19571. while (reUnicode.test(string)) {
  19572. ++result;
  19573. }
  19574. return result;
  19575. }
  19576. /**
  19577. * Converts a Unicode `string` to an array.
  19578. *
  19579. * @private
  19580. * @param {string} string The string to convert.
  19581. * @returns {Array} Returns the converted array.
  19582. */
  19583. function unicodeToArray(string) {
  19584. return string.match(reUnicode) || [];
  19585. }
  19586. /**
  19587. * Splits a Unicode `string` into an array of its words.
  19588. *
  19589. * @private
  19590. * @param {string} The string to inspect.
  19591. * @returns {Array} Returns the words of `string`.
  19592. */
  19593. function unicodeWords(string) {
  19594. return string.match(reUnicodeWord) || [];
  19595. }
  19596. /*--------------------------------------------------------------------------*/
  19597. /**
  19598. * Create a new pristine `lodash` function using the `context` object.
  19599. *
  19600. * @static
  19601. * @memberOf _
  19602. * @since 1.1.0
  19603. * @category Util
  19604. * @param {Object} [context=root] The context object.
  19605. * @returns {Function} Returns a new `lodash` function.
  19606. * @example
  19607. *
  19608. * _.mixin({ 'foo': _.constant('foo') });
  19609. *
  19610. * var lodash = _.runInContext();
  19611. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19612. *
  19613. * _.isFunction(_.foo);
  19614. * // => true
  19615. * _.isFunction(_.bar);
  19616. * // => false
  19617. *
  19618. * lodash.isFunction(lodash.foo);
  19619. * // => false
  19620. * lodash.isFunction(lodash.bar);
  19621. * // => true
  19622. *
  19623. * // Create a suped-up `defer` in Node.js.
  19624. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19625. */
  19626. var runInContext = (function runInContext(context) {
  19627. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19628. /** Built-in constructor references. */
  19629. var Array = context.Array,
  19630. Date = context.Date,
  19631. Error = context.Error,
  19632. Function = context.Function,
  19633. Math = context.Math,
  19634. Object = context.Object,
  19635. RegExp = context.RegExp,
  19636. String = context.String,
  19637. TypeError = context.TypeError;
  19638. /** Used for built-in method references. */
  19639. var arrayProto = Array.prototype,
  19640. funcProto = Function.prototype,
  19641. objectProto = Object.prototype;
  19642. /** Used to detect overreaching core-js shims. */
  19643. var coreJsData = context['__core-js_shared__'];
  19644. /** Used to resolve the decompiled source of functions. */
  19645. var funcToString = funcProto.toString;
  19646. /** Used to check objects for own properties. */
  19647. var hasOwnProperty = objectProto.hasOwnProperty;
  19648. /** Used to generate unique IDs. */
  19649. var idCounter = 0;
  19650. /** Used to detect methods masquerading as native. */
  19651. var maskSrcKey = (function() {
  19652. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19653. return uid ? ('Symbol(src)_1.' + uid) : '';
  19654. }());
  19655. /**
  19656. * Used to resolve the
  19657. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19658. * of values.
  19659. */
  19660. var nativeObjectToString = objectProto.toString;
  19661. /** Used to infer the `Object` constructor. */
  19662. var objectCtorString = funcToString.call(Object);
  19663. /** Used to restore the original `_` reference in `_.noConflict`. */
  19664. var oldDash = root._;
  19665. /** Used to detect if a method is native. */
  19666. var reIsNative = RegExp('^' +
  19667. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19668. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19669. );
  19670. /** Built-in value references. */
  19671. var Buffer = moduleExports ? context.Buffer : undefined,
  19672. Symbol = context.Symbol,
  19673. Uint8Array = context.Uint8Array,
  19674. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19675. getPrototype = overArg(Object.getPrototypeOf, Object),
  19676. objectCreate = Object.create,
  19677. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19678. splice = arrayProto.splice,
  19679. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19680. symIterator = Symbol ? Symbol.iterator : undefined,
  19681. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19682. var defineProperty = (function() {
  19683. try {
  19684. var func = getNative(Object, 'defineProperty');
  19685. func({}, '', {});
  19686. return func;
  19687. } catch (e) {}
  19688. }());
  19689. /** Mocked built-ins. */
  19690. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19691. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19692. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19693. /* Built-in method references for those with the same name as other `lodash` methods. */
  19694. var nativeCeil = Math.ceil,
  19695. nativeFloor = Math.floor,
  19696. nativeGetSymbols = Object.getOwnPropertySymbols,
  19697. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19698. nativeIsFinite = context.isFinite,
  19699. nativeJoin = arrayProto.join,
  19700. nativeKeys = overArg(Object.keys, Object),
  19701. nativeMax = Math.max,
  19702. nativeMin = Math.min,
  19703. nativeNow = Date.now,
  19704. nativeParseInt = context.parseInt,
  19705. nativeRandom = Math.random,
  19706. nativeReverse = arrayProto.reverse;
  19707. /* Built-in method references that are verified to be native. */
  19708. var DataView = getNative(context, 'DataView'),
  19709. Map = getNative(context, 'Map'),
  19710. Promise = getNative(context, 'Promise'),
  19711. Set = getNative(context, 'Set'),
  19712. WeakMap = getNative(context, 'WeakMap'),
  19713. nativeCreate = getNative(Object, 'create');
  19714. /** Used to store function metadata. */
  19715. var metaMap = WeakMap && new WeakMap;
  19716. /** Used to lookup unminified function names. */
  19717. var realNames = {};
  19718. /** Used to detect maps, sets, and weakmaps. */
  19719. var dataViewCtorString = toSource(DataView),
  19720. mapCtorString = toSource(Map),
  19721. promiseCtorString = toSource(Promise),
  19722. setCtorString = toSource(Set),
  19723. weakMapCtorString = toSource(WeakMap);
  19724. /** Used to convert symbols to primitives and strings. */
  19725. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19726. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19727. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19728. /*------------------------------------------------------------------------*/
  19729. /**
  19730. * Creates a `lodash` object which wraps `value` to enable implicit method
  19731. * chain sequences. Methods that operate on and return arrays, collections,
  19732. * and functions can be chained together. Methods that retrieve a single value
  19733. * or may return a primitive value will automatically end the chain sequence
  19734. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19735. * with `_#value`.
  19736. *
  19737. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19738. * enabled using `_.chain`.
  19739. *
  19740. * The execution of chained methods is lazy, that is, it's deferred until
  19741. * `_#value` is implicitly or explicitly called.
  19742. *
  19743. * Lazy evaluation allows several methods to support shortcut fusion.
  19744. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19745. * the creation of intermediate arrays and can greatly reduce the number of
  19746. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19747. * fusion if the section is applied to an array and iteratees accept only
  19748. * one argument. The heuristic for whether a section qualifies for shortcut
  19749. * fusion is subject to change.
  19750. *
  19751. * Chaining is supported in custom builds as long as the `_#value` method is
  19752. * directly or indirectly included in the build.
  19753. *
  19754. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19755. *
  19756. * The wrapper `Array` methods are:
  19757. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19758. *
  19759. * The wrapper `String` methods are:
  19760. * `replace` and `split`
  19761. *
  19762. * The wrapper methods that support shortcut fusion are:
  19763. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19764. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19765. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19766. *
  19767. * The chainable wrapper methods are:
  19768. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19769. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19770. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19771. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19772. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19773. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19774. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19775. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19776. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19777. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19778. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19779. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19780. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19781. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19782. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19783. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19784. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19785. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19786. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19787. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19788. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19789. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19790. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19791. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19792. *
  19793. * The wrapper methods that are **not** chainable by default are:
  19794. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19795. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19796. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19797. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19798. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19799. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19800. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19801. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19802. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19803. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19804. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19805. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19806. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19807. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19808. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19809. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19810. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19811. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19812. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19813. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19814. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19815. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19816. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19817. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19818. * `upperFirst`, `value`, and `words`
  19819. *
  19820. * @name _
  19821. * @constructor
  19822. * @category Seq
  19823. * @param {*} value The value to wrap in a `lodash` instance.
  19824. * @returns {Object} Returns the new `lodash` wrapper instance.
  19825. * @example
  19826. *
  19827. * function square(n) {
  19828. * return n * n;
  19829. * }
  19830. *
  19831. * var wrapped = _([1, 2, 3]);
  19832. *
  19833. * // Returns an unwrapped value.
  19834. * wrapped.reduce(_.add);
  19835. * // => 6
  19836. *
  19837. * // Returns a wrapped value.
  19838. * var squares = wrapped.map(square);
  19839. *
  19840. * _.isArray(squares);
  19841. * // => false
  19842. *
  19843. * _.isArray(squares.value());
  19844. * // => true
  19845. */
  19846. function lodash(value) {
  19847. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19848. if (value instanceof LodashWrapper) {
  19849. return value;
  19850. }
  19851. if (hasOwnProperty.call(value, '__wrapped__')) {
  19852. return wrapperClone(value);
  19853. }
  19854. }
  19855. return new LodashWrapper(value);
  19856. }
  19857. /**
  19858. * The base implementation of `_.create` without support for assigning
  19859. * properties to the created object.
  19860. *
  19861. * @private
  19862. * @param {Object} proto The object to inherit from.
  19863. * @returns {Object} Returns the new object.
  19864. */
  19865. var baseCreate = (function() {
  19866. function object() {}
  19867. return function(proto) {
  19868. if (!isObject(proto)) {
  19869. return {};
  19870. }
  19871. if (objectCreate) {
  19872. return objectCreate(proto);
  19873. }
  19874. object.prototype = proto;
  19875. var result = new object;
  19876. object.prototype = undefined;
  19877. return result;
  19878. };
  19879. }());
  19880. /**
  19881. * The function whose prototype chain sequence wrappers inherit from.
  19882. *
  19883. * @private
  19884. */
  19885. function baseLodash() {
  19886. // No operation performed.
  19887. }
  19888. /**
  19889. * The base constructor for creating `lodash` wrapper objects.
  19890. *
  19891. * @private
  19892. * @param {*} value The value to wrap.
  19893. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19894. */
  19895. function LodashWrapper(value, chainAll) {
  19896. this.__wrapped__ = value;
  19897. this.__actions__ = [];
  19898. this.__chain__ = !!chainAll;
  19899. this.__index__ = 0;
  19900. this.__values__ = undefined;
  19901. }
  19902. /**
  19903. * By default, the template delimiters used by lodash are like those in
  19904. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19905. * following template settings to use alternative delimiters.
  19906. *
  19907. * @static
  19908. * @memberOf _
  19909. * @type {Object}
  19910. */
  19911. lodash.templateSettings = {
  19912. /**
  19913. * Used to detect `data` property values to be HTML-escaped.
  19914. *
  19915. * @memberOf _.templateSettings
  19916. * @type {RegExp}
  19917. */
  19918. 'escape': reEscape,
  19919. /**
  19920. * Used to detect code to be evaluated.
  19921. *
  19922. * @memberOf _.templateSettings
  19923. * @type {RegExp}
  19924. */
  19925. 'evaluate': reEvaluate,
  19926. /**
  19927. * Used to detect `data` property values to inject.
  19928. *
  19929. * @memberOf _.templateSettings
  19930. * @type {RegExp}
  19931. */
  19932. 'interpolate': reInterpolate,
  19933. /**
  19934. * Used to reference the data object in the template text.
  19935. *
  19936. * @memberOf _.templateSettings
  19937. * @type {string}
  19938. */
  19939. 'variable': '',
  19940. /**
  19941. * Used to import variables into the compiled template.
  19942. *
  19943. * @memberOf _.templateSettings
  19944. * @type {Object}
  19945. */
  19946. 'imports': {
  19947. /**
  19948. * A reference to the `lodash` function.
  19949. *
  19950. * @memberOf _.templateSettings.imports
  19951. * @type {Function}
  19952. */
  19953. '_': lodash
  19954. }
  19955. };
  19956. // Ensure wrappers are instances of `baseLodash`.
  19957. lodash.prototype = baseLodash.prototype;
  19958. lodash.prototype.constructor = lodash;
  19959. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19960. LodashWrapper.prototype.constructor = LodashWrapper;
  19961. /*------------------------------------------------------------------------*/
  19962. /**
  19963. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19964. *
  19965. * @private
  19966. * @constructor
  19967. * @param {*} value The value to wrap.
  19968. */
  19969. function LazyWrapper(value) {
  19970. this.__wrapped__ = value;
  19971. this.__actions__ = [];
  19972. this.__dir__ = 1;
  19973. this.__filtered__ = false;
  19974. this.__iteratees__ = [];
  19975. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19976. this.__views__ = [];
  19977. }
  19978. /**
  19979. * Creates a clone of the lazy wrapper object.
  19980. *
  19981. * @private
  19982. * @name clone
  19983. * @memberOf LazyWrapper
  19984. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19985. */
  19986. function lazyClone() {
  19987. var result = new LazyWrapper(this.__wrapped__);
  19988. result.__actions__ = copyArray(this.__actions__);
  19989. result.__dir__ = this.__dir__;
  19990. result.__filtered__ = this.__filtered__;
  19991. result.__iteratees__ = copyArray(this.__iteratees__);
  19992. result.__takeCount__ = this.__takeCount__;
  19993. result.__views__ = copyArray(this.__views__);
  19994. return result;
  19995. }
  19996. /**
  19997. * Reverses the direction of lazy iteration.
  19998. *
  19999. * @private
  20000. * @name reverse
  20001. * @memberOf LazyWrapper
  20002. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20003. */
  20004. function lazyReverse() {
  20005. if (this.__filtered__) {
  20006. var result = new LazyWrapper(this);
  20007. result.__dir__ = -1;
  20008. result.__filtered__ = true;
  20009. } else {
  20010. result = this.clone();
  20011. result.__dir__ *= -1;
  20012. }
  20013. return result;
  20014. }
  20015. /**
  20016. * Extracts the unwrapped value from its lazy wrapper.
  20017. *
  20018. * @private
  20019. * @name value
  20020. * @memberOf LazyWrapper
  20021. * @returns {*} Returns the unwrapped value.
  20022. */
  20023. function lazyValue() {
  20024. var array = this.__wrapped__.value(),
  20025. dir = this.__dir__,
  20026. isArr = isArray(array),
  20027. isRight = dir < 0,
  20028. arrLength = isArr ? array.length : 0,
  20029. view = getView(0, arrLength, this.__views__),
  20030. start = view.start,
  20031. end = view.end,
  20032. length = end - start,
  20033. index = isRight ? end : (start - 1),
  20034. iteratees = this.__iteratees__,
  20035. iterLength = iteratees.length,
  20036. resIndex = 0,
  20037. takeCount = nativeMin(length, this.__takeCount__);
  20038. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20039. return baseWrapperValue(array, this.__actions__);
  20040. }
  20041. var result = [];
  20042. outer:
  20043. while (length-- && resIndex < takeCount) {
  20044. index += dir;
  20045. var iterIndex = -1,
  20046. value = array[index];
  20047. while (++iterIndex < iterLength) {
  20048. var data = iteratees[iterIndex],
  20049. iteratee = data.iteratee,
  20050. type = data.type,
  20051. computed = iteratee(value);
  20052. if (type == LAZY_MAP_FLAG) {
  20053. value = computed;
  20054. } else if (!computed) {
  20055. if (type == LAZY_FILTER_FLAG) {
  20056. continue outer;
  20057. } else {
  20058. break outer;
  20059. }
  20060. }
  20061. }
  20062. result[resIndex++] = value;
  20063. }
  20064. return result;
  20065. }
  20066. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20067. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20068. LazyWrapper.prototype.constructor = LazyWrapper;
  20069. /*------------------------------------------------------------------------*/
  20070. /**
  20071. * Creates a hash object.
  20072. *
  20073. * @private
  20074. * @constructor
  20075. * @param {Array} [entries] The key-value pairs to cache.
  20076. */
  20077. function Hash(entries) {
  20078. var index = -1,
  20079. length = entries == null ? 0 : entries.length;
  20080. this.clear();
  20081. while (++index < length) {
  20082. var entry = entries[index];
  20083. this.set(entry[0], entry[1]);
  20084. }
  20085. }
  20086. /**
  20087. * Removes all key-value entries from the hash.
  20088. *
  20089. * @private
  20090. * @name clear
  20091. * @memberOf Hash
  20092. */
  20093. function hashClear() {
  20094. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20095. this.size = 0;
  20096. }
  20097. /**
  20098. * Removes `key` and its value from the hash.
  20099. *
  20100. * @private
  20101. * @name delete
  20102. * @memberOf Hash
  20103. * @param {Object} hash The hash to modify.
  20104. * @param {string} key The key of the value to remove.
  20105. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20106. */
  20107. function hashDelete(key) {
  20108. var result = this.has(key) && delete this.__data__[key];
  20109. this.size -= result ? 1 : 0;
  20110. return result;
  20111. }
  20112. /**
  20113. * Gets the hash value for `key`.
  20114. *
  20115. * @private
  20116. * @name get
  20117. * @memberOf Hash
  20118. * @param {string} key The key of the value to get.
  20119. * @returns {*} Returns the entry value.
  20120. */
  20121. function hashGet(key) {
  20122. var data = this.__data__;
  20123. if (nativeCreate) {
  20124. var result = data[key];
  20125. return result === HASH_UNDEFINED ? undefined : result;
  20126. }
  20127. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20128. }
  20129. /**
  20130. * Checks if a hash value for `key` exists.
  20131. *
  20132. * @private
  20133. * @name has
  20134. * @memberOf Hash
  20135. * @param {string} key The key of the entry to check.
  20136. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20137. */
  20138. function hashHas(key) {
  20139. var data = this.__data__;
  20140. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20141. }
  20142. /**
  20143. * Sets the hash `key` to `value`.
  20144. *
  20145. * @private
  20146. * @name set
  20147. * @memberOf Hash
  20148. * @param {string} key The key of the value to set.
  20149. * @param {*} value The value to set.
  20150. * @returns {Object} Returns the hash instance.
  20151. */
  20152. function hashSet(key, value) {
  20153. var data = this.__data__;
  20154. this.size += this.has(key) ? 0 : 1;
  20155. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20156. return this;
  20157. }
  20158. // Add methods to `Hash`.
  20159. Hash.prototype.clear = hashClear;
  20160. Hash.prototype['delete'] = hashDelete;
  20161. Hash.prototype.get = hashGet;
  20162. Hash.prototype.has = hashHas;
  20163. Hash.prototype.set = hashSet;
  20164. /*------------------------------------------------------------------------*/
  20165. /**
  20166. * Creates an list cache object.
  20167. *
  20168. * @private
  20169. * @constructor
  20170. * @param {Array} [entries] The key-value pairs to cache.
  20171. */
  20172. function ListCache(entries) {
  20173. var index = -1,
  20174. length = entries == null ? 0 : entries.length;
  20175. this.clear();
  20176. while (++index < length) {
  20177. var entry = entries[index];
  20178. this.set(entry[0], entry[1]);
  20179. }
  20180. }
  20181. /**
  20182. * Removes all key-value entries from the list cache.
  20183. *
  20184. * @private
  20185. * @name clear
  20186. * @memberOf ListCache
  20187. */
  20188. function listCacheClear() {
  20189. this.__data__ = [];
  20190. this.size = 0;
  20191. }
  20192. /**
  20193. * Removes `key` and its value from the list cache.
  20194. *
  20195. * @private
  20196. * @name delete
  20197. * @memberOf ListCache
  20198. * @param {string} key The key of the value to remove.
  20199. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20200. */
  20201. function listCacheDelete(key) {
  20202. var data = this.__data__,
  20203. index = assocIndexOf(data, key);
  20204. if (index < 0) {
  20205. return false;
  20206. }
  20207. var lastIndex = data.length - 1;
  20208. if (index == lastIndex) {
  20209. data.pop();
  20210. } else {
  20211. splice.call(data, index, 1);
  20212. }
  20213. --this.size;
  20214. return true;
  20215. }
  20216. /**
  20217. * Gets the list cache value for `key`.
  20218. *
  20219. * @private
  20220. * @name get
  20221. * @memberOf ListCache
  20222. * @param {string} key The key of the value to get.
  20223. * @returns {*} Returns the entry value.
  20224. */
  20225. function listCacheGet(key) {
  20226. var data = this.__data__,
  20227. index = assocIndexOf(data, key);
  20228. return index < 0 ? undefined : data[index][1];
  20229. }
  20230. /**
  20231. * Checks if a list cache value for `key` exists.
  20232. *
  20233. * @private
  20234. * @name has
  20235. * @memberOf ListCache
  20236. * @param {string} key The key of the entry to check.
  20237. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20238. */
  20239. function listCacheHas(key) {
  20240. return assocIndexOf(this.__data__, key) > -1;
  20241. }
  20242. /**
  20243. * Sets the list cache `key` to `value`.
  20244. *
  20245. * @private
  20246. * @name set
  20247. * @memberOf ListCache
  20248. * @param {string} key The key of the value to set.
  20249. * @param {*} value The value to set.
  20250. * @returns {Object} Returns the list cache instance.
  20251. */
  20252. function listCacheSet(key, value) {
  20253. var data = this.__data__,
  20254. index = assocIndexOf(data, key);
  20255. if (index < 0) {
  20256. ++this.size;
  20257. data.push([key, value]);
  20258. } else {
  20259. data[index][1] = value;
  20260. }
  20261. return this;
  20262. }
  20263. // Add methods to `ListCache`.
  20264. ListCache.prototype.clear = listCacheClear;
  20265. ListCache.prototype['delete'] = listCacheDelete;
  20266. ListCache.prototype.get = listCacheGet;
  20267. ListCache.prototype.has = listCacheHas;
  20268. ListCache.prototype.set = listCacheSet;
  20269. /*------------------------------------------------------------------------*/
  20270. /**
  20271. * Creates a map cache object to store key-value pairs.
  20272. *
  20273. * @private
  20274. * @constructor
  20275. * @param {Array} [entries] The key-value pairs to cache.
  20276. */
  20277. function MapCache(entries) {
  20278. var index = -1,
  20279. length = entries == null ? 0 : entries.length;
  20280. this.clear();
  20281. while (++index < length) {
  20282. var entry = entries[index];
  20283. this.set(entry[0], entry[1]);
  20284. }
  20285. }
  20286. /**
  20287. * Removes all key-value entries from the map.
  20288. *
  20289. * @private
  20290. * @name clear
  20291. * @memberOf MapCache
  20292. */
  20293. function mapCacheClear() {
  20294. this.size = 0;
  20295. this.__data__ = {
  20296. 'hash': new Hash,
  20297. 'map': new (Map || ListCache),
  20298. 'string': new Hash
  20299. };
  20300. }
  20301. /**
  20302. * Removes `key` and its value from the map.
  20303. *
  20304. * @private
  20305. * @name delete
  20306. * @memberOf MapCache
  20307. * @param {string} key The key of the value to remove.
  20308. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20309. */
  20310. function mapCacheDelete(key) {
  20311. var result = getMapData(this, key)['delete'](key);
  20312. this.size -= result ? 1 : 0;
  20313. return result;
  20314. }
  20315. /**
  20316. * Gets the map value for `key`.
  20317. *
  20318. * @private
  20319. * @name get
  20320. * @memberOf MapCache
  20321. * @param {string} key The key of the value to get.
  20322. * @returns {*} Returns the entry value.
  20323. */
  20324. function mapCacheGet(key) {
  20325. return getMapData(this, key).get(key);
  20326. }
  20327. /**
  20328. * Checks if a map value for `key` exists.
  20329. *
  20330. * @private
  20331. * @name has
  20332. * @memberOf MapCache
  20333. * @param {string} key The key of the entry to check.
  20334. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20335. */
  20336. function mapCacheHas(key) {
  20337. return getMapData(this, key).has(key);
  20338. }
  20339. /**
  20340. * Sets the map `key` to `value`.
  20341. *
  20342. * @private
  20343. * @name set
  20344. * @memberOf MapCache
  20345. * @param {string} key The key of the value to set.
  20346. * @param {*} value The value to set.
  20347. * @returns {Object} Returns the map cache instance.
  20348. */
  20349. function mapCacheSet(key, value) {
  20350. var data = getMapData(this, key),
  20351. size = data.size;
  20352. data.set(key, value);
  20353. this.size += data.size == size ? 0 : 1;
  20354. return this;
  20355. }
  20356. // Add methods to `MapCache`.
  20357. MapCache.prototype.clear = mapCacheClear;
  20358. MapCache.prototype['delete'] = mapCacheDelete;
  20359. MapCache.prototype.get = mapCacheGet;
  20360. MapCache.prototype.has = mapCacheHas;
  20361. MapCache.prototype.set = mapCacheSet;
  20362. /*------------------------------------------------------------------------*/
  20363. /**
  20364. *
  20365. * Creates an array cache object to store unique values.
  20366. *
  20367. * @private
  20368. * @constructor
  20369. * @param {Array} [values] The values to cache.
  20370. */
  20371. function SetCache(values) {
  20372. var index = -1,
  20373. length = values == null ? 0 : values.length;
  20374. this.__data__ = new MapCache;
  20375. while (++index < length) {
  20376. this.add(values[index]);
  20377. }
  20378. }
  20379. /**
  20380. * Adds `value` to the array cache.
  20381. *
  20382. * @private
  20383. * @name add
  20384. * @memberOf SetCache
  20385. * @alias push
  20386. * @param {*} value The value to cache.
  20387. * @returns {Object} Returns the cache instance.
  20388. */
  20389. function setCacheAdd(value) {
  20390. this.__data__.set(value, HASH_UNDEFINED);
  20391. return this;
  20392. }
  20393. /**
  20394. * Checks if `value` is in the array cache.
  20395. *
  20396. * @private
  20397. * @name has
  20398. * @memberOf SetCache
  20399. * @param {*} value The value to search for.
  20400. * @returns {number} Returns `true` if `value` is found, else `false`.
  20401. */
  20402. function setCacheHas(value) {
  20403. return this.__data__.has(value);
  20404. }
  20405. // Add methods to `SetCache`.
  20406. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20407. SetCache.prototype.has = setCacheHas;
  20408. /*------------------------------------------------------------------------*/
  20409. /**
  20410. * Creates a stack cache object to store key-value pairs.
  20411. *
  20412. * @private
  20413. * @constructor
  20414. * @param {Array} [entries] The key-value pairs to cache.
  20415. */
  20416. function Stack(entries) {
  20417. var data = this.__data__ = new ListCache(entries);
  20418. this.size = data.size;
  20419. }
  20420. /**
  20421. * Removes all key-value entries from the stack.
  20422. *
  20423. * @private
  20424. * @name clear
  20425. * @memberOf Stack
  20426. */
  20427. function stackClear() {
  20428. this.__data__ = new ListCache;
  20429. this.size = 0;
  20430. }
  20431. /**
  20432. * Removes `key` and its value from the stack.
  20433. *
  20434. * @private
  20435. * @name delete
  20436. * @memberOf Stack
  20437. * @param {string} key The key of the value to remove.
  20438. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20439. */
  20440. function stackDelete(key) {
  20441. var data = this.__data__,
  20442. result = data['delete'](key);
  20443. this.size = data.size;
  20444. return result;
  20445. }
  20446. /**
  20447. * Gets the stack value for `key`.
  20448. *
  20449. * @private
  20450. * @name get
  20451. * @memberOf Stack
  20452. * @param {string} key The key of the value to get.
  20453. * @returns {*} Returns the entry value.
  20454. */
  20455. function stackGet(key) {
  20456. return this.__data__.get(key);
  20457. }
  20458. /**
  20459. * Checks if a stack value for `key` exists.
  20460. *
  20461. * @private
  20462. * @name has
  20463. * @memberOf Stack
  20464. * @param {string} key The key of the entry to check.
  20465. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20466. */
  20467. function stackHas(key) {
  20468. return this.__data__.has(key);
  20469. }
  20470. /**
  20471. * Sets the stack `key` to `value`.
  20472. *
  20473. * @private
  20474. * @name set
  20475. * @memberOf Stack
  20476. * @param {string} key The key of the value to set.
  20477. * @param {*} value The value to set.
  20478. * @returns {Object} Returns the stack cache instance.
  20479. */
  20480. function stackSet(key, value) {
  20481. var data = this.__data__;
  20482. if (data instanceof ListCache) {
  20483. var pairs = data.__data__;
  20484. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20485. pairs.push([key, value]);
  20486. this.size = ++data.size;
  20487. return this;
  20488. }
  20489. data = this.__data__ = new MapCache(pairs);
  20490. }
  20491. data.set(key, value);
  20492. this.size = data.size;
  20493. return this;
  20494. }
  20495. // Add methods to `Stack`.
  20496. Stack.prototype.clear = stackClear;
  20497. Stack.prototype['delete'] = stackDelete;
  20498. Stack.prototype.get = stackGet;
  20499. Stack.prototype.has = stackHas;
  20500. Stack.prototype.set = stackSet;
  20501. /*------------------------------------------------------------------------*/
  20502. /**
  20503. * Creates an array of the enumerable property names of the array-like `value`.
  20504. *
  20505. * @private
  20506. * @param {*} value The value to query.
  20507. * @param {boolean} inherited Specify returning inherited property names.
  20508. * @returns {Array} Returns the array of property names.
  20509. */
  20510. function arrayLikeKeys(value, inherited) {
  20511. var isArr = isArray(value),
  20512. isArg = !isArr && isArguments(value),
  20513. isBuff = !isArr && !isArg && isBuffer(value),
  20514. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20515. skipIndexes = isArr || isArg || isBuff || isType,
  20516. result = skipIndexes ? baseTimes(value.length, String) : [],
  20517. length = result.length;
  20518. for (var key in value) {
  20519. if ((inherited || hasOwnProperty.call(value, key)) &&
  20520. !(skipIndexes && (
  20521. // Safari 9 has enumerable `arguments.length` in strict mode.
  20522. key == 'length' ||
  20523. // Node.js 0.10 has enumerable non-index properties on buffers.
  20524. (isBuff && (key == 'offset' || key == 'parent')) ||
  20525. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20526. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20527. // Skip index properties.
  20528. isIndex(key, length)
  20529. ))) {
  20530. result.push(key);
  20531. }
  20532. }
  20533. return result;
  20534. }
  20535. /**
  20536. * A specialized version of `_.sample` for arrays.
  20537. *
  20538. * @private
  20539. * @param {Array} array The array to sample.
  20540. * @returns {*} Returns the random element.
  20541. */
  20542. function arraySample(array) {
  20543. var length = array.length;
  20544. return length ? array[baseRandom(0, length - 1)] : undefined;
  20545. }
  20546. /**
  20547. * A specialized version of `_.sampleSize` for arrays.
  20548. *
  20549. * @private
  20550. * @param {Array} array The array to sample.
  20551. * @param {number} n The number of elements to sample.
  20552. * @returns {Array} Returns the random elements.
  20553. */
  20554. function arraySampleSize(array, n) {
  20555. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20556. }
  20557. /**
  20558. * A specialized version of `_.shuffle` for arrays.
  20559. *
  20560. * @private
  20561. * @param {Array} array The array to shuffle.
  20562. * @returns {Array} Returns the new shuffled array.
  20563. */
  20564. function arrayShuffle(array) {
  20565. return shuffleSelf(copyArray(array));
  20566. }
  20567. /**
  20568. * This function is like `assignValue` except that it doesn't assign
  20569. * `undefined` values.
  20570. *
  20571. * @private
  20572. * @param {Object} object The object to modify.
  20573. * @param {string} key The key of the property to assign.
  20574. * @param {*} value The value to assign.
  20575. */
  20576. function assignMergeValue(object, key, value) {
  20577. if ((value !== undefined && !eq(object[key], value)) ||
  20578. (value === undefined && !(key in object))) {
  20579. baseAssignValue(object, key, value);
  20580. }
  20581. }
  20582. /**
  20583. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20584. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20585. * for equality comparisons.
  20586. *
  20587. * @private
  20588. * @param {Object} object The object to modify.
  20589. * @param {string} key The key of the property to assign.
  20590. * @param {*} value The value to assign.
  20591. */
  20592. function assignValue(object, key, value) {
  20593. var objValue = object[key];
  20594. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20595. (value === undefined && !(key in object))) {
  20596. baseAssignValue(object, key, value);
  20597. }
  20598. }
  20599. /**
  20600. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20601. *
  20602. * @private
  20603. * @param {Array} array The array to inspect.
  20604. * @param {*} key The key to search for.
  20605. * @returns {number} Returns the index of the matched value, else `-1`.
  20606. */
  20607. function assocIndexOf(array, key) {
  20608. var length = array.length;
  20609. while (length--) {
  20610. if (eq(array[length][0], key)) {
  20611. return length;
  20612. }
  20613. }
  20614. return -1;
  20615. }
  20616. /**
  20617. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20618. * by `iteratee` and values set by `setter`.
  20619. *
  20620. * @private
  20621. * @param {Array|Object} collection The collection to iterate over.
  20622. * @param {Function} setter The function to set `accumulator` values.
  20623. * @param {Function} iteratee The iteratee to transform keys.
  20624. * @param {Object} accumulator The initial aggregated object.
  20625. * @returns {Function} Returns `accumulator`.
  20626. */
  20627. function baseAggregator(collection, setter, iteratee, accumulator) {
  20628. baseEach(collection, function(value, key, collection) {
  20629. setter(accumulator, value, iteratee(value), collection);
  20630. });
  20631. return accumulator;
  20632. }
  20633. /**
  20634. * The base implementation of `_.assign` without support for multiple sources
  20635. * or `customizer` functions.
  20636. *
  20637. * @private
  20638. * @param {Object} object The destination object.
  20639. * @param {Object} source The source object.
  20640. * @returns {Object} Returns `object`.
  20641. */
  20642. function baseAssign(object, source) {
  20643. return object && copyObject(source, keys(source), object);
  20644. }
  20645. /**
  20646. * The base implementation of `_.assignIn` without support for multiple sources
  20647. * or `customizer` functions.
  20648. *
  20649. * @private
  20650. * @param {Object} object The destination object.
  20651. * @param {Object} source The source object.
  20652. * @returns {Object} Returns `object`.
  20653. */
  20654. function baseAssignIn(object, source) {
  20655. return object && copyObject(source, keysIn(source), object);
  20656. }
  20657. /**
  20658. * The base implementation of `assignValue` and `assignMergeValue` without
  20659. * value checks.
  20660. *
  20661. * @private
  20662. * @param {Object} object The object to modify.
  20663. * @param {string} key The key of the property to assign.
  20664. * @param {*} value The value to assign.
  20665. */
  20666. function baseAssignValue(object, key, value) {
  20667. if (key == '__proto__' && defineProperty) {
  20668. defineProperty(object, key, {
  20669. 'configurable': true,
  20670. 'enumerable': true,
  20671. 'value': value,
  20672. 'writable': true
  20673. });
  20674. } else {
  20675. object[key] = value;
  20676. }
  20677. }
  20678. /**
  20679. * The base implementation of `_.at` without support for individual paths.
  20680. *
  20681. * @private
  20682. * @param {Object} object The object to iterate over.
  20683. * @param {string[]} paths The property paths to pick.
  20684. * @returns {Array} Returns the picked elements.
  20685. */
  20686. function baseAt(object, paths) {
  20687. var index = -1,
  20688. length = paths.length,
  20689. result = Array(length),
  20690. skip = object == null;
  20691. while (++index < length) {
  20692. result[index] = skip ? undefined : get(object, paths[index]);
  20693. }
  20694. return result;
  20695. }
  20696. /**
  20697. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20698. *
  20699. * @private
  20700. * @param {number} number The number to clamp.
  20701. * @param {number} [lower] The lower bound.
  20702. * @param {number} upper The upper bound.
  20703. * @returns {number} Returns the clamped number.
  20704. */
  20705. function baseClamp(number, lower, upper) {
  20706. if (number === number) {
  20707. if (upper !== undefined) {
  20708. number = number <= upper ? number : upper;
  20709. }
  20710. if (lower !== undefined) {
  20711. number = number >= lower ? number : lower;
  20712. }
  20713. }
  20714. return number;
  20715. }
  20716. /**
  20717. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20718. * traversed objects.
  20719. *
  20720. * @private
  20721. * @param {*} value The value to clone.
  20722. * @param {boolean} bitmask The bitmask flags.
  20723. * 1 - Deep clone
  20724. * 2 - Flatten inherited properties
  20725. * 4 - Clone symbols
  20726. * @param {Function} [customizer] The function to customize cloning.
  20727. * @param {string} [key] The key of `value`.
  20728. * @param {Object} [object] The parent object of `value`.
  20729. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20730. * @returns {*} Returns the cloned value.
  20731. */
  20732. function baseClone(value, bitmask, customizer, key, object, stack) {
  20733. var result,
  20734. isDeep = bitmask & CLONE_DEEP_FLAG,
  20735. isFlat = bitmask & CLONE_FLAT_FLAG,
  20736. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20737. if (customizer) {
  20738. result = object ? customizer(value, key, object, stack) : customizer(value);
  20739. }
  20740. if (result !== undefined) {
  20741. return result;
  20742. }
  20743. if (!isObject(value)) {
  20744. return value;
  20745. }
  20746. var isArr = isArray(value);
  20747. if (isArr) {
  20748. result = initCloneArray(value);
  20749. if (!isDeep) {
  20750. return copyArray(value, result);
  20751. }
  20752. } else {
  20753. var tag = getTag(value),
  20754. isFunc = tag == funcTag || tag == genTag;
  20755. if (isBuffer(value)) {
  20756. return cloneBuffer(value, isDeep);
  20757. }
  20758. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20759. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20760. if (!isDeep) {
  20761. return isFlat
  20762. ? copySymbolsIn(value, baseAssignIn(result, value))
  20763. : copySymbols(value, baseAssign(result, value));
  20764. }
  20765. } else {
  20766. if (!cloneableTags[tag]) {
  20767. return object ? value : {};
  20768. }
  20769. result = initCloneByTag(value, tag, isDeep);
  20770. }
  20771. }
  20772. // Check for circular references and return its corresponding clone.
  20773. stack || (stack = new Stack);
  20774. var stacked = stack.get(value);
  20775. if (stacked) {
  20776. return stacked;
  20777. }
  20778. stack.set(value, result);
  20779. if (isSet(value)) {
  20780. value.forEach(function(subValue) {
  20781. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20782. });
  20783. } else if (isMap(value)) {
  20784. value.forEach(function(subValue, key) {
  20785. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20786. });
  20787. }
  20788. var keysFunc = isFull
  20789. ? (isFlat ? getAllKeysIn : getAllKeys)
  20790. : (isFlat ? keysIn : keys);
  20791. var props = isArr ? undefined : keysFunc(value);
  20792. arrayEach(props || value, function(subValue, key) {
  20793. if (props) {
  20794. key = subValue;
  20795. subValue = value[key];
  20796. }
  20797. // Recursively populate clone (susceptible to call stack limits).
  20798. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20799. });
  20800. return result;
  20801. }
  20802. /**
  20803. * The base implementation of `_.conforms` which doesn't clone `source`.
  20804. *
  20805. * @private
  20806. * @param {Object} source The object of property predicates to conform to.
  20807. * @returns {Function} Returns the new spec function.
  20808. */
  20809. function baseConforms(source) {
  20810. var props = keys(source);
  20811. return function(object) {
  20812. return baseConformsTo(object, source, props);
  20813. };
  20814. }
  20815. /**
  20816. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20817. *
  20818. * @private
  20819. * @param {Object} object The object to inspect.
  20820. * @param {Object} source The object of property predicates to conform to.
  20821. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20822. */
  20823. function baseConformsTo(object, source, props) {
  20824. var length = props.length;
  20825. if (object == null) {
  20826. return !length;
  20827. }
  20828. object = Object(object);
  20829. while (length--) {
  20830. var key = props[length],
  20831. predicate = source[key],
  20832. value = object[key];
  20833. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20834. return false;
  20835. }
  20836. }
  20837. return true;
  20838. }
  20839. /**
  20840. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20841. * to provide to `func`.
  20842. *
  20843. * @private
  20844. * @param {Function} func The function to delay.
  20845. * @param {number} wait The number of milliseconds to delay invocation.
  20846. * @param {Array} args The arguments to provide to `func`.
  20847. * @returns {number|Object} Returns the timer id or timeout object.
  20848. */
  20849. function baseDelay(func, wait, args) {
  20850. if (typeof func != 'function') {
  20851. throw new TypeError(FUNC_ERROR_TEXT);
  20852. }
  20853. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20854. }
  20855. /**
  20856. * The base implementation of methods like `_.difference` without support
  20857. * for excluding multiple arrays or iteratee shorthands.
  20858. *
  20859. * @private
  20860. * @param {Array} array The array to inspect.
  20861. * @param {Array} values The values to exclude.
  20862. * @param {Function} [iteratee] The iteratee invoked per element.
  20863. * @param {Function} [comparator] The comparator invoked per element.
  20864. * @returns {Array} Returns the new array of filtered values.
  20865. */
  20866. function baseDifference(array, values, iteratee, comparator) {
  20867. var index = -1,
  20868. includes = arrayIncludes,
  20869. isCommon = true,
  20870. length = array.length,
  20871. result = [],
  20872. valuesLength = values.length;
  20873. if (!length) {
  20874. return result;
  20875. }
  20876. if (iteratee) {
  20877. values = arrayMap(values, baseUnary(iteratee));
  20878. }
  20879. if (comparator) {
  20880. includes = arrayIncludesWith;
  20881. isCommon = false;
  20882. }
  20883. else if (values.length >= LARGE_ARRAY_SIZE) {
  20884. includes = cacheHas;
  20885. isCommon = false;
  20886. values = new SetCache(values);
  20887. }
  20888. outer:
  20889. while (++index < length) {
  20890. var value = array[index],
  20891. computed = iteratee == null ? value : iteratee(value);
  20892. value = (comparator || value !== 0) ? value : 0;
  20893. if (isCommon && computed === computed) {
  20894. var valuesIndex = valuesLength;
  20895. while (valuesIndex--) {
  20896. if (values[valuesIndex] === computed) {
  20897. continue outer;
  20898. }
  20899. }
  20900. result.push(value);
  20901. }
  20902. else if (!includes(values, computed, comparator)) {
  20903. result.push(value);
  20904. }
  20905. }
  20906. return result;
  20907. }
  20908. /**
  20909. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20910. *
  20911. * @private
  20912. * @param {Array|Object} collection The collection to iterate over.
  20913. * @param {Function} iteratee The function invoked per iteration.
  20914. * @returns {Array|Object} Returns `collection`.
  20915. */
  20916. var baseEach = createBaseEach(baseForOwn);
  20917. /**
  20918. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20919. *
  20920. * @private
  20921. * @param {Array|Object} collection The collection to iterate over.
  20922. * @param {Function} iteratee The function invoked per iteration.
  20923. * @returns {Array|Object} Returns `collection`.
  20924. */
  20925. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20926. /**
  20927. * The base implementation of `_.every` without support for iteratee shorthands.
  20928. *
  20929. * @private
  20930. * @param {Array|Object} collection The collection to iterate over.
  20931. * @param {Function} predicate The function invoked per iteration.
  20932. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20933. * else `false`
  20934. */
  20935. function baseEvery(collection, predicate) {
  20936. var result = true;
  20937. baseEach(collection, function(value, index, collection) {
  20938. result = !!predicate(value, index, collection);
  20939. return result;
  20940. });
  20941. return result;
  20942. }
  20943. /**
  20944. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20945. * `comparator` to determine the extremum value.
  20946. *
  20947. * @private
  20948. * @param {Array} array The array to iterate over.
  20949. * @param {Function} iteratee The iteratee invoked per iteration.
  20950. * @param {Function} comparator The comparator used to compare values.
  20951. * @returns {*} Returns the extremum value.
  20952. */
  20953. function baseExtremum(array, iteratee, comparator) {
  20954. var index = -1,
  20955. length = array.length;
  20956. while (++index < length) {
  20957. var value = array[index],
  20958. current = iteratee(value);
  20959. if (current != null && (computed === undefined
  20960. ? (current === current && !isSymbol(current))
  20961. : comparator(current, computed)
  20962. )) {
  20963. var computed = current,
  20964. result = value;
  20965. }
  20966. }
  20967. return result;
  20968. }
  20969. /**
  20970. * The base implementation of `_.fill` without an iteratee call guard.
  20971. *
  20972. * @private
  20973. * @param {Array} array The array to fill.
  20974. * @param {*} value The value to fill `array` with.
  20975. * @param {number} [start=0] The start position.
  20976. * @param {number} [end=array.length] The end position.
  20977. * @returns {Array} Returns `array`.
  20978. */
  20979. function baseFill(array, value, start, end) {
  20980. var length = array.length;
  20981. start = toInteger(start);
  20982. if (start < 0) {
  20983. start = -start > length ? 0 : (length + start);
  20984. }
  20985. end = (end === undefined || end > length) ? length : toInteger(end);
  20986. if (end < 0) {
  20987. end += length;
  20988. }
  20989. end = start > end ? 0 : toLength(end);
  20990. while (start < end) {
  20991. array[start++] = value;
  20992. }
  20993. return array;
  20994. }
  20995. /**
  20996. * The base implementation of `_.filter` without support for iteratee shorthands.
  20997. *
  20998. * @private
  20999. * @param {Array|Object} collection The collection to iterate over.
  21000. * @param {Function} predicate The function invoked per iteration.
  21001. * @returns {Array} Returns the new filtered array.
  21002. */
  21003. function baseFilter(collection, predicate) {
  21004. var result = [];
  21005. baseEach(collection, function(value, index, collection) {
  21006. if (predicate(value, index, collection)) {
  21007. result.push(value);
  21008. }
  21009. });
  21010. return result;
  21011. }
  21012. /**
  21013. * The base implementation of `_.flatten` with support for restricting flattening.
  21014. *
  21015. * @private
  21016. * @param {Array} array The array to flatten.
  21017. * @param {number} depth The maximum recursion depth.
  21018. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21019. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21020. * @param {Array} [result=[]] The initial result value.
  21021. * @returns {Array} Returns the new flattened array.
  21022. */
  21023. function baseFlatten(array, depth, predicate, isStrict, result) {
  21024. var index = -1,
  21025. length = array.length;
  21026. predicate || (predicate = isFlattenable);
  21027. result || (result = []);
  21028. while (++index < length) {
  21029. var value = array[index];
  21030. if (depth > 0 && predicate(value)) {
  21031. if (depth > 1) {
  21032. // Recursively flatten arrays (susceptible to call stack limits).
  21033. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21034. } else {
  21035. arrayPush(result, value);
  21036. }
  21037. } else if (!isStrict) {
  21038. result[result.length] = value;
  21039. }
  21040. }
  21041. return result;
  21042. }
  21043. /**
  21044. * The base implementation of `baseForOwn` which iterates over `object`
  21045. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21046. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21047. *
  21048. * @private
  21049. * @param {Object} object The object to iterate over.
  21050. * @param {Function} iteratee The function invoked per iteration.
  21051. * @param {Function} keysFunc The function to get the keys of `object`.
  21052. * @returns {Object} Returns `object`.
  21053. */
  21054. var baseFor = createBaseFor();
  21055. /**
  21056. * This function is like `baseFor` except that it iterates over properties
  21057. * in the opposite order.
  21058. *
  21059. * @private
  21060. * @param {Object} object The object to iterate over.
  21061. * @param {Function} iteratee The function invoked per iteration.
  21062. * @param {Function} keysFunc The function to get the keys of `object`.
  21063. * @returns {Object} Returns `object`.
  21064. */
  21065. var baseForRight = createBaseFor(true);
  21066. /**
  21067. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21068. *
  21069. * @private
  21070. * @param {Object} object The object to iterate over.
  21071. * @param {Function} iteratee The function invoked per iteration.
  21072. * @returns {Object} Returns `object`.
  21073. */
  21074. function baseForOwn(object, iteratee) {
  21075. return object && baseFor(object, iteratee, keys);
  21076. }
  21077. /**
  21078. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21079. *
  21080. * @private
  21081. * @param {Object} object The object to iterate over.
  21082. * @param {Function} iteratee The function invoked per iteration.
  21083. * @returns {Object} Returns `object`.
  21084. */
  21085. function baseForOwnRight(object, iteratee) {
  21086. return object && baseForRight(object, iteratee, keys);
  21087. }
  21088. /**
  21089. * The base implementation of `_.functions` which creates an array of
  21090. * `object` function property names filtered from `props`.
  21091. *
  21092. * @private
  21093. * @param {Object} object The object to inspect.
  21094. * @param {Array} props The property names to filter.
  21095. * @returns {Array} Returns the function names.
  21096. */
  21097. function baseFunctions(object, props) {
  21098. return arrayFilter(props, function(key) {
  21099. return isFunction(object[key]);
  21100. });
  21101. }
  21102. /**
  21103. * The base implementation of `_.get` without support for default values.
  21104. *
  21105. * @private
  21106. * @param {Object} object The object to query.
  21107. * @param {Array|string} path The path of the property to get.
  21108. * @returns {*} Returns the resolved value.
  21109. */
  21110. function baseGet(object, path) {
  21111. path = castPath(path, object);
  21112. var index = 0,
  21113. length = path.length;
  21114. while (object != null && index < length) {
  21115. object = object[toKey(path[index++])];
  21116. }
  21117. return (index && index == length) ? object : undefined;
  21118. }
  21119. /**
  21120. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21121. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21122. * symbols of `object`.
  21123. *
  21124. * @private
  21125. * @param {Object} object The object to query.
  21126. * @param {Function} keysFunc The function to get the keys of `object`.
  21127. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21128. * @returns {Array} Returns the array of property names and symbols.
  21129. */
  21130. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21131. var result = keysFunc(object);
  21132. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21133. }
  21134. /**
  21135. * The base implementation of `getTag` without fallbacks for buggy environments.
  21136. *
  21137. * @private
  21138. * @param {*} value The value to query.
  21139. * @returns {string} Returns the `toStringTag`.
  21140. */
  21141. function baseGetTag(value) {
  21142. if (value == null) {
  21143. return value === undefined ? undefinedTag : nullTag;
  21144. }
  21145. return (symToStringTag && symToStringTag in Object(value))
  21146. ? getRawTag(value)
  21147. : objectToString(value);
  21148. }
  21149. /**
  21150. * The base implementation of `_.gt` which doesn't coerce arguments.
  21151. *
  21152. * @private
  21153. * @param {*} value The value to compare.
  21154. * @param {*} other The other value to compare.
  21155. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21156. * else `false`.
  21157. */
  21158. function baseGt(value, other) {
  21159. return value > other;
  21160. }
  21161. /**
  21162. * The base implementation of `_.has` without support for deep paths.
  21163. *
  21164. * @private
  21165. * @param {Object} [object] The object to query.
  21166. * @param {Array|string} key The key to check.
  21167. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21168. */
  21169. function baseHas(object, key) {
  21170. return object != null && hasOwnProperty.call(object, key);
  21171. }
  21172. /**
  21173. * The base implementation of `_.hasIn` without support for deep paths.
  21174. *
  21175. * @private
  21176. * @param {Object} [object] The object to query.
  21177. * @param {Array|string} key The key to check.
  21178. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21179. */
  21180. function baseHasIn(object, key) {
  21181. return object != null && key in Object(object);
  21182. }
  21183. /**
  21184. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21185. *
  21186. * @private
  21187. * @param {number} number The number to check.
  21188. * @param {number} start The start of the range.
  21189. * @param {number} end The end of the range.
  21190. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21191. */
  21192. function baseInRange(number, start, end) {
  21193. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21194. }
  21195. /**
  21196. * The base implementation of methods like `_.intersection`, without support
  21197. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21198. *
  21199. * @private
  21200. * @param {Array} arrays The arrays to inspect.
  21201. * @param {Function} [iteratee] The iteratee invoked per element.
  21202. * @param {Function} [comparator] The comparator invoked per element.
  21203. * @returns {Array} Returns the new array of shared values.
  21204. */
  21205. function baseIntersection(arrays, iteratee, comparator) {
  21206. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21207. length = arrays[0].length,
  21208. othLength = arrays.length,
  21209. othIndex = othLength,
  21210. caches = Array(othLength),
  21211. maxLength = Infinity,
  21212. result = [];
  21213. while (othIndex--) {
  21214. var array = arrays[othIndex];
  21215. if (othIndex && iteratee) {
  21216. array = arrayMap(array, baseUnary(iteratee));
  21217. }
  21218. maxLength = nativeMin(array.length, maxLength);
  21219. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21220. ? new SetCache(othIndex && array)
  21221. : undefined;
  21222. }
  21223. array = arrays[0];
  21224. var index = -1,
  21225. seen = caches[0];
  21226. outer:
  21227. while (++index < length && result.length < maxLength) {
  21228. var value = array[index],
  21229. computed = iteratee ? iteratee(value) : value;
  21230. value = (comparator || value !== 0) ? value : 0;
  21231. if (!(seen
  21232. ? cacheHas(seen, computed)
  21233. : includes(result, computed, comparator)
  21234. )) {
  21235. othIndex = othLength;
  21236. while (--othIndex) {
  21237. var cache = caches[othIndex];
  21238. if (!(cache
  21239. ? cacheHas(cache, computed)
  21240. : includes(arrays[othIndex], computed, comparator))
  21241. ) {
  21242. continue outer;
  21243. }
  21244. }
  21245. if (seen) {
  21246. seen.push(computed);
  21247. }
  21248. result.push(value);
  21249. }
  21250. }
  21251. return result;
  21252. }
  21253. /**
  21254. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21255. * `object` with values transformed by `iteratee` and set by `setter`.
  21256. *
  21257. * @private
  21258. * @param {Object} object The object to iterate over.
  21259. * @param {Function} setter The function to set `accumulator` values.
  21260. * @param {Function} iteratee The iteratee to transform values.
  21261. * @param {Object} accumulator The initial inverted object.
  21262. * @returns {Function} Returns `accumulator`.
  21263. */
  21264. function baseInverter(object, setter, iteratee, accumulator) {
  21265. baseForOwn(object, function(value, key, object) {
  21266. setter(accumulator, iteratee(value), key, object);
  21267. });
  21268. return accumulator;
  21269. }
  21270. /**
  21271. * The base implementation of `_.invoke` without support for individual
  21272. * method arguments.
  21273. *
  21274. * @private
  21275. * @param {Object} object The object to query.
  21276. * @param {Array|string} path The path of the method to invoke.
  21277. * @param {Array} args The arguments to invoke the method with.
  21278. * @returns {*} Returns the result of the invoked method.
  21279. */
  21280. function baseInvoke(object, path, args) {
  21281. path = castPath(path, object);
  21282. object = parent(object, path);
  21283. var func = object == null ? object : object[toKey(last(path))];
  21284. return func == null ? undefined : apply(func, object, args);
  21285. }
  21286. /**
  21287. * The base implementation of `_.isArguments`.
  21288. *
  21289. * @private
  21290. * @param {*} value The value to check.
  21291. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21292. */
  21293. function baseIsArguments(value) {
  21294. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21295. }
  21296. /**
  21297. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21298. *
  21299. * @private
  21300. * @param {*} value The value to check.
  21301. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21302. */
  21303. function baseIsArrayBuffer(value) {
  21304. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21305. }
  21306. /**
  21307. * The base implementation of `_.isDate` without Node.js optimizations.
  21308. *
  21309. * @private
  21310. * @param {*} value The value to check.
  21311. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21312. */
  21313. function baseIsDate(value) {
  21314. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21315. }
  21316. /**
  21317. * The base implementation of `_.isEqual` which supports partial comparisons
  21318. * and tracks traversed objects.
  21319. *
  21320. * @private
  21321. * @param {*} value The value to compare.
  21322. * @param {*} other The other value to compare.
  21323. * @param {boolean} bitmask The bitmask flags.
  21324. * 1 - Unordered comparison
  21325. * 2 - Partial comparison
  21326. * @param {Function} [customizer] The function to customize comparisons.
  21327. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21328. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21329. */
  21330. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21331. if (value === other) {
  21332. return true;
  21333. }
  21334. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21335. return value !== value && other !== other;
  21336. }
  21337. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21338. }
  21339. /**
  21340. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21341. * deep comparisons and tracks traversed objects enabling objects with circular
  21342. * references to be compared.
  21343. *
  21344. * @private
  21345. * @param {Object} object The object to compare.
  21346. * @param {Object} other The other object to compare.
  21347. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21348. * @param {Function} customizer The function to customize comparisons.
  21349. * @param {Function} equalFunc The function to determine equivalents of values.
  21350. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21351. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21352. */
  21353. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21354. var objIsArr = isArray(object),
  21355. othIsArr = isArray(other),
  21356. objTag = objIsArr ? arrayTag : getTag(object),
  21357. othTag = othIsArr ? arrayTag : getTag(other);
  21358. objTag = objTag == argsTag ? objectTag : objTag;
  21359. othTag = othTag == argsTag ? objectTag : othTag;
  21360. var objIsObj = objTag == objectTag,
  21361. othIsObj = othTag == objectTag,
  21362. isSameTag = objTag == othTag;
  21363. if (isSameTag && isBuffer(object)) {
  21364. if (!isBuffer(other)) {
  21365. return false;
  21366. }
  21367. objIsArr = true;
  21368. objIsObj = false;
  21369. }
  21370. if (isSameTag && !objIsObj) {
  21371. stack || (stack = new Stack);
  21372. return (objIsArr || isTypedArray(object))
  21373. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21374. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21375. }
  21376. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21377. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21378. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21379. if (objIsWrapped || othIsWrapped) {
  21380. var objUnwrapped = objIsWrapped ? object.value() : object,
  21381. othUnwrapped = othIsWrapped ? other.value() : other;
  21382. stack || (stack = new Stack);
  21383. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21384. }
  21385. }
  21386. if (!isSameTag) {
  21387. return false;
  21388. }
  21389. stack || (stack = new Stack);
  21390. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21391. }
  21392. /**
  21393. * The base implementation of `_.isMap` without Node.js optimizations.
  21394. *
  21395. * @private
  21396. * @param {*} value The value to check.
  21397. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21398. */
  21399. function baseIsMap(value) {
  21400. return isObjectLike(value) && getTag(value) == mapTag;
  21401. }
  21402. /**
  21403. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21404. *
  21405. * @private
  21406. * @param {Object} object The object to inspect.
  21407. * @param {Object} source The object of property values to match.
  21408. * @param {Array} matchData The property names, values, and compare flags to match.
  21409. * @param {Function} [customizer] The function to customize comparisons.
  21410. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21411. */
  21412. function baseIsMatch(object, source, matchData, customizer) {
  21413. var index = matchData.length,
  21414. length = index,
  21415. noCustomizer = !customizer;
  21416. if (object == null) {
  21417. return !length;
  21418. }
  21419. object = Object(object);
  21420. while (index--) {
  21421. var data = matchData[index];
  21422. if ((noCustomizer && data[2])
  21423. ? data[1] !== object[data[0]]
  21424. : !(data[0] in object)
  21425. ) {
  21426. return false;
  21427. }
  21428. }
  21429. while (++index < length) {
  21430. data = matchData[index];
  21431. var key = data[0],
  21432. objValue = object[key],
  21433. srcValue = data[1];
  21434. if (noCustomizer && data[2]) {
  21435. if (objValue === undefined && !(key in object)) {
  21436. return false;
  21437. }
  21438. } else {
  21439. var stack = new Stack;
  21440. if (customizer) {
  21441. var result = customizer(objValue, srcValue, key, object, source, stack);
  21442. }
  21443. if (!(result === undefined
  21444. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21445. : result
  21446. )) {
  21447. return false;
  21448. }
  21449. }
  21450. }
  21451. return true;
  21452. }
  21453. /**
  21454. * The base implementation of `_.isNative` without bad shim checks.
  21455. *
  21456. * @private
  21457. * @param {*} value The value to check.
  21458. * @returns {boolean} Returns `true` if `value` is a native function,
  21459. * else `false`.
  21460. */
  21461. function baseIsNative(value) {
  21462. if (!isObject(value) || isMasked(value)) {
  21463. return false;
  21464. }
  21465. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21466. return pattern.test(toSource(value));
  21467. }
  21468. /**
  21469. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21470. *
  21471. * @private
  21472. * @param {*} value The value to check.
  21473. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21474. */
  21475. function baseIsRegExp(value) {
  21476. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21477. }
  21478. /**
  21479. * The base implementation of `_.isSet` without Node.js optimizations.
  21480. *
  21481. * @private
  21482. * @param {*} value The value to check.
  21483. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21484. */
  21485. function baseIsSet(value) {
  21486. return isObjectLike(value) && getTag(value) == setTag;
  21487. }
  21488. /**
  21489. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21490. *
  21491. * @private
  21492. * @param {*} value The value to check.
  21493. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21494. */
  21495. function baseIsTypedArray(value) {
  21496. return isObjectLike(value) &&
  21497. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21498. }
  21499. /**
  21500. * The base implementation of `_.iteratee`.
  21501. *
  21502. * @private
  21503. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21504. * @returns {Function} Returns the iteratee.
  21505. */
  21506. function baseIteratee(value) {
  21507. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21508. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21509. if (typeof value == 'function') {
  21510. return value;
  21511. }
  21512. if (value == null) {
  21513. return identity;
  21514. }
  21515. if (typeof value == 'object') {
  21516. return isArray(value)
  21517. ? baseMatchesProperty(value[0], value[1])
  21518. : baseMatches(value);
  21519. }
  21520. return property(value);
  21521. }
  21522. /**
  21523. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21524. *
  21525. * @private
  21526. * @param {Object} object The object to query.
  21527. * @returns {Array} Returns the array of property names.
  21528. */
  21529. function baseKeys(object) {
  21530. if (!isPrototype(object)) {
  21531. return nativeKeys(object);
  21532. }
  21533. var result = [];
  21534. for (var key in Object(object)) {
  21535. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21536. result.push(key);
  21537. }
  21538. }
  21539. return result;
  21540. }
  21541. /**
  21542. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21543. *
  21544. * @private
  21545. * @param {Object} object The object to query.
  21546. * @returns {Array} Returns the array of property names.
  21547. */
  21548. function baseKeysIn(object) {
  21549. if (!isObject(object)) {
  21550. return nativeKeysIn(object);
  21551. }
  21552. var isProto = isPrototype(object),
  21553. result = [];
  21554. for (var key in object) {
  21555. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21556. result.push(key);
  21557. }
  21558. }
  21559. return result;
  21560. }
  21561. /**
  21562. * The base implementation of `_.lt` which doesn't coerce arguments.
  21563. *
  21564. * @private
  21565. * @param {*} value The value to compare.
  21566. * @param {*} other The other value to compare.
  21567. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21568. * else `false`.
  21569. */
  21570. function baseLt(value, other) {
  21571. return value < other;
  21572. }
  21573. /**
  21574. * The base implementation of `_.map` without support for iteratee shorthands.
  21575. *
  21576. * @private
  21577. * @param {Array|Object} collection The collection to iterate over.
  21578. * @param {Function} iteratee The function invoked per iteration.
  21579. * @returns {Array} Returns the new mapped array.
  21580. */
  21581. function baseMap(collection, iteratee) {
  21582. var index = -1,
  21583. result = isArrayLike(collection) ? Array(collection.length) : [];
  21584. baseEach(collection, function(value, key, collection) {
  21585. result[++index] = iteratee(value, key, collection);
  21586. });
  21587. return result;
  21588. }
  21589. /**
  21590. * The base implementation of `_.matches` which doesn't clone `source`.
  21591. *
  21592. * @private
  21593. * @param {Object} source The object of property values to match.
  21594. * @returns {Function} Returns the new spec function.
  21595. */
  21596. function baseMatches(source) {
  21597. var matchData = getMatchData(source);
  21598. if (matchData.length == 1 && matchData[0][2]) {
  21599. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21600. }
  21601. return function(object) {
  21602. return object === source || baseIsMatch(object, source, matchData);
  21603. };
  21604. }
  21605. /**
  21606. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21607. *
  21608. * @private
  21609. * @param {string} path The path of the property to get.
  21610. * @param {*} srcValue The value to match.
  21611. * @returns {Function} Returns the new spec function.
  21612. */
  21613. function baseMatchesProperty(path, srcValue) {
  21614. if (isKey(path) && isStrictComparable(srcValue)) {
  21615. return matchesStrictComparable(toKey(path), srcValue);
  21616. }
  21617. return function(object) {
  21618. var objValue = get(object, path);
  21619. return (objValue === undefined && objValue === srcValue)
  21620. ? hasIn(object, path)
  21621. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21622. };
  21623. }
  21624. /**
  21625. * The base implementation of `_.merge` without support for multiple sources.
  21626. *
  21627. * @private
  21628. * @param {Object} object The destination object.
  21629. * @param {Object} source The source object.
  21630. * @param {number} srcIndex The index of `source`.
  21631. * @param {Function} [customizer] The function to customize merged values.
  21632. * @param {Object} [stack] Tracks traversed source values and their merged
  21633. * counterparts.
  21634. */
  21635. function baseMerge(object, source, srcIndex, customizer, stack) {
  21636. if (object === source) {
  21637. return;
  21638. }
  21639. baseFor(source, function(srcValue, key) {
  21640. stack || (stack = new Stack);
  21641. if (isObject(srcValue)) {
  21642. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21643. }
  21644. else {
  21645. var newValue = customizer
  21646. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21647. : undefined;
  21648. if (newValue === undefined) {
  21649. newValue = srcValue;
  21650. }
  21651. assignMergeValue(object, key, newValue);
  21652. }
  21653. }, keysIn);
  21654. }
  21655. /**
  21656. * A specialized version of `baseMerge` for arrays and objects which performs
  21657. * deep merges and tracks traversed objects enabling objects with circular
  21658. * references to be merged.
  21659. *
  21660. * @private
  21661. * @param {Object} object The destination object.
  21662. * @param {Object} source The source object.
  21663. * @param {string} key The key of the value to merge.
  21664. * @param {number} srcIndex The index of `source`.
  21665. * @param {Function} mergeFunc The function to merge values.
  21666. * @param {Function} [customizer] The function to customize assigned values.
  21667. * @param {Object} [stack] Tracks traversed source values and their merged
  21668. * counterparts.
  21669. */
  21670. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21671. var objValue = safeGet(object, key),
  21672. srcValue = safeGet(source, key),
  21673. stacked = stack.get(srcValue);
  21674. if (stacked) {
  21675. assignMergeValue(object, key, stacked);
  21676. return;
  21677. }
  21678. var newValue = customizer
  21679. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21680. : undefined;
  21681. var isCommon = newValue === undefined;
  21682. if (isCommon) {
  21683. var isArr = isArray(srcValue),
  21684. isBuff = !isArr && isBuffer(srcValue),
  21685. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21686. newValue = srcValue;
  21687. if (isArr || isBuff || isTyped) {
  21688. if (isArray(objValue)) {
  21689. newValue = objValue;
  21690. }
  21691. else if (isArrayLikeObject(objValue)) {
  21692. newValue = copyArray(objValue);
  21693. }
  21694. else if (isBuff) {
  21695. isCommon = false;
  21696. newValue = cloneBuffer(srcValue, true);
  21697. }
  21698. else if (isTyped) {
  21699. isCommon = false;
  21700. newValue = cloneTypedArray(srcValue, true);
  21701. }
  21702. else {
  21703. newValue = [];
  21704. }
  21705. }
  21706. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21707. newValue = objValue;
  21708. if (isArguments(objValue)) {
  21709. newValue = toPlainObject(objValue);
  21710. }
  21711. else if (!isObject(objValue) || isFunction(objValue)) {
  21712. newValue = initCloneObject(srcValue);
  21713. }
  21714. }
  21715. else {
  21716. isCommon = false;
  21717. }
  21718. }
  21719. if (isCommon) {
  21720. // Recursively merge objects and arrays (susceptible to call stack limits).
  21721. stack.set(srcValue, newValue);
  21722. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21723. stack['delete'](srcValue);
  21724. }
  21725. assignMergeValue(object, key, newValue);
  21726. }
  21727. /**
  21728. * The base implementation of `_.nth` which doesn't coerce arguments.
  21729. *
  21730. * @private
  21731. * @param {Array} array The array to query.
  21732. * @param {number} n The index of the element to return.
  21733. * @returns {*} Returns the nth element of `array`.
  21734. */
  21735. function baseNth(array, n) {
  21736. var length = array.length;
  21737. if (!length) {
  21738. return;
  21739. }
  21740. n += n < 0 ? length : 0;
  21741. return isIndex(n, length) ? array[n] : undefined;
  21742. }
  21743. /**
  21744. * The base implementation of `_.orderBy` without param guards.
  21745. *
  21746. * @private
  21747. * @param {Array|Object} collection The collection to iterate over.
  21748. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21749. * @param {string[]} orders The sort orders of `iteratees`.
  21750. * @returns {Array} Returns the new sorted array.
  21751. */
  21752. function baseOrderBy(collection, iteratees, orders) {
  21753. var index = -1;
  21754. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21755. var result = baseMap(collection, function(value, key, collection) {
  21756. var criteria = arrayMap(iteratees, function(iteratee) {
  21757. return iteratee(value);
  21758. });
  21759. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21760. });
  21761. return baseSortBy(result, function(object, other) {
  21762. return compareMultiple(object, other, orders);
  21763. });
  21764. }
  21765. /**
  21766. * The base implementation of `_.pick` without support for individual
  21767. * property identifiers.
  21768. *
  21769. * @private
  21770. * @param {Object} object The source object.
  21771. * @param {string[]} paths The property paths to pick.
  21772. * @returns {Object} Returns the new object.
  21773. */
  21774. function basePick(object, paths) {
  21775. return basePickBy(object, paths, function(value, path) {
  21776. return hasIn(object, path);
  21777. });
  21778. }
  21779. /**
  21780. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21781. *
  21782. * @private
  21783. * @param {Object} object The source object.
  21784. * @param {string[]} paths The property paths to pick.
  21785. * @param {Function} predicate The function invoked per property.
  21786. * @returns {Object} Returns the new object.
  21787. */
  21788. function basePickBy(object, paths, predicate) {
  21789. var index = -1,
  21790. length = paths.length,
  21791. result = {};
  21792. while (++index < length) {
  21793. var path = paths[index],
  21794. value = baseGet(object, path);
  21795. if (predicate(value, path)) {
  21796. baseSet(result, castPath(path, object), value);
  21797. }
  21798. }
  21799. return result;
  21800. }
  21801. /**
  21802. * A specialized version of `baseProperty` which supports deep paths.
  21803. *
  21804. * @private
  21805. * @param {Array|string} path The path of the property to get.
  21806. * @returns {Function} Returns the new accessor function.
  21807. */
  21808. function basePropertyDeep(path) {
  21809. return function(object) {
  21810. return baseGet(object, path);
  21811. };
  21812. }
  21813. /**
  21814. * The base implementation of `_.pullAllBy` without support for iteratee
  21815. * shorthands.
  21816. *
  21817. * @private
  21818. * @param {Array} array The array to modify.
  21819. * @param {Array} values The values to remove.
  21820. * @param {Function} [iteratee] The iteratee invoked per element.
  21821. * @param {Function} [comparator] The comparator invoked per element.
  21822. * @returns {Array} Returns `array`.
  21823. */
  21824. function basePullAll(array, values, iteratee, comparator) {
  21825. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21826. index = -1,
  21827. length = values.length,
  21828. seen = array;
  21829. if (array === values) {
  21830. values = copyArray(values);
  21831. }
  21832. if (iteratee) {
  21833. seen = arrayMap(array, baseUnary(iteratee));
  21834. }
  21835. while (++index < length) {
  21836. var fromIndex = 0,
  21837. value = values[index],
  21838. computed = iteratee ? iteratee(value) : value;
  21839. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21840. if (seen !== array) {
  21841. splice.call(seen, fromIndex, 1);
  21842. }
  21843. splice.call(array, fromIndex, 1);
  21844. }
  21845. }
  21846. return array;
  21847. }
  21848. /**
  21849. * The base implementation of `_.pullAt` without support for individual
  21850. * indexes or capturing the removed elements.
  21851. *
  21852. * @private
  21853. * @param {Array} array The array to modify.
  21854. * @param {number[]} indexes The indexes of elements to remove.
  21855. * @returns {Array} Returns `array`.
  21856. */
  21857. function basePullAt(array, indexes) {
  21858. var length = array ? indexes.length : 0,
  21859. lastIndex = length - 1;
  21860. while (length--) {
  21861. var index = indexes[length];
  21862. if (length == lastIndex || index !== previous) {
  21863. var previous = index;
  21864. if (isIndex(index)) {
  21865. splice.call(array, index, 1);
  21866. } else {
  21867. baseUnset(array, index);
  21868. }
  21869. }
  21870. }
  21871. return array;
  21872. }
  21873. /**
  21874. * The base implementation of `_.random` without support for returning
  21875. * floating-point numbers.
  21876. *
  21877. * @private
  21878. * @param {number} lower The lower bound.
  21879. * @param {number} upper The upper bound.
  21880. * @returns {number} Returns the random number.
  21881. */
  21882. function baseRandom(lower, upper) {
  21883. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21884. }
  21885. /**
  21886. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21887. * coerce arguments.
  21888. *
  21889. * @private
  21890. * @param {number} start The start of the range.
  21891. * @param {number} end The end of the range.
  21892. * @param {number} step The value to increment or decrement by.
  21893. * @param {boolean} [fromRight] Specify iterating from right to left.
  21894. * @returns {Array} Returns the range of numbers.
  21895. */
  21896. function baseRange(start, end, step, fromRight) {
  21897. var index = -1,
  21898. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21899. result = Array(length);
  21900. while (length--) {
  21901. result[fromRight ? length : ++index] = start;
  21902. start += step;
  21903. }
  21904. return result;
  21905. }
  21906. /**
  21907. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21908. *
  21909. * @private
  21910. * @param {string} string The string to repeat.
  21911. * @param {number} n The number of times to repeat the string.
  21912. * @returns {string} Returns the repeated string.
  21913. */
  21914. function baseRepeat(string, n) {
  21915. var result = '';
  21916. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21917. return result;
  21918. }
  21919. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21920. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21921. do {
  21922. if (n % 2) {
  21923. result += string;
  21924. }
  21925. n = nativeFloor(n / 2);
  21926. if (n) {
  21927. string += string;
  21928. }
  21929. } while (n);
  21930. return result;
  21931. }
  21932. /**
  21933. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21934. *
  21935. * @private
  21936. * @param {Function} func The function to apply a rest parameter to.
  21937. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21938. * @returns {Function} Returns the new function.
  21939. */
  21940. function baseRest(func, start) {
  21941. return setToString(overRest(func, start, identity), func + '');
  21942. }
  21943. /**
  21944. * The base implementation of `_.sample`.
  21945. *
  21946. * @private
  21947. * @param {Array|Object} collection The collection to sample.
  21948. * @returns {*} Returns the random element.
  21949. */
  21950. function baseSample(collection) {
  21951. return arraySample(values(collection));
  21952. }
  21953. /**
  21954. * The base implementation of `_.sampleSize` without param guards.
  21955. *
  21956. * @private
  21957. * @param {Array|Object} collection The collection to sample.
  21958. * @param {number} n The number of elements to sample.
  21959. * @returns {Array} Returns the random elements.
  21960. */
  21961. function baseSampleSize(collection, n) {
  21962. var array = values(collection);
  21963. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21964. }
  21965. /**
  21966. * The base implementation of `_.set`.
  21967. *
  21968. * @private
  21969. * @param {Object} object The object to modify.
  21970. * @param {Array|string} path The path of the property to set.
  21971. * @param {*} value The value to set.
  21972. * @param {Function} [customizer] The function to customize path creation.
  21973. * @returns {Object} Returns `object`.
  21974. */
  21975. function baseSet(object, path, value, customizer) {
  21976. if (!isObject(object)) {
  21977. return object;
  21978. }
  21979. path = castPath(path, object);
  21980. var index = -1,
  21981. length = path.length,
  21982. lastIndex = length - 1,
  21983. nested = object;
  21984. while (nested != null && ++index < length) {
  21985. var key = toKey(path[index]),
  21986. newValue = value;
  21987. if (index != lastIndex) {
  21988. var objValue = nested[key];
  21989. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21990. if (newValue === undefined) {
  21991. newValue = isObject(objValue)
  21992. ? objValue
  21993. : (isIndex(path[index + 1]) ? [] : {});
  21994. }
  21995. }
  21996. assignValue(nested, key, newValue);
  21997. nested = nested[key];
  21998. }
  21999. return object;
  22000. }
  22001. /**
  22002. * The base implementation of `setData` without support for hot loop shorting.
  22003. *
  22004. * @private
  22005. * @param {Function} func The function to associate metadata with.
  22006. * @param {*} data The metadata.
  22007. * @returns {Function} Returns `func`.
  22008. */
  22009. var baseSetData = !metaMap ? identity : function(func, data) {
  22010. metaMap.set(func, data);
  22011. return func;
  22012. };
  22013. /**
  22014. * The base implementation of `setToString` without support for hot loop shorting.
  22015. *
  22016. * @private
  22017. * @param {Function} func The function to modify.
  22018. * @param {Function} string The `toString` result.
  22019. * @returns {Function} Returns `func`.
  22020. */
  22021. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22022. return defineProperty(func, 'toString', {
  22023. 'configurable': true,
  22024. 'enumerable': false,
  22025. 'value': constant(string),
  22026. 'writable': true
  22027. });
  22028. };
  22029. /**
  22030. * The base implementation of `_.shuffle`.
  22031. *
  22032. * @private
  22033. * @param {Array|Object} collection The collection to shuffle.
  22034. * @returns {Array} Returns the new shuffled array.
  22035. */
  22036. function baseShuffle(collection) {
  22037. return shuffleSelf(values(collection));
  22038. }
  22039. /**
  22040. * The base implementation of `_.slice` without an iteratee call guard.
  22041. *
  22042. * @private
  22043. * @param {Array} array The array to slice.
  22044. * @param {number} [start=0] The start position.
  22045. * @param {number} [end=array.length] The end position.
  22046. * @returns {Array} Returns the slice of `array`.
  22047. */
  22048. function baseSlice(array, start, end) {
  22049. var index = -1,
  22050. length = array.length;
  22051. if (start < 0) {
  22052. start = -start > length ? 0 : (length + start);
  22053. }
  22054. end = end > length ? length : end;
  22055. if (end < 0) {
  22056. end += length;
  22057. }
  22058. length = start > end ? 0 : ((end - start) >>> 0);
  22059. start >>>= 0;
  22060. var result = Array(length);
  22061. while (++index < length) {
  22062. result[index] = array[index + start];
  22063. }
  22064. return result;
  22065. }
  22066. /**
  22067. * The base implementation of `_.some` without support for iteratee shorthands.
  22068. *
  22069. * @private
  22070. * @param {Array|Object} collection The collection to iterate over.
  22071. * @param {Function} predicate The function invoked per iteration.
  22072. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22073. * else `false`.
  22074. */
  22075. function baseSome(collection, predicate) {
  22076. var result;
  22077. baseEach(collection, function(value, index, collection) {
  22078. result = predicate(value, index, collection);
  22079. return !result;
  22080. });
  22081. return !!result;
  22082. }
  22083. /**
  22084. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22085. * performs a binary search of `array` to determine the index at which `value`
  22086. * should be inserted into `array` in order to maintain its sort order.
  22087. *
  22088. * @private
  22089. * @param {Array} array The sorted array to inspect.
  22090. * @param {*} value The value to evaluate.
  22091. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22092. * @returns {number} Returns the index at which `value` should be inserted
  22093. * into `array`.
  22094. */
  22095. function baseSortedIndex(array, value, retHighest) {
  22096. var low = 0,
  22097. high = array == null ? low : array.length;
  22098. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22099. while (low < high) {
  22100. var mid = (low + high) >>> 1,
  22101. computed = array[mid];
  22102. if (computed !== null && !isSymbol(computed) &&
  22103. (retHighest ? (computed <= value) : (computed < value))) {
  22104. low = mid + 1;
  22105. } else {
  22106. high = mid;
  22107. }
  22108. }
  22109. return high;
  22110. }
  22111. return baseSortedIndexBy(array, value, identity, retHighest);
  22112. }
  22113. /**
  22114. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22115. * which invokes `iteratee` for `value` and each element of `array` to compute
  22116. * their sort ranking. The iteratee is invoked with one argument; (value).
  22117. *
  22118. * @private
  22119. * @param {Array} array The sorted array to inspect.
  22120. * @param {*} value The value to evaluate.
  22121. * @param {Function} iteratee The iteratee invoked per element.
  22122. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22123. * @returns {number} Returns the index at which `value` should be inserted
  22124. * into `array`.
  22125. */
  22126. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22127. value = iteratee(value);
  22128. var low = 0,
  22129. high = array == null ? 0 : array.length,
  22130. valIsNaN = value !== value,
  22131. valIsNull = value === null,
  22132. valIsSymbol = isSymbol(value),
  22133. valIsUndefined = value === undefined;
  22134. while (low < high) {
  22135. var mid = nativeFloor((low + high) / 2),
  22136. computed = iteratee(array[mid]),
  22137. othIsDefined = computed !== undefined,
  22138. othIsNull = computed === null,
  22139. othIsReflexive = computed === computed,
  22140. othIsSymbol = isSymbol(computed);
  22141. if (valIsNaN) {
  22142. var setLow = retHighest || othIsReflexive;
  22143. } else if (valIsUndefined) {
  22144. setLow = othIsReflexive && (retHighest || othIsDefined);
  22145. } else if (valIsNull) {
  22146. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22147. } else if (valIsSymbol) {
  22148. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22149. } else if (othIsNull || othIsSymbol) {
  22150. setLow = false;
  22151. } else {
  22152. setLow = retHighest ? (computed <= value) : (computed < value);
  22153. }
  22154. if (setLow) {
  22155. low = mid + 1;
  22156. } else {
  22157. high = mid;
  22158. }
  22159. }
  22160. return nativeMin(high, MAX_ARRAY_INDEX);
  22161. }
  22162. /**
  22163. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22164. * support for iteratee shorthands.
  22165. *
  22166. * @private
  22167. * @param {Array} array The array to inspect.
  22168. * @param {Function} [iteratee] The iteratee invoked per element.
  22169. * @returns {Array} Returns the new duplicate free array.
  22170. */
  22171. function baseSortedUniq(array, iteratee) {
  22172. var index = -1,
  22173. length = array.length,
  22174. resIndex = 0,
  22175. result = [];
  22176. while (++index < length) {
  22177. var value = array[index],
  22178. computed = iteratee ? iteratee(value) : value;
  22179. if (!index || !eq(computed, seen)) {
  22180. var seen = computed;
  22181. result[resIndex++] = value === 0 ? 0 : value;
  22182. }
  22183. }
  22184. return result;
  22185. }
  22186. /**
  22187. * The base implementation of `_.toNumber` which doesn't ensure correct
  22188. * conversions of binary, hexadecimal, or octal string values.
  22189. *
  22190. * @private
  22191. * @param {*} value The value to process.
  22192. * @returns {number} Returns the number.
  22193. */
  22194. function baseToNumber(value) {
  22195. if (typeof value == 'number') {
  22196. return value;
  22197. }
  22198. if (isSymbol(value)) {
  22199. return NAN;
  22200. }
  22201. return +value;
  22202. }
  22203. /**
  22204. * The base implementation of `_.toString` which doesn't convert nullish
  22205. * values to empty strings.
  22206. *
  22207. * @private
  22208. * @param {*} value The value to process.
  22209. * @returns {string} Returns the string.
  22210. */
  22211. function baseToString(value) {
  22212. // Exit early for strings to avoid a performance hit in some environments.
  22213. if (typeof value == 'string') {
  22214. return value;
  22215. }
  22216. if (isArray(value)) {
  22217. // Recursively convert values (susceptible to call stack limits).
  22218. return arrayMap(value, baseToString) + '';
  22219. }
  22220. if (isSymbol(value)) {
  22221. return symbolToString ? symbolToString.call(value) : '';
  22222. }
  22223. var result = (value + '');
  22224. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22225. }
  22226. /**
  22227. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22228. *
  22229. * @private
  22230. * @param {Array} array The array to inspect.
  22231. * @param {Function} [iteratee] The iteratee invoked per element.
  22232. * @param {Function} [comparator] The comparator invoked per element.
  22233. * @returns {Array} Returns the new duplicate free array.
  22234. */
  22235. function baseUniq(array, iteratee, comparator) {
  22236. var index = -1,
  22237. includes = arrayIncludes,
  22238. length = array.length,
  22239. isCommon = true,
  22240. result = [],
  22241. seen = result;
  22242. if (comparator) {
  22243. isCommon = false;
  22244. includes = arrayIncludesWith;
  22245. }
  22246. else if (length >= LARGE_ARRAY_SIZE) {
  22247. var set = iteratee ? null : createSet(array);
  22248. if (set) {
  22249. return setToArray(set);
  22250. }
  22251. isCommon = false;
  22252. includes = cacheHas;
  22253. seen = new SetCache;
  22254. }
  22255. else {
  22256. seen = iteratee ? [] : result;
  22257. }
  22258. outer:
  22259. while (++index < length) {
  22260. var value = array[index],
  22261. computed = iteratee ? iteratee(value) : value;
  22262. value = (comparator || value !== 0) ? value : 0;
  22263. if (isCommon && computed === computed) {
  22264. var seenIndex = seen.length;
  22265. while (seenIndex--) {
  22266. if (seen[seenIndex] === computed) {
  22267. continue outer;
  22268. }
  22269. }
  22270. if (iteratee) {
  22271. seen.push(computed);
  22272. }
  22273. result.push(value);
  22274. }
  22275. else if (!includes(seen, computed, comparator)) {
  22276. if (seen !== result) {
  22277. seen.push(computed);
  22278. }
  22279. result.push(value);
  22280. }
  22281. }
  22282. return result;
  22283. }
  22284. /**
  22285. * The base implementation of `_.unset`.
  22286. *
  22287. * @private
  22288. * @param {Object} object The object to modify.
  22289. * @param {Array|string} path The property path to unset.
  22290. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22291. */
  22292. function baseUnset(object, path) {
  22293. path = castPath(path, object);
  22294. object = parent(object, path);
  22295. return object == null || delete object[toKey(last(path))];
  22296. }
  22297. /**
  22298. * The base implementation of `_.update`.
  22299. *
  22300. * @private
  22301. * @param {Object} object The object to modify.
  22302. * @param {Array|string} path The path of the property to update.
  22303. * @param {Function} updater The function to produce the updated value.
  22304. * @param {Function} [customizer] The function to customize path creation.
  22305. * @returns {Object} Returns `object`.
  22306. */
  22307. function baseUpdate(object, path, updater, customizer) {
  22308. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22309. }
  22310. /**
  22311. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22312. * without support for iteratee shorthands.
  22313. *
  22314. * @private
  22315. * @param {Array} array The array to query.
  22316. * @param {Function} predicate The function invoked per iteration.
  22317. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22318. * @param {boolean} [fromRight] Specify iterating from right to left.
  22319. * @returns {Array} Returns the slice of `array`.
  22320. */
  22321. function baseWhile(array, predicate, isDrop, fromRight) {
  22322. var length = array.length,
  22323. index = fromRight ? length : -1;
  22324. while ((fromRight ? index-- : ++index < length) &&
  22325. predicate(array[index], index, array)) {}
  22326. return isDrop
  22327. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22328. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22329. }
  22330. /**
  22331. * The base implementation of `wrapperValue` which returns the result of
  22332. * performing a sequence of actions on the unwrapped `value`, where each
  22333. * successive action is supplied the return value of the previous.
  22334. *
  22335. * @private
  22336. * @param {*} value The unwrapped value.
  22337. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22338. * @returns {*} Returns the resolved value.
  22339. */
  22340. function baseWrapperValue(value, actions) {
  22341. var result = value;
  22342. if (result instanceof LazyWrapper) {
  22343. result = result.value();
  22344. }
  22345. return arrayReduce(actions, function(result, action) {
  22346. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22347. }, result);
  22348. }
  22349. /**
  22350. * The base implementation of methods like `_.xor`, without support for
  22351. * iteratee shorthands, that accepts an array of arrays to inspect.
  22352. *
  22353. * @private
  22354. * @param {Array} arrays The arrays to inspect.
  22355. * @param {Function} [iteratee] The iteratee invoked per element.
  22356. * @param {Function} [comparator] The comparator invoked per element.
  22357. * @returns {Array} Returns the new array of values.
  22358. */
  22359. function baseXor(arrays, iteratee, comparator) {
  22360. var length = arrays.length;
  22361. if (length < 2) {
  22362. return length ? baseUniq(arrays[0]) : [];
  22363. }
  22364. var index = -1,
  22365. result = Array(length);
  22366. while (++index < length) {
  22367. var array = arrays[index],
  22368. othIndex = -1;
  22369. while (++othIndex < length) {
  22370. if (othIndex != index) {
  22371. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22372. }
  22373. }
  22374. }
  22375. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22376. }
  22377. /**
  22378. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22379. *
  22380. * @private
  22381. * @param {Array} props The property identifiers.
  22382. * @param {Array} values The property values.
  22383. * @param {Function} assignFunc The function to assign values.
  22384. * @returns {Object} Returns the new object.
  22385. */
  22386. function baseZipObject(props, values, assignFunc) {
  22387. var index = -1,
  22388. length = props.length,
  22389. valsLength = values.length,
  22390. result = {};
  22391. while (++index < length) {
  22392. var value = index < valsLength ? values[index] : undefined;
  22393. assignFunc(result, props[index], value);
  22394. }
  22395. return result;
  22396. }
  22397. /**
  22398. * Casts `value` to an empty array if it's not an array like object.
  22399. *
  22400. * @private
  22401. * @param {*} value The value to inspect.
  22402. * @returns {Array|Object} Returns the cast array-like object.
  22403. */
  22404. function castArrayLikeObject(value) {
  22405. return isArrayLikeObject(value) ? value : [];
  22406. }
  22407. /**
  22408. * Casts `value` to `identity` if it's not a function.
  22409. *
  22410. * @private
  22411. * @param {*} value The value to inspect.
  22412. * @returns {Function} Returns cast function.
  22413. */
  22414. function castFunction(value) {
  22415. return typeof value == 'function' ? value : identity;
  22416. }
  22417. /**
  22418. * Casts `value` to a path array if it's not one.
  22419. *
  22420. * @private
  22421. * @param {*} value The value to inspect.
  22422. * @param {Object} [object] The object to query keys on.
  22423. * @returns {Array} Returns the cast property path array.
  22424. */
  22425. function castPath(value, object) {
  22426. if (isArray(value)) {
  22427. return value;
  22428. }
  22429. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22430. }
  22431. /**
  22432. * A `baseRest` alias which can be replaced with `identity` by module
  22433. * replacement plugins.
  22434. *
  22435. * @private
  22436. * @type {Function}
  22437. * @param {Function} func The function to apply a rest parameter to.
  22438. * @returns {Function} Returns the new function.
  22439. */
  22440. var castRest = baseRest;
  22441. /**
  22442. * Casts `array` to a slice if it's needed.
  22443. *
  22444. * @private
  22445. * @param {Array} array The array to inspect.
  22446. * @param {number} start The start position.
  22447. * @param {number} [end=array.length] The end position.
  22448. * @returns {Array} Returns the cast slice.
  22449. */
  22450. function castSlice(array, start, end) {
  22451. var length = array.length;
  22452. end = end === undefined ? length : end;
  22453. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22454. }
  22455. /**
  22456. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22457. *
  22458. * @private
  22459. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22460. */
  22461. var clearTimeout = ctxClearTimeout || function(id) {
  22462. return root.clearTimeout(id);
  22463. };
  22464. /**
  22465. * Creates a clone of `buffer`.
  22466. *
  22467. * @private
  22468. * @param {Buffer} buffer The buffer to clone.
  22469. * @param {boolean} [isDeep] Specify a deep clone.
  22470. * @returns {Buffer} Returns the cloned buffer.
  22471. */
  22472. function cloneBuffer(buffer, isDeep) {
  22473. if (isDeep) {
  22474. return buffer.slice();
  22475. }
  22476. var length = buffer.length,
  22477. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22478. buffer.copy(result);
  22479. return result;
  22480. }
  22481. /**
  22482. * Creates a clone of `arrayBuffer`.
  22483. *
  22484. * @private
  22485. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22486. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22487. */
  22488. function cloneArrayBuffer(arrayBuffer) {
  22489. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22490. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22491. return result;
  22492. }
  22493. /**
  22494. * Creates a clone of `dataView`.
  22495. *
  22496. * @private
  22497. * @param {Object} dataView The data view to clone.
  22498. * @param {boolean} [isDeep] Specify a deep clone.
  22499. * @returns {Object} Returns the cloned data view.
  22500. */
  22501. function cloneDataView(dataView, isDeep) {
  22502. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22503. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22504. }
  22505. /**
  22506. * Creates a clone of `regexp`.
  22507. *
  22508. * @private
  22509. * @param {Object} regexp The regexp to clone.
  22510. * @returns {Object} Returns the cloned regexp.
  22511. */
  22512. function cloneRegExp(regexp) {
  22513. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22514. result.lastIndex = regexp.lastIndex;
  22515. return result;
  22516. }
  22517. /**
  22518. * Creates a clone of the `symbol` object.
  22519. *
  22520. * @private
  22521. * @param {Object} symbol The symbol object to clone.
  22522. * @returns {Object} Returns the cloned symbol object.
  22523. */
  22524. function cloneSymbol(symbol) {
  22525. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22526. }
  22527. /**
  22528. * Creates a clone of `typedArray`.
  22529. *
  22530. * @private
  22531. * @param {Object} typedArray The typed array to clone.
  22532. * @param {boolean} [isDeep] Specify a deep clone.
  22533. * @returns {Object} Returns the cloned typed array.
  22534. */
  22535. function cloneTypedArray(typedArray, isDeep) {
  22536. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22537. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22538. }
  22539. /**
  22540. * Compares values to sort them in ascending order.
  22541. *
  22542. * @private
  22543. * @param {*} value The value to compare.
  22544. * @param {*} other The other value to compare.
  22545. * @returns {number} Returns the sort order indicator for `value`.
  22546. */
  22547. function compareAscending(value, other) {
  22548. if (value !== other) {
  22549. var valIsDefined = value !== undefined,
  22550. valIsNull = value === null,
  22551. valIsReflexive = value === value,
  22552. valIsSymbol = isSymbol(value);
  22553. var othIsDefined = other !== undefined,
  22554. othIsNull = other === null,
  22555. othIsReflexive = other === other,
  22556. othIsSymbol = isSymbol(other);
  22557. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22558. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22559. (valIsNull && othIsDefined && othIsReflexive) ||
  22560. (!valIsDefined && othIsReflexive) ||
  22561. !valIsReflexive) {
  22562. return 1;
  22563. }
  22564. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22565. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22566. (othIsNull && valIsDefined && valIsReflexive) ||
  22567. (!othIsDefined && valIsReflexive) ||
  22568. !othIsReflexive) {
  22569. return -1;
  22570. }
  22571. }
  22572. return 0;
  22573. }
  22574. /**
  22575. * Used by `_.orderBy` to compare multiple properties of a value to another
  22576. * and stable sort them.
  22577. *
  22578. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22579. * specify an order of "desc" for descending or "asc" for ascending sort order
  22580. * of corresponding values.
  22581. *
  22582. * @private
  22583. * @param {Object} object The object to compare.
  22584. * @param {Object} other The other object to compare.
  22585. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22586. * @returns {number} Returns the sort order indicator for `object`.
  22587. */
  22588. function compareMultiple(object, other, orders) {
  22589. var index = -1,
  22590. objCriteria = object.criteria,
  22591. othCriteria = other.criteria,
  22592. length = objCriteria.length,
  22593. ordersLength = orders.length;
  22594. while (++index < length) {
  22595. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22596. if (result) {
  22597. if (index >= ordersLength) {
  22598. return result;
  22599. }
  22600. var order = orders[index];
  22601. return result * (order == 'desc' ? -1 : 1);
  22602. }
  22603. }
  22604. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22605. // that causes it, under certain circumstances, to provide the same value for
  22606. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22607. // for more details.
  22608. //
  22609. // This also ensures a stable sort in V8 and other engines.
  22610. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22611. return object.index - other.index;
  22612. }
  22613. /**
  22614. * Creates an array that is the composition of partially applied arguments,
  22615. * placeholders, and provided arguments into a single array of arguments.
  22616. *
  22617. * @private
  22618. * @param {Array} args The provided arguments.
  22619. * @param {Array} partials The arguments to prepend to those provided.
  22620. * @param {Array} holders The `partials` placeholder indexes.
  22621. * @params {boolean} [isCurried] Specify composing for a curried function.
  22622. * @returns {Array} Returns the new array of composed arguments.
  22623. */
  22624. function composeArgs(args, partials, holders, isCurried) {
  22625. var argsIndex = -1,
  22626. argsLength = args.length,
  22627. holdersLength = holders.length,
  22628. leftIndex = -1,
  22629. leftLength = partials.length,
  22630. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22631. result = Array(leftLength + rangeLength),
  22632. isUncurried = !isCurried;
  22633. while (++leftIndex < leftLength) {
  22634. result[leftIndex] = partials[leftIndex];
  22635. }
  22636. while (++argsIndex < holdersLength) {
  22637. if (isUncurried || argsIndex < argsLength) {
  22638. result[holders[argsIndex]] = args[argsIndex];
  22639. }
  22640. }
  22641. while (rangeLength--) {
  22642. result[leftIndex++] = args[argsIndex++];
  22643. }
  22644. return result;
  22645. }
  22646. /**
  22647. * This function is like `composeArgs` except that the arguments composition
  22648. * is tailored for `_.partialRight`.
  22649. *
  22650. * @private
  22651. * @param {Array} args The provided arguments.
  22652. * @param {Array} partials The arguments to append to those provided.
  22653. * @param {Array} holders The `partials` placeholder indexes.
  22654. * @params {boolean} [isCurried] Specify composing for a curried function.
  22655. * @returns {Array} Returns the new array of composed arguments.
  22656. */
  22657. function composeArgsRight(args, partials, holders, isCurried) {
  22658. var argsIndex = -1,
  22659. argsLength = args.length,
  22660. holdersIndex = -1,
  22661. holdersLength = holders.length,
  22662. rightIndex = -1,
  22663. rightLength = partials.length,
  22664. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22665. result = Array(rangeLength + rightLength),
  22666. isUncurried = !isCurried;
  22667. while (++argsIndex < rangeLength) {
  22668. result[argsIndex] = args[argsIndex];
  22669. }
  22670. var offset = argsIndex;
  22671. while (++rightIndex < rightLength) {
  22672. result[offset + rightIndex] = partials[rightIndex];
  22673. }
  22674. while (++holdersIndex < holdersLength) {
  22675. if (isUncurried || argsIndex < argsLength) {
  22676. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22677. }
  22678. }
  22679. return result;
  22680. }
  22681. /**
  22682. * Copies the values of `source` to `array`.
  22683. *
  22684. * @private
  22685. * @param {Array} source The array to copy values from.
  22686. * @param {Array} [array=[]] The array to copy values to.
  22687. * @returns {Array} Returns `array`.
  22688. */
  22689. function copyArray(source, array) {
  22690. var index = -1,
  22691. length = source.length;
  22692. array || (array = Array(length));
  22693. while (++index < length) {
  22694. array[index] = source[index];
  22695. }
  22696. return array;
  22697. }
  22698. /**
  22699. * Copies properties of `source` to `object`.
  22700. *
  22701. * @private
  22702. * @param {Object} source The object to copy properties from.
  22703. * @param {Array} props The property identifiers to copy.
  22704. * @param {Object} [object={}] The object to copy properties to.
  22705. * @param {Function} [customizer] The function to customize copied values.
  22706. * @returns {Object} Returns `object`.
  22707. */
  22708. function copyObject(source, props, object, customizer) {
  22709. var isNew = !object;
  22710. object || (object = {});
  22711. var index = -1,
  22712. length = props.length;
  22713. while (++index < length) {
  22714. var key = props[index];
  22715. var newValue = customizer
  22716. ? customizer(object[key], source[key], key, object, source)
  22717. : undefined;
  22718. if (newValue === undefined) {
  22719. newValue = source[key];
  22720. }
  22721. if (isNew) {
  22722. baseAssignValue(object, key, newValue);
  22723. } else {
  22724. assignValue(object, key, newValue);
  22725. }
  22726. }
  22727. return object;
  22728. }
  22729. /**
  22730. * Copies own symbols of `source` to `object`.
  22731. *
  22732. * @private
  22733. * @param {Object} source The object to copy symbols from.
  22734. * @param {Object} [object={}] The object to copy symbols to.
  22735. * @returns {Object} Returns `object`.
  22736. */
  22737. function copySymbols(source, object) {
  22738. return copyObject(source, getSymbols(source), object);
  22739. }
  22740. /**
  22741. * Copies own and inherited symbols of `source` to `object`.
  22742. *
  22743. * @private
  22744. * @param {Object} source The object to copy symbols from.
  22745. * @param {Object} [object={}] The object to copy symbols to.
  22746. * @returns {Object} Returns `object`.
  22747. */
  22748. function copySymbolsIn(source, object) {
  22749. return copyObject(source, getSymbolsIn(source), object);
  22750. }
  22751. /**
  22752. * Creates a function like `_.groupBy`.
  22753. *
  22754. * @private
  22755. * @param {Function} setter The function to set accumulator values.
  22756. * @param {Function} [initializer] The accumulator object initializer.
  22757. * @returns {Function} Returns the new aggregator function.
  22758. */
  22759. function createAggregator(setter, initializer) {
  22760. return function(collection, iteratee) {
  22761. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22762. accumulator = initializer ? initializer() : {};
  22763. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22764. };
  22765. }
  22766. /**
  22767. * Creates a function like `_.assign`.
  22768. *
  22769. * @private
  22770. * @param {Function} assigner The function to assign values.
  22771. * @returns {Function} Returns the new assigner function.
  22772. */
  22773. function createAssigner(assigner) {
  22774. return baseRest(function(object, sources) {
  22775. var index = -1,
  22776. length = sources.length,
  22777. customizer = length > 1 ? sources[length - 1] : undefined,
  22778. guard = length > 2 ? sources[2] : undefined;
  22779. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22780. ? (length--, customizer)
  22781. : undefined;
  22782. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22783. customizer = length < 3 ? undefined : customizer;
  22784. length = 1;
  22785. }
  22786. object = Object(object);
  22787. while (++index < length) {
  22788. var source = sources[index];
  22789. if (source) {
  22790. assigner(object, source, index, customizer);
  22791. }
  22792. }
  22793. return object;
  22794. });
  22795. }
  22796. /**
  22797. * Creates a `baseEach` or `baseEachRight` function.
  22798. *
  22799. * @private
  22800. * @param {Function} eachFunc The function to iterate over a collection.
  22801. * @param {boolean} [fromRight] Specify iterating from right to left.
  22802. * @returns {Function} Returns the new base function.
  22803. */
  22804. function createBaseEach(eachFunc, fromRight) {
  22805. return function(collection, iteratee) {
  22806. if (collection == null) {
  22807. return collection;
  22808. }
  22809. if (!isArrayLike(collection)) {
  22810. return eachFunc(collection, iteratee);
  22811. }
  22812. var length = collection.length,
  22813. index = fromRight ? length : -1,
  22814. iterable = Object(collection);
  22815. while ((fromRight ? index-- : ++index < length)) {
  22816. if (iteratee(iterable[index], index, iterable) === false) {
  22817. break;
  22818. }
  22819. }
  22820. return collection;
  22821. };
  22822. }
  22823. /**
  22824. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22825. *
  22826. * @private
  22827. * @param {boolean} [fromRight] Specify iterating from right to left.
  22828. * @returns {Function} Returns the new base function.
  22829. */
  22830. function createBaseFor(fromRight) {
  22831. return function(object, iteratee, keysFunc) {
  22832. var index = -1,
  22833. iterable = Object(object),
  22834. props = keysFunc(object),
  22835. length = props.length;
  22836. while (length--) {
  22837. var key = props[fromRight ? length : ++index];
  22838. if (iteratee(iterable[key], key, iterable) === false) {
  22839. break;
  22840. }
  22841. }
  22842. return object;
  22843. };
  22844. }
  22845. /**
  22846. * Creates a function that wraps `func` to invoke it with the optional `this`
  22847. * binding of `thisArg`.
  22848. *
  22849. * @private
  22850. * @param {Function} func The function to wrap.
  22851. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22852. * @param {*} [thisArg] The `this` binding of `func`.
  22853. * @returns {Function} Returns the new wrapped function.
  22854. */
  22855. function createBind(func, bitmask, thisArg) {
  22856. var isBind = bitmask & WRAP_BIND_FLAG,
  22857. Ctor = createCtor(func);
  22858. function wrapper() {
  22859. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22860. return fn.apply(isBind ? thisArg : this, arguments);
  22861. }
  22862. return wrapper;
  22863. }
  22864. /**
  22865. * Creates a function like `_.lowerFirst`.
  22866. *
  22867. * @private
  22868. * @param {string} methodName The name of the `String` case method to use.
  22869. * @returns {Function} Returns the new case function.
  22870. */
  22871. function createCaseFirst(methodName) {
  22872. return function(string) {
  22873. string = toString(string);
  22874. var strSymbols = hasUnicode(string)
  22875. ? stringToArray(string)
  22876. : undefined;
  22877. var chr = strSymbols
  22878. ? strSymbols[0]
  22879. : string.charAt(0);
  22880. var trailing = strSymbols
  22881. ? castSlice(strSymbols, 1).join('')
  22882. : string.slice(1);
  22883. return chr[methodName]() + trailing;
  22884. };
  22885. }
  22886. /**
  22887. * Creates a function like `_.camelCase`.
  22888. *
  22889. * @private
  22890. * @param {Function} callback The function to combine each word.
  22891. * @returns {Function} Returns the new compounder function.
  22892. */
  22893. function createCompounder(callback) {
  22894. return function(string) {
  22895. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22896. };
  22897. }
  22898. /**
  22899. * Creates a function that produces an instance of `Ctor` regardless of
  22900. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22901. *
  22902. * @private
  22903. * @param {Function} Ctor The constructor to wrap.
  22904. * @returns {Function} Returns the new wrapped function.
  22905. */
  22906. function createCtor(Ctor) {
  22907. return function() {
  22908. // Use a `switch` statement to work with class constructors. See
  22909. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22910. // for more details.
  22911. var args = arguments;
  22912. switch (args.length) {
  22913. case 0: return new Ctor;
  22914. case 1: return new Ctor(args[0]);
  22915. case 2: return new Ctor(args[0], args[1]);
  22916. case 3: return new Ctor(args[0], args[1], args[2]);
  22917. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22918. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22919. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22920. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22921. }
  22922. var thisBinding = baseCreate(Ctor.prototype),
  22923. result = Ctor.apply(thisBinding, args);
  22924. // Mimic the constructor's `return` behavior.
  22925. // See https://es5.github.io/#x13.2.2 for more details.
  22926. return isObject(result) ? result : thisBinding;
  22927. };
  22928. }
  22929. /**
  22930. * Creates a function that wraps `func` to enable currying.
  22931. *
  22932. * @private
  22933. * @param {Function} func The function to wrap.
  22934. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22935. * @param {number} arity The arity of `func`.
  22936. * @returns {Function} Returns the new wrapped function.
  22937. */
  22938. function createCurry(func, bitmask, arity) {
  22939. var Ctor = createCtor(func);
  22940. function wrapper() {
  22941. var length = arguments.length,
  22942. args = Array(length),
  22943. index = length,
  22944. placeholder = getHolder(wrapper);
  22945. while (index--) {
  22946. args[index] = arguments[index];
  22947. }
  22948. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22949. ? []
  22950. : replaceHolders(args, placeholder);
  22951. length -= holders.length;
  22952. if (length < arity) {
  22953. return createRecurry(
  22954. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22955. args, holders, undefined, undefined, arity - length);
  22956. }
  22957. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22958. return apply(fn, this, args);
  22959. }
  22960. return wrapper;
  22961. }
  22962. /**
  22963. * Creates a `_.find` or `_.findLast` function.
  22964. *
  22965. * @private
  22966. * @param {Function} findIndexFunc The function to find the collection index.
  22967. * @returns {Function} Returns the new find function.
  22968. */
  22969. function createFind(findIndexFunc) {
  22970. return function(collection, predicate, fromIndex) {
  22971. var iterable = Object(collection);
  22972. if (!isArrayLike(collection)) {
  22973. var iteratee = getIteratee(predicate, 3);
  22974. collection = keys(collection);
  22975. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22976. }
  22977. var index = findIndexFunc(collection, predicate, fromIndex);
  22978. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22979. };
  22980. }
  22981. /**
  22982. * Creates a `_.flow` or `_.flowRight` function.
  22983. *
  22984. * @private
  22985. * @param {boolean} [fromRight] Specify iterating from right to left.
  22986. * @returns {Function} Returns the new flow function.
  22987. */
  22988. function createFlow(fromRight) {
  22989. return flatRest(function(funcs) {
  22990. var length = funcs.length,
  22991. index = length,
  22992. prereq = LodashWrapper.prototype.thru;
  22993. if (fromRight) {
  22994. funcs.reverse();
  22995. }
  22996. while (index--) {
  22997. var func = funcs[index];
  22998. if (typeof func != 'function') {
  22999. throw new TypeError(FUNC_ERROR_TEXT);
  23000. }
  23001. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23002. var wrapper = new LodashWrapper([], true);
  23003. }
  23004. }
  23005. index = wrapper ? index : length;
  23006. while (++index < length) {
  23007. func = funcs[index];
  23008. var funcName = getFuncName(func),
  23009. data = funcName == 'wrapper' ? getData(func) : undefined;
  23010. if (data && isLaziable(data[0]) &&
  23011. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23012. !data[4].length && data[9] == 1
  23013. ) {
  23014. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23015. } else {
  23016. wrapper = (func.length == 1 && isLaziable(func))
  23017. ? wrapper[funcName]()
  23018. : wrapper.thru(func);
  23019. }
  23020. }
  23021. return function() {
  23022. var args = arguments,
  23023. value = args[0];
  23024. if (wrapper && args.length == 1 && isArray(value)) {
  23025. return wrapper.plant(value).value();
  23026. }
  23027. var index = 0,
  23028. result = length ? funcs[index].apply(this, args) : value;
  23029. while (++index < length) {
  23030. result = funcs[index].call(this, result);
  23031. }
  23032. return result;
  23033. };
  23034. });
  23035. }
  23036. /**
  23037. * Creates a function that wraps `func` to invoke it with optional `this`
  23038. * binding of `thisArg`, partial application, and currying.
  23039. *
  23040. * @private
  23041. * @param {Function|string} func The function or method name to wrap.
  23042. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23043. * @param {*} [thisArg] The `this` binding of `func`.
  23044. * @param {Array} [partials] The arguments to prepend to those provided to
  23045. * the new function.
  23046. * @param {Array} [holders] The `partials` placeholder indexes.
  23047. * @param {Array} [partialsRight] The arguments to append to those provided
  23048. * to the new function.
  23049. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23050. * @param {Array} [argPos] The argument positions of the new function.
  23051. * @param {number} [ary] The arity cap of `func`.
  23052. * @param {number} [arity] The arity of `func`.
  23053. * @returns {Function} Returns the new wrapped function.
  23054. */
  23055. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23056. var isAry = bitmask & WRAP_ARY_FLAG,
  23057. isBind = bitmask & WRAP_BIND_FLAG,
  23058. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23059. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23060. isFlip = bitmask & WRAP_FLIP_FLAG,
  23061. Ctor = isBindKey ? undefined : createCtor(func);
  23062. function wrapper() {
  23063. var length = arguments.length,
  23064. args = Array(length),
  23065. index = length;
  23066. while (index--) {
  23067. args[index] = arguments[index];
  23068. }
  23069. if (isCurried) {
  23070. var placeholder = getHolder(wrapper),
  23071. holdersCount = countHolders(args, placeholder);
  23072. }
  23073. if (partials) {
  23074. args = composeArgs(args, partials, holders, isCurried);
  23075. }
  23076. if (partialsRight) {
  23077. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23078. }
  23079. length -= holdersCount;
  23080. if (isCurried && length < arity) {
  23081. var newHolders = replaceHolders(args, placeholder);
  23082. return createRecurry(
  23083. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23084. args, newHolders, argPos, ary, arity - length
  23085. );
  23086. }
  23087. var thisBinding = isBind ? thisArg : this,
  23088. fn = isBindKey ? thisBinding[func] : func;
  23089. length = args.length;
  23090. if (argPos) {
  23091. args = reorder(args, argPos);
  23092. } else if (isFlip && length > 1) {
  23093. args.reverse();
  23094. }
  23095. if (isAry && ary < length) {
  23096. args.length = ary;
  23097. }
  23098. if (this && this !== root && this instanceof wrapper) {
  23099. fn = Ctor || createCtor(fn);
  23100. }
  23101. return fn.apply(thisBinding, args);
  23102. }
  23103. return wrapper;
  23104. }
  23105. /**
  23106. * Creates a function like `_.invertBy`.
  23107. *
  23108. * @private
  23109. * @param {Function} setter The function to set accumulator values.
  23110. * @param {Function} toIteratee The function to resolve iteratees.
  23111. * @returns {Function} Returns the new inverter function.
  23112. */
  23113. function createInverter(setter, toIteratee) {
  23114. return function(object, iteratee) {
  23115. return baseInverter(object, setter, toIteratee(iteratee), {});
  23116. };
  23117. }
  23118. /**
  23119. * Creates a function that performs a mathematical operation on two values.
  23120. *
  23121. * @private
  23122. * @param {Function} operator The function to perform the operation.
  23123. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23124. * @returns {Function} Returns the new mathematical operation function.
  23125. */
  23126. function createMathOperation(operator, defaultValue) {
  23127. return function(value, other) {
  23128. var result;
  23129. if (value === undefined && other === undefined) {
  23130. return defaultValue;
  23131. }
  23132. if (value !== undefined) {
  23133. result = value;
  23134. }
  23135. if (other !== undefined) {
  23136. if (result === undefined) {
  23137. return other;
  23138. }
  23139. if (typeof value == 'string' || typeof other == 'string') {
  23140. value = baseToString(value);
  23141. other = baseToString(other);
  23142. } else {
  23143. value = baseToNumber(value);
  23144. other = baseToNumber(other);
  23145. }
  23146. result = operator(value, other);
  23147. }
  23148. return result;
  23149. };
  23150. }
  23151. /**
  23152. * Creates a function like `_.over`.
  23153. *
  23154. * @private
  23155. * @param {Function} arrayFunc The function to iterate over iteratees.
  23156. * @returns {Function} Returns the new over function.
  23157. */
  23158. function createOver(arrayFunc) {
  23159. return flatRest(function(iteratees) {
  23160. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23161. return baseRest(function(args) {
  23162. var thisArg = this;
  23163. return arrayFunc(iteratees, function(iteratee) {
  23164. return apply(iteratee, thisArg, args);
  23165. });
  23166. });
  23167. });
  23168. }
  23169. /**
  23170. * Creates the padding for `string` based on `length`. The `chars` string
  23171. * is truncated if the number of characters exceeds `length`.
  23172. *
  23173. * @private
  23174. * @param {number} length The padding length.
  23175. * @param {string} [chars=' '] The string used as padding.
  23176. * @returns {string} Returns the padding for `string`.
  23177. */
  23178. function createPadding(length, chars) {
  23179. chars = chars === undefined ? ' ' : baseToString(chars);
  23180. var charsLength = chars.length;
  23181. if (charsLength < 2) {
  23182. return charsLength ? baseRepeat(chars, length) : chars;
  23183. }
  23184. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23185. return hasUnicode(chars)
  23186. ? castSlice(stringToArray(result), 0, length).join('')
  23187. : result.slice(0, length);
  23188. }
  23189. /**
  23190. * Creates a function that wraps `func` to invoke it with the `this` binding
  23191. * of `thisArg` and `partials` prepended to the arguments it receives.
  23192. *
  23193. * @private
  23194. * @param {Function} func The function to wrap.
  23195. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23196. * @param {*} thisArg The `this` binding of `func`.
  23197. * @param {Array} partials The arguments to prepend to those provided to
  23198. * the new function.
  23199. * @returns {Function} Returns the new wrapped function.
  23200. */
  23201. function createPartial(func, bitmask, thisArg, partials) {
  23202. var isBind = bitmask & WRAP_BIND_FLAG,
  23203. Ctor = createCtor(func);
  23204. function wrapper() {
  23205. var argsIndex = -1,
  23206. argsLength = arguments.length,
  23207. leftIndex = -1,
  23208. leftLength = partials.length,
  23209. args = Array(leftLength + argsLength),
  23210. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23211. while (++leftIndex < leftLength) {
  23212. args[leftIndex] = partials[leftIndex];
  23213. }
  23214. while (argsLength--) {
  23215. args[leftIndex++] = arguments[++argsIndex];
  23216. }
  23217. return apply(fn, isBind ? thisArg : this, args);
  23218. }
  23219. return wrapper;
  23220. }
  23221. /**
  23222. * Creates a `_.range` or `_.rangeRight` function.
  23223. *
  23224. * @private
  23225. * @param {boolean} [fromRight] Specify iterating from right to left.
  23226. * @returns {Function} Returns the new range function.
  23227. */
  23228. function createRange(fromRight) {
  23229. return function(start, end, step) {
  23230. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23231. end = step = undefined;
  23232. }
  23233. // Ensure the sign of `-0` is preserved.
  23234. start = toFinite(start);
  23235. if (end === undefined) {
  23236. end = start;
  23237. start = 0;
  23238. } else {
  23239. end = toFinite(end);
  23240. }
  23241. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23242. return baseRange(start, end, step, fromRight);
  23243. };
  23244. }
  23245. /**
  23246. * Creates a function that performs a relational operation on two values.
  23247. *
  23248. * @private
  23249. * @param {Function} operator The function to perform the operation.
  23250. * @returns {Function} Returns the new relational operation function.
  23251. */
  23252. function createRelationalOperation(operator) {
  23253. return function(value, other) {
  23254. if (!(typeof value == 'string' && typeof other == 'string')) {
  23255. value = toNumber(value);
  23256. other = toNumber(other);
  23257. }
  23258. return operator(value, other);
  23259. };
  23260. }
  23261. /**
  23262. * Creates a function that wraps `func` to continue currying.
  23263. *
  23264. * @private
  23265. * @param {Function} func The function to wrap.
  23266. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23267. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23268. * @param {*} placeholder The placeholder value.
  23269. * @param {*} [thisArg] The `this` binding of `func`.
  23270. * @param {Array} [partials] The arguments to prepend to those provided to
  23271. * the new function.
  23272. * @param {Array} [holders] The `partials` placeholder indexes.
  23273. * @param {Array} [argPos] The argument positions of the new function.
  23274. * @param {number} [ary] The arity cap of `func`.
  23275. * @param {number} [arity] The arity of `func`.
  23276. * @returns {Function} Returns the new wrapped function.
  23277. */
  23278. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23279. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23280. newHolders = isCurry ? holders : undefined,
  23281. newHoldersRight = isCurry ? undefined : holders,
  23282. newPartials = isCurry ? partials : undefined,
  23283. newPartialsRight = isCurry ? undefined : partials;
  23284. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23285. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23286. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23287. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23288. }
  23289. var newData = [
  23290. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23291. newHoldersRight, argPos, ary, arity
  23292. ];
  23293. var result = wrapFunc.apply(undefined, newData);
  23294. if (isLaziable(func)) {
  23295. setData(result, newData);
  23296. }
  23297. result.placeholder = placeholder;
  23298. return setWrapToString(result, func, bitmask);
  23299. }
  23300. /**
  23301. * Creates a function like `_.round`.
  23302. *
  23303. * @private
  23304. * @param {string} methodName The name of the `Math` method to use when rounding.
  23305. * @returns {Function} Returns the new round function.
  23306. */
  23307. function createRound(methodName) {
  23308. var func = Math[methodName];
  23309. return function(number, precision) {
  23310. number = toNumber(number);
  23311. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23312. if (precision && nativeIsFinite(number)) {
  23313. // Shift with exponential notation to avoid floating-point issues.
  23314. // See [MDN](https://mdn.io/round#Examples) for more details.
  23315. var pair = (toString(number) + 'e').split('e'),
  23316. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23317. pair = (toString(value) + 'e').split('e');
  23318. return +(pair[0] + 'e' + (+pair[1] - precision));
  23319. }
  23320. return func(number);
  23321. };
  23322. }
  23323. /**
  23324. * Creates a set object of `values`.
  23325. *
  23326. * @private
  23327. * @param {Array} values The values to add to the set.
  23328. * @returns {Object} Returns the new set.
  23329. */
  23330. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23331. return new Set(values);
  23332. };
  23333. /**
  23334. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23335. *
  23336. * @private
  23337. * @param {Function} keysFunc The function to get the keys of a given object.
  23338. * @returns {Function} Returns the new pairs function.
  23339. */
  23340. function createToPairs(keysFunc) {
  23341. return function(object) {
  23342. var tag = getTag(object);
  23343. if (tag == mapTag) {
  23344. return mapToArray(object);
  23345. }
  23346. if (tag == setTag) {
  23347. return setToPairs(object);
  23348. }
  23349. return baseToPairs(object, keysFunc(object));
  23350. };
  23351. }
  23352. /**
  23353. * Creates a function that either curries or invokes `func` with optional
  23354. * `this` binding and partially applied arguments.
  23355. *
  23356. * @private
  23357. * @param {Function|string} func The function or method name to wrap.
  23358. * @param {number} bitmask The bitmask flags.
  23359. * 1 - `_.bind`
  23360. * 2 - `_.bindKey`
  23361. * 4 - `_.curry` or `_.curryRight` of a bound function
  23362. * 8 - `_.curry`
  23363. * 16 - `_.curryRight`
  23364. * 32 - `_.partial`
  23365. * 64 - `_.partialRight`
  23366. * 128 - `_.rearg`
  23367. * 256 - `_.ary`
  23368. * 512 - `_.flip`
  23369. * @param {*} [thisArg] The `this` binding of `func`.
  23370. * @param {Array} [partials] The arguments to be partially applied.
  23371. * @param {Array} [holders] The `partials` placeholder indexes.
  23372. * @param {Array} [argPos] The argument positions of the new function.
  23373. * @param {number} [ary] The arity cap of `func`.
  23374. * @param {number} [arity] The arity of `func`.
  23375. * @returns {Function} Returns the new wrapped function.
  23376. */
  23377. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23378. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23379. if (!isBindKey && typeof func != 'function') {
  23380. throw new TypeError(FUNC_ERROR_TEXT);
  23381. }
  23382. var length = partials ? partials.length : 0;
  23383. if (!length) {
  23384. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23385. partials = holders = undefined;
  23386. }
  23387. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23388. arity = arity === undefined ? arity : toInteger(arity);
  23389. length -= holders ? holders.length : 0;
  23390. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23391. var partialsRight = partials,
  23392. holdersRight = holders;
  23393. partials = holders = undefined;
  23394. }
  23395. var data = isBindKey ? undefined : getData(func);
  23396. var newData = [
  23397. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23398. argPos, ary, arity
  23399. ];
  23400. if (data) {
  23401. mergeData(newData, data);
  23402. }
  23403. func = newData[0];
  23404. bitmask = newData[1];
  23405. thisArg = newData[2];
  23406. partials = newData[3];
  23407. holders = newData[4];
  23408. arity = newData[9] = newData[9] === undefined
  23409. ? (isBindKey ? 0 : func.length)
  23410. : nativeMax(newData[9] - length, 0);
  23411. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23412. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23413. }
  23414. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23415. var result = createBind(func, bitmask, thisArg);
  23416. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23417. result = createCurry(func, bitmask, arity);
  23418. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23419. result = createPartial(func, bitmask, thisArg, partials);
  23420. } else {
  23421. result = createHybrid.apply(undefined, newData);
  23422. }
  23423. var setter = data ? baseSetData : setData;
  23424. return setWrapToString(setter(result, newData), func, bitmask);
  23425. }
  23426. /**
  23427. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23428. * of source objects to the destination object for all destination properties
  23429. * that resolve to `undefined`.
  23430. *
  23431. * @private
  23432. * @param {*} objValue The destination value.
  23433. * @param {*} srcValue The source value.
  23434. * @param {string} key The key of the property to assign.
  23435. * @param {Object} object The parent object of `objValue`.
  23436. * @returns {*} Returns the value to assign.
  23437. */
  23438. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23439. if (objValue === undefined ||
  23440. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23441. return srcValue;
  23442. }
  23443. return objValue;
  23444. }
  23445. /**
  23446. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23447. * objects into destination objects that are passed thru.
  23448. *
  23449. * @private
  23450. * @param {*} objValue The destination value.
  23451. * @param {*} srcValue The source value.
  23452. * @param {string} key The key of the property to merge.
  23453. * @param {Object} object The parent object of `objValue`.
  23454. * @param {Object} source The parent object of `srcValue`.
  23455. * @param {Object} [stack] Tracks traversed source values and their merged
  23456. * counterparts.
  23457. * @returns {*} Returns the value to assign.
  23458. */
  23459. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23460. if (isObject(objValue) && isObject(srcValue)) {
  23461. // Recursively merge objects and arrays (susceptible to call stack limits).
  23462. stack.set(srcValue, objValue);
  23463. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23464. stack['delete'](srcValue);
  23465. }
  23466. return objValue;
  23467. }
  23468. /**
  23469. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23470. * objects.
  23471. *
  23472. * @private
  23473. * @param {*} value The value to inspect.
  23474. * @param {string} key The key of the property to inspect.
  23475. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23476. */
  23477. function customOmitClone(value) {
  23478. return isPlainObject(value) ? undefined : value;
  23479. }
  23480. /**
  23481. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23482. * partial deep comparisons.
  23483. *
  23484. * @private
  23485. * @param {Array} array The array to compare.
  23486. * @param {Array} other The other array to compare.
  23487. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23488. * @param {Function} customizer The function to customize comparisons.
  23489. * @param {Function} equalFunc The function to determine equivalents of values.
  23490. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23491. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23492. */
  23493. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23494. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23495. arrLength = array.length,
  23496. othLength = other.length;
  23497. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23498. return false;
  23499. }
  23500. // Assume cyclic values are equal.
  23501. var stacked = stack.get(array);
  23502. if (stacked && stack.get(other)) {
  23503. return stacked == other;
  23504. }
  23505. var index = -1,
  23506. result = true,
  23507. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23508. stack.set(array, other);
  23509. stack.set(other, array);
  23510. // Ignore non-index properties.
  23511. while (++index < arrLength) {
  23512. var arrValue = array[index],
  23513. othValue = other[index];
  23514. if (customizer) {
  23515. var compared = isPartial
  23516. ? customizer(othValue, arrValue, index, other, array, stack)
  23517. : customizer(arrValue, othValue, index, array, other, stack);
  23518. }
  23519. if (compared !== undefined) {
  23520. if (compared) {
  23521. continue;
  23522. }
  23523. result = false;
  23524. break;
  23525. }
  23526. // Recursively compare arrays (susceptible to call stack limits).
  23527. if (seen) {
  23528. if (!arraySome(other, function(othValue, othIndex) {
  23529. if (!cacheHas(seen, othIndex) &&
  23530. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23531. return seen.push(othIndex);
  23532. }
  23533. })) {
  23534. result = false;
  23535. break;
  23536. }
  23537. } else if (!(
  23538. arrValue === othValue ||
  23539. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23540. )) {
  23541. result = false;
  23542. break;
  23543. }
  23544. }
  23545. stack['delete'](array);
  23546. stack['delete'](other);
  23547. return result;
  23548. }
  23549. /**
  23550. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23551. * the same `toStringTag`.
  23552. *
  23553. * **Note:** This function only supports comparing values with tags of
  23554. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23555. *
  23556. * @private
  23557. * @param {Object} object The object to compare.
  23558. * @param {Object} other The other object to compare.
  23559. * @param {string} tag The `toStringTag` of the objects to compare.
  23560. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23561. * @param {Function} customizer The function to customize comparisons.
  23562. * @param {Function} equalFunc The function to determine equivalents of values.
  23563. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23564. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23565. */
  23566. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23567. switch (tag) {
  23568. case dataViewTag:
  23569. if ((object.byteLength != other.byteLength) ||
  23570. (object.byteOffset != other.byteOffset)) {
  23571. return false;
  23572. }
  23573. object = object.buffer;
  23574. other = other.buffer;
  23575. case arrayBufferTag:
  23576. if ((object.byteLength != other.byteLength) ||
  23577. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23578. return false;
  23579. }
  23580. return true;
  23581. case boolTag:
  23582. case dateTag:
  23583. case numberTag:
  23584. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23585. // Invalid dates are coerced to `NaN`.
  23586. return eq(+object, +other);
  23587. case errorTag:
  23588. return object.name == other.name && object.message == other.message;
  23589. case regexpTag:
  23590. case stringTag:
  23591. // Coerce regexes to strings and treat strings, primitives and objects,
  23592. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23593. // for more details.
  23594. return object == (other + '');
  23595. case mapTag:
  23596. var convert = mapToArray;
  23597. case setTag:
  23598. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23599. convert || (convert = setToArray);
  23600. if (object.size != other.size && !isPartial) {
  23601. return false;
  23602. }
  23603. // Assume cyclic values are equal.
  23604. var stacked = stack.get(object);
  23605. if (stacked) {
  23606. return stacked == other;
  23607. }
  23608. bitmask |= COMPARE_UNORDERED_FLAG;
  23609. // Recursively compare objects (susceptible to call stack limits).
  23610. stack.set(object, other);
  23611. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23612. stack['delete'](object);
  23613. return result;
  23614. case symbolTag:
  23615. if (symbolValueOf) {
  23616. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23617. }
  23618. }
  23619. return false;
  23620. }
  23621. /**
  23622. * A specialized version of `baseIsEqualDeep` for objects with support for
  23623. * partial deep comparisons.
  23624. *
  23625. * @private
  23626. * @param {Object} object The object to compare.
  23627. * @param {Object} other The other object to compare.
  23628. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23629. * @param {Function} customizer The function to customize comparisons.
  23630. * @param {Function} equalFunc The function to determine equivalents of values.
  23631. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23632. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23633. */
  23634. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23635. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23636. objProps = getAllKeys(object),
  23637. objLength = objProps.length,
  23638. othProps = getAllKeys(other),
  23639. othLength = othProps.length;
  23640. if (objLength != othLength && !isPartial) {
  23641. return false;
  23642. }
  23643. var index = objLength;
  23644. while (index--) {
  23645. var key = objProps[index];
  23646. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23647. return false;
  23648. }
  23649. }
  23650. // Assume cyclic values are equal.
  23651. var stacked = stack.get(object);
  23652. if (stacked && stack.get(other)) {
  23653. return stacked == other;
  23654. }
  23655. var result = true;
  23656. stack.set(object, other);
  23657. stack.set(other, object);
  23658. var skipCtor = isPartial;
  23659. while (++index < objLength) {
  23660. key = objProps[index];
  23661. var objValue = object[key],
  23662. othValue = other[key];
  23663. if (customizer) {
  23664. var compared = isPartial
  23665. ? customizer(othValue, objValue, key, other, object, stack)
  23666. : customizer(objValue, othValue, key, object, other, stack);
  23667. }
  23668. // Recursively compare objects (susceptible to call stack limits).
  23669. if (!(compared === undefined
  23670. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23671. : compared
  23672. )) {
  23673. result = false;
  23674. break;
  23675. }
  23676. skipCtor || (skipCtor = key == 'constructor');
  23677. }
  23678. if (result && !skipCtor) {
  23679. var objCtor = object.constructor,
  23680. othCtor = other.constructor;
  23681. // Non `Object` object instances with different constructors are not equal.
  23682. if (objCtor != othCtor &&
  23683. ('constructor' in object && 'constructor' in other) &&
  23684. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23685. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23686. result = false;
  23687. }
  23688. }
  23689. stack['delete'](object);
  23690. stack['delete'](other);
  23691. return result;
  23692. }
  23693. /**
  23694. * A specialized version of `baseRest` which flattens the rest array.
  23695. *
  23696. * @private
  23697. * @param {Function} func The function to apply a rest parameter to.
  23698. * @returns {Function} Returns the new function.
  23699. */
  23700. function flatRest(func) {
  23701. return setToString(overRest(func, undefined, flatten), func + '');
  23702. }
  23703. /**
  23704. * Creates an array of own enumerable property names and symbols of `object`.
  23705. *
  23706. * @private
  23707. * @param {Object} object The object to query.
  23708. * @returns {Array} Returns the array of property names and symbols.
  23709. */
  23710. function getAllKeys(object) {
  23711. return baseGetAllKeys(object, keys, getSymbols);
  23712. }
  23713. /**
  23714. * Creates an array of own and inherited enumerable property names and
  23715. * symbols of `object`.
  23716. *
  23717. * @private
  23718. * @param {Object} object The object to query.
  23719. * @returns {Array} Returns the array of property names and symbols.
  23720. */
  23721. function getAllKeysIn(object) {
  23722. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23723. }
  23724. /**
  23725. * Gets metadata for `func`.
  23726. *
  23727. * @private
  23728. * @param {Function} func The function to query.
  23729. * @returns {*} Returns the metadata for `func`.
  23730. */
  23731. var getData = !metaMap ? noop : function(func) {
  23732. return metaMap.get(func);
  23733. };
  23734. /**
  23735. * Gets the name of `func`.
  23736. *
  23737. * @private
  23738. * @param {Function} func The function to query.
  23739. * @returns {string} Returns the function name.
  23740. */
  23741. function getFuncName(func) {
  23742. var result = (func.name + ''),
  23743. array = realNames[result],
  23744. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23745. while (length--) {
  23746. var data = array[length],
  23747. otherFunc = data.func;
  23748. if (otherFunc == null || otherFunc == func) {
  23749. return data.name;
  23750. }
  23751. }
  23752. return result;
  23753. }
  23754. /**
  23755. * Gets the argument placeholder value for `func`.
  23756. *
  23757. * @private
  23758. * @param {Function} func The function to inspect.
  23759. * @returns {*} Returns the placeholder value.
  23760. */
  23761. function getHolder(func) {
  23762. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23763. return object.placeholder;
  23764. }
  23765. /**
  23766. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23767. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23768. * If arguments are provided, the chosen function is invoked with them and
  23769. * its result is returned.
  23770. *
  23771. * @private
  23772. * @param {*} [value] The value to convert to an iteratee.
  23773. * @param {number} [arity] The arity of the created iteratee.
  23774. * @returns {Function} Returns the chosen function or its result.
  23775. */
  23776. function getIteratee() {
  23777. var result = lodash.iteratee || iteratee;
  23778. result = result === iteratee ? baseIteratee : result;
  23779. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23780. }
  23781. /**
  23782. * Gets the data for `map`.
  23783. *
  23784. * @private
  23785. * @param {Object} map The map to query.
  23786. * @param {string} key The reference key.
  23787. * @returns {*} Returns the map data.
  23788. */
  23789. function getMapData(map, key) {
  23790. var data = map.__data__;
  23791. return isKeyable(key)
  23792. ? data[typeof key == 'string' ? 'string' : 'hash']
  23793. : data.map;
  23794. }
  23795. /**
  23796. * Gets the property names, values, and compare flags of `object`.
  23797. *
  23798. * @private
  23799. * @param {Object} object The object to query.
  23800. * @returns {Array} Returns the match data of `object`.
  23801. */
  23802. function getMatchData(object) {
  23803. var result = keys(object),
  23804. length = result.length;
  23805. while (length--) {
  23806. var key = result[length],
  23807. value = object[key];
  23808. result[length] = [key, value, isStrictComparable(value)];
  23809. }
  23810. return result;
  23811. }
  23812. /**
  23813. * Gets the native function at `key` of `object`.
  23814. *
  23815. * @private
  23816. * @param {Object} object The object to query.
  23817. * @param {string} key The key of the method to get.
  23818. * @returns {*} Returns the function if it's native, else `undefined`.
  23819. */
  23820. function getNative(object, key) {
  23821. var value = getValue(object, key);
  23822. return baseIsNative(value) ? value : undefined;
  23823. }
  23824. /**
  23825. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23826. *
  23827. * @private
  23828. * @param {*} value The value to query.
  23829. * @returns {string} Returns the raw `toStringTag`.
  23830. */
  23831. function getRawTag(value) {
  23832. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23833. tag = value[symToStringTag];
  23834. try {
  23835. value[symToStringTag] = undefined;
  23836. var unmasked = true;
  23837. } catch (e) {}
  23838. var result = nativeObjectToString.call(value);
  23839. if (unmasked) {
  23840. if (isOwn) {
  23841. value[symToStringTag] = tag;
  23842. } else {
  23843. delete value[symToStringTag];
  23844. }
  23845. }
  23846. return result;
  23847. }
  23848. /**
  23849. * Creates an array of the own enumerable symbols of `object`.
  23850. *
  23851. * @private
  23852. * @param {Object} object The object to query.
  23853. * @returns {Array} Returns the array of symbols.
  23854. */
  23855. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23856. if (object == null) {
  23857. return [];
  23858. }
  23859. object = Object(object);
  23860. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23861. return propertyIsEnumerable.call(object, symbol);
  23862. });
  23863. };
  23864. /**
  23865. * Creates an array of the own and inherited enumerable symbols of `object`.
  23866. *
  23867. * @private
  23868. * @param {Object} object The object to query.
  23869. * @returns {Array} Returns the array of symbols.
  23870. */
  23871. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23872. var result = [];
  23873. while (object) {
  23874. arrayPush(result, getSymbols(object));
  23875. object = getPrototype(object);
  23876. }
  23877. return result;
  23878. };
  23879. /**
  23880. * Gets the `toStringTag` of `value`.
  23881. *
  23882. * @private
  23883. * @param {*} value The value to query.
  23884. * @returns {string} Returns the `toStringTag`.
  23885. */
  23886. var getTag = baseGetTag;
  23887. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23888. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23889. (Map && getTag(new Map) != mapTag) ||
  23890. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23891. (Set && getTag(new Set) != setTag) ||
  23892. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23893. getTag = function(value) {
  23894. var result = baseGetTag(value),
  23895. Ctor = result == objectTag ? value.constructor : undefined,
  23896. ctorString = Ctor ? toSource(Ctor) : '';
  23897. if (ctorString) {
  23898. switch (ctorString) {
  23899. case dataViewCtorString: return dataViewTag;
  23900. case mapCtorString: return mapTag;
  23901. case promiseCtorString: return promiseTag;
  23902. case setCtorString: return setTag;
  23903. case weakMapCtorString: return weakMapTag;
  23904. }
  23905. }
  23906. return result;
  23907. };
  23908. }
  23909. /**
  23910. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23911. *
  23912. * @private
  23913. * @param {number} start The start of the view.
  23914. * @param {number} end The end of the view.
  23915. * @param {Array} transforms The transformations to apply to the view.
  23916. * @returns {Object} Returns an object containing the `start` and `end`
  23917. * positions of the view.
  23918. */
  23919. function getView(start, end, transforms) {
  23920. var index = -1,
  23921. length = transforms.length;
  23922. while (++index < length) {
  23923. var data = transforms[index],
  23924. size = data.size;
  23925. switch (data.type) {
  23926. case 'drop': start += size; break;
  23927. case 'dropRight': end -= size; break;
  23928. case 'take': end = nativeMin(end, start + size); break;
  23929. case 'takeRight': start = nativeMax(start, end - size); break;
  23930. }
  23931. }
  23932. return { 'start': start, 'end': end };
  23933. }
  23934. /**
  23935. * Extracts wrapper details from the `source` body comment.
  23936. *
  23937. * @private
  23938. * @param {string} source The source to inspect.
  23939. * @returns {Array} Returns the wrapper details.
  23940. */
  23941. function getWrapDetails(source) {
  23942. var match = source.match(reWrapDetails);
  23943. return match ? match[1].split(reSplitDetails) : [];
  23944. }
  23945. /**
  23946. * Checks if `path` exists on `object`.
  23947. *
  23948. * @private
  23949. * @param {Object} object The object to query.
  23950. * @param {Array|string} path The path to check.
  23951. * @param {Function} hasFunc The function to check properties.
  23952. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23953. */
  23954. function hasPath(object, path, hasFunc) {
  23955. path = castPath(path, object);
  23956. var index = -1,
  23957. length = path.length,
  23958. result = false;
  23959. while (++index < length) {
  23960. var key = toKey(path[index]);
  23961. if (!(result = object != null && hasFunc(object, key))) {
  23962. break;
  23963. }
  23964. object = object[key];
  23965. }
  23966. if (result || ++index != length) {
  23967. return result;
  23968. }
  23969. length = object == null ? 0 : object.length;
  23970. return !!length && isLength(length) && isIndex(key, length) &&
  23971. (isArray(object) || isArguments(object));
  23972. }
  23973. /**
  23974. * Initializes an array clone.
  23975. *
  23976. * @private
  23977. * @param {Array} array The array to clone.
  23978. * @returns {Array} Returns the initialized clone.
  23979. */
  23980. function initCloneArray(array) {
  23981. var length = array.length,
  23982. result = new array.constructor(length);
  23983. // Add properties assigned by `RegExp#exec`.
  23984. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23985. result.index = array.index;
  23986. result.input = array.input;
  23987. }
  23988. return result;
  23989. }
  23990. /**
  23991. * Initializes an object clone.
  23992. *
  23993. * @private
  23994. * @param {Object} object The object to clone.
  23995. * @returns {Object} Returns the initialized clone.
  23996. */
  23997. function initCloneObject(object) {
  23998. return (typeof object.constructor == 'function' && !isPrototype(object))
  23999. ? baseCreate(getPrototype(object))
  24000. : {};
  24001. }
  24002. /**
  24003. * Initializes an object clone based on its `toStringTag`.
  24004. *
  24005. * **Note:** This function only supports cloning values with tags of
  24006. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24007. *
  24008. * @private
  24009. * @param {Object} object The object to clone.
  24010. * @param {string} tag The `toStringTag` of the object to clone.
  24011. * @param {boolean} [isDeep] Specify a deep clone.
  24012. * @returns {Object} Returns the initialized clone.
  24013. */
  24014. function initCloneByTag(object, tag, isDeep) {
  24015. var Ctor = object.constructor;
  24016. switch (tag) {
  24017. case arrayBufferTag:
  24018. return cloneArrayBuffer(object);
  24019. case boolTag:
  24020. case dateTag:
  24021. return new Ctor(+object);
  24022. case dataViewTag:
  24023. return cloneDataView(object, isDeep);
  24024. case float32Tag: case float64Tag:
  24025. case int8Tag: case int16Tag: case int32Tag:
  24026. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24027. return cloneTypedArray(object, isDeep);
  24028. case mapTag:
  24029. return new Ctor;
  24030. case numberTag:
  24031. case stringTag:
  24032. return new Ctor(object);
  24033. case regexpTag:
  24034. return cloneRegExp(object);
  24035. case setTag:
  24036. return new Ctor;
  24037. case symbolTag:
  24038. return cloneSymbol(object);
  24039. }
  24040. }
  24041. /**
  24042. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24043. *
  24044. * @private
  24045. * @param {string} source The source to modify.
  24046. * @returns {Array} details The details to insert.
  24047. * @returns {string} Returns the modified source.
  24048. */
  24049. function insertWrapDetails(source, details) {
  24050. var length = details.length;
  24051. if (!length) {
  24052. return source;
  24053. }
  24054. var lastIndex = length - 1;
  24055. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24056. details = details.join(length > 2 ? ', ' : ' ');
  24057. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24058. }
  24059. /**
  24060. * Checks if `value` is a flattenable `arguments` object or array.
  24061. *
  24062. * @private
  24063. * @param {*} value The value to check.
  24064. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24065. */
  24066. function isFlattenable(value) {
  24067. return isArray(value) || isArguments(value) ||
  24068. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24069. }
  24070. /**
  24071. * Checks if `value` is a valid array-like index.
  24072. *
  24073. * @private
  24074. * @param {*} value The value to check.
  24075. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24076. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24077. */
  24078. function isIndex(value, length) {
  24079. var type = typeof value;
  24080. length = length == null ? MAX_SAFE_INTEGER : length;
  24081. return !!length &&
  24082. (type == 'number' ||
  24083. (type != 'symbol' && reIsUint.test(value))) &&
  24084. (value > -1 && value % 1 == 0 && value < length);
  24085. }
  24086. /**
  24087. * Checks if the given arguments are from an iteratee call.
  24088. *
  24089. * @private
  24090. * @param {*} value The potential iteratee value argument.
  24091. * @param {*} index The potential iteratee index or key argument.
  24092. * @param {*} object The potential iteratee object argument.
  24093. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24094. * else `false`.
  24095. */
  24096. function isIterateeCall(value, index, object) {
  24097. if (!isObject(object)) {
  24098. return false;
  24099. }
  24100. var type = typeof index;
  24101. if (type == 'number'
  24102. ? (isArrayLike(object) && isIndex(index, object.length))
  24103. : (type == 'string' && index in object)
  24104. ) {
  24105. return eq(object[index], value);
  24106. }
  24107. return false;
  24108. }
  24109. /**
  24110. * Checks if `value` is a property name and not a property path.
  24111. *
  24112. * @private
  24113. * @param {*} value The value to check.
  24114. * @param {Object} [object] The object to query keys on.
  24115. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24116. */
  24117. function isKey(value, object) {
  24118. if (isArray(value)) {
  24119. return false;
  24120. }
  24121. var type = typeof value;
  24122. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24123. value == null || isSymbol(value)) {
  24124. return true;
  24125. }
  24126. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24127. (object != null && value in Object(object));
  24128. }
  24129. /**
  24130. * Checks if `value` is suitable for use as unique object key.
  24131. *
  24132. * @private
  24133. * @param {*} value The value to check.
  24134. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24135. */
  24136. function isKeyable(value) {
  24137. var type = typeof value;
  24138. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24139. ? (value !== '__proto__')
  24140. : (value === null);
  24141. }
  24142. /**
  24143. * Checks if `func` has a lazy counterpart.
  24144. *
  24145. * @private
  24146. * @param {Function} func The function to check.
  24147. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24148. * else `false`.
  24149. */
  24150. function isLaziable(func) {
  24151. var funcName = getFuncName(func),
  24152. other = lodash[funcName];
  24153. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24154. return false;
  24155. }
  24156. if (func === other) {
  24157. return true;
  24158. }
  24159. var data = getData(other);
  24160. return !!data && func === data[0];
  24161. }
  24162. /**
  24163. * Checks if `func` has its source masked.
  24164. *
  24165. * @private
  24166. * @param {Function} func The function to check.
  24167. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24168. */
  24169. function isMasked(func) {
  24170. return !!maskSrcKey && (maskSrcKey in func);
  24171. }
  24172. /**
  24173. * Checks if `func` is capable of being masked.
  24174. *
  24175. * @private
  24176. * @param {*} value The value to check.
  24177. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24178. */
  24179. var isMaskable = coreJsData ? isFunction : stubFalse;
  24180. /**
  24181. * Checks if `value` is likely a prototype object.
  24182. *
  24183. * @private
  24184. * @param {*} value The value to check.
  24185. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24186. */
  24187. function isPrototype(value) {
  24188. var Ctor = value && value.constructor,
  24189. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24190. return value === proto;
  24191. }
  24192. /**
  24193. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24194. *
  24195. * @private
  24196. * @param {*} value The value to check.
  24197. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24198. * equality comparisons, else `false`.
  24199. */
  24200. function isStrictComparable(value) {
  24201. return value === value && !isObject(value);
  24202. }
  24203. /**
  24204. * A specialized version of `matchesProperty` for source values suitable
  24205. * for strict equality comparisons, i.e. `===`.
  24206. *
  24207. * @private
  24208. * @param {string} key The key of the property to get.
  24209. * @param {*} srcValue The value to match.
  24210. * @returns {Function} Returns the new spec function.
  24211. */
  24212. function matchesStrictComparable(key, srcValue) {
  24213. return function(object) {
  24214. if (object == null) {
  24215. return false;
  24216. }
  24217. return object[key] === srcValue &&
  24218. (srcValue !== undefined || (key in Object(object)));
  24219. };
  24220. }
  24221. /**
  24222. * A specialized version of `_.memoize` which clears the memoized function's
  24223. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24224. *
  24225. * @private
  24226. * @param {Function} func The function to have its output memoized.
  24227. * @returns {Function} Returns the new memoized function.
  24228. */
  24229. function memoizeCapped(func) {
  24230. var result = memoize(func, function(key) {
  24231. if (cache.size === MAX_MEMOIZE_SIZE) {
  24232. cache.clear();
  24233. }
  24234. return key;
  24235. });
  24236. var cache = result.cache;
  24237. return result;
  24238. }
  24239. /**
  24240. * Merges the function metadata of `source` into `data`.
  24241. *
  24242. * Merging metadata reduces the number of wrappers used to invoke a function.
  24243. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24244. * may be applied regardless of execution order. Methods like `_.ary` and
  24245. * `_.rearg` modify function arguments, making the order in which they are
  24246. * executed important, preventing the merging of metadata. However, we make
  24247. * an exception for a safe combined case where curried functions have `_.ary`
  24248. * and or `_.rearg` applied.
  24249. *
  24250. * @private
  24251. * @param {Array} data The destination metadata.
  24252. * @param {Array} source The source metadata.
  24253. * @returns {Array} Returns `data`.
  24254. */
  24255. function mergeData(data, source) {
  24256. var bitmask = data[1],
  24257. srcBitmask = source[1],
  24258. newBitmask = bitmask | srcBitmask,
  24259. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24260. var isCombo =
  24261. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24262. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24263. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24264. // Exit early if metadata can't be merged.
  24265. if (!(isCommon || isCombo)) {
  24266. return data;
  24267. }
  24268. // Use source `thisArg` if available.
  24269. if (srcBitmask & WRAP_BIND_FLAG) {
  24270. data[2] = source[2];
  24271. // Set when currying a bound function.
  24272. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24273. }
  24274. // Compose partial arguments.
  24275. var value = source[3];
  24276. if (value) {
  24277. var partials = data[3];
  24278. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24279. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24280. }
  24281. // Compose partial right arguments.
  24282. value = source[5];
  24283. if (value) {
  24284. partials = data[5];
  24285. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24286. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24287. }
  24288. // Use source `argPos` if available.
  24289. value = source[7];
  24290. if (value) {
  24291. data[7] = value;
  24292. }
  24293. // Use source `ary` if it's smaller.
  24294. if (srcBitmask & WRAP_ARY_FLAG) {
  24295. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24296. }
  24297. // Use source `arity` if one is not provided.
  24298. if (data[9] == null) {
  24299. data[9] = source[9];
  24300. }
  24301. // Use source `func` and merge bitmasks.
  24302. data[0] = source[0];
  24303. data[1] = newBitmask;
  24304. return data;
  24305. }
  24306. /**
  24307. * This function is like
  24308. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24309. * except that it includes inherited enumerable properties.
  24310. *
  24311. * @private
  24312. * @param {Object} object The object to query.
  24313. * @returns {Array} Returns the array of property names.
  24314. */
  24315. function nativeKeysIn(object) {
  24316. var result = [];
  24317. if (object != null) {
  24318. for (var key in Object(object)) {
  24319. result.push(key);
  24320. }
  24321. }
  24322. return result;
  24323. }
  24324. /**
  24325. * Converts `value` to a string using `Object.prototype.toString`.
  24326. *
  24327. * @private
  24328. * @param {*} value The value to convert.
  24329. * @returns {string} Returns the converted string.
  24330. */
  24331. function objectToString(value) {
  24332. return nativeObjectToString.call(value);
  24333. }
  24334. /**
  24335. * A specialized version of `baseRest` which transforms the rest array.
  24336. *
  24337. * @private
  24338. * @param {Function} func The function to apply a rest parameter to.
  24339. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24340. * @param {Function} transform The rest array transform.
  24341. * @returns {Function} Returns the new function.
  24342. */
  24343. function overRest(func, start, transform) {
  24344. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24345. return function() {
  24346. var args = arguments,
  24347. index = -1,
  24348. length = nativeMax(args.length - start, 0),
  24349. array = Array(length);
  24350. while (++index < length) {
  24351. array[index] = args[start + index];
  24352. }
  24353. index = -1;
  24354. var otherArgs = Array(start + 1);
  24355. while (++index < start) {
  24356. otherArgs[index] = args[index];
  24357. }
  24358. otherArgs[start] = transform(array);
  24359. return apply(func, this, otherArgs);
  24360. };
  24361. }
  24362. /**
  24363. * Gets the parent value at `path` of `object`.
  24364. *
  24365. * @private
  24366. * @param {Object} object The object to query.
  24367. * @param {Array} path The path to get the parent value of.
  24368. * @returns {*} Returns the parent value.
  24369. */
  24370. function parent(object, path) {
  24371. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24372. }
  24373. /**
  24374. * Reorder `array` according to the specified indexes where the element at
  24375. * the first index is assigned as the first element, the element at
  24376. * the second index is assigned as the second element, and so on.
  24377. *
  24378. * @private
  24379. * @param {Array} array The array to reorder.
  24380. * @param {Array} indexes The arranged array indexes.
  24381. * @returns {Array} Returns `array`.
  24382. */
  24383. function reorder(array, indexes) {
  24384. var arrLength = array.length,
  24385. length = nativeMin(indexes.length, arrLength),
  24386. oldArray = copyArray(array);
  24387. while (length--) {
  24388. var index = indexes[length];
  24389. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24390. }
  24391. return array;
  24392. }
  24393. /**
  24394. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24395. *
  24396. * @private
  24397. * @param {Object} object The object to query.
  24398. * @param {string} key The key of the property to get.
  24399. * @returns {*} Returns the property value.
  24400. */
  24401. function safeGet(object, key) {
  24402. if (key === 'constructor' && typeof object[key] === 'function') {
  24403. return;
  24404. }
  24405. if (key == '__proto__') {
  24406. return;
  24407. }
  24408. return object[key];
  24409. }
  24410. /**
  24411. * Sets metadata for `func`.
  24412. *
  24413. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24414. * period of time, it will trip its breaker and transition to an identity
  24415. * function to avoid garbage collection pauses in V8. See
  24416. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24417. * for more details.
  24418. *
  24419. * @private
  24420. * @param {Function} func The function to associate metadata with.
  24421. * @param {*} data The metadata.
  24422. * @returns {Function} Returns `func`.
  24423. */
  24424. var setData = shortOut(baseSetData);
  24425. /**
  24426. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24427. *
  24428. * @private
  24429. * @param {Function} func The function to delay.
  24430. * @param {number} wait The number of milliseconds to delay invocation.
  24431. * @returns {number|Object} Returns the timer id or timeout object.
  24432. */
  24433. var setTimeout = ctxSetTimeout || function(func, wait) {
  24434. return root.setTimeout(func, wait);
  24435. };
  24436. /**
  24437. * Sets the `toString` method of `func` to return `string`.
  24438. *
  24439. * @private
  24440. * @param {Function} func The function to modify.
  24441. * @param {Function} string The `toString` result.
  24442. * @returns {Function} Returns `func`.
  24443. */
  24444. var setToString = shortOut(baseSetToString);
  24445. /**
  24446. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24447. * with wrapper details in a comment at the top of the source body.
  24448. *
  24449. * @private
  24450. * @param {Function} wrapper The function to modify.
  24451. * @param {Function} reference The reference function.
  24452. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24453. * @returns {Function} Returns `wrapper`.
  24454. */
  24455. function setWrapToString(wrapper, reference, bitmask) {
  24456. var source = (reference + '');
  24457. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24458. }
  24459. /**
  24460. * Creates a function that'll short out and invoke `identity` instead
  24461. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24462. * milliseconds.
  24463. *
  24464. * @private
  24465. * @param {Function} func The function to restrict.
  24466. * @returns {Function} Returns the new shortable function.
  24467. */
  24468. function shortOut(func) {
  24469. var count = 0,
  24470. lastCalled = 0;
  24471. return function() {
  24472. var stamp = nativeNow(),
  24473. remaining = HOT_SPAN - (stamp - lastCalled);
  24474. lastCalled = stamp;
  24475. if (remaining > 0) {
  24476. if (++count >= HOT_COUNT) {
  24477. return arguments[0];
  24478. }
  24479. } else {
  24480. count = 0;
  24481. }
  24482. return func.apply(undefined, arguments);
  24483. };
  24484. }
  24485. /**
  24486. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24487. *
  24488. * @private
  24489. * @param {Array} array The array to shuffle.
  24490. * @param {number} [size=array.length] The size of `array`.
  24491. * @returns {Array} Returns `array`.
  24492. */
  24493. function shuffleSelf(array, size) {
  24494. var index = -1,
  24495. length = array.length,
  24496. lastIndex = length - 1;
  24497. size = size === undefined ? length : size;
  24498. while (++index < size) {
  24499. var rand = baseRandom(index, lastIndex),
  24500. value = array[rand];
  24501. array[rand] = array[index];
  24502. array[index] = value;
  24503. }
  24504. array.length = size;
  24505. return array;
  24506. }
  24507. /**
  24508. * Converts `string` to a property path array.
  24509. *
  24510. * @private
  24511. * @param {string} string The string to convert.
  24512. * @returns {Array} Returns the property path array.
  24513. */
  24514. var stringToPath = memoizeCapped(function(string) {
  24515. var result = [];
  24516. if (string.charCodeAt(0) === 46 /* . */) {
  24517. result.push('');
  24518. }
  24519. string.replace(rePropName, function(match, number, quote, subString) {
  24520. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24521. });
  24522. return result;
  24523. });
  24524. /**
  24525. * Converts `value` to a string key if it's not a string or symbol.
  24526. *
  24527. * @private
  24528. * @param {*} value The value to inspect.
  24529. * @returns {string|symbol} Returns the key.
  24530. */
  24531. function toKey(value) {
  24532. if (typeof value == 'string' || isSymbol(value)) {
  24533. return value;
  24534. }
  24535. var result = (value + '');
  24536. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24537. }
  24538. /**
  24539. * Converts `func` to its source code.
  24540. *
  24541. * @private
  24542. * @param {Function} func The function to convert.
  24543. * @returns {string} Returns the source code.
  24544. */
  24545. function toSource(func) {
  24546. if (func != null) {
  24547. try {
  24548. return funcToString.call(func);
  24549. } catch (e) {}
  24550. try {
  24551. return (func + '');
  24552. } catch (e) {}
  24553. }
  24554. return '';
  24555. }
  24556. /**
  24557. * Updates wrapper `details` based on `bitmask` flags.
  24558. *
  24559. * @private
  24560. * @returns {Array} details The details to modify.
  24561. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24562. * @returns {Array} Returns `details`.
  24563. */
  24564. function updateWrapDetails(details, bitmask) {
  24565. arrayEach(wrapFlags, function(pair) {
  24566. var value = '_.' + pair[0];
  24567. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24568. details.push(value);
  24569. }
  24570. });
  24571. return details.sort();
  24572. }
  24573. /**
  24574. * Creates a clone of `wrapper`.
  24575. *
  24576. * @private
  24577. * @param {Object} wrapper The wrapper to clone.
  24578. * @returns {Object} Returns the cloned wrapper.
  24579. */
  24580. function wrapperClone(wrapper) {
  24581. if (wrapper instanceof LazyWrapper) {
  24582. return wrapper.clone();
  24583. }
  24584. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24585. result.__actions__ = copyArray(wrapper.__actions__);
  24586. result.__index__ = wrapper.__index__;
  24587. result.__values__ = wrapper.__values__;
  24588. return result;
  24589. }
  24590. /*------------------------------------------------------------------------*/
  24591. /**
  24592. * Creates an array of elements split into groups the length of `size`.
  24593. * If `array` can't be split evenly, the final chunk will be the remaining
  24594. * elements.
  24595. *
  24596. * @static
  24597. * @memberOf _
  24598. * @since 3.0.0
  24599. * @category Array
  24600. * @param {Array} array The array to process.
  24601. * @param {number} [size=1] The length of each chunk
  24602. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24603. * @returns {Array} Returns the new array of chunks.
  24604. * @example
  24605. *
  24606. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24607. * // => [['a', 'b'], ['c', 'd']]
  24608. *
  24609. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24610. * // => [['a', 'b', 'c'], ['d']]
  24611. */
  24612. function chunk(array, size, guard) {
  24613. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24614. size = 1;
  24615. } else {
  24616. size = nativeMax(toInteger(size), 0);
  24617. }
  24618. var length = array == null ? 0 : array.length;
  24619. if (!length || size < 1) {
  24620. return [];
  24621. }
  24622. var index = 0,
  24623. resIndex = 0,
  24624. result = Array(nativeCeil(length / size));
  24625. while (index < length) {
  24626. result[resIndex++] = baseSlice(array, index, (index += size));
  24627. }
  24628. return result;
  24629. }
  24630. /**
  24631. * Creates an array with all falsey values removed. The values `false`, `null`,
  24632. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24633. *
  24634. * @static
  24635. * @memberOf _
  24636. * @since 0.1.0
  24637. * @category Array
  24638. * @param {Array} array The array to compact.
  24639. * @returns {Array} Returns the new array of filtered values.
  24640. * @example
  24641. *
  24642. * _.compact([0, 1, false, 2, '', 3]);
  24643. * // => [1, 2, 3]
  24644. */
  24645. function compact(array) {
  24646. var index = -1,
  24647. length = array == null ? 0 : array.length,
  24648. resIndex = 0,
  24649. result = [];
  24650. while (++index < length) {
  24651. var value = array[index];
  24652. if (value) {
  24653. result[resIndex++] = value;
  24654. }
  24655. }
  24656. return result;
  24657. }
  24658. /**
  24659. * Creates a new array concatenating `array` with any additional arrays
  24660. * and/or values.
  24661. *
  24662. * @static
  24663. * @memberOf _
  24664. * @since 4.0.0
  24665. * @category Array
  24666. * @param {Array} array The array to concatenate.
  24667. * @param {...*} [values] The values to concatenate.
  24668. * @returns {Array} Returns the new concatenated array.
  24669. * @example
  24670. *
  24671. * var array = [1];
  24672. * var other = _.concat(array, 2, [3], [[4]]);
  24673. *
  24674. * console.log(other);
  24675. * // => [1, 2, 3, [4]]
  24676. *
  24677. * console.log(array);
  24678. * // => [1]
  24679. */
  24680. function concat() {
  24681. var length = arguments.length;
  24682. if (!length) {
  24683. return [];
  24684. }
  24685. var args = Array(length - 1),
  24686. array = arguments[0],
  24687. index = length;
  24688. while (index--) {
  24689. args[index - 1] = arguments[index];
  24690. }
  24691. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24692. }
  24693. /**
  24694. * Creates an array of `array` values not included in the other given arrays
  24695. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24696. * for equality comparisons. The order and references of result values are
  24697. * determined by the first array.
  24698. *
  24699. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24700. *
  24701. * @static
  24702. * @memberOf _
  24703. * @since 0.1.0
  24704. * @category Array
  24705. * @param {Array} array The array to inspect.
  24706. * @param {...Array} [values] The values to exclude.
  24707. * @returns {Array} Returns the new array of filtered values.
  24708. * @see _.without, _.xor
  24709. * @example
  24710. *
  24711. * _.difference([2, 1], [2, 3]);
  24712. * // => [1]
  24713. */
  24714. var difference = baseRest(function(array, values) {
  24715. return isArrayLikeObject(array)
  24716. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24717. : [];
  24718. });
  24719. /**
  24720. * This method is like `_.difference` except that it accepts `iteratee` which
  24721. * is invoked for each element of `array` and `values` to generate the criterion
  24722. * by which they're compared. The order and references of result values are
  24723. * determined by the first array. The iteratee is invoked with one argument:
  24724. * (value).
  24725. *
  24726. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24727. *
  24728. * @static
  24729. * @memberOf _
  24730. * @since 4.0.0
  24731. * @category Array
  24732. * @param {Array} array The array to inspect.
  24733. * @param {...Array} [values] The values to exclude.
  24734. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24735. * @returns {Array} Returns the new array of filtered values.
  24736. * @example
  24737. *
  24738. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24739. * // => [1.2]
  24740. *
  24741. * // The `_.property` iteratee shorthand.
  24742. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24743. * // => [{ 'x': 2 }]
  24744. */
  24745. var differenceBy = baseRest(function(array, values) {
  24746. var iteratee = last(values);
  24747. if (isArrayLikeObject(iteratee)) {
  24748. iteratee = undefined;
  24749. }
  24750. return isArrayLikeObject(array)
  24751. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24752. : [];
  24753. });
  24754. /**
  24755. * This method is like `_.difference` except that it accepts `comparator`
  24756. * which is invoked to compare elements of `array` to `values`. The order and
  24757. * references of result values are determined by the first array. The comparator
  24758. * is invoked with two arguments: (arrVal, othVal).
  24759. *
  24760. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24761. *
  24762. * @static
  24763. * @memberOf _
  24764. * @since 4.0.0
  24765. * @category Array
  24766. * @param {Array} array The array to inspect.
  24767. * @param {...Array} [values] The values to exclude.
  24768. * @param {Function} [comparator] The comparator invoked per element.
  24769. * @returns {Array} Returns the new array of filtered values.
  24770. * @example
  24771. *
  24772. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24773. *
  24774. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24775. * // => [{ 'x': 2, 'y': 1 }]
  24776. */
  24777. var differenceWith = baseRest(function(array, values) {
  24778. var comparator = last(values);
  24779. if (isArrayLikeObject(comparator)) {
  24780. comparator = undefined;
  24781. }
  24782. return isArrayLikeObject(array)
  24783. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24784. : [];
  24785. });
  24786. /**
  24787. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24788. *
  24789. * @static
  24790. * @memberOf _
  24791. * @since 0.5.0
  24792. * @category Array
  24793. * @param {Array} array The array to query.
  24794. * @param {number} [n=1] The number of elements to drop.
  24795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24796. * @returns {Array} Returns the slice of `array`.
  24797. * @example
  24798. *
  24799. * _.drop([1, 2, 3]);
  24800. * // => [2, 3]
  24801. *
  24802. * _.drop([1, 2, 3], 2);
  24803. * // => [3]
  24804. *
  24805. * _.drop([1, 2, 3], 5);
  24806. * // => []
  24807. *
  24808. * _.drop([1, 2, 3], 0);
  24809. * // => [1, 2, 3]
  24810. */
  24811. function drop(array, n, guard) {
  24812. var length = array == null ? 0 : array.length;
  24813. if (!length) {
  24814. return [];
  24815. }
  24816. n = (guard || n === undefined) ? 1 : toInteger(n);
  24817. return baseSlice(array, n < 0 ? 0 : n, length);
  24818. }
  24819. /**
  24820. * Creates a slice of `array` with `n` elements dropped from the end.
  24821. *
  24822. * @static
  24823. * @memberOf _
  24824. * @since 3.0.0
  24825. * @category Array
  24826. * @param {Array} array The array to query.
  24827. * @param {number} [n=1] The number of elements to drop.
  24828. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24829. * @returns {Array} Returns the slice of `array`.
  24830. * @example
  24831. *
  24832. * _.dropRight([1, 2, 3]);
  24833. * // => [1, 2]
  24834. *
  24835. * _.dropRight([1, 2, 3], 2);
  24836. * // => [1]
  24837. *
  24838. * _.dropRight([1, 2, 3], 5);
  24839. * // => []
  24840. *
  24841. * _.dropRight([1, 2, 3], 0);
  24842. * // => [1, 2, 3]
  24843. */
  24844. function dropRight(array, n, guard) {
  24845. var length = array == null ? 0 : array.length;
  24846. if (!length) {
  24847. return [];
  24848. }
  24849. n = (guard || n === undefined) ? 1 : toInteger(n);
  24850. n = length - n;
  24851. return baseSlice(array, 0, n < 0 ? 0 : n);
  24852. }
  24853. /**
  24854. * Creates a slice of `array` excluding elements dropped from the end.
  24855. * Elements are dropped until `predicate` returns falsey. The predicate is
  24856. * invoked with three arguments: (value, index, array).
  24857. *
  24858. * @static
  24859. * @memberOf _
  24860. * @since 3.0.0
  24861. * @category Array
  24862. * @param {Array} array The array to query.
  24863. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24864. * @returns {Array} Returns the slice of `array`.
  24865. * @example
  24866. *
  24867. * var users = [
  24868. * { 'user': 'barney', 'active': true },
  24869. * { 'user': 'fred', 'active': false },
  24870. * { 'user': 'pebbles', 'active': false }
  24871. * ];
  24872. *
  24873. * _.dropRightWhile(users, function(o) { return !o.active; });
  24874. * // => objects for ['barney']
  24875. *
  24876. * // The `_.matches` iteratee shorthand.
  24877. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24878. * // => objects for ['barney', 'fred']
  24879. *
  24880. * // The `_.matchesProperty` iteratee shorthand.
  24881. * _.dropRightWhile(users, ['active', false]);
  24882. * // => objects for ['barney']
  24883. *
  24884. * // The `_.property` iteratee shorthand.
  24885. * _.dropRightWhile(users, 'active');
  24886. * // => objects for ['barney', 'fred', 'pebbles']
  24887. */
  24888. function dropRightWhile(array, predicate) {
  24889. return (array && array.length)
  24890. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24891. : [];
  24892. }
  24893. /**
  24894. * Creates a slice of `array` excluding elements dropped from the beginning.
  24895. * Elements are dropped until `predicate` returns falsey. The predicate is
  24896. * invoked with three arguments: (value, index, array).
  24897. *
  24898. * @static
  24899. * @memberOf _
  24900. * @since 3.0.0
  24901. * @category Array
  24902. * @param {Array} array The array to query.
  24903. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24904. * @returns {Array} Returns the slice of `array`.
  24905. * @example
  24906. *
  24907. * var users = [
  24908. * { 'user': 'barney', 'active': false },
  24909. * { 'user': 'fred', 'active': false },
  24910. * { 'user': 'pebbles', 'active': true }
  24911. * ];
  24912. *
  24913. * _.dropWhile(users, function(o) { return !o.active; });
  24914. * // => objects for ['pebbles']
  24915. *
  24916. * // The `_.matches` iteratee shorthand.
  24917. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24918. * // => objects for ['fred', 'pebbles']
  24919. *
  24920. * // The `_.matchesProperty` iteratee shorthand.
  24921. * _.dropWhile(users, ['active', false]);
  24922. * // => objects for ['pebbles']
  24923. *
  24924. * // The `_.property` iteratee shorthand.
  24925. * _.dropWhile(users, 'active');
  24926. * // => objects for ['barney', 'fred', 'pebbles']
  24927. */
  24928. function dropWhile(array, predicate) {
  24929. return (array && array.length)
  24930. ? baseWhile(array, getIteratee(predicate, 3), true)
  24931. : [];
  24932. }
  24933. /**
  24934. * Fills elements of `array` with `value` from `start` up to, but not
  24935. * including, `end`.
  24936. *
  24937. * **Note:** This method mutates `array`.
  24938. *
  24939. * @static
  24940. * @memberOf _
  24941. * @since 3.2.0
  24942. * @category Array
  24943. * @param {Array} array The array to fill.
  24944. * @param {*} value The value to fill `array` with.
  24945. * @param {number} [start=0] The start position.
  24946. * @param {number} [end=array.length] The end position.
  24947. * @returns {Array} Returns `array`.
  24948. * @example
  24949. *
  24950. * var array = [1, 2, 3];
  24951. *
  24952. * _.fill(array, 'a');
  24953. * console.log(array);
  24954. * // => ['a', 'a', 'a']
  24955. *
  24956. * _.fill(Array(3), 2);
  24957. * // => [2, 2, 2]
  24958. *
  24959. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24960. * // => [4, '*', '*', 10]
  24961. */
  24962. function fill(array, value, start, end) {
  24963. var length = array == null ? 0 : array.length;
  24964. if (!length) {
  24965. return [];
  24966. }
  24967. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24968. start = 0;
  24969. end = length;
  24970. }
  24971. return baseFill(array, value, start, end);
  24972. }
  24973. /**
  24974. * This method is like `_.find` except that it returns the index of the first
  24975. * element `predicate` returns truthy for instead of the element itself.
  24976. *
  24977. * @static
  24978. * @memberOf _
  24979. * @since 1.1.0
  24980. * @category Array
  24981. * @param {Array} array The array to inspect.
  24982. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24983. * @param {number} [fromIndex=0] The index to search from.
  24984. * @returns {number} Returns the index of the found element, else `-1`.
  24985. * @example
  24986. *
  24987. * var users = [
  24988. * { 'user': 'barney', 'active': false },
  24989. * { 'user': 'fred', 'active': false },
  24990. * { 'user': 'pebbles', 'active': true }
  24991. * ];
  24992. *
  24993. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24994. * // => 0
  24995. *
  24996. * // The `_.matches` iteratee shorthand.
  24997. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24998. * // => 1
  24999. *
  25000. * // The `_.matchesProperty` iteratee shorthand.
  25001. * _.findIndex(users, ['active', false]);
  25002. * // => 0
  25003. *
  25004. * // The `_.property` iteratee shorthand.
  25005. * _.findIndex(users, 'active');
  25006. * // => 2
  25007. */
  25008. function findIndex(array, predicate, fromIndex) {
  25009. var length = array == null ? 0 : array.length;
  25010. if (!length) {
  25011. return -1;
  25012. }
  25013. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25014. if (index < 0) {
  25015. index = nativeMax(length + index, 0);
  25016. }
  25017. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25018. }
  25019. /**
  25020. * This method is like `_.findIndex` except that it iterates over elements
  25021. * of `collection` from right to left.
  25022. *
  25023. * @static
  25024. * @memberOf _
  25025. * @since 2.0.0
  25026. * @category Array
  25027. * @param {Array} array The array to inspect.
  25028. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25029. * @param {number} [fromIndex=array.length-1] The index to search from.
  25030. * @returns {number} Returns the index of the found element, else `-1`.
  25031. * @example
  25032. *
  25033. * var users = [
  25034. * { 'user': 'barney', 'active': true },
  25035. * { 'user': 'fred', 'active': false },
  25036. * { 'user': 'pebbles', 'active': false }
  25037. * ];
  25038. *
  25039. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25040. * // => 2
  25041. *
  25042. * // The `_.matches` iteratee shorthand.
  25043. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25044. * // => 0
  25045. *
  25046. * // The `_.matchesProperty` iteratee shorthand.
  25047. * _.findLastIndex(users, ['active', false]);
  25048. * // => 2
  25049. *
  25050. * // The `_.property` iteratee shorthand.
  25051. * _.findLastIndex(users, 'active');
  25052. * // => 0
  25053. */
  25054. function findLastIndex(array, predicate, fromIndex) {
  25055. var length = array == null ? 0 : array.length;
  25056. if (!length) {
  25057. return -1;
  25058. }
  25059. var index = length - 1;
  25060. if (fromIndex !== undefined) {
  25061. index = toInteger(fromIndex);
  25062. index = fromIndex < 0
  25063. ? nativeMax(length + index, 0)
  25064. : nativeMin(index, length - 1);
  25065. }
  25066. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25067. }
  25068. /**
  25069. * Flattens `array` a single level deep.
  25070. *
  25071. * @static
  25072. * @memberOf _
  25073. * @since 0.1.0
  25074. * @category Array
  25075. * @param {Array} array The array to flatten.
  25076. * @returns {Array} Returns the new flattened array.
  25077. * @example
  25078. *
  25079. * _.flatten([1, [2, [3, [4]], 5]]);
  25080. * // => [1, 2, [3, [4]], 5]
  25081. */
  25082. function flatten(array) {
  25083. var length = array == null ? 0 : array.length;
  25084. return length ? baseFlatten(array, 1) : [];
  25085. }
  25086. /**
  25087. * Recursively flattens `array`.
  25088. *
  25089. * @static
  25090. * @memberOf _
  25091. * @since 3.0.0
  25092. * @category Array
  25093. * @param {Array} array The array to flatten.
  25094. * @returns {Array} Returns the new flattened array.
  25095. * @example
  25096. *
  25097. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25098. * // => [1, 2, 3, 4, 5]
  25099. */
  25100. function flattenDeep(array) {
  25101. var length = array == null ? 0 : array.length;
  25102. return length ? baseFlatten(array, INFINITY) : [];
  25103. }
  25104. /**
  25105. * Recursively flatten `array` up to `depth` times.
  25106. *
  25107. * @static
  25108. * @memberOf _
  25109. * @since 4.4.0
  25110. * @category Array
  25111. * @param {Array} array The array to flatten.
  25112. * @param {number} [depth=1] The maximum recursion depth.
  25113. * @returns {Array} Returns the new flattened array.
  25114. * @example
  25115. *
  25116. * var array = [1, [2, [3, [4]], 5]];
  25117. *
  25118. * _.flattenDepth(array, 1);
  25119. * // => [1, 2, [3, [4]], 5]
  25120. *
  25121. * _.flattenDepth(array, 2);
  25122. * // => [1, 2, 3, [4], 5]
  25123. */
  25124. function flattenDepth(array, depth) {
  25125. var length = array == null ? 0 : array.length;
  25126. if (!length) {
  25127. return [];
  25128. }
  25129. depth = depth === undefined ? 1 : toInteger(depth);
  25130. return baseFlatten(array, depth);
  25131. }
  25132. /**
  25133. * The inverse of `_.toPairs`; this method returns an object composed
  25134. * from key-value `pairs`.
  25135. *
  25136. * @static
  25137. * @memberOf _
  25138. * @since 4.0.0
  25139. * @category Array
  25140. * @param {Array} pairs The key-value pairs.
  25141. * @returns {Object} Returns the new object.
  25142. * @example
  25143. *
  25144. * _.fromPairs([['a', 1], ['b', 2]]);
  25145. * // => { 'a': 1, 'b': 2 }
  25146. */
  25147. function fromPairs(pairs) {
  25148. var index = -1,
  25149. length = pairs == null ? 0 : pairs.length,
  25150. result = {};
  25151. while (++index < length) {
  25152. var pair = pairs[index];
  25153. result[pair[0]] = pair[1];
  25154. }
  25155. return result;
  25156. }
  25157. /**
  25158. * Gets the first element of `array`.
  25159. *
  25160. * @static
  25161. * @memberOf _
  25162. * @since 0.1.0
  25163. * @alias first
  25164. * @category Array
  25165. * @param {Array} array The array to query.
  25166. * @returns {*} Returns the first element of `array`.
  25167. * @example
  25168. *
  25169. * _.head([1, 2, 3]);
  25170. * // => 1
  25171. *
  25172. * _.head([]);
  25173. * // => undefined
  25174. */
  25175. function head(array) {
  25176. return (array && array.length) ? array[0] : undefined;
  25177. }
  25178. /**
  25179. * Gets the index at which the first occurrence of `value` is found in `array`
  25180. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25181. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25182. * offset from the end of `array`.
  25183. *
  25184. * @static
  25185. * @memberOf _
  25186. * @since 0.1.0
  25187. * @category Array
  25188. * @param {Array} array The array to inspect.
  25189. * @param {*} value The value to search for.
  25190. * @param {number} [fromIndex=0] The index to search from.
  25191. * @returns {number} Returns the index of the matched value, else `-1`.
  25192. * @example
  25193. *
  25194. * _.indexOf([1, 2, 1, 2], 2);
  25195. * // => 1
  25196. *
  25197. * // Search from the `fromIndex`.
  25198. * _.indexOf([1, 2, 1, 2], 2, 2);
  25199. * // => 3
  25200. */
  25201. function indexOf(array, value, fromIndex) {
  25202. var length = array == null ? 0 : array.length;
  25203. if (!length) {
  25204. return -1;
  25205. }
  25206. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25207. if (index < 0) {
  25208. index = nativeMax(length + index, 0);
  25209. }
  25210. return baseIndexOf(array, value, index);
  25211. }
  25212. /**
  25213. * Gets all but the last element of `array`.
  25214. *
  25215. * @static
  25216. * @memberOf _
  25217. * @since 0.1.0
  25218. * @category Array
  25219. * @param {Array} array The array to query.
  25220. * @returns {Array} Returns the slice of `array`.
  25221. * @example
  25222. *
  25223. * _.initial([1, 2, 3]);
  25224. * // => [1, 2]
  25225. */
  25226. function initial(array) {
  25227. var length = array == null ? 0 : array.length;
  25228. return length ? baseSlice(array, 0, -1) : [];
  25229. }
  25230. /**
  25231. * Creates an array of unique values that are included in all given arrays
  25232. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25233. * for equality comparisons. The order and references of result values are
  25234. * determined by the first array.
  25235. *
  25236. * @static
  25237. * @memberOf _
  25238. * @since 0.1.0
  25239. * @category Array
  25240. * @param {...Array} [arrays] The arrays to inspect.
  25241. * @returns {Array} Returns the new array of intersecting values.
  25242. * @example
  25243. *
  25244. * _.intersection([2, 1], [2, 3]);
  25245. * // => [2]
  25246. */
  25247. var intersection = baseRest(function(arrays) {
  25248. var mapped = arrayMap(arrays, castArrayLikeObject);
  25249. return (mapped.length && mapped[0] === arrays[0])
  25250. ? baseIntersection(mapped)
  25251. : [];
  25252. });
  25253. /**
  25254. * This method is like `_.intersection` except that it accepts `iteratee`
  25255. * which is invoked for each element of each `arrays` to generate the criterion
  25256. * by which they're compared. The order and references of result values are
  25257. * determined by the first array. The iteratee is invoked with one argument:
  25258. * (value).
  25259. *
  25260. * @static
  25261. * @memberOf _
  25262. * @since 4.0.0
  25263. * @category Array
  25264. * @param {...Array} [arrays] The arrays to inspect.
  25265. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25266. * @returns {Array} Returns the new array of intersecting values.
  25267. * @example
  25268. *
  25269. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25270. * // => [2.1]
  25271. *
  25272. * // The `_.property` iteratee shorthand.
  25273. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25274. * // => [{ 'x': 1 }]
  25275. */
  25276. var intersectionBy = baseRest(function(arrays) {
  25277. var iteratee = last(arrays),
  25278. mapped = arrayMap(arrays, castArrayLikeObject);
  25279. if (iteratee === last(mapped)) {
  25280. iteratee = undefined;
  25281. } else {
  25282. mapped.pop();
  25283. }
  25284. return (mapped.length && mapped[0] === arrays[0])
  25285. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25286. : [];
  25287. });
  25288. /**
  25289. * This method is like `_.intersection` except that it accepts `comparator`
  25290. * which is invoked to compare elements of `arrays`. The order and references
  25291. * of result values are determined by the first array. The comparator is
  25292. * invoked with two arguments: (arrVal, othVal).
  25293. *
  25294. * @static
  25295. * @memberOf _
  25296. * @since 4.0.0
  25297. * @category Array
  25298. * @param {...Array} [arrays] The arrays to inspect.
  25299. * @param {Function} [comparator] The comparator invoked per element.
  25300. * @returns {Array} Returns the new array of intersecting values.
  25301. * @example
  25302. *
  25303. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25304. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25305. *
  25306. * _.intersectionWith(objects, others, _.isEqual);
  25307. * // => [{ 'x': 1, 'y': 2 }]
  25308. */
  25309. var intersectionWith = baseRest(function(arrays) {
  25310. var comparator = last(arrays),
  25311. mapped = arrayMap(arrays, castArrayLikeObject);
  25312. comparator = typeof comparator == 'function' ? comparator : undefined;
  25313. if (comparator) {
  25314. mapped.pop();
  25315. }
  25316. return (mapped.length && mapped[0] === arrays[0])
  25317. ? baseIntersection(mapped, undefined, comparator)
  25318. : [];
  25319. });
  25320. /**
  25321. * Converts all elements in `array` into a string separated by `separator`.
  25322. *
  25323. * @static
  25324. * @memberOf _
  25325. * @since 4.0.0
  25326. * @category Array
  25327. * @param {Array} array The array to convert.
  25328. * @param {string} [separator=','] The element separator.
  25329. * @returns {string} Returns the joined string.
  25330. * @example
  25331. *
  25332. * _.join(['a', 'b', 'c'], '~');
  25333. * // => 'a~b~c'
  25334. */
  25335. function join(array, separator) {
  25336. return array == null ? '' : nativeJoin.call(array, separator);
  25337. }
  25338. /**
  25339. * Gets the last element of `array`.
  25340. *
  25341. * @static
  25342. * @memberOf _
  25343. * @since 0.1.0
  25344. * @category Array
  25345. * @param {Array} array The array to query.
  25346. * @returns {*} Returns the last element of `array`.
  25347. * @example
  25348. *
  25349. * _.last([1, 2, 3]);
  25350. * // => 3
  25351. */
  25352. function last(array) {
  25353. var length = array == null ? 0 : array.length;
  25354. return length ? array[length - 1] : undefined;
  25355. }
  25356. /**
  25357. * This method is like `_.indexOf` except that it iterates over elements of
  25358. * `array` from right to left.
  25359. *
  25360. * @static
  25361. * @memberOf _
  25362. * @since 0.1.0
  25363. * @category Array
  25364. * @param {Array} array The array to inspect.
  25365. * @param {*} value The value to search for.
  25366. * @param {number} [fromIndex=array.length-1] The index to search from.
  25367. * @returns {number} Returns the index of the matched value, else `-1`.
  25368. * @example
  25369. *
  25370. * _.lastIndexOf([1, 2, 1, 2], 2);
  25371. * // => 3
  25372. *
  25373. * // Search from the `fromIndex`.
  25374. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25375. * // => 1
  25376. */
  25377. function lastIndexOf(array, value, fromIndex) {
  25378. var length = array == null ? 0 : array.length;
  25379. if (!length) {
  25380. return -1;
  25381. }
  25382. var index = length;
  25383. if (fromIndex !== undefined) {
  25384. index = toInteger(fromIndex);
  25385. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25386. }
  25387. return value === value
  25388. ? strictLastIndexOf(array, value, index)
  25389. : baseFindIndex(array, baseIsNaN, index, true);
  25390. }
  25391. /**
  25392. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25393. * element from the end is returned.
  25394. *
  25395. * @static
  25396. * @memberOf _
  25397. * @since 4.11.0
  25398. * @category Array
  25399. * @param {Array} array The array to query.
  25400. * @param {number} [n=0] The index of the element to return.
  25401. * @returns {*} Returns the nth element of `array`.
  25402. * @example
  25403. *
  25404. * var array = ['a', 'b', 'c', 'd'];
  25405. *
  25406. * _.nth(array, 1);
  25407. * // => 'b'
  25408. *
  25409. * _.nth(array, -2);
  25410. * // => 'c';
  25411. */
  25412. function nth(array, n) {
  25413. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25414. }
  25415. /**
  25416. * Removes all given values from `array` using
  25417. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25418. * for equality comparisons.
  25419. *
  25420. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25421. * to remove elements from an array by predicate.
  25422. *
  25423. * @static
  25424. * @memberOf _
  25425. * @since 2.0.0
  25426. * @category Array
  25427. * @param {Array} array The array to modify.
  25428. * @param {...*} [values] The values to remove.
  25429. * @returns {Array} Returns `array`.
  25430. * @example
  25431. *
  25432. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25433. *
  25434. * _.pull(array, 'a', 'c');
  25435. * console.log(array);
  25436. * // => ['b', 'b']
  25437. */
  25438. var pull = baseRest(pullAll);
  25439. /**
  25440. * This method is like `_.pull` except that it accepts an array of values to remove.
  25441. *
  25442. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25443. *
  25444. * @static
  25445. * @memberOf _
  25446. * @since 4.0.0
  25447. * @category Array
  25448. * @param {Array} array The array to modify.
  25449. * @param {Array} values The values to remove.
  25450. * @returns {Array} Returns `array`.
  25451. * @example
  25452. *
  25453. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25454. *
  25455. * _.pullAll(array, ['a', 'c']);
  25456. * console.log(array);
  25457. * // => ['b', 'b']
  25458. */
  25459. function pullAll(array, values) {
  25460. return (array && array.length && values && values.length)
  25461. ? basePullAll(array, values)
  25462. : array;
  25463. }
  25464. /**
  25465. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25466. * invoked for each element of `array` and `values` to generate the criterion
  25467. * by which they're compared. The iteratee is invoked with one argument: (value).
  25468. *
  25469. * **Note:** Unlike `_.differenceBy`, 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. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25478. * @returns {Array} Returns `array`.
  25479. * @example
  25480. *
  25481. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25482. *
  25483. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25484. * console.log(array);
  25485. * // => [{ 'x': 2 }]
  25486. */
  25487. function pullAllBy(array, values, iteratee) {
  25488. return (array && array.length && values && values.length)
  25489. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25490. : array;
  25491. }
  25492. /**
  25493. * This method is like `_.pullAll` except that it accepts `comparator` which
  25494. * is invoked to compare elements of `array` to `values`. The comparator is
  25495. * invoked with two arguments: (arrVal, othVal).
  25496. *
  25497. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25498. *
  25499. * @static
  25500. * @memberOf _
  25501. * @since 4.6.0
  25502. * @category Array
  25503. * @param {Array} array The array to modify.
  25504. * @param {Array} values The values to remove.
  25505. * @param {Function} [comparator] The comparator invoked per element.
  25506. * @returns {Array} Returns `array`.
  25507. * @example
  25508. *
  25509. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25510. *
  25511. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25512. * console.log(array);
  25513. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25514. */
  25515. function pullAllWith(array, values, comparator) {
  25516. return (array && array.length && values && values.length)
  25517. ? basePullAll(array, values, undefined, comparator)
  25518. : array;
  25519. }
  25520. /**
  25521. * Removes elements from `array` corresponding to `indexes` and returns an
  25522. * array of removed elements.
  25523. *
  25524. * **Note:** Unlike `_.at`, this method mutates `array`.
  25525. *
  25526. * @static
  25527. * @memberOf _
  25528. * @since 3.0.0
  25529. * @category Array
  25530. * @param {Array} array The array to modify.
  25531. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25532. * @returns {Array} Returns the new array of removed elements.
  25533. * @example
  25534. *
  25535. * var array = ['a', 'b', 'c', 'd'];
  25536. * var pulled = _.pullAt(array, [1, 3]);
  25537. *
  25538. * console.log(array);
  25539. * // => ['a', 'c']
  25540. *
  25541. * console.log(pulled);
  25542. * // => ['b', 'd']
  25543. */
  25544. var pullAt = flatRest(function(array, indexes) {
  25545. var length = array == null ? 0 : array.length,
  25546. result = baseAt(array, indexes);
  25547. basePullAt(array, arrayMap(indexes, function(index) {
  25548. return isIndex(index, length) ? +index : index;
  25549. }).sort(compareAscending));
  25550. return result;
  25551. });
  25552. /**
  25553. * Removes all elements from `array` that `predicate` returns truthy for
  25554. * and returns an array of the removed elements. The predicate is invoked
  25555. * with three arguments: (value, index, array).
  25556. *
  25557. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25558. * to pull elements from an array by value.
  25559. *
  25560. * @static
  25561. * @memberOf _
  25562. * @since 2.0.0
  25563. * @category Array
  25564. * @param {Array} array The array to modify.
  25565. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25566. * @returns {Array} Returns the new array of removed elements.
  25567. * @example
  25568. *
  25569. * var array = [1, 2, 3, 4];
  25570. * var evens = _.remove(array, function(n) {
  25571. * return n % 2 == 0;
  25572. * });
  25573. *
  25574. * console.log(array);
  25575. * // => [1, 3]
  25576. *
  25577. * console.log(evens);
  25578. * // => [2, 4]
  25579. */
  25580. function remove(array, predicate) {
  25581. var result = [];
  25582. if (!(array && array.length)) {
  25583. return result;
  25584. }
  25585. var index = -1,
  25586. indexes = [],
  25587. length = array.length;
  25588. predicate = getIteratee(predicate, 3);
  25589. while (++index < length) {
  25590. var value = array[index];
  25591. if (predicate(value, index, array)) {
  25592. result.push(value);
  25593. indexes.push(index);
  25594. }
  25595. }
  25596. basePullAt(array, indexes);
  25597. return result;
  25598. }
  25599. /**
  25600. * Reverses `array` so that the first element becomes the last, the second
  25601. * element becomes the second to last, and so on.
  25602. *
  25603. * **Note:** This method mutates `array` and is based on
  25604. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25605. *
  25606. * @static
  25607. * @memberOf _
  25608. * @since 4.0.0
  25609. * @category Array
  25610. * @param {Array} array The array to modify.
  25611. * @returns {Array} Returns `array`.
  25612. * @example
  25613. *
  25614. * var array = [1, 2, 3];
  25615. *
  25616. * _.reverse(array);
  25617. * // => [3, 2, 1]
  25618. *
  25619. * console.log(array);
  25620. * // => [3, 2, 1]
  25621. */
  25622. function reverse(array) {
  25623. return array == null ? array : nativeReverse.call(array);
  25624. }
  25625. /**
  25626. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25627. *
  25628. * **Note:** This method is used instead of
  25629. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25630. * returned.
  25631. *
  25632. * @static
  25633. * @memberOf _
  25634. * @since 3.0.0
  25635. * @category Array
  25636. * @param {Array} array The array to slice.
  25637. * @param {number} [start=0] The start position.
  25638. * @param {number} [end=array.length] The end position.
  25639. * @returns {Array} Returns the slice of `array`.
  25640. */
  25641. function slice(array, start, end) {
  25642. var length = array == null ? 0 : array.length;
  25643. if (!length) {
  25644. return [];
  25645. }
  25646. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25647. start = 0;
  25648. end = length;
  25649. }
  25650. else {
  25651. start = start == null ? 0 : toInteger(start);
  25652. end = end === undefined ? length : toInteger(end);
  25653. }
  25654. return baseSlice(array, start, end);
  25655. }
  25656. /**
  25657. * Uses a binary search to determine the lowest index at which `value`
  25658. * should be inserted into `array` in order to maintain its sort order.
  25659. *
  25660. * @static
  25661. * @memberOf _
  25662. * @since 0.1.0
  25663. * @category Array
  25664. * @param {Array} array The sorted array to inspect.
  25665. * @param {*} value The value to evaluate.
  25666. * @returns {number} Returns the index at which `value` should be inserted
  25667. * into `array`.
  25668. * @example
  25669. *
  25670. * _.sortedIndex([30, 50], 40);
  25671. * // => 1
  25672. */
  25673. function sortedIndex(array, value) {
  25674. return baseSortedIndex(array, value);
  25675. }
  25676. /**
  25677. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25678. * which is invoked for `value` and each element of `array` to compute their
  25679. * sort ranking. The iteratee is invoked with one argument: (value).
  25680. *
  25681. * @static
  25682. * @memberOf _
  25683. * @since 4.0.0
  25684. * @category Array
  25685. * @param {Array} array The sorted array to inspect.
  25686. * @param {*} value The value to evaluate.
  25687. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25688. * @returns {number} Returns the index at which `value` should be inserted
  25689. * into `array`.
  25690. * @example
  25691. *
  25692. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25693. *
  25694. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25695. * // => 0
  25696. *
  25697. * // The `_.property` iteratee shorthand.
  25698. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25699. * // => 0
  25700. */
  25701. function sortedIndexBy(array, value, iteratee) {
  25702. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25703. }
  25704. /**
  25705. * This method is like `_.indexOf` except that it performs a binary
  25706. * search on a sorted `array`.
  25707. *
  25708. * @static
  25709. * @memberOf _
  25710. * @since 4.0.0
  25711. * @category Array
  25712. * @param {Array} array The array to inspect.
  25713. * @param {*} value The value to search for.
  25714. * @returns {number} Returns the index of the matched value, else `-1`.
  25715. * @example
  25716. *
  25717. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25718. * // => 1
  25719. */
  25720. function sortedIndexOf(array, value) {
  25721. var length = array == null ? 0 : array.length;
  25722. if (length) {
  25723. var index = baseSortedIndex(array, value);
  25724. if (index < length && eq(array[index], value)) {
  25725. return index;
  25726. }
  25727. }
  25728. return -1;
  25729. }
  25730. /**
  25731. * This method is like `_.sortedIndex` except that it returns the highest
  25732. * index at which `value` should be inserted into `array` in order to
  25733. * maintain its sort order.
  25734. *
  25735. * @static
  25736. * @memberOf _
  25737. * @since 3.0.0
  25738. * @category Array
  25739. * @param {Array} array The sorted array to inspect.
  25740. * @param {*} value The value to evaluate.
  25741. * @returns {number} Returns the index at which `value` should be inserted
  25742. * into `array`.
  25743. * @example
  25744. *
  25745. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25746. * // => 4
  25747. */
  25748. function sortedLastIndex(array, value) {
  25749. return baseSortedIndex(array, value, true);
  25750. }
  25751. /**
  25752. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25753. * which is invoked for `value` and each element of `array` to compute their
  25754. * sort ranking. The iteratee is invoked with one argument: (value).
  25755. *
  25756. * @static
  25757. * @memberOf _
  25758. * @since 4.0.0
  25759. * @category Array
  25760. * @param {Array} array The sorted array to inspect.
  25761. * @param {*} value The value to evaluate.
  25762. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25763. * @returns {number} Returns the index at which `value` should be inserted
  25764. * into `array`.
  25765. * @example
  25766. *
  25767. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25768. *
  25769. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25770. * // => 1
  25771. *
  25772. * // The `_.property` iteratee shorthand.
  25773. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25774. * // => 1
  25775. */
  25776. function sortedLastIndexBy(array, value, iteratee) {
  25777. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25778. }
  25779. /**
  25780. * This method is like `_.lastIndexOf` except that it performs a binary
  25781. * search on a sorted `array`.
  25782. *
  25783. * @static
  25784. * @memberOf _
  25785. * @since 4.0.0
  25786. * @category Array
  25787. * @param {Array} array The array to inspect.
  25788. * @param {*} value The value to search for.
  25789. * @returns {number} Returns the index of the matched value, else `-1`.
  25790. * @example
  25791. *
  25792. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25793. * // => 3
  25794. */
  25795. function sortedLastIndexOf(array, value) {
  25796. var length = array == null ? 0 : array.length;
  25797. if (length) {
  25798. var index = baseSortedIndex(array, value, true) - 1;
  25799. if (eq(array[index], value)) {
  25800. return index;
  25801. }
  25802. }
  25803. return -1;
  25804. }
  25805. /**
  25806. * This method is like `_.uniq` except that it's designed and optimized
  25807. * for sorted arrays.
  25808. *
  25809. * @static
  25810. * @memberOf _
  25811. * @since 4.0.0
  25812. * @category Array
  25813. * @param {Array} array The array to inspect.
  25814. * @returns {Array} Returns the new duplicate free array.
  25815. * @example
  25816. *
  25817. * _.sortedUniq([1, 1, 2]);
  25818. * // => [1, 2]
  25819. */
  25820. function sortedUniq(array) {
  25821. return (array && array.length)
  25822. ? baseSortedUniq(array)
  25823. : [];
  25824. }
  25825. /**
  25826. * This method is like `_.uniqBy` except that it's designed and optimized
  25827. * for sorted arrays.
  25828. *
  25829. * @static
  25830. * @memberOf _
  25831. * @since 4.0.0
  25832. * @category Array
  25833. * @param {Array} array The array to inspect.
  25834. * @param {Function} [iteratee] The iteratee invoked per element.
  25835. * @returns {Array} Returns the new duplicate free array.
  25836. * @example
  25837. *
  25838. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25839. * // => [1.1, 2.3]
  25840. */
  25841. function sortedUniqBy(array, iteratee) {
  25842. return (array && array.length)
  25843. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25844. : [];
  25845. }
  25846. /**
  25847. * Gets all but the first element of `array`.
  25848. *
  25849. * @static
  25850. * @memberOf _
  25851. * @since 4.0.0
  25852. * @category Array
  25853. * @param {Array} array The array to query.
  25854. * @returns {Array} Returns the slice of `array`.
  25855. * @example
  25856. *
  25857. * _.tail([1, 2, 3]);
  25858. * // => [2, 3]
  25859. */
  25860. function tail(array) {
  25861. var length = array == null ? 0 : array.length;
  25862. return length ? baseSlice(array, 1, length) : [];
  25863. }
  25864. /**
  25865. * Creates a slice of `array` with `n` elements taken from the beginning.
  25866. *
  25867. * @static
  25868. * @memberOf _
  25869. * @since 0.1.0
  25870. * @category Array
  25871. * @param {Array} array The array to query.
  25872. * @param {number} [n=1] The number of elements to take.
  25873. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25874. * @returns {Array} Returns the slice of `array`.
  25875. * @example
  25876. *
  25877. * _.take([1, 2, 3]);
  25878. * // => [1]
  25879. *
  25880. * _.take([1, 2, 3], 2);
  25881. * // => [1, 2]
  25882. *
  25883. * _.take([1, 2, 3], 5);
  25884. * // => [1, 2, 3]
  25885. *
  25886. * _.take([1, 2, 3], 0);
  25887. * // => []
  25888. */
  25889. function take(array, n, guard) {
  25890. if (!(array && array.length)) {
  25891. return [];
  25892. }
  25893. n = (guard || n === undefined) ? 1 : toInteger(n);
  25894. return baseSlice(array, 0, n < 0 ? 0 : n);
  25895. }
  25896. /**
  25897. * Creates a slice of `array` with `n` elements taken from the end.
  25898. *
  25899. * @static
  25900. * @memberOf _
  25901. * @since 3.0.0
  25902. * @category Array
  25903. * @param {Array} array The array to query.
  25904. * @param {number} [n=1] The number of elements to take.
  25905. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25906. * @returns {Array} Returns the slice of `array`.
  25907. * @example
  25908. *
  25909. * _.takeRight([1, 2, 3]);
  25910. * // => [3]
  25911. *
  25912. * _.takeRight([1, 2, 3], 2);
  25913. * // => [2, 3]
  25914. *
  25915. * _.takeRight([1, 2, 3], 5);
  25916. * // => [1, 2, 3]
  25917. *
  25918. * _.takeRight([1, 2, 3], 0);
  25919. * // => []
  25920. */
  25921. function takeRight(array, n, guard) {
  25922. var length = array == null ? 0 : array.length;
  25923. if (!length) {
  25924. return [];
  25925. }
  25926. n = (guard || n === undefined) ? 1 : toInteger(n);
  25927. n = length - n;
  25928. return baseSlice(array, n < 0 ? 0 : n, length);
  25929. }
  25930. /**
  25931. * Creates a slice of `array` with elements taken from the end. Elements are
  25932. * taken until `predicate` returns falsey. The predicate is invoked with
  25933. * three arguments: (value, index, array).
  25934. *
  25935. * @static
  25936. * @memberOf _
  25937. * @since 3.0.0
  25938. * @category Array
  25939. * @param {Array} array The array to query.
  25940. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25941. * @returns {Array} Returns the slice of `array`.
  25942. * @example
  25943. *
  25944. * var users = [
  25945. * { 'user': 'barney', 'active': true },
  25946. * { 'user': 'fred', 'active': false },
  25947. * { 'user': 'pebbles', 'active': false }
  25948. * ];
  25949. *
  25950. * _.takeRightWhile(users, function(o) { return !o.active; });
  25951. * // => objects for ['fred', 'pebbles']
  25952. *
  25953. * // The `_.matches` iteratee shorthand.
  25954. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25955. * // => objects for ['pebbles']
  25956. *
  25957. * // The `_.matchesProperty` iteratee shorthand.
  25958. * _.takeRightWhile(users, ['active', false]);
  25959. * // => objects for ['fred', 'pebbles']
  25960. *
  25961. * // The `_.property` iteratee shorthand.
  25962. * _.takeRightWhile(users, 'active');
  25963. * // => []
  25964. */
  25965. function takeRightWhile(array, predicate) {
  25966. return (array && array.length)
  25967. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25968. : [];
  25969. }
  25970. /**
  25971. * Creates a slice of `array` with elements taken from the beginning. Elements
  25972. * are taken until `predicate` returns falsey. The predicate is invoked with
  25973. * three arguments: (value, index, array).
  25974. *
  25975. * @static
  25976. * @memberOf _
  25977. * @since 3.0.0
  25978. * @category Array
  25979. * @param {Array} array The array to query.
  25980. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25981. * @returns {Array} Returns the slice of `array`.
  25982. * @example
  25983. *
  25984. * var users = [
  25985. * { 'user': 'barney', 'active': false },
  25986. * { 'user': 'fred', 'active': false },
  25987. * { 'user': 'pebbles', 'active': true }
  25988. * ];
  25989. *
  25990. * _.takeWhile(users, function(o) { return !o.active; });
  25991. * // => objects for ['barney', 'fred']
  25992. *
  25993. * // The `_.matches` iteratee shorthand.
  25994. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25995. * // => objects for ['barney']
  25996. *
  25997. * // The `_.matchesProperty` iteratee shorthand.
  25998. * _.takeWhile(users, ['active', false]);
  25999. * // => objects for ['barney', 'fred']
  26000. *
  26001. * // The `_.property` iteratee shorthand.
  26002. * _.takeWhile(users, 'active');
  26003. * // => []
  26004. */
  26005. function takeWhile(array, predicate) {
  26006. return (array && array.length)
  26007. ? baseWhile(array, getIteratee(predicate, 3))
  26008. : [];
  26009. }
  26010. /**
  26011. * Creates an array of unique values, in order, from all given arrays using
  26012. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26013. * for equality comparisons.
  26014. *
  26015. * @static
  26016. * @memberOf _
  26017. * @since 0.1.0
  26018. * @category Array
  26019. * @param {...Array} [arrays] The arrays to inspect.
  26020. * @returns {Array} Returns the new array of combined values.
  26021. * @example
  26022. *
  26023. * _.union([2], [1, 2]);
  26024. * // => [2, 1]
  26025. */
  26026. var union = baseRest(function(arrays) {
  26027. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26028. });
  26029. /**
  26030. * This method is like `_.union` except that it accepts `iteratee` which is
  26031. * invoked for each element of each `arrays` to generate the criterion by
  26032. * which uniqueness is computed. Result values are chosen from the first
  26033. * array in which the value occurs. The iteratee is invoked with one argument:
  26034. * (value).
  26035. *
  26036. * @static
  26037. * @memberOf _
  26038. * @since 4.0.0
  26039. * @category Array
  26040. * @param {...Array} [arrays] The arrays to inspect.
  26041. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26042. * @returns {Array} Returns the new array of combined values.
  26043. * @example
  26044. *
  26045. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26046. * // => [2.1, 1.2]
  26047. *
  26048. * // The `_.property` iteratee shorthand.
  26049. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26050. * // => [{ 'x': 1 }, { 'x': 2 }]
  26051. */
  26052. var unionBy = baseRest(function(arrays) {
  26053. var iteratee = last(arrays);
  26054. if (isArrayLikeObject(iteratee)) {
  26055. iteratee = undefined;
  26056. }
  26057. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26058. });
  26059. /**
  26060. * This method is like `_.union` except that it accepts `comparator` which
  26061. * is invoked to compare elements of `arrays`. Result values are chosen from
  26062. * the first array in which the value occurs. The comparator is invoked
  26063. * with two arguments: (arrVal, othVal).
  26064. *
  26065. * @static
  26066. * @memberOf _
  26067. * @since 4.0.0
  26068. * @category Array
  26069. * @param {...Array} [arrays] The arrays to inspect.
  26070. * @param {Function} [comparator] The comparator invoked per element.
  26071. * @returns {Array} Returns the new array of combined values.
  26072. * @example
  26073. *
  26074. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26075. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26076. *
  26077. * _.unionWith(objects, others, _.isEqual);
  26078. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26079. */
  26080. var unionWith = baseRest(function(arrays) {
  26081. var comparator = last(arrays);
  26082. comparator = typeof comparator == 'function' ? comparator : undefined;
  26083. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26084. });
  26085. /**
  26086. * Creates a duplicate-free version of an array, using
  26087. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26088. * for equality comparisons, in which only the first occurrence of each element
  26089. * is kept. The order of result values is determined by the order they occur
  26090. * in the array.
  26091. *
  26092. * @static
  26093. * @memberOf _
  26094. * @since 0.1.0
  26095. * @category Array
  26096. * @param {Array} array The array to inspect.
  26097. * @returns {Array} Returns the new duplicate free array.
  26098. * @example
  26099. *
  26100. * _.uniq([2, 1, 2]);
  26101. * // => [2, 1]
  26102. */
  26103. function uniq(array) {
  26104. return (array && array.length) ? baseUniq(array) : [];
  26105. }
  26106. /**
  26107. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26108. * invoked for each element in `array` to generate the criterion by which
  26109. * uniqueness is computed. The order of result values is determined by the
  26110. * order they occur in the array. The iteratee is invoked with one argument:
  26111. * (value).
  26112. *
  26113. * @static
  26114. * @memberOf _
  26115. * @since 4.0.0
  26116. * @category Array
  26117. * @param {Array} array The array to inspect.
  26118. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26119. * @returns {Array} Returns the new duplicate free array.
  26120. * @example
  26121. *
  26122. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26123. * // => [2.1, 1.2]
  26124. *
  26125. * // The `_.property` iteratee shorthand.
  26126. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26127. * // => [{ 'x': 1 }, { 'x': 2 }]
  26128. */
  26129. function uniqBy(array, iteratee) {
  26130. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26131. }
  26132. /**
  26133. * This method is like `_.uniq` except that it accepts `comparator` which
  26134. * is invoked to compare elements of `array`. The order of result values is
  26135. * determined by the order they occur in the array.The comparator is invoked
  26136. * with two arguments: (arrVal, othVal).
  26137. *
  26138. * @static
  26139. * @memberOf _
  26140. * @since 4.0.0
  26141. * @category Array
  26142. * @param {Array} array The array to inspect.
  26143. * @param {Function} [comparator] The comparator invoked per element.
  26144. * @returns {Array} Returns the new duplicate free array.
  26145. * @example
  26146. *
  26147. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26148. *
  26149. * _.uniqWith(objects, _.isEqual);
  26150. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26151. */
  26152. function uniqWith(array, comparator) {
  26153. comparator = typeof comparator == 'function' ? comparator : undefined;
  26154. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26155. }
  26156. /**
  26157. * This method is like `_.zip` except that it accepts an array of grouped
  26158. * elements and creates an array regrouping the elements to their pre-zip
  26159. * configuration.
  26160. *
  26161. * @static
  26162. * @memberOf _
  26163. * @since 1.2.0
  26164. * @category Array
  26165. * @param {Array} array The array of grouped elements to process.
  26166. * @returns {Array} Returns the new array of regrouped elements.
  26167. * @example
  26168. *
  26169. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26170. * // => [['a', 1, true], ['b', 2, false]]
  26171. *
  26172. * _.unzip(zipped);
  26173. * // => [['a', 'b'], [1, 2], [true, false]]
  26174. */
  26175. function unzip(array) {
  26176. if (!(array && array.length)) {
  26177. return [];
  26178. }
  26179. var length = 0;
  26180. array = arrayFilter(array, function(group) {
  26181. if (isArrayLikeObject(group)) {
  26182. length = nativeMax(group.length, length);
  26183. return true;
  26184. }
  26185. });
  26186. return baseTimes(length, function(index) {
  26187. return arrayMap(array, baseProperty(index));
  26188. });
  26189. }
  26190. /**
  26191. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26192. * how regrouped values should be combined. The iteratee is invoked with the
  26193. * elements of each group: (...group).
  26194. *
  26195. * @static
  26196. * @memberOf _
  26197. * @since 3.8.0
  26198. * @category Array
  26199. * @param {Array} array The array of grouped elements to process.
  26200. * @param {Function} [iteratee=_.identity] The function to combine
  26201. * regrouped values.
  26202. * @returns {Array} Returns the new array of regrouped elements.
  26203. * @example
  26204. *
  26205. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26206. * // => [[1, 10, 100], [2, 20, 200]]
  26207. *
  26208. * _.unzipWith(zipped, _.add);
  26209. * // => [3, 30, 300]
  26210. */
  26211. function unzipWith(array, iteratee) {
  26212. if (!(array && array.length)) {
  26213. return [];
  26214. }
  26215. var result = unzip(array);
  26216. if (iteratee == null) {
  26217. return result;
  26218. }
  26219. return arrayMap(result, function(group) {
  26220. return apply(iteratee, undefined, group);
  26221. });
  26222. }
  26223. /**
  26224. * Creates an array excluding all given values using
  26225. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26226. * for equality comparisons.
  26227. *
  26228. * **Note:** Unlike `_.pull`, this method returns a new array.
  26229. *
  26230. * @static
  26231. * @memberOf _
  26232. * @since 0.1.0
  26233. * @category Array
  26234. * @param {Array} array The array to inspect.
  26235. * @param {...*} [values] The values to exclude.
  26236. * @returns {Array} Returns the new array of filtered values.
  26237. * @see _.difference, _.xor
  26238. * @example
  26239. *
  26240. * _.without([2, 1, 2, 3], 1, 2);
  26241. * // => [3]
  26242. */
  26243. var without = baseRest(function(array, values) {
  26244. return isArrayLikeObject(array)
  26245. ? baseDifference(array, values)
  26246. : [];
  26247. });
  26248. /**
  26249. * Creates an array of unique values that is the
  26250. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26251. * of the given arrays. The order of result values is determined by the order
  26252. * they occur in the arrays.
  26253. *
  26254. * @static
  26255. * @memberOf _
  26256. * @since 2.4.0
  26257. * @category Array
  26258. * @param {...Array} [arrays] The arrays to inspect.
  26259. * @returns {Array} Returns the new array of filtered values.
  26260. * @see _.difference, _.without
  26261. * @example
  26262. *
  26263. * _.xor([2, 1], [2, 3]);
  26264. * // => [1, 3]
  26265. */
  26266. var xor = baseRest(function(arrays) {
  26267. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26268. });
  26269. /**
  26270. * This method is like `_.xor` except that it accepts `iteratee` which is
  26271. * invoked for each element of each `arrays` to generate the criterion by
  26272. * which by which they're compared. The order of result values is determined
  26273. * by the order they occur in the arrays. The iteratee is invoked with one
  26274. * argument: (value).
  26275. *
  26276. * @static
  26277. * @memberOf _
  26278. * @since 4.0.0
  26279. * @category Array
  26280. * @param {...Array} [arrays] The arrays to inspect.
  26281. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26282. * @returns {Array} Returns the new array of filtered values.
  26283. * @example
  26284. *
  26285. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26286. * // => [1.2, 3.4]
  26287. *
  26288. * // The `_.property` iteratee shorthand.
  26289. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26290. * // => [{ 'x': 2 }]
  26291. */
  26292. var xorBy = baseRest(function(arrays) {
  26293. var iteratee = last(arrays);
  26294. if (isArrayLikeObject(iteratee)) {
  26295. iteratee = undefined;
  26296. }
  26297. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26298. });
  26299. /**
  26300. * This method is like `_.xor` except that it accepts `comparator` which is
  26301. * invoked to compare elements of `arrays`. The order of result values is
  26302. * determined by the order they occur in the arrays. The comparator is invoked
  26303. * with two arguments: (arrVal, othVal).
  26304. *
  26305. * @static
  26306. * @memberOf _
  26307. * @since 4.0.0
  26308. * @category Array
  26309. * @param {...Array} [arrays] The arrays to inspect.
  26310. * @param {Function} [comparator] The comparator invoked per element.
  26311. * @returns {Array} Returns the new array of filtered values.
  26312. * @example
  26313. *
  26314. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26315. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26316. *
  26317. * _.xorWith(objects, others, _.isEqual);
  26318. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26319. */
  26320. var xorWith = baseRest(function(arrays) {
  26321. var comparator = last(arrays);
  26322. comparator = typeof comparator == 'function' ? comparator : undefined;
  26323. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26324. });
  26325. /**
  26326. * Creates an array of grouped elements, the first of which contains the
  26327. * first elements of the given arrays, the second of which contains the
  26328. * second elements of the given arrays, and so on.
  26329. *
  26330. * @static
  26331. * @memberOf _
  26332. * @since 0.1.0
  26333. * @category Array
  26334. * @param {...Array} [arrays] The arrays to process.
  26335. * @returns {Array} Returns the new array of grouped elements.
  26336. * @example
  26337. *
  26338. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26339. * // => [['a', 1, true], ['b', 2, false]]
  26340. */
  26341. var zip = baseRest(unzip);
  26342. /**
  26343. * This method is like `_.fromPairs` except that it accepts two arrays,
  26344. * one of property identifiers and one of corresponding values.
  26345. *
  26346. * @static
  26347. * @memberOf _
  26348. * @since 0.4.0
  26349. * @category Array
  26350. * @param {Array} [props=[]] The property identifiers.
  26351. * @param {Array} [values=[]] The property values.
  26352. * @returns {Object} Returns the new object.
  26353. * @example
  26354. *
  26355. * _.zipObject(['a', 'b'], [1, 2]);
  26356. * // => { 'a': 1, 'b': 2 }
  26357. */
  26358. function zipObject(props, values) {
  26359. return baseZipObject(props || [], values || [], assignValue);
  26360. }
  26361. /**
  26362. * This method is like `_.zipObject` except that it supports property paths.
  26363. *
  26364. * @static
  26365. * @memberOf _
  26366. * @since 4.1.0
  26367. * @category Array
  26368. * @param {Array} [props=[]] The property identifiers.
  26369. * @param {Array} [values=[]] The property values.
  26370. * @returns {Object} Returns the new object.
  26371. * @example
  26372. *
  26373. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26374. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26375. */
  26376. function zipObjectDeep(props, values) {
  26377. return baseZipObject(props || [], values || [], baseSet);
  26378. }
  26379. /**
  26380. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26381. * how grouped values should be combined. The iteratee is invoked with the
  26382. * elements of each group: (...group).
  26383. *
  26384. * @static
  26385. * @memberOf _
  26386. * @since 3.8.0
  26387. * @category Array
  26388. * @param {...Array} [arrays] The arrays to process.
  26389. * @param {Function} [iteratee=_.identity] The function to combine
  26390. * grouped values.
  26391. * @returns {Array} Returns the new array of grouped elements.
  26392. * @example
  26393. *
  26394. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26395. * return a + b + c;
  26396. * });
  26397. * // => [111, 222]
  26398. */
  26399. var zipWith = baseRest(function(arrays) {
  26400. var length = arrays.length,
  26401. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26402. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26403. return unzipWith(arrays, iteratee);
  26404. });
  26405. /*------------------------------------------------------------------------*/
  26406. /**
  26407. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26408. * chain sequences enabled. The result of such sequences must be unwrapped
  26409. * with `_#value`.
  26410. *
  26411. * @static
  26412. * @memberOf _
  26413. * @since 1.3.0
  26414. * @category Seq
  26415. * @param {*} value The value to wrap.
  26416. * @returns {Object} Returns the new `lodash` wrapper instance.
  26417. * @example
  26418. *
  26419. * var users = [
  26420. * { 'user': 'barney', 'age': 36 },
  26421. * { 'user': 'fred', 'age': 40 },
  26422. * { 'user': 'pebbles', 'age': 1 }
  26423. * ];
  26424. *
  26425. * var youngest = _
  26426. * .chain(users)
  26427. * .sortBy('age')
  26428. * .map(function(o) {
  26429. * return o.user + ' is ' + o.age;
  26430. * })
  26431. * .head()
  26432. * .value();
  26433. * // => 'pebbles is 1'
  26434. */
  26435. function chain(value) {
  26436. var result = lodash(value);
  26437. result.__chain__ = true;
  26438. return result;
  26439. }
  26440. /**
  26441. * This method invokes `interceptor` and returns `value`. The interceptor
  26442. * is invoked with one argument; (value). The purpose of this method is to
  26443. * "tap into" a method chain sequence in order to modify intermediate results.
  26444. *
  26445. * @static
  26446. * @memberOf _
  26447. * @since 0.1.0
  26448. * @category Seq
  26449. * @param {*} value The value to provide to `interceptor`.
  26450. * @param {Function} interceptor The function to invoke.
  26451. * @returns {*} Returns `value`.
  26452. * @example
  26453. *
  26454. * _([1, 2, 3])
  26455. * .tap(function(array) {
  26456. * // Mutate input array.
  26457. * array.pop();
  26458. * })
  26459. * .reverse()
  26460. * .value();
  26461. * // => [2, 1]
  26462. */
  26463. function tap(value, interceptor) {
  26464. interceptor(value);
  26465. return value;
  26466. }
  26467. /**
  26468. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26469. * The purpose of this method is to "pass thru" values replacing intermediate
  26470. * results in a method chain sequence.
  26471. *
  26472. * @static
  26473. * @memberOf _
  26474. * @since 3.0.0
  26475. * @category Seq
  26476. * @param {*} value The value to provide to `interceptor`.
  26477. * @param {Function} interceptor The function to invoke.
  26478. * @returns {*} Returns the result of `interceptor`.
  26479. * @example
  26480. *
  26481. * _(' abc ')
  26482. * .chain()
  26483. * .trim()
  26484. * .thru(function(value) {
  26485. * return [value];
  26486. * })
  26487. * .value();
  26488. * // => ['abc']
  26489. */
  26490. function thru(value, interceptor) {
  26491. return interceptor(value);
  26492. }
  26493. /**
  26494. * This method is the wrapper version of `_.at`.
  26495. *
  26496. * @name at
  26497. * @memberOf _
  26498. * @since 1.0.0
  26499. * @category Seq
  26500. * @param {...(string|string[])} [paths] The property paths to pick.
  26501. * @returns {Object} Returns the new `lodash` wrapper instance.
  26502. * @example
  26503. *
  26504. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26505. *
  26506. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26507. * // => [3, 4]
  26508. */
  26509. var wrapperAt = flatRest(function(paths) {
  26510. var length = paths.length,
  26511. start = length ? paths[0] : 0,
  26512. value = this.__wrapped__,
  26513. interceptor = function(object) { return baseAt(object, paths); };
  26514. if (length > 1 || this.__actions__.length ||
  26515. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26516. return this.thru(interceptor);
  26517. }
  26518. value = value.slice(start, +start + (length ? 1 : 0));
  26519. value.__actions__.push({
  26520. 'func': thru,
  26521. 'args': [interceptor],
  26522. 'thisArg': undefined
  26523. });
  26524. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26525. if (length && !array.length) {
  26526. array.push(undefined);
  26527. }
  26528. return array;
  26529. });
  26530. });
  26531. /**
  26532. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26533. *
  26534. * @name chain
  26535. * @memberOf _
  26536. * @since 0.1.0
  26537. * @category Seq
  26538. * @returns {Object} Returns the new `lodash` wrapper instance.
  26539. * @example
  26540. *
  26541. * var users = [
  26542. * { 'user': 'barney', 'age': 36 },
  26543. * { 'user': 'fred', 'age': 40 }
  26544. * ];
  26545. *
  26546. * // A sequence without explicit chaining.
  26547. * _(users).head();
  26548. * // => { 'user': 'barney', 'age': 36 }
  26549. *
  26550. * // A sequence with explicit chaining.
  26551. * _(users)
  26552. * .chain()
  26553. * .head()
  26554. * .pick('user')
  26555. * .value();
  26556. * // => { 'user': 'barney' }
  26557. */
  26558. function wrapperChain() {
  26559. return chain(this);
  26560. }
  26561. /**
  26562. * Executes the chain sequence and returns the wrapped result.
  26563. *
  26564. * @name commit
  26565. * @memberOf _
  26566. * @since 3.2.0
  26567. * @category Seq
  26568. * @returns {Object} Returns the new `lodash` wrapper instance.
  26569. * @example
  26570. *
  26571. * var array = [1, 2];
  26572. * var wrapped = _(array).push(3);
  26573. *
  26574. * console.log(array);
  26575. * // => [1, 2]
  26576. *
  26577. * wrapped = wrapped.commit();
  26578. * console.log(array);
  26579. * // => [1, 2, 3]
  26580. *
  26581. * wrapped.last();
  26582. * // => 3
  26583. *
  26584. * console.log(array);
  26585. * // => [1, 2, 3]
  26586. */
  26587. function wrapperCommit() {
  26588. return new LodashWrapper(this.value(), this.__chain__);
  26589. }
  26590. /**
  26591. * Gets the next value on a wrapped object following the
  26592. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26593. *
  26594. * @name next
  26595. * @memberOf _
  26596. * @since 4.0.0
  26597. * @category Seq
  26598. * @returns {Object} Returns the next iterator value.
  26599. * @example
  26600. *
  26601. * var wrapped = _([1, 2]);
  26602. *
  26603. * wrapped.next();
  26604. * // => { 'done': false, 'value': 1 }
  26605. *
  26606. * wrapped.next();
  26607. * // => { 'done': false, 'value': 2 }
  26608. *
  26609. * wrapped.next();
  26610. * // => { 'done': true, 'value': undefined }
  26611. */
  26612. function wrapperNext() {
  26613. if (this.__values__ === undefined) {
  26614. this.__values__ = toArray(this.value());
  26615. }
  26616. var done = this.__index__ >= this.__values__.length,
  26617. value = done ? undefined : this.__values__[this.__index__++];
  26618. return { 'done': done, 'value': value };
  26619. }
  26620. /**
  26621. * Enables the wrapper to be iterable.
  26622. *
  26623. * @name Symbol.iterator
  26624. * @memberOf _
  26625. * @since 4.0.0
  26626. * @category Seq
  26627. * @returns {Object} Returns the wrapper object.
  26628. * @example
  26629. *
  26630. * var wrapped = _([1, 2]);
  26631. *
  26632. * wrapped[Symbol.iterator]() === wrapped;
  26633. * // => true
  26634. *
  26635. * Array.from(wrapped);
  26636. * // => [1, 2]
  26637. */
  26638. function wrapperToIterator() {
  26639. return this;
  26640. }
  26641. /**
  26642. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26643. *
  26644. * @name plant
  26645. * @memberOf _
  26646. * @since 3.2.0
  26647. * @category Seq
  26648. * @param {*} value The value to plant.
  26649. * @returns {Object} Returns the new `lodash` wrapper instance.
  26650. * @example
  26651. *
  26652. * function square(n) {
  26653. * return n * n;
  26654. * }
  26655. *
  26656. * var wrapped = _([1, 2]).map(square);
  26657. * var other = wrapped.plant([3, 4]);
  26658. *
  26659. * other.value();
  26660. * // => [9, 16]
  26661. *
  26662. * wrapped.value();
  26663. * // => [1, 4]
  26664. */
  26665. function wrapperPlant(value) {
  26666. var result,
  26667. parent = this;
  26668. while (parent instanceof baseLodash) {
  26669. var clone = wrapperClone(parent);
  26670. clone.__index__ = 0;
  26671. clone.__values__ = undefined;
  26672. if (result) {
  26673. previous.__wrapped__ = clone;
  26674. } else {
  26675. result = clone;
  26676. }
  26677. var previous = clone;
  26678. parent = parent.__wrapped__;
  26679. }
  26680. previous.__wrapped__ = value;
  26681. return result;
  26682. }
  26683. /**
  26684. * This method is the wrapper version of `_.reverse`.
  26685. *
  26686. * **Note:** This method mutates the wrapped array.
  26687. *
  26688. * @name reverse
  26689. * @memberOf _
  26690. * @since 0.1.0
  26691. * @category Seq
  26692. * @returns {Object} Returns the new `lodash` wrapper instance.
  26693. * @example
  26694. *
  26695. * var array = [1, 2, 3];
  26696. *
  26697. * _(array).reverse().value()
  26698. * // => [3, 2, 1]
  26699. *
  26700. * console.log(array);
  26701. * // => [3, 2, 1]
  26702. */
  26703. function wrapperReverse() {
  26704. var value = this.__wrapped__;
  26705. if (value instanceof LazyWrapper) {
  26706. var wrapped = value;
  26707. if (this.__actions__.length) {
  26708. wrapped = new LazyWrapper(this);
  26709. }
  26710. wrapped = wrapped.reverse();
  26711. wrapped.__actions__.push({
  26712. 'func': thru,
  26713. 'args': [reverse],
  26714. 'thisArg': undefined
  26715. });
  26716. return new LodashWrapper(wrapped, this.__chain__);
  26717. }
  26718. return this.thru(reverse);
  26719. }
  26720. /**
  26721. * Executes the chain sequence to resolve the unwrapped value.
  26722. *
  26723. * @name value
  26724. * @memberOf _
  26725. * @since 0.1.0
  26726. * @alias toJSON, valueOf
  26727. * @category Seq
  26728. * @returns {*} Returns the resolved unwrapped value.
  26729. * @example
  26730. *
  26731. * _([1, 2, 3]).value();
  26732. * // => [1, 2, 3]
  26733. */
  26734. function wrapperValue() {
  26735. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26736. }
  26737. /*------------------------------------------------------------------------*/
  26738. /**
  26739. * Creates an object composed of keys generated from the results of running
  26740. * each element of `collection` thru `iteratee`. The corresponding value of
  26741. * each key is the number of times the key was returned by `iteratee`. The
  26742. * iteratee is invoked with one argument: (value).
  26743. *
  26744. * @static
  26745. * @memberOf _
  26746. * @since 0.5.0
  26747. * @category Collection
  26748. * @param {Array|Object} collection The collection to iterate over.
  26749. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26750. * @returns {Object} Returns the composed aggregate object.
  26751. * @example
  26752. *
  26753. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26754. * // => { '4': 1, '6': 2 }
  26755. *
  26756. * // The `_.property` iteratee shorthand.
  26757. * _.countBy(['one', 'two', 'three'], 'length');
  26758. * // => { '3': 2, '5': 1 }
  26759. */
  26760. var countBy = createAggregator(function(result, value, key) {
  26761. if (hasOwnProperty.call(result, key)) {
  26762. ++result[key];
  26763. } else {
  26764. baseAssignValue(result, key, 1);
  26765. }
  26766. });
  26767. /**
  26768. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26769. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26770. * invoked with three arguments: (value, index|key, collection).
  26771. *
  26772. * **Note:** This method returns `true` for
  26773. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26774. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26775. * elements of empty collections.
  26776. *
  26777. * @static
  26778. * @memberOf _
  26779. * @since 0.1.0
  26780. * @category Collection
  26781. * @param {Array|Object} collection The collection to iterate over.
  26782. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26783. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26784. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26785. * else `false`.
  26786. * @example
  26787. *
  26788. * _.every([true, 1, null, 'yes'], Boolean);
  26789. * // => false
  26790. *
  26791. * var users = [
  26792. * { 'user': 'barney', 'age': 36, 'active': false },
  26793. * { 'user': 'fred', 'age': 40, 'active': false }
  26794. * ];
  26795. *
  26796. * // The `_.matches` iteratee shorthand.
  26797. * _.every(users, { 'user': 'barney', 'active': false });
  26798. * // => false
  26799. *
  26800. * // The `_.matchesProperty` iteratee shorthand.
  26801. * _.every(users, ['active', false]);
  26802. * // => true
  26803. *
  26804. * // The `_.property` iteratee shorthand.
  26805. * _.every(users, 'active');
  26806. * // => false
  26807. */
  26808. function every(collection, predicate, guard) {
  26809. var func = isArray(collection) ? arrayEvery : baseEvery;
  26810. if (guard && isIterateeCall(collection, predicate, guard)) {
  26811. predicate = undefined;
  26812. }
  26813. return func(collection, getIteratee(predicate, 3));
  26814. }
  26815. /**
  26816. * Iterates over elements of `collection`, returning an array of all elements
  26817. * `predicate` returns truthy for. The predicate is invoked with three
  26818. * arguments: (value, index|key, collection).
  26819. *
  26820. * **Note:** Unlike `_.remove`, this method returns a new array.
  26821. *
  26822. * @static
  26823. * @memberOf _
  26824. * @since 0.1.0
  26825. * @category Collection
  26826. * @param {Array|Object} collection The collection to iterate over.
  26827. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26828. * @returns {Array} Returns the new filtered array.
  26829. * @see _.reject
  26830. * @example
  26831. *
  26832. * var users = [
  26833. * { 'user': 'barney', 'age': 36, 'active': true },
  26834. * { 'user': 'fred', 'age': 40, 'active': false }
  26835. * ];
  26836. *
  26837. * _.filter(users, function(o) { return !o.active; });
  26838. * // => objects for ['fred']
  26839. *
  26840. * // The `_.matches` iteratee shorthand.
  26841. * _.filter(users, { 'age': 36, 'active': true });
  26842. * // => objects for ['barney']
  26843. *
  26844. * // The `_.matchesProperty` iteratee shorthand.
  26845. * _.filter(users, ['active', false]);
  26846. * // => objects for ['fred']
  26847. *
  26848. * // The `_.property` iteratee shorthand.
  26849. * _.filter(users, 'active');
  26850. * // => objects for ['barney']
  26851. */
  26852. function filter(collection, predicate) {
  26853. var func = isArray(collection) ? arrayFilter : baseFilter;
  26854. return func(collection, getIteratee(predicate, 3));
  26855. }
  26856. /**
  26857. * Iterates over elements of `collection`, returning the first element
  26858. * `predicate` returns truthy for. The predicate is invoked with three
  26859. * arguments: (value, index|key, collection).
  26860. *
  26861. * @static
  26862. * @memberOf _
  26863. * @since 0.1.0
  26864. * @category Collection
  26865. * @param {Array|Object} collection The collection to inspect.
  26866. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26867. * @param {number} [fromIndex=0] The index to search from.
  26868. * @returns {*} Returns the matched element, else `undefined`.
  26869. * @example
  26870. *
  26871. * var users = [
  26872. * { 'user': 'barney', 'age': 36, 'active': true },
  26873. * { 'user': 'fred', 'age': 40, 'active': false },
  26874. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26875. * ];
  26876. *
  26877. * _.find(users, function(o) { return o.age < 40; });
  26878. * // => object for 'barney'
  26879. *
  26880. * // The `_.matches` iteratee shorthand.
  26881. * _.find(users, { 'age': 1, 'active': true });
  26882. * // => object for 'pebbles'
  26883. *
  26884. * // The `_.matchesProperty` iteratee shorthand.
  26885. * _.find(users, ['active', false]);
  26886. * // => object for 'fred'
  26887. *
  26888. * // The `_.property` iteratee shorthand.
  26889. * _.find(users, 'active');
  26890. * // => object for 'barney'
  26891. */
  26892. var find = createFind(findIndex);
  26893. /**
  26894. * This method is like `_.find` except that it iterates over elements of
  26895. * `collection` from right to left.
  26896. *
  26897. * @static
  26898. * @memberOf _
  26899. * @since 2.0.0
  26900. * @category Collection
  26901. * @param {Array|Object} collection The collection to inspect.
  26902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26903. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26904. * @returns {*} Returns the matched element, else `undefined`.
  26905. * @example
  26906. *
  26907. * _.findLast([1, 2, 3, 4], function(n) {
  26908. * return n % 2 == 1;
  26909. * });
  26910. * // => 3
  26911. */
  26912. var findLast = createFind(findLastIndex);
  26913. /**
  26914. * Creates a flattened array of values by running each element in `collection`
  26915. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26916. * with three arguments: (value, index|key, collection).
  26917. *
  26918. * @static
  26919. * @memberOf _
  26920. * @since 4.0.0
  26921. * @category Collection
  26922. * @param {Array|Object} collection The collection to iterate over.
  26923. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26924. * @returns {Array} Returns the new flattened array.
  26925. * @example
  26926. *
  26927. * function duplicate(n) {
  26928. * return [n, n];
  26929. * }
  26930. *
  26931. * _.flatMap([1, 2], duplicate);
  26932. * // => [1, 1, 2, 2]
  26933. */
  26934. function flatMap(collection, iteratee) {
  26935. return baseFlatten(map(collection, iteratee), 1);
  26936. }
  26937. /**
  26938. * This method is like `_.flatMap` except that it recursively flattens the
  26939. * mapped results.
  26940. *
  26941. * @static
  26942. * @memberOf _
  26943. * @since 4.7.0
  26944. * @category Collection
  26945. * @param {Array|Object} collection The collection to iterate over.
  26946. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26947. * @returns {Array} Returns the new flattened array.
  26948. * @example
  26949. *
  26950. * function duplicate(n) {
  26951. * return [[[n, n]]];
  26952. * }
  26953. *
  26954. * _.flatMapDeep([1, 2], duplicate);
  26955. * // => [1, 1, 2, 2]
  26956. */
  26957. function flatMapDeep(collection, iteratee) {
  26958. return baseFlatten(map(collection, iteratee), INFINITY);
  26959. }
  26960. /**
  26961. * This method is like `_.flatMap` except that it recursively flattens the
  26962. * mapped results up to `depth` times.
  26963. *
  26964. * @static
  26965. * @memberOf _
  26966. * @since 4.7.0
  26967. * @category Collection
  26968. * @param {Array|Object} collection The collection to iterate over.
  26969. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26970. * @param {number} [depth=1] The maximum recursion depth.
  26971. * @returns {Array} Returns the new flattened array.
  26972. * @example
  26973. *
  26974. * function duplicate(n) {
  26975. * return [[[n, n]]];
  26976. * }
  26977. *
  26978. * _.flatMapDepth([1, 2], duplicate, 2);
  26979. * // => [[1, 1], [2, 2]]
  26980. */
  26981. function flatMapDepth(collection, iteratee, depth) {
  26982. depth = depth === undefined ? 1 : toInteger(depth);
  26983. return baseFlatten(map(collection, iteratee), depth);
  26984. }
  26985. /**
  26986. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26987. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26988. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26989. *
  26990. * **Note:** As with other "Collections" methods, objects with a "length"
  26991. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26992. * or `_.forOwn` for object iteration.
  26993. *
  26994. * @static
  26995. * @memberOf _
  26996. * @since 0.1.0
  26997. * @alias each
  26998. * @category Collection
  26999. * @param {Array|Object} collection The collection to iterate over.
  27000. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27001. * @returns {Array|Object} Returns `collection`.
  27002. * @see _.forEachRight
  27003. * @example
  27004. *
  27005. * _.forEach([1, 2], function(value) {
  27006. * console.log(value);
  27007. * });
  27008. * // => Logs `1` then `2`.
  27009. *
  27010. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27011. * console.log(key);
  27012. * });
  27013. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27014. */
  27015. function forEach(collection, iteratee) {
  27016. var func = isArray(collection) ? arrayEach : baseEach;
  27017. return func(collection, getIteratee(iteratee, 3));
  27018. }
  27019. /**
  27020. * This method is like `_.forEach` except that it iterates over elements of
  27021. * `collection` from right to left.
  27022. *
  27023. * @static
  27024. * @memberOf _
  27025. * @since 2.0.0
  27026. * @alias eachRight
  27027. * @category Collection
  27028. * @param {Array|Object} collection The collection to iterate over.
  27029. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27030. * @returns {Array|Object} Returns `collection`.
  27031. * @see _.forEach
  27032. * @example
  27033. *
  27034. * _.forEachRight([1, 2], function(value) {
  27035. * console.log(value);
  27036. * });
  27037. * // => Logs `2` then `1`.
  27038. */
  27039. function forEachRight(collection, iteratee) {
  27040. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27041. return func(collection, getIteratee(iteratee, 3));
  27042. }
  27043. /**
  27044. * Creates an object composed of keys generated from the results of running
  27045. * each element of `collection` thru `iteratee`. The order of grouped values
  27046. * is determined by the order they occur in `collection`. The corresponding
  27047. * value of each key is an array of elements responsible for generating the
  27048. * key. The iteratee is invoked with one argument: (value).
  27049. *
  27050. * @static
  27051. * @memberOf _
  27052. * @since 0.1.0
  27053. * @category Collection
  27054. * @param {Array|Object} collection The collection to iterate over.
  27055. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27056. * @returns {Object} Returns the composed aggregate object.
  27057. * @example
  27058. *
  27059. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27060. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27061. *
  27062. * // The `_.property` iteratee shorthand.
  27063. * _.groupBy(['one', 'two', 'three'], 'length');
  27064. * // => { '3': ['one', 'two'], '5': ['three'] }
  27065. */
  27066. var groupBy = createAggregator(function(result, value, key) {
  27067. if (hasOwnProperty.call(result, key)) {
  27068. result[key].push(value);
  27069. } else {
  27070. baseAssignValue(result, key, [value]);
  27071. }
  27072. });
  27073. /**
  27074. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27075. * checked for a substring of `value`, otherwise
  27076. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27077. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27078. * the offset from the end of `collection`.
  27079. *
  27080. * @static
  27081. * @memberOf _
  27082. * @since 0.1.0
  27083. * @category Collection
  27084. * @param {Array|Object|string} collection The collection to inspect.
  27085. * @param {*} value The value to search for.
  27086. * @param {number} [fromIndex=0] The index to search from.
  27087. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27088. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27089. * @example
  27090. *
  27091. * _.includes([1, 2, 3], 1);
  27092. * // => true
  27093. *
  27094. * _.includes([1, 2, 3], 1, 2);
  27095. * // => false
  27096. *
  27097. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27098. * // => true
  27099. *
  27100. * _.includes('abcd', 'bc');
  27101. * // => true
  27102. */
  27103. function includes(collection, value, fromIndex, guard) {
  27104. collection = isArrayLike(collection) ? collection : values(collection);
  27105. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27106. var length = collection.length;
  27107. if (fromIndex < 0) {
  27108. fromIndex = nativeMax(length + fromIndex, 0);
  27109. }
  27110. return isString(collection)
  27111. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27112. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27113. }
  27114. /**
  27115. * Invokes the method at `path` of each element in `collection`, returning
  27116. * an array of the results of each invoked method. Any additional arguments
  27117. * are provided to each invoked method. If `path` is a function, it's invoked
  27118. * for, and `this` bound to, each element in `collection`.
  27119. *
  27120. * @static
  27121. * @memberOf _
  27122. * @since 4.0.0
  27123. * @category Collection
  27124. * @param {Array|Object} collection The collection to iterate over.
  27125. * @param {Array|Function|string} path The path of the method to invoke or
  27126. * the function invoked per iteration.
  27127. * @param {...*} [args] The arguments to invoke each method with.
  27128. * @returns {Array} Returns the array of results.
  27129. * @example
  27130. *
  27131. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27132. * // => [[1, 5, 7], [1, 2, 3]]
  27133. *
  27134. * _.invokeMap([123, 456], String.prototype.split, '');
  27135. * // => [['1', '2', '3'], ['4', '5', '6']]
  27136. */
  27137. var invokeMap = baseRest(function(collection, path, args) {
  27138. var index = -1,
  27139. isFunc = typeof path == 'function',
  27140. result = isArrayLike(collection) ? Array(collection.length) : [];
  27141. baseEach(collection, function(value) {
  27142. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27143. });
  27144. return result;
  27145. });
  27146. /**
  27147. * Creates an object composed of keys generated from the results of running
  27148. * each element of `collection` thru `iteratee`. The corresponding value of
  27149. * each key is the last element responsible for generating the key. The
  27150. * iteratee is invoked with one argument: (value).
  27151. *
  27152. * @static
  27153. * @memberOf _
  27154. * @since 4.0.0
  27155. * @category Collection
  27156. * @param {Array|Object} collection The collection to iterate over.
  27157. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27158. * @returns {Object} Returns the composed aggregate object.
  27159. * @example
  27160. *
  27161. * var array = [
  27162. * { 'dir': 'left', 'code': 97 },
  27163. * { 'dir': 'right', 'code': 100 }
  27164. * ];
  27165. *
  27166. * _.keyBy(array, function(o) {
  27167. * return String.fromCharCode(o.code);
  27168. * });
  27169. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27170. *
  27171. * _.keyBy(array, 'dir');
  27172. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27173. */
  27174. var keyBy = createAggregator(function(result, value, key) {
  27175. baseAssignValue(result, key, value);
  27176. });
  27177. /**
  27178. * Creates an array of values by running each element in `collection` thru
  27179. * `iteratee`. The iteratee is invoked with three arguments:
  27180. * (value, index|key, collection).
  27181. *
  27182. * Many lodash methods are guarded to work as iteratees for methods like
  27183. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27184. *
  27185. * The guarded methods are:
  27186. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27187. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27188. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27189. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27190. *
  27191. * @static
  27192. * @memberOf _
  27193. * @since 0.1.0
  27194. * @category Collection
  27195. * @param {Array|Object} collection The collection to iterate over.
  27196. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27197. * @returns {Array} Returns the new mapped array.
  27198. * @example
  27199. *
  27200. * function square(n) {
  27201. * return n * n;
  27202. * }
  27203. *
  27204. * _.map([4, 8], square);
  27205. * // => [16, 64]
  27206. *
  27207. * _.map({ 'a': 4, 'b': 8 }, square);
  27208. * // => [16, 64] (iteration order is not guaranteed)
  27209. *
  27210. * var users = [
  27211. * { 'user': 'barney' },
  27212. * { 'user': 'fred' }
  27213. * ];
  27214. *
  27215. * // The `_.property` iteratee shorthand.
  27216. * _.map(users, 'user');
  27217. * // => ['barney', 'fred']
  27218. */
  27219. function map(collection, iteratee) {
  27220. var func = isArray(collection) ? arrayMap : baseMap;
  27221. return func(collection, getIteratee(iteratee, 3));
  27222. }
  27223. /**
  27224. * This method is like `_.sortBy` except that it allows specifying the sort
  27225. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27226. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27227. * descending or "asc" for ascending sort order of corresponding values.
  27228. *
  27229. * @static
  27230. * @memberOf _
  27231. * @since 4.0.0
  27232. * @category Collection
  27233. * @param {Array|Object} collection The collection to iterate over.
  27234. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27235. * The iteratees to sort by.
  27236. * @param {string[]} [orders] The sort orders of `iteratees`.
  27237. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27238. * @returns {Array} Returns the new sorted array.
  27239. * @example
  27240. *
  27241. * var users = [
  27242. * { 'user': 'fred', 'age': 48 },
  27243. * { 'user': 'barney', 'age': 34 },
  27244. * { 'user': 'fred', 'age': 40 },
  27245. * { 'user': 'barney', 'age': 36 }
  27246. * ];
  27247. *
  27248. * // Sort by `user` in ascending order and by `age` in descending order.
  27249. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27250. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27251. */
  27252. function orderBy(collection, iteratees, orders, guard) {
  27253. if (collection == null) {
  27254. return [];
  27255. }
  27256. if (!isArray(iteratees)) {
  27257. iteratees = iteratees == null ? [] : [iteratees];
  27258. }
  27259. orders = guard ? undefined : orders;
  27260. if (!isArray(orders)) {
  27261. orders = orders == null ? [] : [orders];
  27262. }
  27263. return baseOrderBy(collection, iteratees, orders);
  27264. }
  27265. /**
  27266. * Creates an array of elements split into two groups, the first of which
  27267. * contains elements `predicate` returns truthy for, the second of which
  27268. * contains elements `predicate` returns falsey for. The predicate is
  27269. * invoked with one argument: (value).
  27270. *
  27271. * @static
  27272. * @memberOf _
  27273. * @since 3.0.0
  27274. * @category Collection
  27275. * @param {Array|Object} collection The collection to iterate over.
  27276. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27277. * @returns {Array} Returns the array of grouped elements.
  27278. * @example
  27279. *
  27280. * var users = [
  27281. * { 'user': 'barney', 'age': 36, 'active': false },
  27282. * { 'user': 'fred', 'age': 40, 'active': true },
  27283. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27284. * ];
  27285. *
  27286. * _.partition(users, function(o) { return o.active; });
  27287. * // => objects for [['fred'], ['barney', 'pebbles']]
  27288. *
  27289. * // The `_.matches` iteratee shorthand.
  27290. * _.partition(users, { 'age': 1, 'active': false });
  27291. * // => objects for [['pebbles'], ['barney', 'fred']]
  27292. *
  27293. * // The `_.matchesProperty` iteratee shorthand.
  27294. * _.partition(users, ['active', false]);
  27295. * // => objects for [['barney', 'pebbles'], ['fred']]
  27296. *
  27297. * // The `_.property` iteratee shorthand.
  27298. * _.partition(users, 'active');
  27299. * // => objects for [['fred'], ['barney', 'pebbles']]
  27300. */
  27301. var partition = createAggregator(function(result, value, key) {
  27302. result[key ? 0 : 1].push(value);
  27303. }, function() { return [[], []]; });
  27304. /**
  27305. * Reduces `collection` to a value which is the accumulated result of running
  27306. * each element in `collection` thru `iteratee`, where each successive
  27307. * invocation is supplied the return value of the previous. If `accumulator`
  27308. * is not given, the first element of `collection` is used as the initial
  27309. * value. The iteratee is invoked with four arguments:
  27310. * (accumulator, value, index|key, collection).
  27311. *
  27312. * Many lodash methods are guarded to work as iteratees for methods like
  27313. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27314. *
  27315. * The guarded methods are:
  27316. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27317. * and `sortBy`
  27318. *
  27319. * @static
  27320. * @memberOf _
  27321. * @since 0.1.0
  27322. * @category Collection
  27323. * @param {Array|Object} collection The collection to iterate over.
  27324. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27325. * @param {*} [accumulator] The initial value.
  27326. * @returns {*} Returns the accumulated value.
  27327. * @see _.reduceRight
  27328. * @example
  27329. *
  27330. * _.reduce([1, 2], function(sum, n) {
  27331. * return sum + n;
  27332. * }, 0);
  27333. * // => 3
  27334. *
  27335. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27336. * (result[value] || (result[value] = [])).push(key);
  27337. * return result;
  27338. * }, {});
  27339. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27340. */
  27341. function reduce(collection, iteratee, accumulator) {
  27342. var func = isArray(collection) ? arrayReduce : baseReduce,
  27343. initAccum = arguments.length < 3;
  27344. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27345. }
  27346. /**
  27347. * This method is like `_.reduce` except that it iterates over elements of
  27348. * `collection` from right to left.
  27349. *
  27350. * @static
  27351. * @memberOf _
  27352. * @since 0.1.0
  27353. * @category Collection
  27354. * @param {Array|Object} collection The collection to iterate over.
  27355. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27356. * @param {*} [accumulator] The initial value.
  27357. * @returns {*} Returns the accumulated value.
  27358. * @see _.reduce
  27359. * @example
  27360. *
  27361. * var array = [[0, 1], [2, 3], [4, 5]];
  27362. *
  27363. * _.reduceRight(array, function(flattened, other) {
  27364. * return flattened.concat(other);
  27365. * }, []);
  27366. * // => [4, 5, 2, 3, 0, 1]
  27367. */
  27368. function reduceRight(collection, iteratee, accumulator) {
  27369. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27370. initAccum = arguments.length < 3;
  27371. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27372. }
  27373. /**
  27374. * The opposite of `_.filter`; this method returns the elements of `collection`
  27375. * that `predicate` does **not** return truthy for.
  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} [predicate=_.identity] The function invoked per iteration.
  27383. * @returns {Array} Returns the new filtered array.
  27384. * @see _.filter
  27385. * @example
  27386. *
  27387. * var users = [
  27388. * { 'user': 'barney', 'age': 36, 'active': false },
  27389. * { 'user': 'fred', 'age': 40, 'active': true }
  27390. * ];
  27391. *
  27392. * _.reject(users, function(o) { return !o.active; });
  27393. * // => objects for ['fred']
  27394. *
  27395. * // The `_.matches` iteratee shorthand.
  27396. * _.reject(users, { 'age': 40, 'active': true });
  27397. * // => objects for ['barney']
  27398. *
  27399. * // The `_.matchesProperty` iteratee shorthand.
  27400. * _.reject(users, ['active', false]);
  27401. * // => objects for ['fred']
  27402. *
  27403. * // The `_.property` iteratee shorthand.
  27404. * _.reject(users, 'active');
  27405. * // => objects for ['barney']
  27406. */
  27407. function reject(collection, predicate) {
  27408. var func = isArray(collection) ? arrayFilter : baseFilter;
  27409. return func(collection, negate(getIteratee(predicate, 3)));
  27410. }
  27411. /**
  27412. * Gets a random element from `collection`.
  27413. *
  27414. * @static
  27415. * @memberOf _
  27416. * @since 2.0.0
  27417. * @category Collection
  27418. * @param {Array|Object} collection The collection to sample.
  27419. * @returns {*} Returns the random element.
  27420. * @example
  27421. *
  27422. * _.sample([1, 2, 3, 4]);
  27423. * // => 2
  27424. */
  27425. function sample(collection) {
  27426. var func = isArray(collection) ? arraySample : baseSample;
  27427. return func(collection);
  27428. }
  27429. /**
  27430. * Gets `n` random elements at unique keys from `collection` up to the
  27431. * size of `collection`.
  27432. *
  27433. * @static
  27434. * @memberOf _
  27435. * @since 4.0.0
  27436. * @category Collection
  27437. * @param {Array|Object} collection The collection to sample.
  27438. * @param {number} [n=1] The number of elements to sample.
  27439. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27440. * @returns {Array} Returns the random elements.
  27441. * @example
  27442. *
  27443. * _.sampleSize([1, 2, 3], 2);
  27444. * // => [3, 1]
  27445. *
  27446. * _.sampleSize([1, 2, 3], 4);
  27447. * // => [2, 3, 1]
  27448. */
  27449. function sampleSize(collection, n, guard) {
  27450. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27451. n = 1;
  27452. } else {
  27453. n = toInteger(n);
  27454. }
  27455. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27456. return func(collection, n);
  27457. }
  27458. /**
  27459. * Creates an array of shuffled values, using a version of the
  27460. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27461. *
  27462. * @static
  27463. * @memberOf _
  27464. * @since 0.1.0
  27465. * @category Collection
  27466. * @param {Array|Object} collection The collection to shuffle.
  27467. * @returns {Array} Returns the new shuffled array.
  27468. * @example
  27469. *
  27470. * _.shuffle([1, 2, 3, 4]);
  27471. * // => [4, 1, 3, 2]
  27472. */
  27473. function shuffle(collection) {
  27474. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27475. return func(collection);
  27476. }
  27477. /**
  27478. * Gets the size of `collection` by returning its length for array-like
  27479. * values or the number of own enumerable string keyed properties for objects.
  27480. *
  27481. * @static
  27482. * @memberOf _
  27483. * @since 0.1.0
  27484. * @category Collection
  27485. * @param {Array|Object|string} collection The collection to inspect.
  27486. * @returns {number} Returns the collection size.
  27487. * @example
  27488. *
  27489. * _.size([1, 2, 3]);
  27490. * // => 3
  27491. *
  27492. * _.size({ 'a': 1, 'b': 2 });
  27493. * // => 2
  27494. *
  27495. * _.size('pebbles');
  27496. * // => 7
  27497. */
  27498. function size(collection) {
  27499. if (collection == null) {
  27500. return 0;
  27501. }
  27502. if (isArrayLike(collection)) {
  27503. return isString(collection) ? stringSize(collection) : collection.length;
  27504. }
  27505. var tag = getTag(collection);
  27506. if (tag == mapTag || tag == setTag) {
  27507. return collection.size;
  27508. }
  27509. return baseKeys(collection).length;
  27510. }
  27511. /**
  27512. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27513. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27514. * invoked with three arguments: (value, index|key, collection).
  27515. *
  27516. * @static
  27517. * @memberOf _
  27518. * @since 0.1.0
  27519. * @category Collection
  27520. * @param {Array|Object} collection The collection to iterate over.
  27521. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27522. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27523. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27524. * else `false`.
  27525. * @example
  27526. *
  27527. * _.some([null, 0, 'yes', false], Boolean);
  27528. * // => true
  27529. *
  27530. * var users = [
  27531. * { 'user': 'barney', 'active': true },
  27532. * { 'user': 'fred', 'active': false }
  27533. * ];
  27534. *
  27535. * // The `_.matches` iteratee shorthand.
  27536. * _.some(users, { 'user': 'barney', 'active': false });
  27537. * // => false
  27538. *
  27539. * // The `_.matchesProperty` iteratee shorthand.
  27540. * _.some(users, ['active', false]);
  27541. * // => true
  27542. *
  27543. * // The `_.property` iteratee shorthand.
  27544. * _.some(users, 'active');
  27545. * // => true
  27546. */
  27547. function some(collection, predicate, guard) {
  27548. var func = isArray(collection) ? arraySome : baseSome;
  27549. if (guard && isIterateeCall(collection, predicate, guard)) {
  27550. predicate = undefined;
  27551. }
  27552. return func(collection, getIteratee(predicate, 3));
  27553. }
  27554. /**
  27555. * Creates an array of elements, sorted in ascending order by the results of
  27556. * running each element in a collection thru each iteratee. This method
  27557. * performs a stable sort, that is, it preserves the original sort order of
  27558. * equal elements. The iteratees are invoked with one argument: (value).
  27559. *
  27560. * @static
  27561. * @memberOf _
  27562. * @since 0.1.0
  27563. * @category Collection
  27564. * @param {Array|Object} collection The collection to iterate over.
  27565. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27566. * The iteratees to sort by.
  27567. * @returns {Array} Returns the new sorted array.
  27568. * @example
  27569. *
  27570. * var users = [
  27571. * { 'user': 'fred', 'age': 48 },
  27572. * { 'user': 'barney', 'age': 36 },
  27573. * { 'user': 'fred', 'age': 40 },
  27574. * { 'user': 'barney', 'age': 34 }
  27575. * ];
  27576. *
  27577. * _.sortBy(users, [function(o) { return o.user; }]);
  27578. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27579. *
  27580. * _.sortBy(users, ['user', 'age']);
  27581. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27582. */
  27583. var sortBy = baseRest(function(collection, iteratees) {
  27584. if (collection == null) {
  27585. return [];
  27586. }
  27587. var length = iteratees.length;
  27588. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27589. iteratees = [];
  27590. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27591. iteratees = [iteratees[0]];
  27592. }
  27593. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27594. });
  27595. /*------------------------------------------------------------------------*/
  27596. /**
  27597. * Gets the timestamp of the number of milliseconds that have elapsed since
  27598. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27599. *
  27600. * @static
  27601. * @memberOf _
  27602. * @since 2.4.0
  27603. * @category Date
  27604. * @returns {number} Returns the timestamp.
  27605. * @example
  27606. *
  27607. * _.defer(function(stamp) {
  27608. * console.log(_.now() - stamp);
  27609. * }, _.now());
  27610. * // => Logs the number of milliseconds it took for the deferred invocation.
  27611. */
  27612. var now = ctxNow || function() {
  27613. return root.Date.now();
  27614. };
  27615. /*------------------------------------------------------------------------*/
  27616. /**
  27617. * The opposite of `_.before`; this method creates a function that invokes
  27618. * `func` once it's called `n` or more times.
  27619. *
  27620. * @static
  27621. * @memberOf _
  27622. * @since 0.1.0
  27623. * @category Function
  27624. * @param {number} n The number of calls before `func` is invoked.
  27625. * @param {Function} func The function to restrict.
  27626. * @returns {Function} Returns the new restricted function.
  27627. * @example
  27628. *
  27629. * var saves = ['profile', 'settings'];
  27630. *
  27631. * var done = _.after(saves.length, function() {
  27632. * console.log('done saving!');
  27633. * });
  27634. *
  27635. * _.forEach(saves, function(type) {
  27636. * asyncSave({ 'type': type, 'complete': done });
  27637. * });
  27638. * // => Logs 'done saving!' after the two async saves have completed.
  27639. */
  27640. function after(n, func) {
  27641. if (typeof func != 'function') {
  27642. throw new TypeError(FUNC_ERROR_TEXT);
  27643. }
  27644. n = toInteger(n);
  27645. return function() {
  27646. if (--n < 1) {
  27647. return func.apply(this, arguments);
  27648. }
  27649. };
  27650. }
  27651. /**
  27652. * Creates a function that invokes `func`, with up to `n` arguments,
  27653. * ignoring any additional arguments.
  27654. *
  27655. * @static
  27656. * @memberOf _
  27657. * @since 3.0.0
  27658. * @category Function
  27659. * @param {Function} func The function to cap arguments for.
  27660. * @param {number} [n=func.length] The arity cap.
  27661. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27662. * @returns {Function} Returns the new capped function.
  27663. * @example
  27664. *
  27665. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27666. * // => [6, 8, 10]
  27667. */
  27668. function ary(func, n, guard) {
  27669. n = guard ? undefined : n;
  27670. n = (func && n == null) ? func.length : n;
  27671. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27672. }
  27673. /**
  27674. * Creates a function that invokes `func`, with the `this` binding and arguments
  27675. * of the created function, while it's called less than `n` times. Subsequent
  27676. * calls to the created function return the result of the last `func` invocation.
  27677. *
  27678. * @static
  27679. * @memberOf _
  27680. * @since 3.0.0
  27681. * @category Function
  27682. * @param {number} n The number of calls at which `func` is no longer invoked.
  27683. * @param {Function} func The function to restrict.
  27684. * @returns {Function} Returns the new restricted function.
  27685. * @example
  27686. *
  27687. * jQuery(element).on('click', _.before(5, addContactToList));
  27688. * // => Allows adding up to 4 contacts to the list.
  27689. */
  27690. function before(n, func) {
  27691. var result;
  27692. if (typeof func != 'function') {
  27693. throw new TypeError(FUNC_ERROR_TEXT);
  27694. }
  27695. n = toInteger(n);
  27696. return function() {
  27697. if (--n > 0) {
  27698. result = func.apply(this, arguments);
  27699. }
  27700. if (n <= 1) {
  27701. func = undefined;
  27702. }
  27703. return result;
  27704. };
  27705. }
  27706. /**
  27707. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27708. * and `partials` prepended to the arguments it receives.
  27709. *
  27710. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27711. * may be used as a placeholder for partially applied arguments.
  27712. *
  27713. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27714. * property of bound functions.
  27715. *
  27716. * @static
  27717. * @memberOf _
  27718. * @since 0.1.0
  27719. * @category Function
  27720. * @param {Function} func The function to bind.
  27721. * @param {*} thisArg The `this` binding of `func`.
  27722. * @param {...*} [partials] The arguments to be partially applied.
  27723. * @returns {Function} Returns the new bound function.
  27724. * @example
  27725. *
  27726. * function greet(greeting, punctuation) {
  27727. * return greeting + ' ' + this.user + punctuation;
  27728. * }
  27729. *
  27730. * var object = { 'user': 'fred' };
  27731. *
  27732. * var bound = _.bind(greet, object, 'hi');
  27733. * bound('!');
  27734. * // => 'hi fred!'
  27735. *
  27736. * // Bound with placeholders.
  27737. * var bound = _.bind(greet, object, _, '!');
  27738. * bound('hi');
  27739. * // => 'hi fred!'
  27740. */
  27741. var bind = baseRest(function(func, thisArg, partials) {
  27742. var bitmask = WRAP_BIND_FLAG;
  27743. if (partials.length) {
  27744. var holders = replaceHolders(partials, getHolder(bind));
  27745. bitmask |= WRAP_PARTIAL_FLAG;
  27746. }
  27747. return createWrap(func, bitmask, thisArg, partials, holders);
  27748. });
  27749. /**
  27750. * Creates a function that invokes the method at `object[key]` with `partials`
  27751. * prepended to the arguments it receives.
  27752. *
  27753. * This method differs from `_.bind` by allowing bound functions to reference
  27754. * methods that may be redefined or don't yet exist. See
  27755. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27756. * for more details.
  27757. *
  27758. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27759. * builds, may be used as a placeholder for partially applied arguments.
  27760. *
  27761. * @static
  27762. * @memberOf _
  27763. * @since 0.10.0
  27764. * @category Function
  27765. * @param {Object} object The object to invoke the method on.
  27766. * @param {string} key The key of the method.
  27767. * @param {...*} [partials] The arguments to be partially applied.
  27768. * @returns {Function} Returns the new bound function.
  27769. * @example
  27770. *
  27771. * var object = {
  27772. * 'user': 'fred',
  27773. * 'greet': function(greeting, punctuation) {
  27774. * return greeting + ' ' + this.user + punctuation;
  27775. * }
  27776. * };
  27777. *
  27778. * var bound = _.bindKey(object, 'greet', 'hi');
  27779. * bound('!');
  27780. * // => 'hi fred!'
  27781. *
  27782. * object.greet = function(greeting, punctuation) {
  27783. * return greeting + 'ya ' + this.user + punctuation;
  27784. * };
  27785. *
  27786. * bound('!');
  27787. * // => 'hiya fred!'
  27788. *
  27789. * // Bound with placeholders.
  27790. * var bound = _.bindKey(object, 'greet', _, '!');
  27791. * bound('hi');
  27792. * // => 'hiya fred!'
  27793. */
  27794. var bindKey = baseRest(function(object, key, partials) {
  27795. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27796. if (partials.length) {
  27797. var holders = replaceHolders(partials, getHolder(bindKey));
  27798. bitmask |= WRAP_PARTIAL_FLAG;
  27799. }
  27800. return createWrap(key, bitmask, object, partials, holders);
  27801. });
  27802. /**
  27803. * Creates a function that accepts arguments of `func` and either invokes
  27804. * `func` returning its result, if at least `arity` number of arguments have
  27805. * been provided, or returns a function that accepts the remaining `func`
  27806. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27807. * is not sufficient.
  27808. *
  27809. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27810. * may be used as a placeholder for provided arguments.
  27811. *
  27812. * **Note:** This method doesn't set the "length" property of curried functions.
  27813. *
  27814. * @static
  27815. * @memberOf _
  27816. * @since 2.0.0
  27817. * @category Function
  27818. * @param {Function} func The function to curry.
  27819. * @param {number} [arity=func.length] The arity of `func`.
  27820. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27821. * @returns {Function} Returns the new curried function.
  27822. * @example
  27823. *
  27824. * var abc = function(a, b, c) {
  27825. * return [a, b, c];
  27826. * };
  27827. *
  27828. * var curried = _.curry(abc);
  27829. *
  27830. * curried(1)(2)(3);
  27831. * // => [1, 2, 3]
  27832. *
  27833. * curried(1, 2)(3);
  27834. * // => [1, 2, 3]
  27835. *
  27836. * curried(1, 2, 3);
  27837. * // => [1, 2, 3]
  27838. *
  27839. * // Curried with placeholders.
  27840. * curried(1)(_, 3)(2);
  27841. * // => [1, 2, 3]
  27842. */
  27843. function curry(func, arity, guard) {
  27844. arity = guard ? undefined : arity;
  27845. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27846. result.placeholder = curry.placeholder;
  27847. return result;
  27848. }
  27849. /**
  27850. * This method is like `_.curry` except that arguments are applied to `func`
  27851. * in the manner of `_.partialRight` instead of `_.partial`.
  27852. *
  27853. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27854. * builds, may be used as a placeholder for provided arguments.
  27855. *
  27856. * **Note:** This method doesn't set the "length" property of curried functions.
  27857. *
  27858. * @static
  27859. * @memberOf _
  27860. * @since 3.0.0
  27861. * @category Function
  27862. * @param {Function} func The function to curry.
  27863. * @param {number} [arity=func.length] The arity of `func`.
  27864. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27865. * @returns {Function} Returns the new curried function.
  27866. * @example
  27867. *
  27868. * var abc = function(a, b, c) {
  27869. * return [a, b, c];
  27870. * };
  27871. *
  27872. * var curried = _.curryRight(abc);
  27873. *
  27874. * curried(3)(2)(1);
  27875. * // => [1, 2, 3]
  27876. *
  27877. * curried(2, 3)(1);
  27878. * // => [1, 2, 3]
  27879. *
  27880. * curried(1, 2, 3);
  27881. * // => [1, 2, 3]
  27882. *
  27883. * // Curried with placeholders.
  27884. * curried(3)(1, _)(2);
  27885. * // => [1, 2, 3]
  27886. */
  27887. function curryRight(func, arity, guard) {
  27888. arity = guard ? undefined : arity;
  27889. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27890. result.placeholder = curryRight.placeholder;
  27891. return result;
  27892. }
  27893. /**
  27894. * Creates a debounced function that delays invoking `func` until after `wait`
  27895. * milliseconds have elapsed since the last time the debounced function was
  27896. * invoked. The debounced function comes with a `cancel` method to cancel
  27897. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27898. * Provide `options` to indicate whether `func` should be invoked on the
  27899. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27900. * with the last arguments provided to the debounced function. Subsequent
  27901. * calls to the debounced function return the result of the last `func`
  27902. * invocation.
  27903. *
  27904. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27905. * invoked on the trailing edge of the timeout only if the debounced function
  27906. * is invoked more than once during the `wait` timeout.
  27907. *
  27908. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27909. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27910. *
  27911. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27912. * for details over the differences between `_.debounce` and `_.throttle`.
  27913. *
  27914. * @static
  27915. * @memberOf _
  27916. * @since 0.1.0
  27917. * @category Function
  27918. * @param {Function} func The function to debounce.
  27919. * @param {number} [wait=0] The number of milliseconds to delay.
  27920. * @param {Object} [options={}] The options object.
  27921. * @param {boolean} [options.leading=false]
  27922. * Specify invoking on the leading edge of the timeout.
  27923. * @param {number} [options.maxWait]
  27924. * The maximum time `func` is allowed to be delayed before it's invoked.
  27925. * @param {boolean} [options.trailing=true]
  27926. * Specify invoking on the trailing edge of the timeout.
  27927. * @returns {Function} Returns the new debounced function.
  27928. * @example
  27929. *
  27930. * // Avoid costly calculations while the window size is in flux.
  27931. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27932. *
  27933. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27934. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27935. * 'leading': true,
  27936. * 'trailing': false
  27937. * }));
  27938. *
  27939. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27940. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27941. * var source = new EventSource('/stream');
  27942. * jQuery(source).on('message', debounced);
  27943. *
  27944. * // Cancel the trailing debounced invocation.
  27945. * jQuery(window).on('popstate', debounced.cancel);
  27946. */
  27947. function debounce(func, wait, options) {
  27948. var lastArgs,
  27949. lastThis,
  27950. maxWait,
  27951. result,
  27952. timerId,
  27953. lastCallTime,
  27954. lastInvokeTime = 0,
  27955. leading = false,
  27956. maxing = false,
  27957. trailing = true;
  27958. if (typeof func != 'function') {
  27959. throw new TypeError(FUNC_ERROR_TEXT);
  27960. }
  27961. wait = toNumber(wait) || 0;
  27962. if (isObject(options)) {
  27963. leading = !!options.leading;
  27964. maxing = 'maxWait' in options;
  27965. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27966. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27967. }
  27968. function invokeFunc(time) {
  27969. var args = lastArgs,
  27970. thisArg = lastThis;
  27971. lastArgs = lastThis = undefined;
  27972. lastInvokeTime = time;
  27973. result = func.apply(thisArg, args);
  27974. return result;
  27975. }
  27976. function leadingEdge(time) {
  27977. // Reset any `maxWait` timer.
  27978. lastInvokeTime = time;
  27979. // Start the timer for the trailing edge.
  27980. timerId = setTimeout(timerExpired, wait);
  27981. // Invoke the leading edge.
  27982. return leading ? invokeFunc(time) : result;
  27983. }
  27984. function remainingWait(time) {
  27985. var timeSinceLastCall = time - lastCallTime,
  27986. timeSinceLastInvoke = time - lastInvokeTime,
  27987. timeWaiting = wait - timeSinceLastCall;
  27988. return maxing
  27989. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27990. : timeWaiting;
  27991. }
  27992. function shouldInvoke(time) {
  27993. var timeSinceLastCall = time - lastCallTime,
  27994. timeSinceLastInvoke = time - lastInvokeTime;
  27995. // Either this is the first call, activity has stopped and we're at the
  27996. // trailing edge, the system time has gone backwards and we're treating
  27997. // it as the trailing edge, or we've hit the `maxWait` limit.
  27998. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27999. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28000. }
  28001. function timerExpired() {
  28002. var time = now();
  28003. if (shouldInvoke(time)) {
  28004. return trailingEdge(time);
  28005. }
  28006. // Restart the timer.
  28007. timerId = setTimeout(timerExpired, remainingWait(time));
  28008. }
  28009. function trailingEdge(time) {
  28010. timerId = undefined;
  28011. // Only invoke if we have `lastArgs` which means `func` has been
  28012. // debounced at least once.
  28013. if (trailing && lastArgs) {
  28014. return invokeFunc(time);
  28015. }
  28016. lastArgs = lastThis = undefined;
  28017. return result;
  28018. }
  28019. function cancel() {
  28020. if (timerId !== undefined) {
  28021. clearTimeout(timerId);
  28022. }
  28023. lastInvokeTime = 0;
  28024. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28025. }
  28026. function flush() {
  28027. return timerId === undefined ? result : trailingEdge(now());
  28028. }
  28029. function debounced() {
  28030. var time = now(),
  28031. isInvoking = shouldInvoke(time);
  28032. lastArgs = arguments;
  28033. lastThis = this;
  28034. lastCallTime = time;
  28035. if (isInvoking) {
  28036. if (timerId === undefined) {
  28037. return leadingEdge(lastCallTime);
  28038. }
  28039. if (maxing) {
  28040. // Handle invocations in a tight loop.
  28041. clearTimeout(timerId);
  28042. timerId = setTimeout(timerExpired, wait);
  28043. return invokeFunc(lastCallTime);
  28044. }
  28045. }
  28046. if (timerId === undefined) {
  28047. timerId = setTimeout(timerExpired, wait);
  28048. }
  28049. return result;
  28050. }
  28051. debounced.cancel = cancel;
  28052. debounced.flush = flush;
  28053. return debounced;
  28054. }
  28055. /**
  28056. * Defers invoking the `func` until the current call stack has cleared. Any
  28057. * additional arguments are provided to `func` when it's invoked.
  28058. *
  28059. * @static
  28060. * @memberOf _
  28061. * @since 0.1.0
  28062. * @category Function
  28063. * @param {Function} func The function to defer.
  28064. * @param {...*} [args] The arguments to invoke `func` with.
  28065. * @returns {number} Returns the timer id.
  28066. * @example
  28067. *
  28068. * _.defer(function(text) {
  28069. * console.log(text);
  28070. * }, 'deferred');
  28071. * // => Logs 'deferred' after one millisecond.
  28072. */
  28073. var defer = baseRest(function(func, args) {
  28074. return baseDelay(func, 1, args);
  28075. });
  28076. /**
  28077. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28078. * provided to `func` when it's invoked.
  28079. *
  28080. * @static
  28081. * @memberOf _
  28082. * @since 0.1.0
  28083. * @category Function
  28084. * @param {Function} func The function to delay.
  28085. * @param {number} wait The number of milliseconds to delay invocation.
  28086. * @param {...*} [args] The arguments to invoke `func` with.
  28087. * @returns {number} Returns the timer id.
  28088. * @example
  28089. *
  28090. * _.delay(function(text) {
  28091. * console.log(text);
  28092. * }, 1000, 'later');
  28093. * // => Logs 'later' after one second.
  28094. */
  28095. var delay = baseRest(function(func, wait, args) {
  28096. return baseDelay(func, toNumber(wait) || 0, args);
  28097. });
  28098. /**
  28099. * Creates a function that invokes `func` with arguments reversed.
  28100. *
  28101. * @static
  28102. * @memberOf _
  28103. * @since 4.0.0
  28104. * @category Function
  28105. * @param {Function} func The function to flip arguments for.
  28106. * @returns {Function} Returns the new flipped function.
  28107. * @example
  28108. *
  28109. * var flipped = _.flip(function() {
  28110. * return _.toArray(arguments);
  28111. * });
  28112. *
  28113. * flipped('a', 'b', 'c', 'd');
  28114. * // => ['d', 'c', 'b', 'a']
  28115. */
  28116. function flip(func) {
  28117. return createWrap(func, WRAP_FLIP_FLAG);
  28118. }
  28119. /**
  28120. * Creates a function that memoizes the result of `func`. If `resolver` is
  28121. * provided, it determines the cache key for storing the result based on the
  28122. * arguments provided to the memoized function. By default, the first argument
  28123. * provided to the memoized function is used as the map cache key. The `func`
  28124. * is invoked with the `this` binding of the memoized function.
  28125. *
  28126. * **Note:** The cache is exposed as the `cache` property on the memoized
  28127. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28128. * constructor with one whose instances implement the
  28129. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28130. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28131. *
  28132. * @static
  28133. * @memberOf _
  28134. * @since 0.1.0
  28135. * @category Function
  28136. * @param {Function} func The function to have its output memoized.
  28137. * @param {Function} [resolver] The function to resolve the cache key.
  28138. * @returns {Function} Returns the new memoized function.
  28139. * @example
  28140. *
  28141. * var object = { 'a': 1, 'b': 2 };
  28142. * var other = { 'c': 3, 'd': 4 };
  28143. *
  28144. * var values = _.memoize(_.values);
  28145. * values(object);
  28146. * // => [1, 2]
  28147. *
  28148. * values(other);
  28149. * // => [3, 4]
  28150. *
  28151. * object.a = 2;
  28152. * values(object);
  28153. * // => [1, 2]
  28154. *
  28155. * // Modify the result cache.
  28156. * values.cache.set(object, ['a', 'b']);
  28157. * values(object);
  28158. * // => ['a', 'b']
  28159. *
  28160. * // Replace `_.memoize.Cache`.
  28161. * _.memoize.Cache = WeakMap;
  28162. */
  28163. function memoize(func, resolver) {
  28164. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28165. throw new TypeError(FUNC_ERROR_TEXT);
  28166. }
  28167. var memoized = function() {
  28168. var args = arguments,
  28169. key = resolver ? resolver.apply(this, args) : args[0],
  28170. cache = memoized.cache;
  28171. if (cache.has(key)) {
  28172. return cache.get(key);
  28173. }
  28174. var result = func.apply(this, args);
  28175. memoized.cache = cache.set(key, result) || cache;
  28176. return result;
  28177. };
  28178. memoized.cache = new (memoize.Cache || MapCache);
  28179. return memoized;
  28180. }
  28181. // Expose `MapCache`.
  28182. memoize.Cache = MapCache;
  28183. /**
  28184. * Creates a function that negates the result of the predicate `func`. The
  28185. * `func` predicate is invoked with the `this` binding and arguments of the
  28186. * created function.
  28187. *
  28188. * @static
  28189. * @memberOf _
  28190. * @since 3.0.0
  28191. * @category Function
  28192. * @param {Function} predicate The predicate to negate.
  28193. * @returns {Function} Returns the new negated function.
  28194. * @example
  28195. *
  28196. * function isEven(n) {
  28197. * return n % 2 == 0;
  28198. * }
  28199. *
  28200. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28201. * // => [1, 3, 5]
  28202. */
  28203. function negate(predicate) {
  28204. if (typeof predicate != 'function') {
  28205. throw new TypeError(FUNC_ERROR_TEXT);
  28206. }
  28207. return function() {
  28208. var args = arguments;
  28209. switch (args.length) {
  28210. case 0: return !predicate.call(this);
  28211. case 1: return !predicate.call(this, args[0]);
  28212. case 2: return !predicate.call(this, args[0], args[1]);
  28213. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28214. }
  28215. return !predicate.apply(this, args);
  28216. };
  28217. }
  28218. /**
  28219. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28220. * to the function return the value of the first invocation. The `func` is
  28221. * invoked with the `this` binding and arguments of the created function.
  28222. *
  28223. * @static
  28224. * @memberOf _
  28225. * @since 0.1.0
  28226. * @category Function
  28227. * @param {Function} func The function to restrict.
  28228. * @returns {Function} Returns the new restricted function.
  28229. * @example
  28230. *
  28231. * var initialize = _.once(createApplication);
  28232. * initialize();
  28233. * initialize();
  28234. * // => `createApplication` is invoked once
  28235. */
  28236. function once(func) {
  28237. return before(2, func);
  28238. }
  28239. /**
  28240. * Creates a function that invokes `func` with its arguments transformed.
  28241. *
  28242. * @static
  28243. * @since 4.0.0
  28244. * @memberOf _
  28245. * @category Function
  28246. * @param {Function} func The function to wrap.
  28247. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28248. * The argument transforms.
  28249. * @returns {Function} Returns the new function.
  28250. * @example
  28251. *
  28252. * function doubled(n) {
  28253. * return n * 2;
  28254. * }
  28255. *
  28256. * function square(n) {
  28257. * return n * n;
  28258. * }
  28259. *
  28260. * var func = _.overArgs(function(x, y) {
  28261. * return [x, y];
  28262. * }, [square, doubled]);
  28263. *
  28264. * func(9, 3);
  28265. * // => [81, 6]
  28266. *
  28267. * func(10, 5);
  28268. * // => [100, 10]
  28269. */
  28270. var overArgs = castRest(function(func, transforms) {
  28271. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28272. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28273. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28274. var funcsLength = transforms.length;
  28275. return baseRest(function(args) {
  28276. var index = -1,
  28277. length = nativeMin(args.length, funcsLength);
  28278. while (++index < length) {
  28279. args[index] = transforms[index].call(this, args[index]);
  28280. }
  28281. return apply(func, this, args);
  28282. });
  28283. });
  28284. /**
  28285. * Creates a function that invokes `func` with `partials` prepended to the
  28286. * arguments it receives. This method is like `_.bind` except it does **not**
  28287. * alter the `this` binding.
  28288. *
  28289. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28290. * builds, may be used as a placeholder for partially applied arguments.
  28291. *
  28292. * **Note:** This method doesn't set the "length" property of partially
  28293. * applied functions.
  28294. *
  28295. * @static
  28296. * @memberOf _
  28297. * @since 0.2.0
  28298. * @category Function
  28299. * @param {Function} func The function to partially apply arguments to.
  28300. * @param {...*} [partials] The arguments to be partially applied.
  28301. * @returns {Function} Returns the new partially applied function.
  28302. * @example
  28303. *
  28304. * function greet(greeting, name) {
  28305. * return greeting + ' ' + name;
  28306. * }
  28307. *
  28308. * var sayHelloTo = _.partial(greet, 'hello');
  28309. * sayHelloTo('fred');
  28310. * // => 'hello fred'
  28311. *
  28312. * // Partially applied with placeholders.
  28313. * var greetFred = _.partial(greet, _, 'fred');
  28314. * greetFred('hi');
  28315. * // => 'hi fred'
  28316. */
  28317. var partial = baseRest(function(func, partials) {
  28318. var holders = replaceHolders(partials, getHolder(partial));
  28319. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28320. });
  28321. /**
  28322. * This method is like `_.partial` except that partially applied arguments
  28323. * are appended to the arguments it receives.
  28324. *
  28325. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28326. * builds, may be used as a placeholder for partially applied arguments.
  28327. *
  28328. * **Note:** This method doesn't set the "length" property of partially
  28329. * applied functions.
  28330. *
  28331. * @static
  28332. * @memberOf _
  28333. * @since 1.0.0
  28334. * @category Function
  28335. * @param {Function} func The function to partially apply arguments to.
  28336. * @param {...*} [partials] The arguments to be partially applied.
  28337. * @returns {Function} Returns the new partially applied function.
  28338. * @example
  28339. *
  28340. * function greet(greeting, name) {
  28341. * return greeting + ' ' + name;
  28342. * }
  28343. *
  28344. * var greetFred = _.partialRight(greet, 'fred');
  28345. * greetFred('hi');
  28346. * // => 'hi fred'
  28347. *
  28348. * // Partially applied with placeholders.
  28349. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28350. * sayHelloTo('fred');
  28351. * // => 'hello fred'
  28352. */
  28353. var partialRight = baseRest(function(func, partials) {
  28354. var holders = replaceHolders(partials, getHolder(partialRight));
  28355. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28356. });
  28357. /**
  28358. * Creates a function that invokes `func` with arguments arranged according
  28359. * to the specified `indexes` where the argument value at the first index is
  28360. * provided as the first argument, the argument value at the second index is
  28361. * provided as the second argument, and so on.
  28362. *
  28363. * @static
  28364. * @memberOf _
  28365. * @since 3.0.0
  28366. * @category Function
  28367. * @param {Function} func The function to rearrange arguments for.
  28368. * @param {...(number|number[])} indexes The arranged argument indexes.
  28369. * @returns {Function} Returns the new function.
  28370. * @example
  28371. *
  28372. * var rearged = _.rearg(function(a, b, c) {
  28373. * return [a, b, c];
  28374. * }, [2, 0, 1]);
  28375. *
  28376. * rearged('b', 'c', 'a')
  28377. * // => ['a', 'b', 'c']
  28378. */
  28379. var rearg = flatRest(function(func, indexes) {
  28380. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28381. });
  28382. /**
  28383. * Creates a function that invokes `func` with the `this` binding of the
  28384. * created function and arguments from `start` and beyond provided as
  28385. * an array.
  28386. *
  28387. * **Note:** This method is based on the
  28388. * [rest parameter](https://mdn.io/rest_parameters).
  28389. *
  28390. * @static
  28391. * @memberOf _
  28392. * @since 4.0.0
  28393. * @category Function
  28394. * @param {Function} func The function to apply a rest parameter to.
  28395. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28396. * @returns {Function} Returns the new function.
  28397. * @example
  28398. *
  28399. * var say = _.rest(function(what, names) {
  28400. * return what + ' ' + _.initial(names).join(', ') +
  28401. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28402. * });
  28403. *
  28404. * say('hello', 'fred', 'barney', 'pebbles');
  28405. * // => 'hello fred, barney, & pebbles'
  28406. */
  28407. function rest(func, start) {
  28408. if (typeof func != 'function') {
  28409. throw new TypeError(FUNC_ERROR_TEXT);
  28410. }
  28411. start = start === undefined ? start : toInteger(start);
  28412. return baseRest(func, start);
  28413. }
  28414. /**
  28415. * Creates a function that invokes `func` with the `this` binding of the
  28416. * create function and an array of arguments much like
  28417. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28418. *
  28419. * **Note:** This method is based on the
  28420. * [spread operator](https://mdn.io/spread_operator).
  28421. *
  28422. * @static
  28423. * @memberOf _
  28424. * @since 3.2.0
  28425. * @category Function
  28426. * @param {Function} func The function to spread arguments over.
  28427. * @param {number} [start=0] The start position of the spread.
  28428. * @returns {Function} Returns the new function.
  28429. * @example
  28430. *
  28431. * var say = _.spread(function(who, what) {
  28432. * return who + ' says ' + what;
  28433. * });
  28434. *
  28435. * say(['fred', 'hello']);
  28436. * // => 'fred says hello'
  28437. *
  28438. * var numbers = Promise.all([
  28439. * Promise.resolve(40),
  28440. * Promise.resolve(36)
  28441. * ]);
  28442. *
  28443. * numbers.then(_.spread(function(x, y) {
  28444. * return x + y;
  28445. * }));
  28446. * // => a Promise of 76
  28447. */
  28448. function spread(func, start) {
  28449. if (typeof func != 'function') {
  28450. throw new TypeError(FUNC_ERROR_TEXT);
  28451. }
  28452. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28453. return baseRest(function(args) {
  28454. var array = args[start],
  28455. otherArgs = castSlice(args, 0, start);
  28456. if (array) {
  28457. arrayPush(otherArgs, array);
  28458. }
  28459. return apply(func, this, otherArgs);
  28460. });
  28461. }
  28462. /**
  28463. * Creates a throttled function that only invokes `func` at most once per
  28464. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28465. * method to cancel delayed `func` invocations and a `flush` method to
  28466. * immediately invoke them. Provide `options` to indicate whether `func`
  28467. * should be invoked on the leading and/or trailing edge of the `wait`
  28468. * timeout. The `func` is invoked with the last arguments provided to the
  28469. * throttled function. Subsequent calls to the throttled function return the
  28470. * result of the last `func` invocation.
  28471. *
  28472. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28473. * invoked on the trailing edge of the timeout only if the throttled function
  28474. * is invoked more than once during the `wait` timeout.
  28475. *
  28476. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28477. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28478. *
  28479. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28480. * for details over the differences between `_.throttle` and `_.debounce`.
  28481. *
  28482. * @static
  28483. * @memberOf _
  28484. * @since 0.1.0
  28485. * @category Function
  28486. * @param {Function} func The function to throttle.
  28487. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28488. * @param {Object} [options={}] The options object.
  28489. * @param {boolean} [options.leading=true]
  28490. * Specify invoking on the leading edge of the timeout.
  28491. * @param {boolean} [options.trailing=true]
  28492. * Specify invoking on the trailing edge of the timeout.
  28493. * @returns {Function} Returns the new throttled function.
  28494. * @example
  28495. *
  28496. * // Avoid excessively updating the position while scrolling.
  28497. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28498. *
  28499. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28500. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28501. * jQuery(element).on('click', throttled);
  28502. *
  28503. * // Cancel the trailing throttled invocation.
  28504. * jQuery(window).on('popstate', throttled.cancel);
  28505. */
  28506. function throttle(func, wait, options) {
  28507. var leading = true,
  28508. trailing = true;
  28509. if (typeof func != 'function') {
  28510. throw new TypeError(FUNC_ERROR_TEXT);
  28511. }
  28512. if (isObject(options)) {
  28513. leading = 'leading' in options ? !!options.leading : leading;
  28514. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28515. }
  28516. return debounce(func, wait, {
  28517. 'leading': leading,
  28518. 'maxWait': wait,
  28519. 'trailing': trailing
  28520. });
  28521. }
  28522. /**
  28523. * Creates a function that accepts up to one argument, ignoring any
  28524. * additional arguments.
  28525. *
  28526. * @static
  28527. * @memberOf _
  28528. * @since 4.0.0
  28529. * @category Function
  28530. * @param {Function} func The function to cap arguments for.
  28531. * @returns {Function} Returns the new capped function.
  28532. * @example
  28533. *
  28534. * _.map(['6', '8', '10'], _.unary(parseInt));
  28535. * // => [6, 8, 10]
  28536. */
  28537. function unary(func) {
  28538. return ary(func, 1);
  28539. }
  28540. /**
  28541. * Creates a function that provides `value` to `wrapper` as its first
  28542. * argument. Any additional arguments provided to the function are appended
  28543. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28544. * binding of the created function.
  28545. *
  28546. * @static
  28547. * @memberOf _
  28548. * @since 0.1.0
  28549. * @category Function
  28550. * @param {*} value The value to wrap.
  28551. * @param {Function} [wrapper=identity] The wrapper function.
  28552. * @returns {Function} Returns the new function.
  28553. * @example
  28554. *
  28555. * var p = _.wrap(_.escape, function(func, text) {
  28556. * return '<p>' + func(text) + '</p>';
  28557. * });
  28558. *
  28559. * p('fred, barney, & pebbles');
  28560. * // => '<p>fred, barney, &amp; pebbles</p>'
  28561. */
  28562. function wrap(value, wrapper) {
  28563. return partial(castFunction(wrapper), value);
  28564. }
  28565. /*------------------------------------------------------------------------*/
  28566. /**
  28567. * Casts `value` as an array if it's not one.
  28568. *
  28569. * @static
  28570. * @memberOf _
  28571. * @since 4.4.0
  28572. * @category Lang
  28573. * @param {*} value The value to inspect.
  28574. * @returns {Array} Returns the cast array.
  28575. * @example
  28576. *
  28577. * _.castArray(1);
  28578. * // => [1]
  28579. *
  28580. * _.castArray({ 'a': 1 });
  28581. * // => [{ 'a': 1 }]
  28582. *
  28583. * _.castArray('abc');
  28584. * // => ['abc']
  28585. *
  28586. * _.castArray(null);
  28587. * // => [null]
  28588. *
  28589. * _.castArray(undefined);
  28590. * // => [undefined]
  28591. *
  28592. * _.castArray();
  28593. * // => []
  28594. *
  28595. * var array = [1, 2, 3];
  28596. * console.log(_.castArray(array) === array);
  28597. * // => true
  28598. */
  28599. function castArray() {
  28600. if (!arguments.length) {
  28601. return [];
  28602. }
  28603. var value = arguments[0];
  28604. return isArray(value) ? value : [value];
  28605. }
  28606. /**
  28607. * Creates a shallow clone of `value`.
  28608. *
  28609. * **Note:** This method is loosely based on the
  28610. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28611. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28612. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28613. * arrays. The own enumerable properties of `arguments` objects are cloned
  28614. * as plain objects. An empty object is returned for uncloneable values such
  28615. * as error objects, functions, DOM nodes, and WeakMaps.
  28616. *
  28617. * @static
  28618. * @memberOf _
  28619. * @since 0.1.0
  28620. * @category Lang
  28621. * @param {*} value The value to clone.
  28622. * @returns {*} Returns the cloned value.
  28623. * @see _.cloneDeep
  28624. * @example
  28625. *
  28626. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28627. *
  28628. * var shallow = _.clone(objects);
  28629. * console.log(shallow[0] === objects[0]);
  28630. * // => true
  28631. */
  28632. function clone(value) {
  28633. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28634. }
  28635. /**
  28636. * This method is like `_.clone` except that it accepts `customizer` which
  28637. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28638. * cloning is handled by the method instead. The `customizer` is invoked with
  28639. * up to four arguments; (value [, index|key, object, stack]).
  28640. *
  28641. * @static
  28642. * @memberOf _
  28643. * @since 4.0.0
  28644. * @category Lang
  28645. * @param {*} value The value to clone.
  28646. * @param {Function} [customizer] The function to customize cloning.
  28647. * @returns {*} Returns the cloned value.
  28648. * @see _.cloneDeepWith
  28649. * @example
  28650. *
  28651. * function customizer(value) {
  28652. * if (_.isElement(value)) {
  28653. * return value.cloneNode(false);
  28654. * }
  28655. * }
  28656. *
  28657. * var el = _.cloneWith(document.body, customizer);
  28658. *
  28659. * console.log(el === document.body);
  28660. * // => false
  28661. * console.log(el.nodeName);
  28662. * // => 'BODY'
  28663. * console.log(el.childNodes.length);
  28664. * // => 0
  28665. */
  28666. function cloneWith(value, customizer) {
  28667. customizer = typeof customizer == 'function' ? customizer : undefined;
  28668. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28669. }
  28670. /**
  28671. * This method is like `_.clone` except that it recursively clones `value`.
  28672. *
  28673. * @static
  28674. * @memberOf _
  28675. * @since 1.0.0
  28676. * @category Lang
  28677. * @param {*} value The value to recursively clone.
  28678. * @returns {*} Returns the deep cloned value.
  28679. * @see _.clone
  28680. * @example
  28681. *
  28682. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28683. *
  28684. * var deep = _.cloneDeep(objects);
  28685. * console.log(deep[0] === objects[0]);
  28686. * // => false
  28687. */
  28688. function cloneDeep(value) {
  28689. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28690. }
  28691. /**
  28692. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28693. *
  28694. * @static
  28695. * @memberOf _
  28696. * @since 4.0.0
  28697. * @category Lang
  28698. * @param {*} value The value to recursively clone.
  28699. * @param {Function} [customizer] The function to customize cloning.
  28700. * @returns {*} Returns the deep cloned value.
  28701. * @see _.cloneWith
  28702. * @example
  28703. *
  28704. * function customizer(value) {
  28705. * if (_.isElement(value)) {
  28706. * return value.cloneNode(true);
  28707. * }
  28708. * }
  28709. *
  28710. * var el = _.cloneDeepWith(document.body, customizer);
  28711. *
  28712. * console.log(el === document.body);
  28713. * // => false
  28714. * console.log(el.nodeName);
  28715. * // => 'BODY'
  28716. * console.log(el.childNodes.length);
  28717. * // => 20
  28718. */
  28719. function cloneDeepWith(value, customizer) {
  28720. customizer = typeof customizer == 'function' ? customizer : undefined;
  28721. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28722. }
  28723. /**
  28724. * Checks if `object` conforms to `source` by invoking the predicate
  28725. * properties of `source` with the corresponding property values of `object`.
  28726. *
  28727. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28728. * partially applied.
  28729. *
  28730. * @static
  28731. * @memberOf _
  28732. * @since 4.14.0
  28733. * @category Lang
  28734. * @param {Object} object The object to inspect.
  28735. * @param {Object} source The object of property predicates to conform to.
  28736. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28737. * @example
  28738. *
  28739. * var object = { 'a': 1, 'b': 2 };
  28740. *
  28741. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28742. * // => true
  28743. *
  28744. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28745. * // => false
  28746. */
  28747. function conformsTo(object, source) {
  28748. return source == null || baseConformsTo(object, source, keys(source));
  28749. }
  28750. /**
  28751. * Performs a
  28752. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28753. * comparison between two values to determine if they are equivalent.
  28754. *
  28755. * @static
  28756. * @memberOf _
  28757. * @since 4.0.0
  28758. * @category Lang
  28759. * @param {*} value The value to compare.
  28760. * @param {*} other The other value to compare.
  28761. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28762. * @example
  28763. *
  28764. * var object = { 'a': 1 };
  28765. * var other = { 'a': 1 };
  28766. *
  28767. * _.eq(object, object);
  28768. * // => true
  28769. *
  28770. * _.eq(object, other);
  28771. * // => false
  28772. *
  28773. * _.eq('a', 'a');
  28774. * // => true
  28775. *
  28776. * _.eq('a', Object('a'));
  28777. * // => false
  28778. *
  28779. * _.eq(NaN, NaN);
  28780. * // => true
  28781. */
  28782. function eq(value, other) {
  28783. return value === other || (value !== value && other !== other);
  28784. }
  28785. /**
  28786. * Checks if `value` is greater than `other`.
  28787. *
  28788. * @static
  28789. * @memberOf _
  28790. * @since 3.9.0
  28791. * @category Lang
  28792. * @param {*} value The value to compare.
  28793. * @param {*} other The other value to compare.
  28794. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28795. * else `false`.
  28796. * @see _.lt
  28797. * @example
  28798. *
  28799. * _.gt(3, 1);
  28800. * // => true
  28801. *
  28802. * _.gt(3, 3);
  28803. * // => false
  28804. *
  28805. * _.gt(1, 3);
  28806. * // => false
  28807. */
  28808. var gt = createRelationalOperation(baseGt);
  28809. /**
  28810. * Checks if `value` is greater than or equal to `other`.
  28811. *
  28812. * @static
  28813. * @memberOf _
  28814. * @since 3.9.0
  28815. * @category Lang
  28816. * @param {*} value The value to compare.
  28817. * @param {*} other The other value to compare.
  28818. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28819. * `other`, else `false`.
  28820. * @see _.lte
  28821. * @example
  28822. *
  28823. * _.gte(3, 1);
  28824. * // => true
  28825. *
  28826. * _.gte(3, 3);
  28827. * // => true
  28828. *
  28829. * _.gte(1, 3);
  28830. * // => false
  28831. */
  28832. var gte = createRelationalOperation(function(value, other) {
  28833. return value >= other;
  28834. });
  28835. /**
  28836. * Checks if `value` is likely an `arguments` object.
  28837. *
  28838. * @static
  28839. * @memberOf _
  28840. * @since 0.1.0
  28841. * @category Lang
  28842. * @param {*} value The value to check.
  28843. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28844. * else `false`.
  28845. * @example
  28846. *
  28847. * _.isArguments(function() { return arguments; }());
  28848. * // => true
  28849. *
  28850. * _.isArguments([1, 2, 3]);
  28851. * // => false
  28852. */
  28853. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28854. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28855. !propertyIsEnumerable.call(value, 'callee');
  28856. };
  28857. /**
  28858. * Checks if `value` is classified as an `Array` object.
  28859. *
  28860. * @static
  28861. * @memberOf _
  28862. * @since 0.1.0
  28863. * @category Lang
  28864. * @param {*} value The value to check.
  28865. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28866. * @example
  28867. *
  28868. * _.isArray([1, 2, 3]);
  28869. * // => true
  28870. *
  28871. * _.isArray(document.body.children);
  28872. * // => false
  28873. *
  28874. * _.isArray('abc');
  28875. * // => false
  28876. *
  28877. * _.isArray(_.noop);
  28878. * // => false
  28879. */
  28880. var isArray = Array.isArray;
  28881. /**
  28882. * Checks if `value` is classified as an `ArrayBuffer` object.
  28883. *
  28884. * @static
  28885. * @memberOf _
  28886. * @since 4.3.0
  28887. * @category Lang
  28888. * @param {*} value The value to check.
  28889. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28890. * @example
  28891. *
  28892. * _.isArrayBuffer(new ArrayBuffer(2));
  28893. * // => true
  28894. *
  28895. * _.isArrayBuffer(new Array(2));
  28896. * // => false
  28897. */
  28898. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28899. /**
  28900. * Checks if `value` is array-like. A value is considered array-like if it's
  28901. * not a function and has a `value.length` that's an integer greater than or
  28902. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28903. *
  28904. * @static
  28905. * @memberOf _
  28906. * @since 4.0.0
  28907. * @category Lang
  28908. * @param {*} value The value to check.
  28909. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28910. * @example
  28911. *
  28912. * _.isArrayLike([1, 2, 3]);
  28913. * // => true
  28914. *
  28915. * _.isArrayLike(document.body.children);
  28916. * // => true
  28917. *
  28918. * _.isArrayLike('abc');
  28919. * // => true
  28920. *
  28921. * _.isArrayLike(_.noop);
  28922. * // => false
  28923. */
  28924. function isArrayLike(value) {
  28925. return value != null && isLength(value.length) && !isFunction(value);
  28926. }
  28927. /**
  28928. * This method is like `_.isArrayLike` except that it also checks if `value`
  28929. * is an object.
  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 an array-like object,
  28937. * else `false`.
  28938. * @example
  28939. *
  28940. * _.isArrayLikeObject([1, 2, 3]);
  28941. * // => true
  28942. *
  28943. * _.isArrayLikeObject(document.body.children);
  28944. * // => true
  28945. *
  28946. * _.isArrayLikeObject('abc');
  28947. * // => false
  28948. *
  28949. * _.isArrayLikeObject(_.noop);
  28950. * // => false
  28951. */
  28952. function isArrayLikeObject(value) {
  28953. return isObjectLike(value) && isArrayLike(value);
  28954. }
  28955. /**
  28956. * Checks if `value` is classified as a boolean primitive or object.
  28957. *
  28958. * @static
  28959. * @memberOf _
  28960. * @since 0.1.0
  28961. * @category Lang
  28962. * @param {*} value The value to check.
  28963. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28964. * @example
  28965. *
  28966. * _.isBoolean(false);
  28967. * // => true
  28968. *
  28969. * _.isBoolean(null);
  28970. * // => false
  28971. */
  28972. function isBoolean(value) {
  28973. return value === true || value === false ||
  28974. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28975. }
  28976. /**
  28977. * Checks if `value` is a buffer.
  28978. *
  28979. * @static
  28980. * @memberOf _
  28981. * @since 4.3.0
  28982. * @category Lang
  28983. * @param {*} value The value to check.
  28984. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28985. * @example
  28986. *
  28987. * _.isBuffer(new Buffer(2));
  28988. * // => true
  28989. *
  28990. * _.isBuffer(new Uint8Array(2));
  28991. * // => false
  28992. */
  28993. var isBuffer = nativeIsBuffer || stubFalse;
  28994. /**
  28995. * Checks if `value` is classified as a `Date` object.
  28996. *
  28997. * @static
  28998. * @memberOf _
  28999. * @since 0.1.0
  29000. * @category Lang
  29001. * @param {*} value The value to check.
  29002. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29003. * @example
  29004. *
  29005. * _.isDate(new Date);
  29006. * // => true
  29007. *
  29008. * _.isDate('Mon April 23 2012');
  29009. * // => false
  29010. */
  29011. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29012. /**
  29013. * Checks if `value` is likely a DOM element.
  29014. *
  29015. * @static
  29016. * @memberOf _
  29017. * @since 0.1.0
  29018. * @category Lang
  29019. * @param {*} value The value to check.
  29020. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29021. * @example
  29022. *
  29023. * _.isElement(document.body);
  29024. * // => true
  29025. *
  29026. * _.isElement('<body>');
  29027. * // => false
  29028. */
  29029. function isElement(value) {
  29030. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29031. }
  29032. /**
  29033. * Checks if `value` is an empty object, collection, map, or set.
  29034. *
  29035. * Objects are considered empty if they have no own enumerable string keyed
  29036. * properties.
  29037. *
  29038. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29039. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29040. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  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 empty, else `false`.
  29048. * @example
  29049. *
  29050. * _.isEmpty(null);
  29051. * // => true
  29052. *
  29053. * _.isEmpty(true);
  29054. * // => true
  29055. *
  29056. * _.isEmpty(1);
  29057. * // => true
  29058. *
  29059. * _.isEmpty([1, 2, 3]);
  29060. * // => false
  29061. *
  29062. * _.isEmpty({ 'a': 1 });
  29063. * // => false
  29064. */
  29065. function isEmpty(value) {
  29066. if (value == null) {
  29067. return true;
  29068. }
  29069. if (isArrayLike(value) &&
  29070. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29071. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29072. return !value.length;
  29073. }
  29074. var tag = getTag(value);
  29075. if (tag == mapTag || tag == setTag) {
  29076. return !value.size;
  29077. }
  29078. if (isPrototype(value)) {
  29079. return !baseKeys(value).length;
  29080. }
  29081. for (var key in value) {
  29082. if (hasOwnProperty.call(value, key)) {
  29083. return false;
  29084. }
  29085. }
  29086. return true;
  29087. }
  29088. /**
  29089. * Performs a deep comparison between two values to determine if they are
  29090. * equivalent.
  29091. *
  29092. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29093. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29094. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29095. * by their own, not inherited, enumerable properties. Functions and DOM
  29096. * nodes are compared by strict equality, i.e. `===`.
  29097. *
  29098. * @static
  29099. * @memberOf _
  29100. * @since 0.1.0
  29101. * @category Lang
  29102. * @param {*} value The value to compare.
  29103. * @param {*} other The other value to compare.
  29104. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29105. * @example
  29106. *
  29107. * var object = { 'a': 1 };
  29108. * var other = { 'a': 1 };
  29109. *
  29110. * _.isEqual(object, other);
  29111. * // => true
  29112. *
  29113. * object === other;
  29114. * // => false
  29115. */
  29116. function isEqual(value, other) {
  29117. return baseIsEqual(value, other);
  29118. }
  29119. /**
  29120. * This method is like `_.isEqual` except that it accepts `customizer` which
  29121. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29122. * are handled by the method instead. The `customizer` is invoked with up to
  29123. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29124. *
  29125. * @static
  29126. * @memberOf _
  29127. * @since 4.0.0
  29128. * @category Lang
  29129. * @param {*} value The value to compare.
  29130. * @param {*} other The other value to compare.
  29131. * @param {Function} [customizer] The function to customize comparisons.
  29132. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29133. * @example
  29134. *
  29135. * function isGreeting(value) {
  29136. * return /^h(?:i|ello)$/.test(value);
  29137. * }
  29138. *
  29139. * function customizer(objValue, othValue) {
  29140. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29141. * return true;
  29142. * }
  29143. * }
  29144. *
  29145. * var array = ['hello', 'goodbye'];
  29146. * var other = ['hi', 'goodbye'];
  29147. *
  29148. * _.isEqualWith(array, other, customizer);
  29149. * // => true
  29150. */
  29151. function isEqualWith(value, other, customizer) {
  29152. customizer = typeof customizer == 'function' ? customizer : undefined;
  29153. var result = customizer ? customizer(value, other) : undefined;
  29154. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29155. }
  29156. /**
  29157. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29158. * `SyntaxError`, `TypeError`, or `URIError` object.
  29159. *
  29160. * @static
  29161. * @memberOf _
  29162. * @since 3.0.0
  29163. * @category Lang
  29164. * @param {*} value The value to check.
  29165. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29166. * @example
  29167. *
  29168. * _.isError(new Error);
  29169. * // => true
  29170. *
  29171. * _.isError(Error);
  29172. * // => false
  29173. */
  29174. function isError(value) {
  29175. if (!isObjectLike(value)) {
  29176. return false;
  29177. }
  29178. var tag = baseGetTag(value);
  29179. return tag == errorTag || tag == domExcTag ||
  29180. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29181. }
  29182. /**
  29183. * Checks if `value` is a finite primitive number.
  29184. *
  29185. * **Note:** This method is based on
  29186. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29187. *
  29188. * @static
  29189. * @memberOf _
  29190. * @since 0.1.0
  29191. * @category Lang
  29192. * @param {*} value The value to check.
  29193. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29194. * @example
  29195. *
  29196. * _.isFinite(3);
  29197. * // => true
  29198. *
  29199. * _.isFinite(Number.MIN_VALUE);
  29200. * // => true
  29201. *
  29202. * _.isFinite(Infinity);
  29203. * // => false
  29204. *
  29205. * _.isFinite('3');
  29206. * // => false
  29207. */
  29208. function isFinite(value) {
  29209. return typeof value == 'number' && nativeIsFinite(value);
  29210. }
  29211. /**
  29212. * Checks if `value` is classified as a `Function` object.
  29213. *
  29214. * @static
  29215. * @memberOf _
  29216. * @since 0.1.0
  29217. * @category Lang
  29218. * @param {*} value The value to check.
  29219. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29220. * @example
  29221. *
  29222. * _.isFunction(_);
  29223. * // => true
  29224. *
  29225. * _.isFunction(/abc/);
  29226. * // => false
  29227. */
  29228. function isFunction(value) {
  29229. if (!isObject(value)) {
  29230. return false;
  29231. }
  29232. // The use of `Object#toString` avoids issues with the `typeof` operator
  29233. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29234. var tag = baseGetTag(value);
  29235. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29236. }
  29237. /**
  29238. * Checks if `value` is an integer.
  29239. *
  29240. * **Note:** This method is based on
  29241. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29242. *
  29243. * @static
  29244. * @memberOf _
  29245. * @since 4.0.0
  29246. * @category Lang
  29247. * @param {*} value The value to check.
  29248. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29249. * @example
  29250. *
  29251. * _.isInteger(3);
  29252. * // => true
  29253. *
  29254. * _.isInteger(Number.MIN_VALUE);
  29255. * // => false
  29256. *
  29257. * _.isInteger(Infinity);
  29258. * // => false
  29259. *
  29260. * _.isInteger('3');
  29261. * // => false
  29262. */
  29263. function isInteger(value) {
  29264. return typeof value == 'number' && value == toInteger(value);
  29265. }
  29266. /**
  29267. * Checks if `value` is a valid array-like length.
  29268. *
  29269. * **Note:** This method is loosely based on
  29270. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29271. *
  29272. * @static
  29273. * @memberOf _
  29274. * @since 4.0.0
  29275. * @category Lang
  29276. * @param {*} value The value to check.
  29277. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29278. * @example
  29279. *
  29280. * _.isLength(3);
  29281. * // => true
  29282. *
  29283. * _.isLength(Number.MIN_VALUE);
  29284. * // => false
  29285. *
  29286. * _.isLength(Infinity);
  29287. * // => false
  29288. *
  29289. * _.isLength('3');
  29290. * // => false
  29291. */
  29292. function isLength(value) {
  29293. return typeof value == 'number' &&
  29294. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29295. }
  29296. /**
  29297. * Checks if `value` is the
  29298. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29299. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29300. *
  29301. * @static
  29302. * @memberOf _
  29303. * @since 0.1.0
  29304. * @category Lang
  29305. * @param {*} value The value to check.
  29306. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29307. * @example
  29308. *
  29309. * _.isObject({});
  29310. * // => true
  29311. *
  29312. * _.isObject([1, 2, 3]);
  29313. * // => true
  29314. *
  29315. * _.isObject(_.noop);
  29316. * // => true
  29317. *
  29318. * _.isObject(null);
  29319. * // => false
  29320. */
  29321. function isObject(value) {
  29322. var type = typeof value;
  29323. return value != null && (type == 'object' || type == 'function');
  29324. }
  29325. /**
  29326. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29327. * and has a `typeof` result of "object".
  29328. *
  29329. * @static
  29330. * @memberOf _
  29331. * @since 4.0.0
  29332. * @category Lang
  29333. * @param {*} value The value to check.
  29334. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29335. * @example
  29336. *
  29337. * _.isObjectLike({});
  29338. * // => true
  29339. *
  29340. * _.isObjectLike([1, 2, 3]);
  29341. * // => true
  29342. *
  29343. * _.isObjectLike(_.noop);
  29344. * // => false
  29345. *
  29346. * _.isObjectLike(null);
  29347. * // => false
  29348. */
  29349. function isObjectLike(value) {
  29350. return value != null && typeof value == 'object';
  29351. }
  29352. /**
  29353. * Checks if `value` is classified as a `Map` object.
  29354. *
  29355. * @static
  29356. * @memberOf _
  29357. * @since 4.3.0
  29358. * @category Lang
  29359. * @param {*} value The value to check.
  29360. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29361. * @example
  29362. *
  29363. * _.isMap(new Map);
  29364. * // => true
  29365. *
  29366. * _.isMap(new WeakMap);
  29367. * // => false
  29368. */
  29369. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29370. /**
  29371. * Performs a partial deep comparison between `object` and `source` to
  29372. * determine if `object` contains equivalent property values.
  29373. *
  29374. * **Note:** This method is equivalent to `_.matches` when `source` is
  29375. * partially applied.
  29376. *
  29377. * Partial comparisons will match empty array and empty object `source`
  29378. * values against any array or object value, respectively. See `_.isEqual`
  29379. * for a list of supported value comparisons.
  29380. *
  29381. * @static
  29382. * @memberOf _
  29383. * @since 3.0.0
  29384. * @category Lang
  29385. * @param {Object} object The object to inspect.
  29386. * @param {Object} source The object of property values to match.
  29387. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29388. * @example
  29389. *
  29390. * var object = { 'a': 1, 'b': 2 };
  29391. *
  29392. * _.isMatch(object, { 'b': 2 });
  29393. * // => true
  29394. *
  29395. * _.isMatch(object, { 'b': 1 });
  29396. * // => false
  29397. */
  29398. function isMatch(object, source) {
  29399. return object === source || baseIsMatch(object, source, getMatchData(source));
  29400. }
  29401. /**
  29402. * This method is like `_.isMatch` except that it accepts `customizer` which
  29403. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29404. * are handled by the method instead. The `customizer` is invoked with five
  29405. * arguments: (objValue, srcValue, index|key, object, source).
  29406. *
  29407. * @static
  29408. * @memberOf _
  29409. * @since 4.0.0
  29410. * @category Lang
  29411. * @param {Object} object The object to inspect.
  29412. * @param {Object} source The object of property values to match.
  29413. * @param {Function} [customizer] The function to customize comparisons.
  29414. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29415. * @example
  29416. *
  29417. * function isGreeting(value) {
  29418. * return /^h(?:i|ello)$/.test(value);
  29419. * }
  29420. *
  29421. * function customizer(objValue, srcValue) {
  29422. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29423. * return true;
  29424. * }
  29425. * }
  29426. *
  29427. * var object = { 'greeting': 'hello' };
  29428. * var source = { 'greeting': 'hi' };
  29429. *
  29430. * _.isMatchWith(object, source, customizer);
  29431. * // => true
  29432. */
  29433. function isMatchWith(object, source, customizer) {
  29434. customizer = typeof customizer == 'function' ? customizer : undefined;
  29435. return baseIsMatch(object, source, getMatchData(source), customizer);
  29436. }
  29437. /**
  29438. * Checks if `value` is `NaN`.
  29439. *
  29440. * **Note:** This method is based on
  29441. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29442. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29443. * `undefined` and other non-number values.
  29444. *
  29445. * @static
  29446. * @memberOf _
  29447. * @since 0.1.0
  29448. * @category Lang
  29449. * @param {*} value The value to check.
  29450. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29451. * @example
  29452. *
  29453. * _.isNaN(NaN);
  29454. * // => true
  29455. *
  29456. * _.isNaN(new Number(NaN));
  29457. * // => true
  29458. *
  29459. * isNaN(undefined);
  29460. * // => true
  29461. *
  29462. * _.isNaN(undefined);
  29463. * // => false
  29464. */
  29465. function isNaN(value) {
  29466. // An `NaN` primitive is the only value that is not equal to itself.
  29467. // Perform the `toStringTag` check first to avoid errors with some
  29468. // ActiveX objects in IE.
  29469. return isNumber(value) && value != +value;
  29470. }
  29471. /**
  29472. * Checks if `value` is a pristine native function.
  29473. *
  29474. * **Note:** This method can't reliably detect native functions in the presence
  29475. * of the core-js package because core-js circumvents this kind of detection.
  29476. * Despite multiple requests, the core-js maintainer has made it clear: any
  29477. * attempt to fix the detection will be obstructed. As a result, we're left
  29478. * with little choice but to throw an error. Unfortunately, this also affects
  29479. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29480. * which rely on core-js.
  29481. *
  29482. * @static
  29483. * @memberOf _
  29484. * @since 3.0.0
  29485. * @category Lang
  29486. * @param {*} value The value to check.
  29487. * @returns {boolean} Returns `true` if `value` is a native function,
  29488. * else `false`.
  29489. * @example
  29490. *
  29491. * _.isNative(Array.prototype.push);
  29492. * // => true
  29493. *
  29494. * _.isNative(_);
  29495. * // => false
  29496. */
  29497. function isNative(value) {
  29498. if (isMaskable(value)) {
  29499. throw new Error(CORE_ERROR_TEXT);
  29500. }
  29501. return baseIsNative(value);
  29502. }
  29503. /**
  29504. * Checks if `value` is `null`.
  29505. *
  29506. * @static
  29507. * @memberOf _
  29508. * @since 0.1.0
  29509. * @category Lang
  29510. * @param {*} value The value to check.
  29511. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29512. * @example
  29513. *
  29514. * _.isNull(null);
  29515. * // => true
  29516. *
  29517. * _.isNull(void 0);
  29518. * // => false
  29519. */
  29520. function isNull(value) {
  29521. return value === null;
  29522. }
  29523. /**
  29524. * Checks if `value` is `null` or `undefined`.
  29525. *
  29526. * @static
  29527. * @memberOf _
  29528. * @since 4.0.0
  29529. * @category Lang
  29530. * @param {*} value The value to check.
  29531. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29532. * @example
  29533. *
  29534. * _.isNil(null);
  29535. * // => true
  29536. *
  29537. * _.isNil(void 0);
  29538. * // => true
  29539. *
  29540. * _.isNil(NaN);
  29541. * // => false
  29542. */
  29543. function isNil(value) {
  29544. return value == null;
  29545. }
  29546. /**
  29547. * Checks if `value` is classified as a `Number` primitive or object.
  29548. *
  29549. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29550. * classified as numbers, use the `_.isFinite` method.
  29551. *
  29552. * @static
  29553. * @memberOf _
  29554. * @since 0.1.0
  29555. * @category Lang
  29556. * @param {*} value The value to check.
  29557. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29558. * @example
  29559. *
  29560. * _.isNumber(3);
  29561. * // => true
  29562. *
  29563. * _.isNumber(Number.MIN_VALUE);
  29564. * // => true
  29565. *
  29566. * _.isNumber(Infinity);
  29567. * // => true
  29568. *
  29569. * _.isNumber('3');
  29570. * // => false
  29571. */
  29572. function isNumber(value) {
  29573. return typeof value == 'number' ||
  29574. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29575. }
  29576. /**
  29577. * Checks if `value` is a plain object, that is, an object created by the
  29578. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29579. *
  29580. * @static
  29581. * @memberOf _
  29582. * @since 0.8.0
  29583. * @category Lang
  29584. * @param {*} value The value to check.
  29585. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29586. * @example
  29587. *
  29588. * function Foo() {
  29589. * this.a = 1;
  29590. * }
  29591. *
  29592. * _.isPlainObject(new Foo);
  29593. * // => false
  29594. *
  29595. * _.isPlainObject([1, 2, 3]);
  29596. * // => false
  29597. *
  29598. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29599. * // => true
  29600. *
  29601. * _.isPlainObject(Object.create(null));
  29602. * // => true
  29603. */
  29604. function isPlainObject(value) {
  29605. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29606. return false;
  29607. }
  29608. var proto = getPrototype(value);
  29609. if (proto === null) {
  29610. return true;
  29611. }
  29612. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29613. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29614. funcToString.call(Ctor) == objectCtorString;
  29615. }
  29616. /**
  29617. * Checks if `value` is classified as a `RegExp` object.
  29618. *
  29619. * @static
  29620. * @memberOf _
  29621. * @since 0.1.0
  29622. * @category Lang
  29623. * @param {*} value The value to check.
  29624. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29625. * @example
  29626. *
  29627. * _.isRegExp(/abc/);
  29628. * // => true
  29629. *
  29630. * _.isRegExp('/abc/');
  29631. * // => false
  29632. */
  29633. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29634. /**
  29635. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29636. * double precision number which isn't the result of a rounded unsafe integer.
  29637. *
  29638. * **Note:** This method is based on
  29639. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29640. *
  29641. * @static
  29642. * @memberOf _
  29643. * @since 4.0.0
  29644. * @category Lang
  29645. * @param {*} value The value to check.
  29646. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29647. * @example
  29648. *
  29649. * _.isSafeInteger(3);
  29650. * // => true
  29651. *
  29652. * _.isSafeInteger(Number.MIN_VALUE);
  29653. * // => false
  29654. *
  29655. * _.isSafeInteger(Infinity);
  29656. * // => false
  29657. *
  29658. * _.isSafeInteger('3');
  29659. * // => false
  29660. */
  29661. function isSafeInteger(value) {
  29662. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29663. }
  29664. /**
  29665. * Checks if `value` is classified as a `Set` object.
  29666. *
  29667. * @static
  29668. * @memberOf _
  29669. * @since 4.3.0
  29670. * @category Lang
  29671. * @param {*} value The value to check.
  29672. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29673. * @example
  29674. *
  29675. * _.isSet(new Set);
  29676. * // => true
  29677. *
  29678. * _.isSet(new WeakSet);
  29679. * // => false
  29680. */
  29681. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29682. /**
  29683. * Checks if `value` is classified as a `String` primitive or object.
  29684. *
  29685. * @static
  29686. * @since 0.1.0
  29687. * @memberOf _
  29688. * @category Lang
  29689. * @param {*} value The value to check.
  29690. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29691. * @example
  29692. *
  29693. * _.isString('abc');
  29694. * // => true
  29695. *
  29696. * _.isString(1);
  29697. * // => false
  29698. */
  29699. function isString(value) {
  29700. return typeof value == 'string' ||
  29701. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29702. }
  29703. /**
  29704. * Checks if `value` is classified as a `Symbol` primitive or object.
  29705. *
  29706. * @static
  29707. * @memberOf _
  29708. * @since 4.0.0
  29709. * @category Lang
  29710. * @param {*} value The value to check.
  29711. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29712. * @example
  29713. *
  29714. * _.isSymbol(Symbol.iterator);
  29715. * // => true
  29716. *
  29717. * _.isSymbol('abc');
  29718. * // => false
  29719. */
  29720. function isSymbol(value) {
  29721. return typeof value == 'symbol' ||
  29722. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29723. }
  29724. /**
  29725. * Checks if `value` is classified as a typed array.
  29726. *
  29727. * @static
  29728. * @memberOf _
  29729. * @since 3.0.0
  29730. * @category Lang
  29731. * @param {*} value The value to check.
  29732. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29733. * @example
  29734. *
  29735. * _.isTypedArray(new Uint8Array);
  29736. * // => true
  29737. *
  29738. * _.isTypedArray([]);
  29739. * // => false
  29740. */
  29741. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29742. /**
  29743. * Checks if `value` is `undefined`.
  29744. *
  29745. * @static
  29746. * @since 0.1.0
  29747. * @memberOf _
  29748. * @category Lang
  29749. * @param {*} value The value to check.
  29750. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29751. * @example
  29752. *
  29753. * _.isUndefined(void 0);
  29754. * // => true
  29755. *
  29756. * _.isUndefined(null);
  29757. * // => false
  29758. */
  29759. function isUndefined(value) {
  29760. return value === undefined;
  29761. }
  29762. /**
  29763. * Checks if `value` is classified as a `WeakMap` object.
  29764. *
  29765. * @static
  29766. * @memberOf _
  29767. * @since 4.3.0
  29768. * @category Lang
  29769. * @param {*} value The value to check.
  29770. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29771. * @example
  29772. *
  29773. * _.isWeakMap(new WeakMap);
  29774. * // => true
  29775. *
  29776. * _.isWeakMap(new Map);
  29777. * // => false
  29778. */
  29779. function isWeakMap(value) {
  29780. return isObjectLike(value) && getTag(value) == weakMapTag;
  29781. }
  29782. /**
  29783. * Checks if `value` is classified as a `WeakSet` object.
  29784. *
  29785. * @static
  29786. * @memberOf _
  29787. * @since 4.3.0
  29788. * @category Lang
  29789. * @param {*} value The value to check.
  29790. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29791. * @example
  29792. *
  29793. * _.isWeakSet(new WeakSet);
  29794. * // => true
  29795. *
  29796. * _.isWeakSet(new Set);
  29797. * // => false
  29798. */
  29799. function isWeakSet(value) {
  29800. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29801. }
  29802. /**
  29803. * Checks if `value` is less than `other`.
  29804. *
  29805. * @static
  29806. * @memberOf _
  29807. * @since 3.9.0
  29808. * @category Lang
  29809. * @param {*} value The value to compare.
  29810. * @param {*} other The other value to compare.
  29811. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29812. * else `false`.
  29813. * @see _.gt
  29814. * @example
  29815. *
  29816. * _.lt(1, 3);
  29817. * // => true
  29818. *
  29819. * _.lt(3, 3);
  29820. * // => false
  29821. *
  29822. * _.lt(3, 1);
  29823. * // => false
  29824. */
  29825. var lt = createRelationalOperation(baseLt);
  29826. /**
  29827. * Checks if `value` is less than or equal to `other`.
  29828. *
  29829. * @static
  29830. * @memberOf _
  29831. * @since 3.9.0
  29832. * @category Lang
  29833. * @param {*} value The value to compare.
  29834. * @param {*} other The other value to compare.
  29835. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29836. * `other`, else `false`.
  29837. * @see _.gte
  29838. * @example
  29839. *
  29840. * _.lte(1, 3);
  29841. * // => true
  29842. *
  29843. * _.lte(3, 3);
  29844. * // => true
  29845. *
  29846. * _.lte(3, 1);
  29847. * // => false
  29848. */
  29849. var lte = createRelationalOperation(function(value, other) {
  29850. return value <= other;
  29851. });
  29852. /**
  29853. * Converts `value` to an array.
  29854. *
  29855. * @static
  29856. * @since 0.1.0
  29857. * @memberOf _
  29858. * @category Lang
  29859. * @param {*} value The value to convert.
  29860. * @returns {Array} Returns the converted array.
  29861. * @example
  29862. *
  29863. * _.toArray({ 'a': 1, 'b': 2 });
  29864. * // => [1, 2]
  29865. *
  29866. * _.toArray('abc');
  29867. * // => ['a', 'b', 'c']
  29868. *
  29869. * _.toArray(1);
  29870. * // => []
  29871. *
  29872. * _.toArray(null);
  29873. * // => []
  29874. */
  29875. function toArray(value) {
  29876. if (!value) {
  29877. return [];
  29878. }
  29879. if (isArrayLike(value)) {
  29880. return isString(value) ? stringToArray(value) : copyArray(value);
  29881. }
  29882. if (symIterator && value[symIterator]) {
  29883. return iteratorToArray(value[symIterator]());
  29884. }
  29885. var tag = getTag(value),
  29886. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29887. return func(value);
  29888. }
  29889. /**
  29890. * Converts `value` to a finite number.
  29891. *
  29892. * @static
  29893. * @memberOf _
  29894. * @since 4.12.0
  29895. * @category Lang
  29896. * @param {*} value The value to convert.
  29897. * @returns {number} Returns the converted number.
  29898. * @example
  29899. *
  29900. * _.toFinite(3.2);
  29901. * // => 3.2
  29902. *
  29903. * _.toFinite(Number.MIN_VALUE);
  29904. * // => 5e-324
  29905. *
  29906. * _.toFinite(Infinity);
  29907. * // => 1.7976931348623157e+308
  29908. *
  29909. * _.toFinite('3.2');
  29910. * // => 3.2
  29911. */
  29912. function toFinite(value) {
  29913. if (!value) {
  29914. return value === 0 ? value : 0;
  29915. }
  29916. value = toNumber(value);
  29917. if (value === INFINITY || value === -INFINITY) {
  29918. var sign = (value < 0 ? -1 : 1);
  29919. return sign * MAX_INTEGER;
  29920. }
  29921. return value === value ? value : 0;
  29922. }
  29923. /**
  29924. * Converts `value` to an integer.
  29925. *
  29926. * **Note:** This method is loosely based on
  29927. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29928. *
  29929. * @static
  29930. * @memberOf _
  29931. * @since 4.0.0
  29932. * @category Lang
  29933. * @param {*} value The value to convert.
  29934. * @returns {number} Returns the converted integer.
  29935. * @example
  29936. *
  29937. * _.toInteger(3.2);
  29938. * // => 3
  29939. *
  29940. * _.toInteger(Number.MIN_VALUE);
  29941. * // => 0
  29942. *
  29943. * _.toInteger(Infinity);
  29944. * // => 1.7976931348623157e+308
  29945. *
  29946. * _.toInteger('3.2');
  29947. * // => 3
  29948. */
  29949. function toInteger(value) {
  29950. var result = toFinite(value),
  29951. remainder = result % 1;
  29952. return result === result ? (remainder ? result - remainder : result) : 0;
  29953. }
  29954. /**
  29955. * Converts `value` to an integer suitable for use as the length of an
  29956. * array-like object.
  29957. *
  29958. * **Note:** This method is based on
  29959. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29960. *
  29961. * @static
  29962. * @memberOf _
  29963. * @since 4.0.0
  29964. * @category Lang
  29965. * @param {*} value The value to convert.
  29966. * @returns {number} Returns the converted integer.
  29967. * @example
  29968. *
  29969. * _.toLength(3.2);
  29970. * // => 3
  29971. *
  29972. * _.toLength(Number.MIN_VALUE);
  29973. * // => 0
  29974. *
  29975. * _.toLength(Infinity);
  29976. * // => 4294967295
  29977. *
  29978. * _.toLength('3.2');
  29979. * // => 3
  29980. */
  29981. function toLength(value) {
  29982. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29983. }
  29984. /**
  29985. * Converts `value` to a number.
  29986. *
  29987. * @static
  29988. * @memberOf _
  29989. * @since 4.0.0
  29990. * @category Lang
  29991. * @param {*} value The value to process.
  29992. * @returns {number} Returns the number.
  29993. * @example
  29994. *
  29995. * _.toNumber(3.2);
  29996. * // => 3.2
  29997. *
  29998. * _.toNumber(Number.MIN_VALUE);
  29999. * // => 5e-324
  30000. *
  30001. * _.toNumber(Infinity);
  30002. * // => Infinity
  30003. *
  30004. * _.toNumber('3.2');
  30005. * // => 3.2
  30006. */
  30007. function toNumber(value) {
  30008. if (typeof value == 'number') {
  30009. return value;
  30010. }
  30011. if (isSymbol(value)) {
  30012. return NAN;
  30013. }
  30014. if (isObject(value)) {
  30015. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30016. value = isObject(other) ? (other + '') : other;
  30017. }
  30018. if (typeof value != 'string') {
  30019. return value === 0 ? value : +value;
  30020. }
  30021. value = value.replace(reTrim, '');
  30022. var isBinary = reIsBinary.test(value);
  30023. return (isBinary || reIsOctal.test(value))
  30024. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30025. : (reIsBadHex.test(value) ? NAN : +value);
  30026. }
  30027. /**
  30028. * Converts `value` to a plain object flattening inherited enumerable string
  30029. * keyed properties of `value` to own properties of the plain object.
  30030. *
  30031. * @static
  30032. * @memberOf _
  30033. * @since 3.0.0
  30034. * @category Lang
  30035. * @param {*} value The value to convert.
  30036. * @returns {Object} Returns the converted plain object.
  30037. * @example
  30038. *
  30039. * function Foo() {
  30040. * this.b = 2;
  30041. * }
  30042. *
  30043. * Foo.prototype.c = 3;
  30044. *
  30045. * _.assign({ 'a': 1 }, new Foo);
  30046. * // => { 'a': 1, 'b': 2 }
  30047. *
  30048. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30049. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30050. */
  30051. function toPlainObject(value) {
  30052. return copyObject(value, keysIn(value));
  30053. }
  30054. /**
  30055. * Converts `value` to a safe integer. A safe integer can be compared and
  30056. * represented correctly.
  30057. *
  30058. * @static
  30059. * @memberOf _
  30060. * @since 4.0.0
  30061. * @category Lang
  30062. * @param {*} value The value to convert.
  30063. * @returns {number} Returns the converted integer.
  30064. * @example
  30065. *
  30066. * _.toSafeInteger(3.2);
  30067. * // => 3
  30068. *
  30069. * _.toSafeInteger(Number.MIN_VALUE);
  30070. * // => 0
  30071. *
  30072. * _.toSafeInteger(Infinity);
  30073. * // => 9007199254740991
  30074. *
  30075. * _.toSafeInteger('3.2');
  30076. * // => 3
  30077. */
  30078. function toSafeInteger(value) {
  30079. return value
  30080. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30081. : (value === 0 ? value : 0);
  30082. }
  30083. /**
  30084. * Converts `value` to a string. An empty string is returned for `null`
  30085. * and `undefined` values. The sign of `-0` is preserved.
  30086. *
  30087. * @static
  30088. * @memberOf _
  30089. * @since 4.0.0
  30090. * @category Lang
  30091. * @param {*} value The value to convert.
  30092. * @returns {string} Returns the converted string.
  30093. * @example
  30094. *
  30095. * _.toString(null);
  30096. * // => ''
  30097. *
  30098. * _.toString(-0);
  30099. * // => '-0'
  30100. *
  30101. * _.toString([1, 2, 3]);
  30102. * // => '1,2,3'
  30103. */
  30104. function toString(value) {
  30105. return value == null ? '' : baseToString(value);
  30106. }
  30107. /*------------------------------------------------------------------------*/
  30108. /**
  30109. * Assigns own enumerable string keyed properties of source objects to the
  30110. * destination object. Source objects are applied from left to right.
  30111. * Subsequent sources overwrite property assignments of previous sources.
  30112. *
  30113. * **Note:** This method mutates `object` and is loosely based on
  30114. * [`Object.assign`](https://mdn.io/Object/assign).
  30115. *
  30116. * @static
  30117. * @memberOf _
  30118. * @since 0.10.0
  30119. * @category Object
  30120. * @param {Object} object The destination object.
  30121. * @param {...Object} [sources] The source objects.
  30122. * @returns {Object} Returns `object`.
  30123. * @see _.assignIn
  30124. * @example
  30125. *
  30126. * function Foo() {
  30127. * this.a = 1;
  30128. * }
  30129. *
  30130. * function Bar() {
  30131. * this.c = 3;
  30132. * }
  30133. *
  30134. * Foo.prototype.b = 2;
  30135. * Bar.prototype.d = 4;
  30136. *
  30137. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30138. * // => { 'a': 1, 'c': 3 }
  30139. */
  30140. var assign = createAssigner(function(object, source) {
  30141. if (isPrototype(source) || isArrayLike(source)) {
  30142. copyObject(source, keys(source), object);
  30143. return;
  30144. }
  30145. for (var key in source) {
  30146. if (hasOwnProperty.call(source, key)) {
  30147. assignValue(object, key, source[key]);
  30148. }
  30149. }
  30150. });
  30151. /**
  30152. * This method is like `_.assign` except that it iterates over own and
  30153. * inherited source properties.
  30154. *
  30155. * **Note:** This method mutates `object`.
  30156. *
  30157. * @static
  30158. * @memberOf _
  30159. * @since 4.0.0
  30160. * @alias extend
  30161. * @category Object
  30162. * @param {Object} object The destination object.
  30163. * @param {...Object} [sources] The source objects.
  30164. * @returns {Object} Returns `object`.
  30165. * @see _.assign
  30166. * @example
  30167. *
  30168. * function Foo() {
  30169. * this.a = 1;
  30170. * }
  30171. *
  30172. * function Bar() {
  30173. * this.c = 3;
  30174. * }
  30175. *
  30176. * Foo.prototype.b = 2;
  30177. * Bar.prototype.d = 4;
  30178. *
  30179. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30180. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30181. */
  30182. var assignIn = createAssigner(function(object, source) {
  30183. copyObject(source, keysIn(source), object);
  30184. });
  30185. /**
  30186. * This method is like `_.assignIn` except that it accepts `customizer`
  30187. * which is invoked to produce the assigned values. If `customizer` returns
  30188. * `undefined`, assignment is handled by the method instead. The `customizer`
  30189. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30190. *
  30191. * **Note:** This method mutates `object`.
  30192. *
  30193. * @static
  30194. * @memberOf _
  30195. * @since 4.0.0
  30196. * @alias extendWith
  30197. * @category Object
  30198. * @param {Object} object The destination object.
  30199. * @param {...Object} sources The source objects.
  30200. * @param {Function} [customizer] The function to customize assigned values.
  30201. * @returns {Object} Returns `object`.
  30202. * @see _.assignWith
  30203. * @example
  30204. *
  30205. * function customizer(objValue, srcValue) {
  30206. * return _.isUndefined(objValue) ? srcValue : objValue;
  30207. * }
  30208. *
  30209. * var defaults = _.partialRight(_.assignInWith, customizer);
  30210. *
  30211. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30212. * // => { 'a': 1, 'b': 2 }
  30213. */
  30214. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30215. copyObject(source, keysIn(source), object, customizer);
  30216. });
  30217. /**
  30218. * This method is like `_.assign` except that it accepts `customizer`
  30219. * which is invoked to produce the assigned values. If `customizer` returns
  30220. * `undefined`, assignment is handled by the method instead. The `customizer`
  30221. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30222. *
  30223. * **Note:** This method mutates `object`.
  30224. *
  30225. * @static
  30226. * @memberOf _
  30227. * @since 4.0.0
  30228. * @category Object
  30229. * @param {Object} object The destination object.
  30230. * @param {...Object} sources The source objects.
  30231. * @param {Function} [customizer] The function to customize assigned values.
  30232. * @returns {Object} Returns `object`.
  30233. * @see _.assignInWith
  30234. * @example
  30235. *
  30236. * function customizer(objValue, srcValue) {
  30237. * return _.isUndefined(objValue) ? srcValue : objValue;
  30238. * }
  30239. *
  30240. * var defaults = _.partialRight(_.assignWith, customizer);
  30241. *
  30242. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30243. * // => { 'a': 1, 'b': 2 }
  30244. */
  30245. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30246. copyObject(source, keys(source), object, customizer);
  30247. });
  30248. /**
  30249. * Creates an array of values corresponding to `paths` of `object`.
  30250. *
  30251. * @static
  30252. * @memberOf _
  30253. * @since 1.0.0
  30254. * @category Object
  30255. * @param {Object} object The object to iterate over.
  30256. * @param {...(string|string[])} [paths] The property paths to pick.
  30257. * @returns {Array} Returns the picked values.
  30258. * @example
  30259. *
  30260. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30261. *
  30262. * _.at(object, ['a[0].b.c', 'a[1]']);
  30263. * // => [3, 4]
  30264. */
  30265. var at = flatRest(baseAt);
  30266. /**
  30267. * Creates an object that inherits from the `prototype` object. If a
  30268. * `properties` object is given, its own enumerable string keyed properties
  30269. * are assigned to the created object.
  30270. *
  30271. * @static
  30272. * @memberOf _
  30273. * @since 2.3.0
  30274. * @category Object
  30275. * @param {Object} prototype The object to inherit from.
  30276. * @param {Object} [properties] The properties to assign to the object.
  30277. * @returns {Object} Returns the new object.
  30278. * @example
  30279. *
  30280. * function Shape() {
  30281. * this.x = 0;
  30282. * this.y = 0;
  30283. * }
  30284. *
  30285. * function Circle() {
  30286. * Shape.call(this);
  30287. * }
  30288. *
  30289. * Circle.prototype = _.create(Shape.prototype, {
  30290. * 'constructor': Circle
  30291. * });
  30292. *
  30293. * var circle = new Circle;
  30294. * circle instanceof Circle;
  30295. * // => true
  30296. *
  30297. * circle instanceof Shape;
  30298. * // => true
  30299. */
  30300. function create(prototype, properties) {
  30301. var result = baseCreate(prototype);
  30302. return properties == null ? result : baseAssign(result, properties);
  30303. }
  30304. /**
  30305. * Assigns own and inherited enumerable string keyed properties of source
  30306. * objects to the destination object for all destination properties that
  30307. * resolve to `undefined`. Source objects are applied from left to right.
  30308. * Once a property is set, additional values of the same property are ignored.
  30309. *
  30310. * **Note:** This method mutates `object`.
  30311. *
  30312. * @static
  30313. * @since 0.1.0
  30314. * @memberOf _
  30315. * @category Object
  30316. * @param {Object} object The destination object.
  30317. * @param {...Object} [sources] The source objects.
  30318. * @returns {Object} Returns `object`.
  30319. * @see _.defaultsDeep
  30320. * @example
  30321. *
  30322. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30323. * // => { 'a': 1, 'b': 2 }
  30324. */
  30325. var defaults = baseRest(function(object, sources) {
  30326. object = Object(object);
  30327. var index = -1;
  30328. var length = sources.length;
  30329. var guard = length > 2 ? sources[2] : undefined;
  30330. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30331. length = 1;
  30332. }
  30333. while (++index < length) {
  30334. var source = sources[index];
  30335. var props = keysIn(source);
  30336. var propsIndex = -1;
  30337. var propsLength = props.length;
  30338. while (++propsIndex < propsLength) {
  30339. var key = props[propsIndex];
  30340. var value = object[key];
  30341. if (value === undefined ||
  30342. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30343. object[key] = source[key];
  30344. }
  30345. }
  30346. }
  30347. return object;
  30348. });
  30349. /**
  30350. * This method is like `_.defaults` except that it recursively assigns
  30351. * default properties.
  30352. *
  30353. * **Note:** This method mutates `object`.
  30354. *
  30355. * @static
  30356. * @memberOf _
  30357. * @since 3.10.0
  30358. * @category Object
  30359. * @param {Object} object The destination object.
  30360. * @param {...Object} [sources] The source objects.
  30361. * @returns {Object} Returns `object`.
  30362. * @see _.defaults
  30363. * @example
  30364. *
  30365. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30366. * // => { 'a': { 'b': 2, 'c': 3 } }
  30367. */
  30368. var defaultsDeep = baseRest(function(args) {
  30369. args.push(undefined, customDefaultsMerge);
  30370. return apply(mergeWith, undefined, args);
  30371. });
  30372. /**
  30373. * This method is like `_.find` except that it returns the key of the first
  30374. * element `predicate` returns truthy for instead of the element itself.
  30375. *
  30376. * @static
  30377. * @memberOf _
  30378. * @since 1.1.0
  30379. * @category Object
  30380. * @param {Object} object The object to inspect.
  30381. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30382. * @returns {string|undefined} Returns the key of the matched element,
  30383. * else `undefined`.
  30384. * @example
  30385. *
  30386. * var users = {
  30387. * 'barney': { 'age': 36, 'active': true },
  30388. * 'fred': { 'age': 40, 'active': false },
  30389. * 'pebbles': { 'age': 1, 'active': true }
  30390. * };
  30391. *
  30392. * _.findKey(users, function(o) { return o.age < 40; });
  30393. * // => 'barney' (iteration order is not guaranteed)
  30394. *
  30395. * // The `_.matches` iteratee shorthand.
  30396. * _.findKey(users, { 'age': 1, 'active': true });
  30397. * // => 'pebbles'
  30398. *
  30399. * // The `_.matchesProperty` iteratee shorthand.
  30400. * _.findKey(users, ['active', false]);
  30401. * // => 'fred'
  30402. *
  30403. * // The `_.property` iteratee shorthand.
  30404. * _.findKey(users, 'active');
  30405. * // => 'barney'
  30406. */
  30407. function findKey(object, predicate) {
  30408. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30409. }
  30410. /**
  30411. * This method is like `_.findKey` except that it iterates over elements of
  30412. * a collection in the opposite order.
  30413. *
  30414. * @static
  30415. * @memberOf _
  30416. * @since 2.0.0
  30417. * @category Object
  30418. * @param {Object} object The object to inspect.
  30419. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30420. * @returns {string|undefined} Returns the key of the matched element,
  30421. * else `undefined`.
  30422. * @example
  30423. *
  30424. * var users = {
  30425. * 'barney': { 'age': 36, 'active': true },
  30426. * 'fred': { 'age': 40, 'active': false },
  30427. * 'pebbles': { 'age': 1, 'active': true }
  30428. * };
  30429. *
  30430. * _.findLastKey(users, function(o) { return o.age < 40; });
  30431. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30432. *
  30433. * // The `_.matches` iteratee shorthand.
  30434. * _.findLastKey(users, { 'age': 36, 'active': true });
  30435. * // => 'barney'
  30436. *
  30437. * // The `_.matchesProperty` iteratee shorthand.
  30438. * _.findLastKey(users, ['active', false]);
  30439. * // => 'fred'
  30440. *
  30441. * // The `_.property` iteratee shorthand.
  30442. * _.findLastKey(users, 'active');
  30443. * // => 'pebbles'
  30444. */
  30445. function findLastKey(object, predicate) {
  30446. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30447. }
  30448. /**
  30449. * Iterates over own and inherited enumerable string keyed properties of an
  30450. * object and invokes `iteratee` for each property. The iteratee is invoked
  30451. * with three arguments: (value, key, object). Iteratee functions may exit
  30452. * iteration early by explicitly returning `false`.
  30453. *
  30454. * @static
  30455. * @memberOf _
  30456. * @since 0.3.0
  30457. * @category Object
  30458. * @param {Object} object The object to iterate over.
  30459. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30460. * @returns {Object} Returns `object`.
  30461. * @see _.forInRight
  30462. * @example
  30463. *
  30464. * function Foo() {
  30465. * this.a = 1;
  30466. * this.b = 2;
  30467. * }
  30468. *
  30469. * Foo.prototype.c = 3;
  30470. *
  30471. * _.forIn(new Foo, function(value, key) {
  30472. * console.log(key);
  30473. * });
  30474. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30475. */
  30476. function forIn(object, iteratee) {
  30477. return object == null
  30478. ? object
  30479. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30480. }
  30481. /**
  30482. * This method is like `_.forIn` except that it iterates over properties of
  30483. * `object` in the opposite order.
  30484. *
  30485. * @static
  30486. * @memberOf _
  30487. * @since 2.0.0
  30488. * @category Object
  30489. * @param {Object} object The object to iterate over.
  30490. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30491. * @returns {Object} Returns `object`.
  30492. * @see _.forIn
  30493. * @example
  30494. *
  30495. * function Foo() {
  30496. * this.a = 1;
  30497. * this.b = 2;
  30498. * }
  30499. *
  30500. * Foo.prototype.c = 3;
  30501. *
  30502. * _.forInRight(new Foo, function(value, key) {
  30503. * console.log(key);
  30504. * });
  30505. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30506. */
  30507. function forInRight(object, iteratee) {
  30508. return object == null
  30509. ? object
  30510. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30511. }
  30512. /**
  30513. * Iterates over own enumerable string keyed properties of an object and
  30514. * invokes `iteratee` for each property. The iteratee is invoked with three
  30515. * arguments: (value, key, object). Iteratee functions may exit iteration
  30516. * early by explicitly returning `false`.
  30517. *
  30518. * @static
  30519. * @memberOf _
  30520. * @since 0.3.0
  30521. * @category Object
  30522. * @param {Object} object The object to iterate over.
  30523. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30524. * @returns {Object} Returns `object`.
  30525. * @see _.forOwnRight
  30526. * @example
  30527. *
  30528. * function Foo() {
  30529. * this.a = 1;
  30530. * this.b = 2;
  30531. * }
  30532. *
  30533. * Foo.prototype.c = 3;
  30534. *
  30535. * _.forOwn(new Foo, function(value, key) {
  30536. * console.log(key);
  30537. * });
  30538. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30539. */
  30540. function forOwn(object, iteratee) {
  30541. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30542. }
  30543. /**
  30544. * This method is like `_.forOwn` except that it iterates over properties of
  30545. * `object` in the opposite order.
  30546. *
  30547. * @static
  30548. * @memberOf _
  30549. * @since 2.0.0
  30550. * @category Object
  30551. * @param {Object} object The object to iterate over.
  30552. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30553. * @returns {Object} Returns `object`.
  30554. * @see _.forOwn
  30555. * @example
  30556. *
  30557. * function Foo() {
  30558. * this.a = 1;
  30559. * this.b = 2;
  30560. * }
  30561. *
  30562. * Foo.prototype.c = 3;
  30563. *
  30564. * _.forOwnRight(new Foo, function(value, key) {
  30565. * console.log(key);
  30566. * });
  30567. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30568. */
  30569. function forOwnRight(object, iteratee) {
  30570. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30571. }
  30572. /**
  30573. * Creates an array of function property names from own enumerable properties
  30574. * of `object`.
  30575. *
  30576. * @static
  30577. * @since 0.1.0
  30578. * @memberOf _
  30579. * @category Object
  30580. * @param {Object} object The object to inspect.
  30581. * @returns {Array} Returns the function names.
  30582. * @see _.functionsIn
  30583. * @example
  30584. *
  30585. * function Foo() {
  30586. * this.a = _.constant('a');
  30587. * this.b = _.constant('b');
  30588. * }
  30589. *
  30590. * Foo.prototype.c = _.constant('c');
  30591. *
  30592. * _.functions(new Foo);
  30593. * // => ['a', 'b']
  30594. */
  30595. function functions(object) {
  30596. return object == null ? [] : baseFunctions(object, keys(object));
  30597. }
  30598. /**
  30599. * Creates an array of function property names from own and inherited
  30600. * enumerable properties of `object`.
  30601. *
  30602. * @static
  30603. * @memberOf _
  30604. * @since 4.0.0
  30605. * @category Object
  30606. * @param {Object} object The object to inspect.
  30607. * @returns {Array} Returns the function names.
  30608. * @see _.functions
  30609. * @example
  30610. *
  30611. * function Foo() {
  30612. * this.a = _.constant('a');
  30613. * this.b = _.constant('b');
  30614. * }
  30615. *
  30616. * Foo.prototype.c = _.constant('c');
  30617. *
  30618. * _.functionsIn(new Foo);
  30619. * // => ['a', 'b', 'c']
  30620. */
  30621. function functionsIn(object) {
  30622. return object == null ? [] : baseFunctions(object, keysIn(object));
  30623. }
  30624. /**
  30625. * Gets the value at `path` of `object`. If the resolved value is
  30626. * `undefined`, the `defaultValue` is returned in its place.
  30627. *
  30628. * @static
  30629. * @memberOf _
  30630. * @since 3.7.0
  30631. * @category Object
  30632. * @param {Object} object The object to query.
  30633. * @param {Array|string} path The path of the property to get.
  30634. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30635. * @returns {*} Returns the resolved value.
  30636. * @example
  30637. *
  30638. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30639. *
  30640. * _.get(object, 'a[0].b.c');
  30641. * // => 3
  30642. *
  30643. * _.get(object, ['a', '0', 'b', 'c']);
  30644. * // => 3
  30645. *
  30646. * _.get(object, 'a.b.c', 'default');
  30647. * // => 'default'
  30648. */
  30649. function get(object, path, defaultValue) {
  30650. var result = object == null ? undefined : baseGet(object, path);
  30651. return result === undefined ? defaultValue : result;
  30652. }
  30653. /**
  30654. * Checks if `path` is a direct property of `object`.
  30655. *
  30656. * @static
  30657. * @since 0.1.0
  30658. * @memberOf _
  30659. * @category Object
  30660. * @param {Object} object The object to query.
  30661. * @param {Array|string} path The path to check.
  30662. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30663. * @example
  30664. *
  30665. * var object = { 'a': { 'b': 2 } };
  30666. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30667. *
  30668. * _.has(object, 'a');
  30669. * // => true
  30670. *
  30671. * _.has(object, 'a.b');
  30672. * // => true
  30673. *
  30674. * _.has(object, ['a', 'b']);
  30675. * // => true
  30676. *
  30677. * _.has(other, 'a');
  30678. * // => false
  30679. */
  30680. function has(object, path) {
  30681. return object != null && hasPath(object, path, baseHas);
  30682. }
  30683. /**
  30684. * Checks if `path` is a direct or inherited property of `object`.
  30685. *
  30686. * @static
  30687. * @memberOf _
  30688. * @since 4.0.0
  30689. * @category Object
  30690. * @param {Object} object The object to query.
  30691. * @param {Array|string} path The path to check.
  30692. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30693. * @example
  30694. *
  30695. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30696. *
  30697. * _.hasIn(object, 'a');
  30698. * // => true
  30699. *
  30700. * _.hasIn(object, 'a.b');
  30701. * // => true
  30702. *
  30703. * _.hasIn(object, ['a', 'b']);
  30704. * // => true
  30705. *
  30706. * _.hasIn(object, 'b');
  30707. * // => false
  30708. */
  30709. function hasIn(object, path) {
  30710. return object != null && hasPath(object, path, baseHasIn);
  30711. }
  30712. /**
  30713. * Creates an object composed of the inverted keys and values of `object`.
  30714. * If `object` contains duplicate values, subsequent values overwrite
  30715. * property assignments of previous values.
  30716. *
  30717. * @static
  30718. * @memberOf _
  30719. * @since 0.7.0
  30720. * @category Object
  30721. * @param {Object} object The object to invert.
  30722. * @returns {Object} Returns the new inverted object.
  30723. * @example
  30724. *
  30725. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30726. *
  30727. * _.invert(object);
  30728. * // => { '1': 'c', '2': 'b' }
  30729. */
  30730. var invert = createInverter(function(result, value, key) {
  30731. if (value != null &&
  30732. typeof value.toString != 'function') {
  30733. value = nativeObjectToString.call(value);
  30734. }
  30735. result[value] = key;
  30736. }, constant(identity));
  30737. /**
  30738. * This method is like `_.invert` except that the inverted object is generated
  30739. * from the results of running each element of `object` thru `iteratee`. The
  30740. * corresponding inverted value of each inverted key is an array of keys
  30741. * responsible for generating the inverted value. The iteratee is invoked
  30742. * with one argument: (value).
  30743. *
  30744. * @static
  30745. * @memberOf _
  30746. * @since 4.1.0
  30747. * @category Object
  30748. * @param {Object} object The object to invert.
  30749. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30750. * @returns {Object} Returns the new inverted object.
  30751. * @example
  30752. *
  30753. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30754. *
  30755. * _.invertBy(object);
  30756. * // => { '1': ['a', 'c'], '2': ['b'] }
  30757. *
  30758. * _.invertBy(object, function(value) {
  30759. * return 'group' + value;
  30760. * });
  30761. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30762. */
  30763. var invertBy = createInverter(function(result, value, key) {
  30764. if (value != null &&
  30765. typeof value.toString != 'function') {
  30766. value = nativeObjectToString.call(value);
  30767. }
  30768. if (hasOwnProperty.call(result, value)) {
  30769. result[value].push(key);
  30770. } else {
  30771. result[value] = [key];
  30772. }
  30773. }, getIteratee);
  30774. /**
  30775. * Invokes the method at `path` of `object`.
  30776. *
  30777. * @static
  30778. * @memberOf _
  30779. * @since 4.0.0
  30780. * @category Object
  30781. * @param {Object} object The object to query.
  30782. * @param {Array|string} path The path of the method to invoke.
  30783. * @param {...*} [args] The arguments to invoke the method with.
  30784. * @returns {*} Returns the result of the invoked method.
  30785. * @example
  30786. *
  30787. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30788. *
  30789. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30790. * // => [2, 3]
  30791. */
  30792. var invoke = baseRest(baseInvoke);
  30793. /**
  30794. * Creates an array of the own enumerable property names of `object`.
  30795. *
  30796. * **Note:** Non-object values are coerced to objects. See the
  30797. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30798. * for more details.
  30799. *
  30800. * @static
  30801. * @since 0.1.0
  30802. * @memberOf _
  30803. * @category Object
  30804. * @param {Object} object The object to query.
  30805. * @returns {Array} Returns the array of property names.
  30806. * @example
  30807. *
  30808. * function Foo() {
  30809. * this.a = 1;
  30810. * this.b = 2;
  30811. * }
  30812. *
  30813. * Foo.prototype.c = 3;
  30814. *
  30815. * _.keys(new Foo);
  30816. * // => ['a', 'b'] (iteration order is not guaranteed)
  30817. *
  30818. * _.keys('hi');
  30819. * // => ['0', '1']
  30820. */
  30821. function keys(object) {
  30822. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30823. }
  30824. /**
  30825. * Creates an array of the own and inherited enumerable property names of `object`.
  30826. *
  30827. * **Note:** Non-object values are coerced to objects.
  30828. *
  30829. * @static
  30830. * @memberOf _
  30831. * @since 3.0.0
  30832. * @category Object
  30833. * @param {Object} object The object to query.
  30834. * @returns {Array} Returns the array of property names.
  30835. * @example
  30836. *
  30837. * function Foo() {
  30838. * this.a = 1;
  30839. * this.b = 2;
  30840. * }
  30841. *
  30842. * Foo.prototype.c = 3;
  30843. *
  30844. * _.keysIn(new Foo);
  30845. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30846. */
  30847. function keysIn(object) {
  30848. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30849. }
  30850. /**
  30851. * The opposite of `_.mapValues`; this method creates an object with the
  30852. * same values as `object` and keys generated by running each own enumerable
  30853. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30854. * with three arguments: (value, key, object).
  30855. *
  30856. * @static
  30857. * @memberOf _
  30858. * @since 3.8.0
  30859. * @category Object
  30860. * @param {Object} object The object to iterate over.
  30861. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30862. * @returns {Object} Returns the new mapped object.
  30863. * @see _.mapValues
  30864. * @example
  30865. *
  30866. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30867. * return key + value;
  30868. * });
  30869. * // => { 'a1': 1, 'b2': 2 }
  30870. */
  30871. function mapKeys(object, iteratee) {
  30872. var result = {};
  30873. iteratee = getIteratee(iteratee, 3);
  30874. baseForOwn(object, function(value, key, object) {
  30875. baseAssignValue(result, iteratee(value, key, object), value);
  30876. });
  30877. return result;
  30878. }
  30879. /**
  30880. * Creates an object with the same keys as `object` and values generated
  30881. * by running each own enumerable string keyed property of `object` thru
  30882. * `iteratee`. The iteratee is invoked with three arguments:
  30883. * (value, key, object).
  30884. *
  30885. * @static
  30886. * @memberOf _
  30887. * @since 2.4.0
  30888. * @category Object
  30889. * @param {Object} object The object to iterate over.
  30890. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30891. * @returns {Object} Returns the new mapped object.
  30892. * @see _.mapKeys
  30893. * @example
  30894. *
  30895. * var users = {
  30896. * 'fred': { 'user': 'fred', 'age': 40 },
  30897. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30898. * };
  30899. *
  30900. * _.mapValues(users, function(o) { return o.age; });
  30901. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30902. *
  30903. * // The `_.property` iteratee shorthand.
  30904. * _.mapValues(users, 'age');
  30905. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30906. */
  30907. function mapValues(object, iteratee) {
  30908. var result = {};
  30909. iteratee = getIteratee(iteratee, 3);
  30910. baseForOwn(object, function(value, key, object) {
  30911. baseAssignValue(result, key, iteratee(value, key, object));
  30912. });
  30913. return result;
  30914. }
  30915. /**
  30916. * This method is like `_.assign` except that it recursively merges own and
  30917. * inherited enumerable string keyed properties of source objects into the
  30918. * destination object. Source properties that resolve to `undefined` are
  30919. * skipped if a destination value exists. Array and plain object properties
  30920. * are merged recursively. Other objects and value types are overridden by
  30921. * assignment. Source objects are applied from left to right. Subsequent
  30922. * sources overwrite property assignments of previous sources.
  30923. *
  30924. * **Note:** This method mutates `object`.
  30925. *
  30926. * @static
  30927. * @memberOf _
  30928. * @since 0.5.0
  30929. * @category Object
  30930. * @param {Object} object The destination object.
  30931. * @param {...Object} [sources] The source objects.
  30932. * @returns {Object} Returns `object`.
  30933. * @example
  30934. *
  30935. * var object = {
  30936. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30937. * };
  30938. *
  30939. * var other = {
  30940. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30941. * };
  30942. *
  30943. * _.merge(object, other);
  30944. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30945. */
  30946. var merge = createAssigner(function(object, source, srcIndex) {
  30947. baseMerge(object, source, srcIndex);
  30948. });
  30949. /**
  30950. * This method is like `_.merge` except that it accepts `customizer` which
  30951. * is invoked to produce the merged values of the destination and source
  30952. * properties. If `customizer` returns `undefined`, merging is handled by the
  30953. * method instead. The `customizer` is invoked with six arguments:
  30954. * (objValue, srcValue, key, object, source, stack).
  30955. *
  30956. * **Note:** This method mutates `object`.
  30957. *
  30958. * @static
  30959. * @memberOf _
  30960. * @since 4.0.0
  30961. * @category Object
  30962. * @param {Object} object The destination object.
  30963. * @param {...Object} sources The source objects.
  30964. * @param {Function} customizer The function to customize assigned values.
  30965. * @returns {Object} Returns `object`.
  30966. * @example
  30967. *
  30968. * function customizer(objValue, srcValue) {
  30969. * if (_.isArray(objValue)) {
  30970. * return objValue.concat(srcValue);
  30971. * }
  30972. * }
  30973. *
  30974. * var object = { 'a': [1], 'b': [2] };
  30975. * var other = { 'a': [3], 'b': [4] };
  30976. *
  30977. * _.mergeWith(object, other, customizer);
  30978. * // => { 'a': [1, 3], 'b': [2, 4] }
  30979. */
  30980. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30981. baseMerge(object, source, srcIndex, customizer);
  30982. });
  30983. /**
  30984. * The opposite of `_.pick`; this method creates an object composed of the
  30985. * own and inherited enumerable property paths of `object` that are not omitted.
  30986. *
  30987. * **Note:** This method is considerably slower than `_.pick`.
  30988. *
  30989. * @static
  30990. * @since 0.1.0
  30991. * @memberOf _
  30992. * @category Object
  30993. * @param {Object} object The source object.
  30994. * @param {...(string|string[])} [paths] The property paths to omit.
  30995. * @returns {Object} Returns the new object.
  30996. * @example
  30997. *
  30998. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30999. *
  31000. * _.omit(object, ['a', 'c']);
  31001. * // => { 'b': '2' }
  31002. */
  31003. var omit = flatRest(function(object, paths) {
  31004. var result = {};
  31005. if (object == null) {
  31006. return result;
  31007. }
  31008. var isDeep = false;
  31009. paths = arrayMap(paths, function(path) {
  31010. path = castPath(path, object);
  31011. isDeep || (isDeep = path.length > 1);
  31012. return path;
  31013. });
  31014. copyObject(object, getAllKeysIn(object), result);
  31015. if (isDeep) {
  31016. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31017. }
  31018. var length = paths.length;
  31019. while (length--) {
  31020. baseUnset(result, paths[length]);
  31021. }
  31022. return result;
  31023. });
  31024. /**
  31025. * The opposite of `_.pickBy`; this method creates an object composed of
  31026. * the own and inherited enumerable string keyed properties of `object` that
  31027. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31028. * arguments: (value, key).
  31029. *
  31030. * @static
  31031. * @memberOf _
  31032. * @since 4.0.0
  31033. * @category Object
  31034. * @param {Object} object The source object.
  31035. * @param {Function} [predicate=_.identity] The function invoked per property.
  31036. * @returns {Object} Returns the new object.
  31037. * @example
  31038. *
  31039. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31040. *
  31041. * _.omitBy(object, _.isNumber);
  31042. * // => { 'b': '2' }
  31043. */
  31044. function omitBy(object, predicate) {
  31045. return pickBy(object, negate(getIteratee(predicate)));
  31046. }
  31047. /**
  31048. * Creates an object composed of the picked `object` properties.
  31049. *
  31050. * @static
  31051. * @since 0.1.0
  31052. * @memberOf _
  31053. * @category Object
  31054. * @param {Object} object The source object.
  31055. * @param {...(string|string[])} [paths] The property paths to pick.
  31056. * @returns {Object} Returns the new object.
  31057. * @example
  31058. *
  31059. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31060. *
  31061. * _.pick(object, ['a', 'c']);
  31062. * // => { 'a': 1, 'c': 3 }
  31063. */
  31064. var pick = flatRest(function(object, paths) {
  31065. return object == null ? {} : basePick(object, paths);
  31066. });
  31067. /**
  31068. * Creates an object composed of the `object` properties `predicate` returns
  31069. * truthy for. The predicate is invoked with two arguments: (value, key).
  31070. *
  31071. * @static
  31072. * @memberOf _
  31073. * @since 4.0.0
  31074. * @category Object
  31075. * @param {Object} object The source object.
  31076. * @param {Function} [predicate=_.identity] The function invoked per property.
  31077. * @returns {Object} Returns the new object.
  31078. * @example
  31079. *
  31080. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31081. *
  31082. * _.pickBy(object, _.isNumber);
  31083. * // => { 'a': 1, 'c': 3 }
  31084. */
  31085. function pickBy(object, predicate) {
  31086. if (object == null) {
  31087. return {};
  31088. }
  31089. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31090. return [prop];
  31091. });
  31092. predicate = getIteratee(predicate);
  31093. return basePickBy(object, props, function(value, path) {
  31094. return predicate(value, path[0]);
  31095. });
  31096. }
  31097. /**
  31098. * This method is like `_.get` except that if the resolved value is a
  31099. * function it's invoked with the `this` binding of its parent object and
  31100. * its result is returned.
  31101. *
  31102. * @static
  31103. * @since 0.1.0
  31104. * @memberOf _
  31105. * @category Object
  31106. * @param {Object} object The object to query.
  31107. * @param {Array|string} path The path of the property to resolve.
  31108. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31109. * @returns {*} Returns the resolved value.
  31110. * @example
  31111. *
  31112. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31113. *
  31114. * _.result(object, 'a[0].b.c1');
  31115. * // => 3
  31116. *
  31117. * _.result(object, 'a[0].b.c2');
  31118. * // => 4
  31119. *
  31120. * _.result(object, 'a[0].b.c3', 'default');
  31121. * // => 'default'
  31122. *
  31123. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31124. * // => 'default'
  31125. */
  31126. function result(object, path, defaultValue) {
  31127. path = castPath(path, object);
  31128. var index = -1,
  31129. length = path.length;
  31130. // Ensure the loop is entered when path is empty.
  31131. if (!length) {
  31132. length = 1;
  31133. object = undefined;
  31134. }
  31135. while (++index < length) {
  31136. var value = object == null ? undefined : object[toKey(path[index])];
  31137. if (value === undefined) {
  31138. index = length;
  31139. value = defaultValue;
  31140. }
  31141. object = isFunction(value) ? value.call(object) : value;
  31142. }
  31143. return object;
  31144. }
  31145. /**
  31146. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31147. * it's created. Arrays are created for missing index properties while objects
  31148. * are created for all other missing properties. Use `_.setWith` to customize
  31149. * `path` creation.
  31150. *
  31151. * **Note:** This method mutates `object`.
  31152. *
  31153. * @static
  31154. * @memberOf _
  31155. * @since 3.7.0
  31156. * @category Object
  31157. * @param {Object} object The object to modify.
  31158. * @param {Array|string} path The path of the property to set.
  31159. * @param {*} value The value to set.
  31160. * @returns {Object} Returns `object`.
  31161. * @example
  31162. *
  31163. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31164. *
  31165. * _.set(object, 'a[0].b.c', 4);
  31166. * console.log(object.a[0].b.c);
  31167. * // => 4
  31168. *
  31169. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31170. * console.log(object.x[0].y.z);
  31171. * // => 5
  31172. */
  31173. function set(object, path, value) {
  31174. return object == null ? object : baseSet(object, path, value);
  31175. }
  31176. /**
  31177. * This method is like `_.set` except that it accepts `customizer` which is
  31178. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31179. * path creation is handled by the method instead. The `customizer` is invoked
  31180. * with three arguments: (nsValue, key, nsObject).
  31181. *
  31182. * **Note:** This method mutates `object`.
  31183. *
  31184. * @static
  31185. * @memberOf _
  31186. * @since 4.0.0
  31187. * @category Object
  31188. * @param {Object} object The object to modify.
  31189. * @param {Array|string} path The path of the property to set.
  31190. * @param {*} value The value to set.
  31191. * @param {Function} [customizer] The function to customize assigned values.
  31192. * @returns {Object} Returns `object`.
  31193. * @example
  31194. *
  31195. * var object = {};
  31196. *
  31197. * _.setWith(object, '[0][1]', 'a', Object);
  31198. * // => { '0': { '1': 'a' } }
  31199. */
  31200. function setWith(object, path, value, customizer) {
  31201. customizer = typeof customizer == 'function' ? customizer : undefined;
  31202. return object == null ? object : baseSet(object, path, value, customizer);
  31203. }
  31204. /**
  31205. * Creates an array of own enumerable string keyed-value pairs for `object`
  31206. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31207. * entries are returned.
  31208. *
  31209. * @static
  31210. * @memberOf _
  31211. * @since 4.0.0
  31212. * @alias entries
  31213. * @category Object
  31214. * @param {Object} object The object to query.
  31215. * @returns {Array} Returns the key-value pairs.
  31216. * @example
  31217. *
  31218. * function Foo() {
  31219. * this.a = 1;
  31220. * this.b = 2;
  31221. * }
  31222. *
  31223. * Foo.prototype.c = 3;
  31224. *
  31225. * _.toPairs(new Foo);
  31226. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31227. */
  31228. var toPairs = createToPairs(keys);
  31229. /**
  31230. * Creates an array of own and inherited enumerable string keyed-value pairs
  31231. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31232. * or set, its entries are returned.
  31233. *
  31234. * @static
  31235. * @memberOf _
  31236. * @since 4.0.0
  31237. * @alias entriesIn
  31238. * @category Object
  31239. * @param {Object} object The object to query.
  31240. * @returns {Array} Returns the key-value pairs.
  31241. * @example
  31242. *
  31243. * function Foo() {
  31244. * this.a = 1;
  31245. * this.b = 2;
  31246. * }
  31247. *
  31248. * Foo.prototype.c = 3;
  31249. *
  31250. * _.toPairsIn(new Foo);
  31251. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31252. */
  31253. var toPairsIn = createToPairs(keysIn);
  31254. /**
  31255. * An alternative to `_.reduce`; this method transforms `object` to a new
  31256. * `accumulator` object which is the result of running each of its own
  31257. * enumerable string keyed properties thru `iteratee`, with each invocation
  31258. * potentially mutating the `accumulator` object. If `accumulator` is not
  31259. * provided, a new object with the same `[[Prototype]]` will be used. The
  31260. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31261. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31262. *
  31263. * @static
  31264. * @memberOf _
  31265. * @since 1.3.0
  31266. * @category Object
  31267. * @param {Object} object The object to iterate over.
  31268. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31269. * @param {*} [accumulator] The custom accumulator value.
  31270. * @returns {*} Returns the accumulated value.
  31271. * @example
  31272. *
  31273. * _.transform([2, 3, 4], function(result, n) {
  31274. * result.push(n *= n);
  31275. * return n % 2 == 0;
  31276. * }, []);
  31277. * // => [4, 9]
  31278. *
  31279. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31280. * (result[value] || (result[value] = [])).push(key);
  31281. * }, {});
  31282. * // => { '1': ['a', 'c'], '2': ['b'] }
  31283. */
  31284. function transform(object, iteratee, accumulator) {
  31285. var isArr = isArray(object),
  31286. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31287. iteratee = getIteratee(iteratee, 4);
  31288. if (accumulator == null) {
  31289. var Ctor = object && object.constructor;
  31290. if (isArrLike) {
  31291. accumulator = isArr ? new Ctor : [];
  31292. }
  31293. else if (isObject(object)) {
  31294. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31295. }
  31296. else {
  31297. accumulator = {};
  31298. }
  31299. }
  31300. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31301. return iteratee(accumulator, value, index, object);
  31302. });
  31303. return accumulator;
  31304. }
  31305. /**
  31306. * Removes the property at `path` of `object`.
  31307. *
  31308. * **Note:** This method mutates `object`.
  31309. *
  31310. * @static
  31311. * @memberOf _
  31312. * @since 4.0.0
  31313. * @category Object
  31314. * @param {Object} object The object to modify.
  31315. * @param {Array|string} path The path of the property to unset.
  31316. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31317. * @example
  31318. *
  31319. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31320. * _.unset(object, 'a[0].b.c');
  31321. * // => true
  31322. *
  31323. * console.log(object);
  31324. * // => { 'a': [{ 'b': {} }] };
  31325. *
  31326. * _.unset(object, ['a', '0', 'b', 'c']);
  31327. * // => true
  31328. *
  31329. * console.log(object);
  31330. * // => { 'a': [{ 'b': {} }] };
  31331. */
  31332. function unset(object, path) {
  31333. return object == null ? true : baseUnset(object, path);
  31334. }
  31335. /**
  31336. * This method is like `_.set` except that accepts `updater` to produce the
  31337. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31338. * is invoked with one argument: (value).
  31339. *
  31340. * **Note:** This method mutates `object`.
  31341. *
  31342. * @static
  31343. * @memberOf _
  31344. * @since 4.6.0
  31345. * @category Object
  31346. * @param {Object} object The object to modify.
  31347. * @param {Array|string} path The path of the property to set.
  31348. * @param {Function} updater The function to produce the updated value.
  31349. * @returns {Object} Returns `object`.
  31350. * @example
  31351. *
  31352. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31353. *
  31354. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31355. * console.log(object.a[0].b.c);
  31356. * // => 9
  31357. *
  31358. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31359. * console.log(object.x[0].y.z);
  31360. * // => 0
  31361. */
  31362. function update(object, path, updater) {
  31363. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31364. }
  31365. /**
  31366. * This method is like `_.update` except that it accepts `customizer` which is
  31367. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31368. * path creation is handled by the method instead. The `customizer` is invoked
  31369. * with three arguments: (nsValue, key, nsObject).
  31370. *
  31371. * **Note:** This method mutates `object`.
  31372. *
  31373. * @static
  31374. * @memberOf _
  31375. * @since 4.6.0
  31376. * @category Object
  31377. * @param {Object} object The object to modify.
  31378. * @param {Array|string} path The path of the property to set.
  31379. * @param {Function} updater The function to produce the updated value.
  31380. * @param {Function} [customizer] The function to customize assigned values.
  31381. * @returns {Object} Returns `object`.
  31382. * @example
  31383. *
  31384. * var object = {};
  31385. *
  31386. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31387. * // => { '0': { '1': 'a' } }
  31388. */
  31389. function updateWith(object, path, updater, customizer) {
  31390. customizer = typeof customizer == 'function' ? customizer : undefined;
  31391. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31392. }
  31393. /**
  31394. * Creates an array of the own enumerable string keyed property values of `object`.
  31395. *
  31396. * **Note:** Non-object values are coerced to objects.
  31397. *
  31398. * @static
  31399. * @since 0.1.0
  31400. * @memberOf _
  31401. * @category Object
  31402. * @param {Object} object The object to query.
  31403. * @returns {Array} Returns the array of property values.
  31404. * @example
  31405. *
  31406. * function Foo() {
  31407. * this.a = 1;
  31408. * this.b = 2;
  31409. * }
  31410. *
  31411. * Foo.prototype.c = 3;
  31412. *
  31413. * _.values(new Foo);
  31414. * // => [1, 2] (iteration order is not guaranteed)
  31415. *
  31416. * _.values('hi');
  31417. * // => ['h', 'i']
  31418. */
  31419. function values(object) {
  31420. return object == null ? [] : baseValues(object, keys(object));
  31421. }
  31422. /**
  31423. * Creates an array of the own and inherited enumerable string keyed property
  31424. * values of `object`.
  31425. *
  31426. * **Note:** Non-object values are coerced to objects.
  31427. *
  31428. * @static
  31429. * @memberOf _
  31430. * @since 3.0.0
  31431. * @category Object
  31432. * @param {Object} object The object to query.
  31433. * @returns {Array} Returns the array of property values.
  31434. * @example
  31435. *
  31436. * function Foo() {
  31437. * this.a = 1;
  31438. * this.b = 2;
  31439. * }
  31440. *
  31441. * Foo.prototype.c = 3;
  31442. *
  31443. * _.valuesIn(new Foo);
  31444. * // => [1, 2, 3] (iteration order is not guaranteed)
  31445. */
  31446. function valuesIn(object) {
  31447. return object == null ? [] : baseValues(object, keysIn(object));
  31448. }
  31449. /*------------------------------------------------------------------------*/
  31450. /**
  31451. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31452. *
  31453. * @static
  31454. * @memberOf _
  31455. * @since 4.0.0
  31456. * @category Number
  31457. * @param {number} number The number to clamp.
  31458. * @param {number} [lower] The lower bound.
  31459. * @param {number} upper The upper bound.
  31460. * @returns {number} Returns the clamped number.
  31461. * @example
  31462. *
  31463. * _.clamp(-10, -5, 5);
  31464. * // => -5
  31465. *
  31466. * _.clamp(10, -5, 5);
  31467. * // => 5
  31468. */
  31469. function clamp(number, lower, upper) {
  31470. if (upper === undefined) {
  31471. upper = lower;
  31472. lower = undefined;
  31473. }
  31474. if (upper !== undefined) {
  31475. upper = toNumber(upper);
  31476. upper = upper === upper ? upper : 0;
  31477. }
  31478. if (lower !== undefined) {
  31479. lower = toNumber(lower);
  31480. lower = lower === lower ? lower : 0;
  31481. }
  31482. return baseClamp(toNumber(number), lower, upper);
  31483. }
  31484. /**
  31485. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31486. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31487. * If `start` is greater than `end` the params are swapped to support
  31488. * negative ranges.
  31489. *
  31490. * @static
  31491. * @memberOf _
  31492. * @since 3.3.0
  31493. * @category Number
  31494. * @param {number} number The number to check.
  31495. * @param {number} [start=0] The start of the range.
  31496. * @param {number} end The end of the range.
  31497. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31498. * @see _.range, _.rangeRight
  31499. * @example
  31500. *
  31501. * _.inRange(3, 2, 4);
  31502. * // => true
  31503. *
  31504. * _.inRange(4, 8);
  31505. * // => true
  31506. *
  31507. * _.inRange(4, 2);
  31508. * // => false
  31509. *
  31510. * _.inRange(2, 2);
  31511. * // => false
  31512. *
  31513. * _.inRange(1.2, 2);
  31514. * // => true
  31515. *
  31516. * _.inRange(5.2, 4);
  31517. * // => false
  31518. *
  31519. * _.inRange(-3, -2, -6);
  31520. * // => true
  31521. */
  31522. function inRange(number, start, end) {
  31523. start = toFinite(start);
  31524. if (end === undefined) {
  31525. end = start;
  31526. start = 0;
  31527. } else {
  31528. end = toFinite(end);
  31529. }
  31530. number = toNumber(number);
  31531. return baseInRange(number, start, end);
  31532. }
  31533. /**
  31534. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31535. * If only one argument is provided a number between `0` and the given number
  31536. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31537. * floats, a floating-point number is returned instead of an integer.
  31538. *
  31539. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31540. * floating-point values which can produce unexpected results.
  31541. *
  31542. * @static
  31543. * @memberOf _
  31544. * @since 0.7.0
  31545. * @category Number
  31546. * @param {number} [lower=0] The lower bound.
  31547. * @param {number} [upper=1] The upper bound.
  31548. * @param {boolean} [floating] Specify returning a floating-point number.
  31549. * @returns {number} Returns the random number.
  31550. * @example
  31551. *
  31552. * _.random(0, 5);
  31553. * // => an integer between 0 and 5
  31554. *
  31555. * _.random(5);
  31556. * // => also an integer between 0 and 5
  31557. *
  31558. * _.random(5, true);
  31559. * // => a floating-point number between 0 and 5
  31560. *
  31561. * _.random(1.2, 5.2);
  31562. * // => a floating-point number between 1.2 and 5.2
  31563. */
  31564. function random(lower, upper, floating) {
  31565. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31566. upper = floating = undefined;
  31567. }
  31568. if (floating === undefined) {
  31569. if (typeof upper == 'boolean') {
  31570. floating = upper;
  31571. upper = undefined;
  31572. }
  31573. else if (typeof lower == 'boolean') {
  31574. floating = lower;
  31575. lower = undefined;
  31576. }
  31577. }
  31578. if (lower === undefined && upper === undefined) {
  31579. lower = 0;
  31580. upper = 1;
  31581. }
  31582. else {
  31583. lower = toFinite(lower);
  31584. if (upper === undefined) {
  31585. upper = lower;
  31586. lower = 0;
  31587. } else {
  31588. upper = toFinite(upper);
  31589. }
  31590. }
  31591. if (lower > upper) {
  31592. var temp = lower;
  31593. lower = upper;
  31594. upper = temp;
  31595. }
  31596. if (floating || lower % 1 || upper % 1) {
  31597. var rand = nativeRandom();
  31598. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31599. }
  31600. return baseRandom(lower, upper);
  31601. }
  31602. /*------------------------------------------------------------------------*/
  31603. /**
  31604. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31605. *
  31606. * @static
  31607. * @memberOf _
  31608. * @since 3.0.0
  31609. * @category String
  31610. * @param {string} [string=''] The string to convert.
  31611. * @returns {string} Returns the camel cased string.
  31612. * @example
  31613. *
  31614. * _.camelCase('Foo Bar');
  31615. * // => 'fooBar'
  31616. *
  31617. * _.camelCase('--foo-bar--');
  31618. * // => 'fooBar'
  31619. *
  31620. * _.camelCase('__FOO_BAR__');
  31621. * // => 'fooBar'
  31622. */
  31623. var camelCase = createCompounder(function(result, word, index) {
  31624. word = word.toLowerCase();
  31625. return result + (index ? capitalize(word) : word);
  31626. });
  31627. /**
  31628. * Converts the first character of `string` to upper case and the remaining
  31629. * to lower case.
  31630. *
  31631. * @static
  31632. * @memberOf _
  31633. * @since 3.0.0
  31634. * @category String
  31635. * @param {string} [string=''] The string to capitalize.
  31636. * @returns {string} Returns the capitalized string.
  31637. * @example
  31638. *
  31639. * _.capitalize('FRED');
  31640. * // => 'Fred'
  31641. */
  31642. function capitalize(string) {
  31643. return upperFirst(toString(string).toLowerCase());
  31644. }
  31645. /**
  31646. * Deburrs `string` by converting
  31647. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31648. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31649. * letters to basic Latin letters and removing
  31650. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31651. *
  31652. * @static
  31653. * @memberOf _
  31654. * @since 3.0.0
  31655. * @category String
  31656. * @param {string} [string=''] The string to deburr.
  31657. * @returns {string} Returns the deburred string.
  31658. * @example
  31659. *
  31660. * _.deburr('déjà vu');
  31661. * // => 'deja vu'
  31662. */
  31663. function deburr(string) {
  31664. string = toString(string);
  31665. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31666. }
  31667. /**
  31668. * Checks if `string` ends with the given target string.
  31669. *
  31670. * @static
  31671. * @memberOf _
  31672. * @since 3.0.0
  31673. * @category String
  31674. * @param {string} [string=''] The string to inspect.
  31675. * @param {string} [target] The string to search for.
  31676. * @param {number} [position=string.length] The position to search up to.
  31677. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31678. * else `false`.
  31679. * @example
  31680. *
  31681. * _.endsWith('abc', 'c');
  31682. * // => true
  31683. *
  31684. * _.endsWith('abc', 'b');
  31685. * // => false
  31686. *
  31687. * _.endsWith('abc', 'b', 2);
  31688. * // => true
  31689. */
  31690. function endsWith(string, target, position) {
  31691. string = toString(string);
  31692. target = baseToString(target);
  31693. var length = string.length;
  31694. position = position === undefined
  31695. ? length
  31696. : baseClamp(toInteger(position), 0, length);
  31697. var end = position;
  31698. position -= target.length;
  31699. return position >= 0 && string.slice(position, end) == target;
  31700. }
  31701. /**
  31702. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31703. * corresponding HTML entities.
  31704. *
  31705. * **Note:** No other characters are escaped. To escape additional
  31706. * characters use a third-party library like [_he_](https://mths.be/he).
  31707. *
  31708. * Though the ">" character is escaped for symmetry, characters like
  31709. * ">" and "/" don't need escaping in HTML and have no special meaning
  31710. * unless they're part of a tag or unquoted attribute value. See
  31711. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31712. * (under "semi-related fun fact") for more details.
  31713. *
  31714. * When working with HTML you should always
  31715. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31716. * XSS vectors.
  31717. *
  31718. * @static
  31719. * @since 0.1.0
  31720. * @memberOf _
  31721. * @category String
  31722. * @param {string} [string=''] The string to escape.
  31723. * @returns {string} Returns the escaped string.
  31724. * @example
  31725. *
  31726. * _.escape('fred, barney, & pebbles');
  31727. * // => 'fred, barney, &amp; pebbles'
  31728. */
  31729. function escape(string) {
  31730. string = toString(string);
  31731. return (string && reHasUnescapedHtml.test(string))
  31732. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31733. : string;
  31734. }
  31735. /**
  31736. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31737. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31738. *
  31739. * @static
  31740. * @memberOf _
  31741. * @since 3.0.0
  31742. * @category String
  31743. * @param {string} [string=''] The string to escape.
  31744. * @returns {string} Returns the escaped string.
  31745. * @example
  31746. *
  31747. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31748. * // => '\[lodash\]\(https://lodash\.com/\)'
  31749. */
  31750. function escapeRegExp(string) {
  31751. string = toString(string);
  31752. return (string && reHasRegExpChar.test(string))
  31753. ? string.replace(reRegExpChar, '\\$&')
  31754. : string;
  31755. }
  31756. /**
  31757. * Converts `string` to
  31758. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31759. *
  31760. * @static
  31761. * @memberOf _
  31762. * @since 3.0.0
  31763. * @category String
  31764. * @param {string} [string=''] The string to convert.
  31765. * @returns {string} Returns the kebab cased string.
  31766. * @example
  31767. *
  31768. * _.kebabCase('Foo Bar');
  31769. * // => 'foo-bar'
  31770. *
  31771. * _.kebabCase('fooBar');
  31772. * // => 'foo-bar'
  31773. *
  31774. * _.kebabCase('__FOO_BAR__');
  31775. * // => 'foo-bar'
  31776. */
  31777. var kebabCase = createCompounder(function(result, word, index) {
  31778. return result + (index ? '-' : '') + word.toLowerCase();
  31779. });
  31780. /**
  31781. * Converts `string`, as space separated words, to lower case.
  31782. *
  31783. * @static
  31784. * @memberOf _
  31785. * @since 4.0.0
  31786. * @category String
  31787. * @param {string} [string=''] The string to convert.
  31788. * @returns {string} Returns the lower cased string.
  31789. * @example
  31790. *
  31791. * _.lowerCase('--Foo-Bar--');
  31792. * // => 'foo bar'
  31793. *
  31794. * _.lowerCase('fooBar');
  31795. * // => 'foo bar'
  31796. *
  31797. * _.lowerCase('__FOO_BAR__');
  31798. * // => 'foo bar'
  31799. */
  31800. var lowerCase = createCompounder(function(result, word, index) {
  31801. return result + (index ? ' ' : '') + word.toLowerCase();
  31802. });
  31803. /**
  31804. * Converts the first character of `string` to lower case.
  31805. *
  31806. * @static
  31807. * @memberOf _
  31808. * @since 4.0.0
  31809. * @category String
  31810. * @param {string} [string=''] The string to convert.
  31811. * @returns {string} Returns the converted string.
  31812. * @example
  31813. *
  31814. * _.lowerFirst('Fred');
  31815. * // => 'fred'
  31816. *
  31817. * _.lowerFirst('FRED');
  31818. * // => 'fRED'
  31819. */
  31820. var lowerFirst = createCaseFirst('toLowerCase');
  31821. /**
  31822. * Pads `string` on the left and right sides if it's shorter than `length`.
  31823. * Padding characters are truncated if they can't be evenly divided by `length`.
  31824. *
  31825. * @static
  31826. * @memberOf _
  31827. * @since 3.0.0
  31828. * @category String
  31829. * @param {string} [string=''] The string to pad.
  31830. * @param {number} [length=0] The padding length.
  31831. * @param {string} [chars=' '] The string used as padding.
  31832. * @returns {string} Returns the padded string.
  31833. * @example
  31834. *
  31835. * _.pad('abc', 8);
  31836. * // => ' abc '
  31837. *
  31838. * _.pad('abc', 8, '_-');
  31839. * // => '_-abc_-_'
  31840. *
  31841. * _.pad('abc', 3);
  31842. * // => 'abc'
  31843. */
  31844. function pad(string, length, chars) {
  31845. string = toString(string);
  31846. length = toInteger(length);
  31847. var strLength = length ? stringSize(string) : 0;
  31848. if (!length || strLength >= length) {
  31849. return string;
  31850. }
  31851. var mid = (length - strLength) / 2;
  31852. return (
  31853. createPadding(nativeFloor(mid), chars) +
  31854. string +
  31855. createPadding(nativeCeil(mid), chars)
  31856. );
  31857. }
  31858. /**
  31859. * Pads `string` on the right side if it's shorter than `length`. Padding
  31860. * characters are truncated if they exceed `length`.
  31861. *
  31862. * @static
  31863. * @memberOf _
  31864. * @since 4.0.0
  31865. * @category String
  31866. * @param {string} [string=''] The string to pad.
  31867. * @param {number} [length=0] The padding length.
  31868. * @param {string} [chars=' '] The string used as padding.
  31869. * @returns {string} Returns the padded string.
  31870. * @example
  31871. *
  31872. * _.padEnd('abc', 6);
  31873. * // => 'abc '
  31874. *
  31875. * _.padEnd('abc', 6, '_-');
  31876. * // => 'abc_-_'
  31877. *
  31878. * _.padEnd('abc', 3);
  31879. * // => 'abc'
  31880. */
  31881. function padEnd(string, length, chars) {
  31882. string = toString(string);
  31883. length = toInteger(length);
  31884. var strLength = length ? stringSize(string) : 0;
  31885. return (length && strLength < length)
  31886. ? (string + createPadding(length - strLength, chars))
  31887. : string;
  31888. }
  31889. /**
  31890. * Pads `string` on the left side if it's shorter than `length`. Padding
  31891. * characters are truncated if they exceed `length`.
  31892. *
  31893. * @static
  31894. * @memberOf _
  31895. * @since 4.0.0
  31896. * @category String
  31897. * @param {string} [string=''] The string to pad.
  31898. * @param {number} [length=0] The padding length.
  31899. * @param {string} [chars=' '] The string used as padding.
  31900. * @returns {string} Returns the padded string.
  31901. * @example
  31902. *
  31903. * _.padStart('abc', 6);
  31904. * // => ' abc'
  31905. *
  31906. * _.padStart('abc', 6, '_-');
  31907. * // => '_-_abc'
  31908. *
  31909. * _.padStart('abc', 3);
  31910. * // => 'abc'
  31911. */
  31912. function padStart(string, length, chars) {
  31913. string = toString(string);
  31914. length = toInteger(length);
  31915. var strLength = length ? stringSize(string) : 0;
  31916. return (length && strLength < length)
  31917. ? (createPadding(length - strLength, chars) + string)
  31918. : string;
  31919. }
  31920. /**
  31921. * Converts `string` to an integer of the specified radix. If `radix` is
  31922. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31923. * hexadecimal, in which case a `radix` of `16` is used.
  31924. *
  31925. * **Note:** This method aligns with the
  31926. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31927. *
  31928. * @static
  31929. * @memberOf _
  31930. * @since 1.1.0
  31931. * @category String
  31932. * @param {string} string The string to convert.
  31933. * @param {number} [radix=10] The radix to interpret `value` by.
  31934. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31935. * @returns {number} Returns the converted integer.
  31936. * @example
  31937. *
  31938. * _.parseInt('08');
  31939. * // => 8
  31940. *
  31941. * _.map(['6', '08', '10'], _.parseInt);
  31942. * // => [6, 8, 10]
  31943. */
  31944. function parseInt(string, radix, guard) {
  31945. if (guard || radix == null) {
  31946. radix = 0;
  31947. } else if (radix) {
  31948. radix = +radix;
  31949. }
  31950. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31951. }
  31952. /**
  31953. * Repeats the given string `n` times.
  31954. *
  31955. * @static
  31956. * @memberOf _
  31957. * @since 3.0.0
  31958. * @category String
  31959. * @param {string} [string=''] The string to repeat.
  31960. * @param {number} [n=1] The number of times to repeat the string.
  31961. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31962. * @returns {string} Returns the repeated string.
  31963. * @example
  31964. *
  31965. * _.repeat('*', 3);
  31966. * // => '***'
  31967. *
  31968. * _.repeat('abc', 2);
  31969. * // => 'abcabc'
  31970. *
  31971. * _.repeat('abc', 0);
  31972. * // => ''
  31973. */
  31974. function repeat(string, n, guard) {
  31975. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31976. n = 1;
  31977. } else {
  31978. n = toInteger(n);
  31979. }
  31980. return baseRepeat(toString(string), n);
  31981. }
  31982. /**
  31983. * Replaces matches for `pattern` in `string` with `replacement`.
  31984. *
  31985. * **Note:** This method is based on
  31986. * [`String#replace`](https://mdn.io/String/replace).
  31987. *
  31988. * @static
  31989. * @memberOf _
  31990. * @since 4.0.0
  31991. * @category String
  31992. * @param {string} [string=''] The string to modify.
  31993. * @param {RegExp|string} pattern The pattern to replace.
  31994. * @param {Function|string} replacement The match replacement.
  31995. * @returns {string} Returns the modified string.
  31996. * @example
  31997. *
  31998. * _.replace('Hi Fred', 'Fred', 'Barney');
  31999. * // => 'Hi Barney'
  32000. */
  32001. function replace() {
  32002. var args = arguments,
  32003. string = toString(args[0]);
  32004. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32005. }
  32006. /**
  32007. * Converts `string` to
  32008. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32009. *
  32010. * @static
  32011. * @memberOf _
  32012. * @since 3.0.0
  32013. * @category String
  32014. * @param {string} [string=''] The string to convert.
  32015. * @returns {string} Returns the snake cased string.
  32016. * @example
  32017. *
  32018. * _.snakeCase('Foo Bar');
  32019. * // => 'foo_bar'
  32020. *
  32021. * _.snakeCase('fooBar');
  32022. * // => 'foo_bar'
  32023. *
  32024. * _.snakeCase('--FOO-BAR--');
  32025. * // => 'foo_bar'
  32026. */
  32027. var snakeCase = createCompounder(function(result, word, index) {
  32028. return result + (index ? '_' : '') + word.toLowerCase();
  32029. });
  32030. /**
  32031. * Splits `string` by `separator`.
  32032. *
  32033. * **Note:** This method is based on
  32034. * [`String#split`](https://mdn.io/String/split).
  32035. *
  32036. * @static
  32037. * @memberOf _
  32038. * @since 4.0.0
  32039. * @category String
  32040. * @param {string} [string=''] The string to split.
  32041. * @param {RegExp|string} separator The separator pattern to split by.
  32042. * @param {number} [limit] The length to truncate results to.
  32043. * @returns {Array} Returns the string segments.
  32044. * @example
  32045. *
  32046. * _.split('a-b-c', '-', 2);
  32047. * // => ['a', 'b']
  32048. */
  32049. function split(string, separator, limit) {
  32050. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32051. separator = limit = undefined;
  32052. }
  32053. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32054. if (!limit) {
  32055. return [];
  32056. }
  32057. string = toString(string);
  32058. if (string && (
  32059. typeof separator == 'string' ||
  32060. (separator != null && !isRegExp(separator))
  32061. )) {
  32062. separator = baseToString(separator);
  32063. if (!separator && hasUnicode(string)) {
  32064. return castSlice(stringToArray(string), 0, limit);
  32065. }
  32066. }
  32067. return string.split(separator, limit);
  32068. }
  32069. /**
  32070. * Converts `string` to
  32071. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32072. *
  32073. * @static
  32074. * @memberOf _
  32075. * @since 3.1.0
  32076. * @category String
  32077. * @param {string} [string=''] The string to convert.
  32078. * @returns {string} Returns the start cased string.
  32079. * @example
  32080. *
  32081. * _.startCase('--foo-bar--');
  32082. * // => 'Foo Bar'
  32083. *
  32084. * _.startCase('fooBar');
  32085. * // => 'Foo Bar'
  32086. *
  32087. * _.startCase('__FOO_BAR__');
  32088. * // => 'FOO BAR'
  32089. */
  32090. var startCase = createCompounder(function(result, word, index) {
  32091. return result + (index ? ' ' : '') + upperFirst(word);
  32092. });
  32093. /**
  32094. * Checks if `string` starts with the given target string.
  32095. *
  32096. * @static
  32097. * @memberOf _
  32098. * @since 3.0.0
  32099. * @category String
  32100. * @param {string} [string=''] The string to inspect.
  32101. * @param {string} [target] The string to search for.
  32102. * @param {number} [position=0] The position to search from.
  32103. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32104. * else `false`.
  32105. * @example
  32106. *
  32107. * _.startsWith('abc', 'a');
  32108. * // => true
  32109. *
  32110. * _.startsWith('abc', 'b');
  32111. * // => false
  32112. *
  32113. * _.startsWith('abc', 'b', 1);
  32114. * // => true
  32115. */
  32116. function startsWith(string, target, position) {
  32117. string = toString(string);
  32118. position = position == null
  32119. ? 0
  32120. : baseClamp(toInteger(position), 0, string.length);
  32121. target = baseToString(target);
  32122. return string.slice(position, position + target.length) == target;
  32123. }
  32124. /**
  32125. * Creates a compiled template function that can interpolate data properties
  32126. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32127. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32128. * properties may be accessed as free variables in the template. If a setting
  32129. * object is given, it takes precedence over `_.templateSettings` values.
  32130. *
  32131. * **Note:** In the development build `_.template` utilizes
  32132. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32133. * for easier debugging.
  32134. *
  32135. * For more information on precompiling templates see
  32136. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32137. *
  32138. * For more information on Chrome extension sandboxes see
  32139. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32140. *
  32141. * @static
  32142. * @since 0.1.0
  32143. * @memberOf _
  32144. * @category String
  32145. * @param {string} [string=''] The template string.
  32146. * @param {Object} [options={}] The options object.
  32147. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32148. * The HTML "escape" delimiter.
  32149. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32150. * The "evaluate" delimiter.
  32151. * @param {Object} [options.imports=_.templateSettings.imports]
  32152. * An object to import into the template as free variables.
  32153. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32154. * The "interpolate" delimiter.
  32155. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32156. * The sourceURL of the compiled template.
  32157. * @param {string} [options.variable='obj']
  32158. * The data object variable name.
  32159. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32160. * @returns {Function} Returns the compiled template function.
  32161. * @example
  32162. *
  32163. * // Use the "interpolate" delimiter to create a compiled template.
  32164. * var compiled = _.template('hello <%= user %>!');
  32165. * compiled({ 'user': 'fred' });
  32166. * // => 'hello fred!'
  32167. *
  32168. * // Use the HTML "escape" delimiter to escape data property values.
  32169. * var compiled = _.template('<b><%- value %></b>');
  32170. * compiled({ 'value': '<script>' });
  32171. * // => '<b>&lt;script&gt;</b>'
  32172. *
  32173. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32174. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32175. * compiled({ 'users': ['fred', 'barney'] });
  32176. * // => '<li>fred</li><li>barney</li>'
  32177. *
  32178. * // Use the internal `print` function in "evaluate" delimiters.
  32179. * var compiled = _.template('<% print("hello " + user); %>!');
  32180. * compiled({ 'user': 'barney' });
  32181. * // => 'hello barney!'
  32182. *
  32183. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32184. * // Disable support by replacing the "interpolate" delimiter.
  32185. * var compiled = _.template('hello ${ user }!');
  32186. * compiled({ 'user': 'pebbles' });
  32187. * // => 'hello pebbles!'
  32188. *
  32189. * // Use backslashes to treat delimiters as plain text.
  32190. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32191. * compiled({ 'value': 'ignored' });
  32192. * // => '<%- value %>'
  32193. *
  32194. * // Use the `imports` option to import `jQuery` as `jq`.
  32195. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32196. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32197. * compiled({ 'users': ['fred', 'barney'] });
  32198. * // => '<li>fred</li><li>barney</li>'
  32199. *
  32200. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32201. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32202. * compiled(data);
  32203. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32204. *
  32205. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32206. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32207. * compiled.source;
  32208. * // => function(data) {
  32209. * // var __t, __p = '';
  32210. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32211. * // return __p;
  32212. * // }
  32213. *
  32214. * // Use custom template delimiters.
  32215. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32216. * var compiled = _.template('hello {{ user }}!');
  32217. * compiled({ 'user': 'mustache' });
  32218. * // => 'hello mustache!'
  32219. *
  32220. * // Use the `source` property to inline compiled templates for meaningful
  32221. * // line numbers in error messages and stack traces.
  32222. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32223. * var JST = {\
  32224. * "main": ' + _.template(mainText).source + '\
  32225. * };\
  32226. * ');
  32227. */
  32228. function template(string, options, guard) {
  32229. // Based on John Resig's `tmpl` implementation
  32230. // (http://ejohn.org/blog/javascript-micro-templating/)
  32231. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32232. var settings = lodash.templateSettings;
  32233. if (guard && isIterateeCall(string, options, guard)) {
  32234. options = undefined;
  32235. }
  32236. string = toString(string);
  32237. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32238. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32239. importsKeys = keys(imports),
  32240. importsValues = baseValues(imports, importsKeys);
  32241. var isEscaping,
  32242. isEvaluating,
  32243. index = 0,
  32244. interpolate = options.interpolate || reNoMatch,
  32245. source = "__p += '";
  32246. // Compile the regexp to match each delimiter.
  32247. var reDelimiters = RegExp(
  32248. (options.escape || reNoMatch).source + '|' +
  32249. interpolate.source + '|' +
  32250. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32251. (options.evaluate || reNoMatch).source + '|$'
  32252. , 'g');
  32253. // Use a sourceURL for easier debugging.
  32254. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32255. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32256. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32257. var sourceURL = '//# sourceURL=' +
  32258. (hasOwnProperty.call(options, 'sourceURL')
  32259. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32260. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32261. ) + '\n';
  32262. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32263. interpolateValue || (interpolateValue = esTemplateValue);
  32264. // Escape characters that can't be included in string literals.
  32265. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32266. // Replace delimiters with snippets.
  32267. if (escapeValue) {
  32268. isEscaping = true;
  32269. source += "' +\n__e(" + escapeValue + ") +\n'";
  32270. }
  32271. if (evaluateValue) {
  32272. isEvaluating = true;
  32273. source += "';\n" + evaluateValue + ";\n__p += '";
  32274. }
  32275. if (interpolateValue) {
  32276. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32277. }
  32278. index = offset + match.length;
  32279. // The JS engine embedded in Adobe products needs `match` returned in
  32280. // order to produce the correct `offset` value.
  32281. return match;
  32282. });
  32283. source += "';\n";
  32284. // If `variable` is not specified wrap a with-statement around the generated
  32285. // code to add the data object to the top of the scope chain.
  32286. // Like with sourceURL, we take care to not check the option's prototype,
  32287. // as this configuration is a code injection vector.
  32288. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32289. if (!variable) {
  32290. source = 'with (obj) {\n' + source + '\n}\n';
  32291. }
  32292. // Cleanup code by stripping empty strings.
  32293. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32294. .replace(reEmptyStringMiddle, '$1')
  32295. .replace(reEmptyStringTrailing, '$1;');
  32296. // Frame code as the function body.
  32297. source = 'function(' + (variable || 'obj') + ') {\n' +
  32298. (variable
  32299. ? ''
  32300. : 'obj || (obj = {});\n'
  32301. ) +
  32302. "var __t, __p = ''" +
  32303. (isEscaping
  32304. ? ', __e = _.escape'
  32305. : ''
  32306. ) +
  32307. (isEvaluating
  32308. ? ', __j = Array.prototype.join;\n' +
  32309. "function print() { __p += __j.call(arguments, '') }\n"
  32310. : ';\n'
  32311. ) +
  32312. source +
  32313. 'return __p\n}';
  32314. var result = attempt(function() {
  32315. return Function(importsKeys, sourceURL + 'return ' + source)
  32316. .apply(undefined, importsValues);
  32317. });
  32318. // Provide the compiled function's source by its `toString` method or
  32319. // the `source` property as a convenience for inlining compiled templates.
  32320. result.source = source;
  32321. if (isError(result)) {
  32322. throw result;
  32323. }
  32324. return result;
  32325. }
  32326. /**
  32327. * Converts `string`, as a whole, to lower case just like
  32328. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32329. *
  32330. * @static
  32331. * @memberOf _
  32332. * @since 4.0.0
  32333. * @category String
  32334. * @param {string} [string=''] The string to convert.
  32335. * @returns {string} Returns the lower cased string.
  32336. * @example
  32337. *
  32338. * _.toLower('--Foo-Bar--');
  32339. * // => '--foo-bar--'
  32340. *
  32341. * _.toLower('fooBar');
  32342. * // => 'foobar'
  32343. *
  32344. * _.toLower('__FOO_BAR__');
  32345. * // => '__foo_bar__'
  32346. */
  32347. function toLower(value) {
  32348. return toString(value).toLowerCase();
  32349. }
  32350. /**
  32351. * Converts `string`, as a whole, to upper case just like
  32352. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32353. *
  32354. * @static
  32355. * @memberOf _
  32356. * @since 4.0.0
  32357. * @category String
  32358. * @param {string} [string=''] The string to convert.
  32359. * @returns {string} Returns the upper cased string.
  32360. * @example
  32361. *
  32362. * _.toUpper('--foo-bar--');
  32363. * // => '--FOO-BAR--'
  32364. *
  32365. * _.toUpper('fooBar');
  32366. * // => 'FOOBAR'
  32367. *
  32368. * _.toUpper('__foo_bar__');
  32369. * // => '__FOO_BAR__'
  32370. */
  32371. function toUpper(value) {
  32372. return toString(value).toUpperCase();
  32373. }
  32374. /**
  32375. * Removes leading and trailing whitespace or specified characters from `string`.
  32376. *
  32377. * @static
  32378. * @memberOf _
  32379. * @since 3.0.0
  32380. * @category String
  32381. * @param {string} [string=''] The string to trim.
  32382. * @param {string} [chars=whitespace] The characters to trim.
  32383. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32384. * @returns {string} Returns the trimmed string.
  32385. * @example
  32386. *
  32387. * _.trim(' abc ');
  32388. * // => 'abc'
  32389. *
  32390. * _.trim('-_-abc-_-', '_-');
  32391. * // => 'abc'
  32392. *
  32393. * _.map([' foo ', ' bar '], _.trim);
  32394. * // => ['foo', 'bar']
  32395. */
  32396. function trim(string, chars, guard) {
  32397. string = toString(string);
  32398. if (string && (guard || chars === undefined)) {
  32399. return string.replace(reTrim, '');
  32400. }
  32401. if (!string || !(chars = baseToString(chars))) {
  32402. return string;
  32403. }
  32404. var strSymbols = stringToArray(string),
  32405. chrSymbols = stringToArray(chars),
  32406. start = charsStartIndex(strSymbols, chrSymbols),
  32407. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32408. return castSlice(strSymbols, start, end).join('');
  32409. }
  32410. /**
  32411. * Removes trailing whitespace or specified characters from `string`.
  32412. *
  32413. * @static
  32414. * @memberOf _
  32415. * @since 4.0.0
  32416. * @category String
  32417. * @param {string} [string=''] The string to trim.
  32418. * @param {string} [chars=whitespace] The characters to trim.
  32419. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32420. * @returns {string} Returns the trimmed string.
  32421. * @example
  32422. *
  32423. * _.trimEnd(' abc ');
  32424. * // => ' abc'
  32425. *
  32426. * _.trimEnd('-_-abc-_-', '_-');
  32427. * // => '-_-abc'
  32428. */
  32429. function trimEnd(string, chars, guard) {
  32430. string = toString(string);
  32431. if (string && (guard || chars === undefined)) {
  32432. return string.replace(reTrimEnd, '');
  32433. }
  32434. if (!string || !(chars = baseToString(chars))) {
  32435. return string;
  32436. }
  32437. var strSymbols = stringToArray(string),
  32438. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32439. return castSlice(strSymbols, 0, end).join('');
  32440. }
  32441. /**
  32442. * Removes leading whitespace or specified characters from `string`.
  32443. *
  32444. * @static
  32445. * @memberOf _
  32446. * @since 4.0.0
  32447. * @category String
  32448. * @param {string} [string=''] The string to trim.
  32449. * @param {string} [chars=whitespace] The characters to trim.
  32450. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32451. * @returns {string} Returns the trimmed string.
  32452. * @example
  32453. *
  32454. * _.trimStart(' abc ');
  32455. * // => 'abc '
  32456. *
  32457. * _.trimStart('-_-abc-_-', '_-');
  32458. * // => 'abc-_-'
  32459. */
  32460. function trimStart(string, chars, guard) {
  32461. string = toString(string);
  32462. if (string && (guard || chars === undefined)) {
  32463. return string.replace(reTrimStart, '');
  32464. }
  32465. if (!string || !(chars = baseToString(chars))) {
  32466. return string;
  32467. }
  32468. var strSymbols = stringToArray(string),
  32469. start = charsStartIndex(strSymbols, stringToArray(chars));
  32470. return castSlice(strSymbols, start).join('');
  32471. }
  32472. /**
  32473. * Truncates `string` if it's longer than the given maximum string length.
  32474. * The last characters of the truncated string are replaced with the omission
  32475. * string which defaults to "...".
  32476. *
  32477. * @static
  32478. * @memberOf _
  32479. * @since 4.0.0
  32480. * @category String
  32481. * @param {string} [string=''] The string to truncate.
  32482. * @param {Object} [options={}] The options object.
  32483. * @param {number} [options.length=30] The maximum string length.
  32484. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32485. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32486. * @returns {string} Returns the truncated string.
  32487. * @example
  32488. *
  32489. * _.truncate('hi-diddly-ho there, neighborino');
  32490. * // => 'hi-diddly-ho there, neighbo...'
  32491. *
  32492. * _.truncate('hi-diddly-ho there, neighborino', {
  32493. * 'length': 24,
  32494. * 'separator': ' '
  32495. * });
  32496. * // => 'hi-diddly-ho there,...'
  32497. *
  32498. * _.truncate('hi-diddly-ho there, neighborino', {
  32499. * 'length': 24,
  32500. * 'separator': /,? +/
  32501. * });
  32502. * // => 'hi-diddly-ho there...'
  32503. *
  32504. * _.truncate('hi-diddly-ho there, neighborino', {
  32505. * 'omission': ' [...]'
  32506. * });
  32507. * // => 'hi-diddly-ho there, neig [...]'
  32508. */
  32509. function truncate(string, options) {
  32510. var length = DEFAULT_TRUNC_LENGTH,
  32511. omission = DEFAULT_TRUNC_OMISSION;
  32512. if (isObject(options)) {
  32513. var separator = 'separator' in options ? options.separator : separator;
  32514. length = 'length' in options ? toInteger(options.length) : length;
  32515. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32516. }
  32517. string = toString(string);
  32518. var strLength = string.length;
  32519. if (hasUnicode(string)) {
  32520. var strSymbols = stringToArray(string);
  32521. strLength = strSymbols.length;
  32522. }
  32523. if (length >= strLength) {
  32524. return string;
  32525. }
  32526. var end = length - stringSize(omission);
  32527. if (end < 1) {
  32528. return omission;
  32529. }
  32530. var result = strSymbols
  32531. ? castSlice(strSymbols, 0, end).join('')
  32532. : string.slice(0, end);
  32533. if (separator === undefined) {
  32534. return result + omission;
  32535. }
  32536. if (strSymbols) {
  32537. end += (result.length - end);
  32538. }
  32539. if (isRegExp(separator)) {
  32540. if (string.slice(end).search(separator)) {
  32541. var match,
  32542. substring = result;
  32543. if (!separator.global) {
  32544. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32545. }
  32546. separator.lastIndex = 0;
  32547. while ((match = separator.exec(substring))) {
  32548. var newEnd = match.index;
  32549. }
  32550. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32551. }
  32552. } else if (string.indexOf(baseToString(separator), end) != end) {
  32553. var index = result.lastIndexOf(separator);
  32554. if (index > -1) {
  32555. result = result.slice(0, index);
  32556. }
  32557. }
  32558. return result + omission;
  32559. }
  32560. /**
  32561. * The inverse of `_.escape`; this method converts the HTML entities
  32562. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32563. * their corresponding characters.
  32564. *
  32565. * **Note:** No other HTML entities are unescaped. To unescape additional
  32566. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32567. *
  32568. * @static
  32569. * @memberOf _
  32570. * @since 0.6.0
  32571. * @category String
  32572. * @param {string} [string=''] The string to unescape.
  32573. * @returns {string} Returns the unescaped string.
  32574. * @example
  32575. *
  32576. * _.unescape('fred, barney, &amp; pebbles');
  32577. * // => 'fred, barney, & pebbles'
  32578. */
  32579. function unescape(string) {
  32580. string = toString(string);
  32581. return (string && reHasEscapedHtml.test(string))
  32582. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32583. : string;
  32584. }
  32585. /**
  32586. * Converts `string`, as space separated words, to upper case.
  32587. *
  32588. * @static
  32589. * @memberOf _
  32590. * @since 4.0.0
  32591. * @category String
  32592. * @param {string} [string=''] The string to convert.
  32593. * @returns {string} Returns the upper cased string.
  32594. * @example
  32595. *
  32596. * _.upperCase('--foo-bar');
  32597. * // => 'FOO BAR'
  32598. *
  32599. * _.upperCase('fooBar');
  32600. * // => 'FOO BAR'
  32601. *
  32602. * _.upperCase('__foo_bar__');
  32603. * // => 'FOO BAR'
  32604. */
  32605. var upperCase = createCompounder(function(result, word, index) {
  32606. return result + (index ? ' ' : '') + word.toUpperCase();
  32607. });
  32608. /**
  32609. * Converts the first character of `string` to upper case.
  32610. *
  32611. * @static
  32612. * @memberOf _
  32613. * @since 4.0.0
  32614. * @category String
  32615. * @param {string} [string=''] The string to convert.
  32616. * @returns {string} Returns the converted string.
  32617. * @example
  32618. *
  32619. * _.upperFirst('fred');
  32620. * // => 'Fred'
  32621. *
  32622. * _.upperFirst('FRED');
  32623. * // => 'FRED'
  32624. */
  32625. var upperFirst = createCaseFirst('toUpperCase');
  32626. /**
  32627. * Splits `string` into an array of its words.
  32628. *
  32629. * @static
  32630. * @memberOf _
  32631. * @since 3.0.0
  32632. * @category String
  32633. * @param {string} [string=''] The string to inspect.
  32634. * @param {RegExp|string} [pattern] The pattern to match words.
  32635. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32636. * @returns {Array} Returns the words of `string`.
  32637. * @example
  32638. *
  32639. * _.words('fred, barney, & pebbles');
  32640. * // => ['fred', 'barney', 'pebbles']
  32641. *
  32642. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32643. * // => ['fred', 'barney', '&', 'pebbles']
  32644. */
  32645. function words(string, pattern, guard) {
  32646. string = toString(string);
  32647. pattern = guard ? undefined : pattern;
  32648. if (pattern === undefined) {
  32649. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32650. }
  32651. return string.match(pattern) || [];
  32652. }
  32653. /*------------------------------------------------------------------------*/
  32654. /**
  32655. * Attempts to invoke `func`, returning either the result or the caught error
  32656. * object. Any additional arguments are provided to `func` when it's invoked.
  32657. *
  32658. * @static
  32659. * @memberOf _
  32660. * @since 3.0.0
  32661. * @category Util
  32662. * @param {Function} func The function to attempt.
  32663. * @param {...*} [args] The arguments to invoke `func` with.
  32664. * @returns {*} Returns the `func` result or error object.
  32665. * @example
  32666. *
  32667. * // Avoid throwing errors for invalid selectors.
  32668. * var elements = _.attempt(function(selector) {
  32669. * return document.querySelectorAll(selector);
  32670. * }, '>_>');
  32671. *
  32672. * if (_.isError(elements)) {
  32673. * elements = [];
  32674. * }
  32675. */
  32676. var attempt = baseRest(function(func, args) {
  32677. try {
  32678. return apply(func, undefined, args);
  32679. } catch (e) {
  32680. return isError(e) ? e : new Error(e);
  32681. }
  32682. });
  32683. /**
  32684. * Binds methods of an object to the object itself, overwriting the existing
  32685. * method.
  32686. *
  32687. * **Note:** This method doesn't set the "length" property of bound functions.
  32688. *
  32689. * @static
  32690. * @since 0.1.0
  32691. * @memberOf _
  32692. * @category Util
  32693. * @param {Object} object The object to bind and assign the bound methods to.
  32694. * @param {...(string|string[])} methodNames The object method names to bind.
  32695. * @returns {Object} Returns `object`.
  32696. * @example
  32697. *
  32698. * var view = {
  32699. * 'label': 'docs',
  32700. * 'click': function() {
  32701. * console.log('clicked ' + this.label);
  32702. * }
  32703. * };
  32704. *
  32705. * _.bindAll(view, ['click']);
  32706. * jQuery(element).on('click', view.click);
  32707. * // => Logs 'clicked docs' when clicked.
  32708. */
  32709. var bindAll = flatRest(function(object, methodNames) {
  32710. arrayEach(methodNames, function(key) {
  32711. key = toKey(key);
  32712. baseAssignValue(object, key, bind(object[key], object));
  32713. });
  32714. return object;
  32715. });
  32716. /**
  32717. * Creates a function that iterates over `pairs` and invokes the corresponding
  32718. * function of the first predicate to return truthy. The predicate-function
  32719. * pairs are invoked with the `this` binding and arguments of the created
  32720. * function.
  32721. *
  32722. * @static
  32723. * @memberOf _
  32724. * @since 4.0.0
  32725. * @category Util
  32726. * @param {Array} pairs The predicate-function pairs.
  32727. * @returns {Function} Returns the new composite function.
  32728. * @example
  32729. *
  32730. * var func = _.cond([
  32731. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32732. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32733. * [_.stubTrue, _.constant('no match')]
  32734. * ]);
  32735. *
  32736. * func({ 'a': 1, 'b': 2 });
  32737. * // => 'matches A'
  32738. *
  32739. * func({ 'a': 0, 'b': 1 });
  32740. * // => 'matches B'
  32741. *
  32742. * func({ 'a': '1', 'b': '2' });
  32743. * // => 'no match'
  32744. */
  32745. function cond(pairs) {
  32746. var length = pairs == null ? 0 : pairs.length,
  32747. toIteratee = getIteratee();
  32748. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32749. if (typeof pair[1] != 'function') {
  32750. throw new TypeError(FUNC_ERROR_TEXT);
  32751. }
  32752. return [toIteratee(pair[0]), pair[1]];
  32753. });
  32754. return baseRest(function(args) {
  32755. var index = -1;
  32756. while (++index < length) {
  32757. var pair = pairs[index];
  32758. if (apply(pair[0], this, args)) {
  32759. return apply(pair[1], this, args);
  32760. }
  32761. }
  32762. });
  32763. }
  32764. /**
  32765. * Creates a function that invokes the predicate properties of `source` with
  32766. * the corresponding property values of a given object, returning `true` if
  32767. * all predicates return truthy, else `false`.
  32768. *
  32769. * **Note:** The created function is equivalent to `_.conformsTo` with
  32770. * `source` partially applied.
  32771. *
  32772. * @static
  32773. * @memberOf _
  32774. * @since 4.0.0
  32775. * @category Util
  32776. * @param {Object} source The object of property predicates to conform to.
  32777. * @returns {Function} Returns the new spec function.
  32778. * @example
  32779. *
  32780. * var objects = [
  32781. * { 'a': 2, 'b': 1 },
  32782. * { 'a': 1, 'b': 2 }
  32783. * ];
  32784. *
  32785. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32786. * // => [{ 'a': 1, 'b': 2 }]
  32787. */
  32788. function conforms(source) {
  32789. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32790. }
  32791. /**
  32792. * Creates a function that returns `value`.
  32793. *
  32794. * @static
  32795. * @memberOf _
  32796. * @since 2.4.0
  32797. * @category Util
  32798. * @param {*} value The value to return from the new function.
  32799. * @returns {Function} Returns the new constant function.
  32800. * @example
  32801. *
  32802. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32803. *
  32804. * console.log(objects);
  32805. * // => [{ 'a': 1 }, { 'a': 1 }]
  32806. *
  32807. * console.log(objects[0] === objects[1]);
  32808. * // => true
  32809. */
  32810. function constant(value) {
  32811. return function() {
  32812. return value;
  32813. };
  32814. }
  32815. /**
  32816. * Checks `value` to determine whether a default value should be returned in
  32817. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32818. * or `undefined`.
  32819. *
  32820. * @static
  32821. * @memberOf _
  32822. * @since 4.14.0
  32823. * @category Util
  32824. * @param {*} value The value to check.
  32825. * @param {*} defaultValue The default value.
  32826. * @returns {*} Returns the resolved value.
  32827. * @example
  32828. *
  32829. * _.defaultTo(1, 10);
  32830. * // => 1
  32831. *
  32832. * _.defaultTo(undefined, 10);
  32833. * // => 10
  32834. */
  32835. function defaultTo(value, defaultValue) {
  32836. return (value == null || value !== value) ? defaultValue : value;
  32837. }
  32838. /**
  32839. * Creates a function that returns the result of invoking the given functions
  32840. * with the `this` binding of the created function, where each successive
  32841. * invocation is supplied the return value of the previous.
  32842. *
  32843. * @static
  32844. * @memberOf _
  32845. * @since 3.0.0
  32846. * @category Util
  32847. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32848. * @returns {Function} Returns the new composite function.
  32849. * @see _.flowRight
  32850. * @example
  32851. *
  32852. * function square(n) {
  32853. * return n * n;
  32854. * }
  32855. *
  32856. * var addSquare = _.flow([_.add, square]);
  32857. * addSquare(1, 2);
  32858. * // => 9
  32859. */
  32860. var flow = createFlow();
  32861. /**
  32862. * This method is like `_.flow` except that it creates a function that
  32863. * invokes the given functions from right to left.
  32864. *
  32865. * @static
  32866. * @since 3.0.0
  32867. * @memberOf _
  32868. * @category Util
  32869. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32870. * @returns {Function} Returns the new composite function.
  32871. * @see _.flow
  32872. * @example
  32873. *
  32874. * function square(n) {
  32875. * return n * n;
  32876. * }
  32877. *
  32878. * var addSquare = _.flowRight([square, _.add]);
  32879. * addSquare(1, 2);
  32880. * // => 9
  32881. */
  32882. var flowRight = createFlow(true);
  32883. /**
  32884. * This method returns the first argument it receives.
  32885. *
  32886. * @static
  32887. * @since 0.1.0
  32888. * @memberOf _
  32889. * @category Util
  32890. * @param {*} value Any value.
  32891. * @returns {*} Returns `value`.
  32892. * @example
  32893. *
  32894. * var object = { 'a': 1 };
  32895. *
  32896. * console.log(_.identity(object) === object);
  32897. * // => true
  32898. */
  32899. function identity(value) {
  32900. return value;
  32901. }
  32902. /**
  32903. * Creates a function that invokes `func` with the arguments of the created
  32904. * function. If `func` is a property name, the created function returns the
  32905. * property value for a given element. If `func` is an array or object, the
  32906. * created function returns `true` for elements that contain the equivalent
  32907. * source properties, otherwise it returns `false`.
  32908. *
  32909. * @static
  32910. * @since 4.0.0
  32911. * @memberOf _
  32912. * @category Util
  32913. * @param {*} [func=_.identity] The value to convert to a callback.
  32914. * @returns {Function} Returns the callback.
  32915. * @example
  32916. *
  32917. * var users = [
  32918. * { 'user': 'barney', 'age': 36, 'active': true },
  32919. * { 'user': 'fred', 'age': 40, 'active': false }
  32920. * ];
  32921. *
  32922. * // The `_.matches` iteratee shorthand.
  32923. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32924. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32925. *
  32926. * // The `_.matchesProperty` iteratee shorthand.
  32927. * _.filter(users, _.iteratee(['user', 'fred']));
  32928. * // => [{ 'user': 'fred', 'age': 40 }]
  32929. *
  32930. * // The `_.property` iteratee shorthand.
  32931. * _.map(users, _.iteratee('user'));
  32932. * // => ['barney', 'fred']
  32933. *
  32934. * // Create custom iteratee shorthands.
  32935. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32936. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32937. * return func.test(string);
  32938. * };
  32939. * });
  32940. *
  32941. * _.filter(['abc', 'def'], /ef/);
  32942. * // => ['def']
  32943. */
  32944. function iteratee(func) {
  32945. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32946. }
  32947. /**
  32948. * Creates a function that performs a partial deep comparison between a given
  32949. * object and `source`, returning `true` if the given object has equivalent
  32950. * property values, else `false`.
  32951. *
  32952. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32953. * partially applied.
  32954. *
  32955. * Partial comparisons will match empty array and empty object `source`
  32956. * values against any array or object value, respectively. See `_.isEqual`
  32957. * for a list of supported value comparisons.
  32958. *
  32959. * @static
  32960. * @memberOf _
  32961. * @since 3.0.0
  32962. * @category Util
  32963. * @param {Object} source The object of property values to match.
  32964. * @returns {Function} Returns the new spec function.
  32965. * @example
  32966. *
  32967. * var objects = [
  32968. * { 'a': 1, 'b': 2, 'c': 3 },
  32969. * { 'a': 4, 'b': 5, 'c': 6 }
  32970. * ];
  32971. *
  32972. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32973. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32974. */
  32975. function matches(source) {
  32976. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32977. }
  32978. /**
  32979. * Creates a function that performs a partial deep comparison between the
  32980. * value at `path` of a given object to `srcValue`, returning `true` if the
  32981. * object value is equivalent, else `false`.
  32982. *
  32983. * **Note:** Partial comparisons will match empty array and empty object
  32984. * `srcValue` values against any array or object value, respectively. See
  32985. * `_.isEqual` for a list of supported value comparisons.
  32986. *
  32987. * @static
  32988. * @memberOf _
  32989. * @since 3.2.0
  32990. * @category Util
  32991. * @param {Array|string} path The path of the property to get.
  32992. * @param {*} srcValue The value to match.
  32993. * @returns {Function} Returns the new spec function.
  32994. * @example
  32995. *
  32996. * var objects = [
  32997. * { 'a': 1, 'b': 2, 'c': 3 },
  32998. * { 'a': 4, 'b': 5, 'c': 6 }
  32999. * ];
  33000. *
  33001. * _.find(objects, _.matchesProperty('a', 4));
  33002. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33003. */
  33004. function matchesProperty(path, srcValue) {
  33005. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33006. }
  33007. /**
  33008. * Creates a function that invokes the method at `path` of a given object.
  33009. * Any additional arguments are provided to the invoked method.
  33010. *
  33011. * @static
  33012. * @memberOf _
  33013. * @since 3.7.0
  33014. * @category Util
  33015. * @param {Array|string} path The path of the method to invoke.
  33016. * @param {...*} [args] The arguments to invoke the method with.
  33017. * @returns {Function} Returns the new invoker function.
  33018. * @example
  33019. *
  33020. * var objects = [
  33021. * { 'a': { 'b': _.constant(2) } },
  33022. * { 'a': { 'b': _.constant(1) } }
  33023. * ];
  33024. *
  33025. * _.map(objects, _.method('a.b'));
  33026. * // => [2, 1]
  33027. *
  33028. * _.map(objects, _.method(['a', 'b']));
  33029. * // => [2, 1]
  33030. */
  33031. var method = baseRest(function(path, args) {
  33032. return function(object) {
  33033. return baseInvoke(object, path, args);
  33034. };
  33035. });
  33036. /**
  33037. * The opposite of `_.method`; this method creates a function that invokes
  33038. * the method at a given path of `object`. Any additional arguments are
  33039. * provided to the invoked method.
  33040. *
  33041. * @static
  33042. * @memberOf _
  33043. * @since 3.7.0
  33044. * @category Util
  33045. * @param {Object} object The object to query.
  33046. * @param {...*} [args] The arguments to invoke the method with.
  33047. * @returns {Function} Returns the new invoker function.
  33048. * @example
  33049. *
  33050. * var array = _.times(3, _.constant),
  33051. * object = { 'a': array, 'b': array, 'c': array };
  33052. *
  33053. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33054. * // => [2, 0]
  33055. *
  33056. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33057. * // => [2, 0]
  33058. */
  33059. var methodOf = baseRest(function(object, args) {
  33060. return function(path) {
  33061. return baseInvoke(object, path, args);
  33062. };
  33063. });
  33064. /**
  33065. * Adds all own enumerable string keyed function properties of a source
  33066. * object to the destination object. If `object` is a function, then methods
  33067. * are added to its prototype as well.
  33068. *
  33069. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33070. * avoid conflicts caused by modifying the original.
  33071. *
  33072. * @static
  33073. * @since 0.1.0
  33074. * @memberOf _
  33075. * @category Util
  33076. * @param {Function|Object} [object=lodash] The destination object.
  33077. * @param {Object} source The object of functions to add.
  33078. * @param {Object} [options={}] The options object.
  33079. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33080. * @returns {Function|Object} Returns `object`.
  33081. * @example
  33082. *
  33083. * function vowels(string) {
  33084. * return _.filter(string, function(v) {
  33085. * return /[aeiou]/i.test(v);
  33086. * });
  33087. * }
  33088. *
  33089. * _.mixin({ 'vowels': vowels });
  33090. * _.vowels('fred');
  33091. * // => ['e']
  33092. *
  33093. * _('fred').vowels().value();
  33094. * // => ['e']
  33095. *
  33096. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33097. * _('fred').vowels();
  33098. * // => ['e']
  33099. */
  33100. function mixin(object, source, options) {
  33101. var props = keys(source),
  33102. methodNames = baseFunctions(source, props);
  33103. if (options == null &&
  33104. !(isObject(source) && (methodNames.length || !props.length))) {
  33105. options = source;
  33106. source = object;
  33107. object = this;
  33108. methodNames = baseFunctions(source, keys(source));
  33109. }
  33110. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33111. isFunc = isFunction(object);
  33112. arrayEach(methodNames, function(methodName) {
  33113. var func = source[methodName];
  33114. object[methodName] = func;
  33115. if (isFunc) {
  33116. object.prototype[methodName] = function() {
  33117. var chainAll = this.__chain__;
  33118. if (chain || chainAll) {
  33119. var result = object(this.__wrapped__),
  33120. actions = result.__actions__ = copyArray(this.__actions__);
  33121. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33122. result.__chain__ = chainAll;
  33123. return result;
  33124. }
  33125. return func.apply(object, arrayPush([this.value()], arguments));
  33126. };
  33127. }
  33128. });
  33129. return object;
  33130. }
  33131. /**
  33132. * Reverts the `_` variable to its previous value and returns a reference to
  33133. * the `lodash` function.
  33134. *
  33135. * @static
  33136. * @since 0.1.0
  33137. * @memberOf _
  33138. * @category Util
  33139. * @returns {Function} Returns the `lodash` function.
  33140. * @example
  33141. *
  33142. * var lodash = _.noConflict();
  33143. */
  33144. function noConflict() {
  33145. if (root._ === this) {
  33146. root._ = oldDash;
  33147. }
  33148. return this;
  33149. }
  33150. /**
  33151. * This method returns `undefined`.
  33152. *
  33153. * @static
  33154. * @memberOf _
  33155. * @since 2.3.0
  33156. * @category Util
  33157. * @example
  33158. *
  33159. * _.times(2, _.noop);
  33160. * // => [undefined, undefined]
  33161. */
  33162. function noop() {
  33163. // No operation performed.
  33164. }
  33165. /**
  33166. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33167. * the nth argument from the end is returned.
  33168. *
  33169. * @static
  33170. * @memberOf _
  33171. * @since 4.0.0
  33172. * @category Util
  33173. * @param {number} [n=0] The index of the argument to return.
  33174. * @returns {Function} Returns the new pass-thru function.
  33175. * @example
  33176. *
  33177. * var func = _.nthArg(1);
  33178. * func('a', 'b', 'c', 'd');
  33179. * // => 'b'
  33180. *
  33181. * var func = _.nthArg(-2);
  33182. * func('a', 'b', 'c', 'd');
  33183. * // => 'c'
  33184. */
  33185. function nthArg(n) {
  33186. n = toInteger(n);
  33187. return baseRest(function(args) {
  33188. return baseNth(args, n);
  33189. });
  33190. }
  33191. /**
  33192. * Creates a function that invokes `iteratees` with the arguments it receives
  33193. * and returns their results.
  33194. *
  33195. * @static
  33196. * @memberOf _
  33197. * @since 4.0.0
  33198. * @category Util
  33199. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33200. * The iteratees to invoke.
  33201. * @returns {Function} Returns the new function.
  33202. * @example
  33203. *
  33204. * var func = _.over([Math.max, Math.min]);
  33205. *
  33206. * func(1, 2, 3, 4);
  33207. * // => [4, 1]
  33208. */
  33209. var over = createOver(arrayMap);
  33210. /**
  33211. * Creates a function that checks if **all** of the `predicates` return
  33212. * truthy when invoked with the arguments it receives.
  33213. *
  33214. * @static
  33215. * @memberOf _
  33216. * @since 4.0.0
  33217. * @category Util
  33218. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33219. * The predicates to check.
  33220. * @returns {Function} Returns the new function.
  33221. * @example
  33222. *
  33223. * var func = _.overEvery([Boolean, isFinite]);
  33224. *
  33225. * func('1');
  33226. * // => true
  33227. *
  33228. * func(null);
  33229. * // => false
  33230. *
  33231. * func(NaN);
  33232. * // => false
  33233. */
  33234. var overEvery = createOver(arrayEvery);
  33235. /**
  33236. * Creates a function that checks if **any** of the `predicates` return
  33237. * truthy when invoked with the arguments it receives.
  33238. *
  33239. * @static
  33240. * @memberOf _
  33241. * @since 4.0.0
  33242. * @category Util
  33243. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33244. * The predicates to check.
  33245. * @returns {Function} Returns the new function.
  33246. * @example
  33247. *
  33248. * var func = _.overSome([Boolean, isFinite]);
  33249. *
  33250. * func('1');
  33251. * // => true
  33252. *
  33253. * func(null);
  33254. * // => true
  33255. *
  33256. * func(NaN);
  33257. * // => false
  33258. */
  33259. var overSome = createOver(arraySome);
  33260. /**
  33261. * Creates a function that returns the value at `path` of a given object.
  33262. *
  33263. * @static
  33264. * @memberOf _
  33265. * @since 2.4.0
  33266. * @category Util
  33267. * @param {Array|string} path The path of the property to get.
  33268. * @returns {Function} Returns the new accessor function.
  33269. * @example
  33270. *
  33271. * var objects = [
  33272. * { 'a': { 'b': 2 } },
  33273. * { 'a': { 'b': 1 } }
  33274. * ];
  33275. *
  33276. * _.map(objects, _.property('a.b'));
  33277. * // => [2, 1]
  33278. *
  33279. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33280. * // => [1, 2]
  33281. */
  33282. function property(path) {
  33283. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33284. }
  33285. /**
  33286. * The opposite of `_.property`; this method creates a function that returns
  33287. * the value at a given path of `object`.
  33288. *
  33289. * @static
  33290. * @memberOf _
  33291. * @since 3.0.0
  33292. * @category Util
  33293. * @param {Object} object The object to query.
  33294. * @returns {Function} Returns the new accessor function.
  33295. * @example
  33296. *
  33297. * var array = [0, 1, 2],
  33298. * object = { 'a': array, 'b': array, 'c': array };
  33299. *
  33300. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33301. * // => [2, 0]
  33302. *
  33303. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33304. * // => [2, 0]
  33305. */
  33306. function propertyOf(object) {
  33307. return function(path) {
  33308. return object == null ? undefined : baseGet(object, path);
  33309. };
  33310. }
  33311. /**
  33312. * Creates an array of numbers (positive and/or negative) progressing from
  33313. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33314. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33315. * it's set to `start` with `start` then set to `0`.
  33316. *
  33317. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33318. * floating-point values which can produce unexpected results.
  33319. *
  33320. * @static
  33321. * @since 0.1.0
  33322. * @memberOf _
  33323. * @category Util
  33324. * @param {number} [start=0] The start of the range.
  33325. * @param {number} end The end of the range.
  33326. * @param {number} [step=1] The value to increment or decrement by.
  33327. * @returns {Array} Returns the range of numbers.
  33328. * @see _.inRange, _.rangeRight
  33329. * @example
  33330. *
  33331. * _.range(4);
  33332. * // => [0, 1, 2, 3]
  33333. *
  33334. * _.range(-4);
  33335. * // => [0, -1, -2, -3]
  33336. *
  33337. * _.range(1, 5);
  33338. * // => [1, 2, 3, 4]
  33339. *
  33340. * _.range(0, 20, 5);
  33341. * // => [0, 5, 10, 15]
  33342. *
  33343. * _.range(0, -4, -1);
  33344. * // => [0, -1, -2, -3]
  33345. *
  33346. * _.range(1, 4, 0);
  33347. * // => [1, 1, 1]
  33348. *
  33349. * _.range(0);
  33350. * // => []
  33351. */
  33352. var range = createRange();
  33353. /**
  33354. * This method is like `_.range` except that it populates values in
  33355. * descending order.
  33356. *
  33357. * @static
  33358. * @memberOf _
  33359. * @since 4.0.0
  33360. * @category Util
  33361. * @param {number} [start=0] The start of the range.
  33362. * @param {number} end The end of the range.
  33363. * @param {number} [step=1] The value to increment or decrement by.
  33364. * @returns {Array} Returns the range of numbers.
  33365. * @see _.inRange, _.range
  33366. * @example
  33367. *
  33368. * _.rangeRight(4);
  33369. * // => [3, 2, 1, 0]
  33370. *
  33371. * _.rangeRight(-4);
  33372. * // => [-3, -2, -1, 0]
  33373. *
  33374. * _.rangeRight(1, 5);
  33375. * // => [4, 3, 2, 1]
  33376. *
  33377. * _.rangeRight(0, 20, 5);
  33378. * // => [15, 10, 5, 0]
  33379. *
  33380. * _.rangeRight(0, -4, -1);
  33381. * // => [-3, -2, -1, 0]
  33382. *
  33383. * _.rangeRight(1, 4, 0);
  33384. * // => [1, 1, 1]
  33385. *
  33386. * _.rangeRight(0);
  33387. * // => []
  33388. */
  33389. var rangeRight = createRange(true);
  33390. /**
  33391. * This method returns a new empty array.
  33392. *
  33393. * @static
  33394. * @memberOf _
  33395. * @since 4.13.0
  33396. * @category Util
  33397. * @returns {Array} Returns the new empty array.
  33398. * @example
  33399. *
  33400. * var arrays = _.times(2, _.stubArray);
  33401. *
  33402. * console.log(arrays);
  33403. * // => [[], []]
  33404. *
  33405. * console.log(arrays[0] === arrays[1]);
  33406. * // => false
  33407. */
  33408. function stubArray() {
  33409. return [];
  33410. }
  33411. /**
  33412. * This method returns `false`.
  33413. *
  33414. * @static
  33415. * @memberOf _
  33416. * @since 4.13.0
  33417. * @category Util
  33418. * @returns {boolean} Returns `false`.
  33419. * @example
  33420. *
  33421. * _.times(2, _.stubFalse);
  33422. * // => [false, false]
  33423. */
  33424. function stubFalse() {
  33425. return false;
  33426. }
  33427. /**
  33428. * This method returns a new empty object.
  33429. *
  33430. * @static
  33431. * @memberOf _
  33432. * @since 4.13.0
  33433. * @category Util
  33434. * @returns {Object} Returns the new empty object.
  33435. * @example
  33436. *
  33437. * var objects = _.times(2, _.stubObject);
  33438. *
  33439. * console.log(objects);
  33440. * // => [{}, {}]
  33441. *
  33442. * console.log(objects[0] === objects[1]);
  33443. * // => false
  33444. */
  33445. function stubObject() {
  33446. return {};
  33447. }
  33448. /**
  33449. * This method returns an empty string.
  33450. *
  33451. * @static
  33452. * @memberOf _
  33453. * @since 4.13.0
  33454. * @category Util
  33455. * @returns {string} Returns the empty string.
  33456. * @example
  33457. *
  33458. * _.times(2, _.stubString);
  33459. * // => ['', '']
  33460. */
  33461. function stubString() {
  33462. return '';
  33463. }
  33464. /**
  33465. * This method returns `true`.
  33466. *
  33467. * @static
  33468. * @memberOf _
  33469. * @since 4.13.0
  33470. * @category Util
  33471. * @returns {boolean} Returns `true`.
  33472. * @example
  33473. *
  33474. * _.times(2, _.stubTrue);
  33475. * // => [true, true]
  33476. */
  33477. function stubTrue() {
  33478. return true;
  33479. }
  33480. /**
  33481. * Invokes the iteratee `n` times, returning an array of the results of
  33482. * each invocation. The iteratee is invoked with one argument; (index).
  33483. *
  33484. * @static
  33485. * @since 0.1.0
  33486. * @memberOf _
  33487. * @category Util
  33488. * @param {number} n The number of times to invoke `iteratee`.
  33489. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33490. * @returns {Array} Returns the array of results.
  33491. * @example
  33492. *
  33493. * _.times(3, String);
  33494. * // => ['0', '1', '2']
  33495. *
  33496. * _.times(4, _.constant(0));
  33497. * // => [0, 0, 0, 0]
  33498. */
  33499. function times(n, iteratee) {
  33500. n = toInteger(n);
  33501. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33502. return [];
  33503. }
  33504. var index = MAX_ARRAY_LENGTH,
  33505. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33506. iteratee = getIteratee(iteratee);
  33507. n -= MAX_ARRAY_LENGTH;
  33508. var result = baseTimes(length, iteratee);
  33509. while (++index < n) {
  33510. iteratee(index);
  33511. }
  33512. return result;
  33513. }
  33514. /**
  33515. * Converts `value` to a property path array.
  33516. *
  33517. * @static
  33518. * @memberOf _
  33519. * @since 4.0.0
  33520. * @category Util
  33521. * @param {*} value The value to convert.
  33522. * @returns {Array} Returns the new property path array.
  33523. * @example
  33524. *
  33525. * _.toPath('a.b.c');
  33526. * // => ['a', 'b', 'c']
  33527. *
  33528. * _.toPath('a[0].b.c');
  33529. * // => ['a', '0', 'b', 'c']
  33530. */
  33531. function toPath(value) {
  33532. if (isArray(value)) {
  33533. return arrayMap(value, toKey);
  33534. }
  33535. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33536. }
  33537. /**
  33538. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33539. *
  33540. * @static
  33541. * @since 0.1.0
  33542. * @memberOf _
  33543. * @category Util
  33544. * @param {string} [prefix=''] The value to prefix the ID with.
  33545. * @returns {string} Returns the unique ID.
  33546. * @example
  33547. *
  33548. * _.uniqueId('contact_');
  33549. * // => 'contact_104'
  33550. *
  33551. * _.uniqueId();
  33552. * // => '105'
  33553. */
  33554. function uniqueId(prefix) {
  33555. var id = ++idCounter;
  33556. return toString(prefix) + id;
  33557. }
  33558. /*------------------------------------------------------------------------*/
  33559. /**
  33560. * Adds two numbers.
  33561. *
  33562. * @static
  33563. * @memberOf _
  33564. * @since 3.4.0
  33565. * @category Math
  33566. * @param {number} augend The first number in an addition.
  33567. * @param {number} addend The second number in an addition.
  33568. * @returns {number} Returns the total.
  33569. * @example
  33570. *
  33571. * _.add(6, 4);
  33572. * // => 10
  33573. */
  33574. var add = createMathOperation(function(augend, addend) {
  33575. return augend + addend;
  33576. }, 0);
  33577. /**
  33578. * Computes `number` rounded up to `precision`.
  33579. *
  33580. * @static
  33581. * @memberOf _
  33582. * @since 3.10.0
  33583. * @category Math
  33584. * @param {number} number The number to round up.
  33585. * @param {number} [precision=0] The precision to round up to.
  33586. * @returns {number} Returns the rounded up number.
  33587. * @example
  33588. *
  33589. * _.ceil(4.006);
  33590. * // => 5
  33591. *
  33592. * _.ceil(6.004, 2);
  33593. * // => 6.01
  33594. *
  33595. * _.ceil(6040, -2);
  33596. * // => 6100
  33597. */
  33598. var ceil = createRound('ceil');
  33599. /**
  33600. * Divide two numbers.
  33601. *
  33602. * @static
  33603. * @memberOf _
  33604. * @since 4.7.0
  33605. * @category Math
  33606. * @param {number} dividend The first number in a division.
  33607. * @param {number} divisor The second number in a division.
  33608. * @returns {number} Returns the quotient.
  33609. * @example
  33610. *
  33611. * _.divide(6, 4);
  33612. * // => 1.5
  33613. */
  33614. var divide = createMathOperation(function(dividend, divisor) {
  33615. return dividend / divisor;
  33616. }, 1);
  33617. /**
  33618. * Computes `number` rounded down to `precision`.
  33619. *
  33620. * @static
  33621. * @memberOf _
  33622. * @since 3.10.0
  33623. * @category Math
  33624. * @param {number} number The number to round down.
  33625. * @param {number} [precision=0] The precision to round down to.
  33626. * @returns {number} Returns the rounded down number.
  33627. * @example
  33628. *
  33629. * _.floor(4.006);
  33630. * // => 4
  33631. *
  33632. * _.floor(0.046, 2);
  33633. * // => 0.04
  33634. *
  33635. * _.floor(4060, -2);
  33636. * // => 4000
  33637. */
  33638. var floor = createRound('floor');
  33639. /**
  33640. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33641. * `undefined` is returned.
  33642. *
  33643. * @static
  33644. * @since 0.1.0
  33645. * @memberOf _
  33646. * @category Math
  33647. * @param {Array} array The array to iterate over.
  33648. * @returns {*} Returns the maximum value.
  33649. * @example
  33650. *
  33651. * _.max([4, 2, 8, 6]);
  33652. * // => 8
  33653. *
  33654. * _.max([]);
  33655. * // => undefined
  33656. */
  33657. function max(array) {
  33658. return (array && array.length)
  33659. ? baseExtremum(array, identity, baseGt)
  33660. : undefined;
  33661. }
  33662. /**
  33663. * This method is like `_.max` except that it accepts `iteratee` which is
  33664. * invoked for each element in `array` to generate the criterion by which
  33665. * the value is ranked. The iteratee is invoked with one argument: (value).
  33666. *
  33667. * @static
  33668. * @memberOf _
  33669. * @since 4.0.0
  33670. * @category Math
  33671. * @param {Array} array The array to iterate over.
  33672. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33673. * @returns {*} Returns the maximum value.
  33674. * @example
  33675. *
  33676. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33677. *
  33678. * _.maxBy(objects, function(o) { return o.n; });
  33679. * // => { 'n': 2 }
  33680. *
  33681. * // The `_.property` iteratee shorthand.
  33682. * _.maxBy(objects, 'n');
  33683. * // => { 'n': 2 }
  33684. */
  33685. function maxBy(array, iteratee) {
  33686. return (array && array.length)
  33687. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33688. : undefined;
  33689. }
  33690. /**
  33691. * Computes the mean of the values in `array`.
  33692. *
  33693. * @static
  33694. * @memberOf _
  33695. * @since 4.0.0
  33696. * @category Math
  33697. * @param {Array} array The array to iterate over.
  33698. * @returns {number} Returns the mean.
  33699. * @example
  33700. *
  33701. * _.mean([4, 2, 8, 6]);
  33702. * // => 5
  33703. */
  33704. function mean(array) {
  33705. return baseMean(array, identity);
  33706. }
  33707. /**
  33708. * This method is like `_.mean` except that it accepts `iteratee` which is
  33709. * invoked for each element in `array` to generate the value to be averaged.
  33710. * The iteratee is invoked with one argument: (value).
  33711. *
  33712. * @static
  33713. * @memberOf _
  33714. * @since 4.7.0
  33715. * @category Math
  33716. * @param {Array} array The array to iterate over.
  33717. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33718. * @returns {number} Returns the mean.
  33719. * @example
  33720. *
  33721. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33722. *
  33723. * _.meanBy(objects, function(o) { return o.n; });
  33724. * // => 5
  33725. *
  33726. * // The `_.property` iteratee shorthand.
  33727. * _.meanBy(objects, 'n');
  33728. * // => 5
  33729. */
  33730. function meanBy(array, iteratee) {
  33731. return baseMean(array, getIteratee(iteratee, 2));
  33732. }
  33733. /**
  33734. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33735. * `undefined` is returned.
  33736. *
  33737. * @static
  33738. * @since 0.1.0
  33739. * @memberOf _
  33740. * @category Math
  33741. * @param {Array} array The array to iterate over.
  33742. * @returns {*} Returns the minimum value.
  33743. * @example
  33744. *
  33745. * _.min([4, 2, 8, 6]);
  33746. * // => 2
  33747. *
  33748. * _.min([]);
  33749. * // => undefined
  33750. */
  33751. function min(array) {
  33752. return (array && array.length)
  33753. ? baseExtremum(array, identity, baseLt)
  33754. : undefined;
  33755. }
  33756. /**
  33757. * This method is like `_.min` except that it accepts `iteratee` which is
  33758. * invoked for each element in `array` to generate the criterion by which
  33759. * the value is ranked. The iteratee is invoked with one argument: (value).
  33760. *
  33761. * @static
  33762. * @memberOf _
  33763. * @since 4.0.0
  33764. * @category Math
  33765. * @param {Array} array The array to iterate over.
  33766. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33767. * @returns {*} Returns the minimum value.
  33768. * @example
  33769. *
  33770. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33771. *
  33772. * _.minBy(objects, function(o) { return o.n; });
  33773. * // => { 'n': 1 }
  33774. *
  33775. * // The `_.property` iteratee shorthand.
  33776. * _.minBy(objects, 'n');
  33777. * // => { 'n': 1 }
  33778. */
  33779. function minBy(array, iteratee) {
  33780. return (array && array.length)
  33781. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33782. : undefined;
  33783. }
  33784. /**
  33785. * Multiply two numbers.
  33786. *
  33787. * @static
  33788. * @memberOf _
  33789. * @since 4.7.0
  33790. * @category Math
  33791. * @param {number} multiplier The first number in a multiplication.
  33792. * @param {number} multiplicand The second number in a multiplication.
  33793. * @returns {number} Returns the product.
  33794. * @example
  33795. *
  33796. * _.multiply(6, 4);
  33797. * // => 24
  33798. */
  33799. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33800. return multiplier * multiplicand;
  33801. }, 1);
  33802. /**
  33803. * Computes `number` rounded to `precision`.
  33804. *
  33805. * @static
  33806. * @memberOf _
  33807. * @since 3.10.0
  33808. * @category Math
  33809. * @param {number} number The number to round.
  33810. * @param {number} [precision=0] The precision to round to.
  33811. * @returns {number} Returns the rounded number.
  33812. * @example
  33813. *
  33814. * _.round(4.006);
  33815. * // => 4
  33816. *
  33817. * _.round(4.006, 2);
  33818. * // => 4.01
  33819. *
  33820. * _.round(4060, -2);
  33821. * // => 4100
  33822. */
  33823. var round = createRound('round');
  33824. /**
  33825. * Subtract two numbers.
  33826. *
  33827. * @static
  33828. * @memberOf _
  33829. * @since 4.0.0
  33830. * @category Math
  33831. * @param {number} minuend The first number in a subtraction.
  33832. * @param {number} subtrahend The second number in a subtraction.
  33833. * @returns {number} Returns the difference.
  33834. * @example
  33835. *
  33836. * _.subtract(6, 4);
  33837. * // => 2
  33838. */
  33839. var subtract = createMathOperation(function(minuend, subtrahend) {
  33840. return minuend - subtrahend;
  33841. }, 0);
  33842. /**
  33843. * Computes the sum of the values in `array`.
  33844. *
  33845. * @static
  33846. * @memberOf _
  33847. * @since 3.4.0
  33848. * @category Math
  33849. * @param {Array} array The array to iterate over.
  33850. * @returns {number} Returns the sum.
  33851. * @example
  33852. *
  33853. * _.sum([4, 2, 8, 6]);
  33854. * // => 20
  33855. */
  33856. function sum(array) {
  33857. return (array && array.length)
  33858. ? baseSum(array, identity)
  33859. : 0;
  33860. }
  33861. /**
  33862. * This method is like `_.sum` except that it accepts `iteratee` which is
  33863. * invoked for each element in `array` to generate the value to be summed.
  33864. * The iteratee is invoked with one argument: (value).
  33865. *
  33866. * @static
  33867. * @memberOf _
  33868. * @since 4.0.0
  33869. * @category Math
  33870. * @param {Array} array The array to iterate over.
  33871. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33872. * @returns {number} Returns the sum.
  33873. * @example
  33874. *
  33875. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33876. *
  33877. * _.sumBy(objects, function(o) { return o.n; });
  33878. * // => 20
  33879. *
  33880. * // The `_.property` iteratee shorthand.
  33881. * _.sumBy(objects, 'n');
  33882. * // => 20
  33883. */
  33884. function sumBy(array, iteratee) {
  33885. return (array && array.length)
  33886. ? baseSum(array, getIteratee(iteratee, 2))
  33887. : 0;
  33888. }
  33889. /*------------------------------------------------------------------------*/
  33890. // Add methods that return wrapped values in chain sequences.
  33891. lodash.after = after;
  33892. lodash.ary = ary;
  33893. lodash.assign = assign;
  33894. lodash.assignIn = assignIn;
  33895. lodash.assignInWith = assignInWith;
  33896. lodash.assignWith = assignWith;
  33897. lodash.at = at;
  33898. lodash.before = before;
  33899. lodash.bind = bind;
  33900. lodash.bindAll = bindAll;
  33901. lodash.bindKey = bindKey;
  33902. lodash.castArray = castArray;
  33903. lodash.chain = chain;
  33904. lodash.chunk = chunk;
  33905. lodash.compact = compact;
  33906. lodash.concat = concat;
  33907. lodash.cond = cond;
  33908. lodash.conforms = conforms;
  33909. lodash.constant = constant;
  33910. lodash.countBy = countBy;
  33911. lodash.create = create;
  33912. lodash.curry = curry;
  33913. lodash.curryRight = curryRight;
  33914. lodash.debounce = debounce;
  33915. lodash.defaults = defaults;
  33916. lodash.defaultsDeep = defaultsDeep;
  33917. lodash.defer = defer;
  33918. lodash.delay = delay;
  33919. lodash.difference = difference;
  33920. lodash.differenceBy = differenceBy;
  33921. lodash.differenceWith = differenceWith;
  33922. lodash.drop = drop;
  33923. lodash.dropRight = dropRight;
  33924. lodash.dropRightWhile = dropRightWhile;
  33925. lodash.dropWhile = dropWhile;
  33926. lodash.fill = fill;
  33927. lodash.filter = filter;
  33928. lodash.flatMap = flatMap;
  33929. lodash.flatMapDeep = flatMapDeep;
  33930. lodash.flatMapDepth = flatMapDepth;
  33931. lodash.flatten = flatten;
  33932. lodash.flattenDeep = flattenDeep;
  33933. lodash.flattenDepth = flattenDepth;
  33934. lodash.flip = flip;
  33935. lodash.flow = flow;
  33936. lodash.flowRight = flowRight;
  33937. lodash.fromPairs = fromPairs;
  33938. lodash.functions = functions;
  33939. lodash.functionsIn = functionsIn;
  33940. lodash.groupBy = groupBy;
  33941. lodash.initial = initial;
  33942. lodash.intersection = intersection;
  33943. lodash.intersectionBy = intersectionBy;
  33944. lodash.intersectionWith = intersectionWith;
  33945. lodash.invert = invert;
  33946. lodash.invertBy = invertBy;
  33947. lodash.invokeMap = invokeMap;
  33948. lodash.iteratee = iteratee;
  33949. lodash.keyBy = keyBy;
  33950. lodash.keys = keys;
  33951. lodash.keysIn = keysIn;
  33952. lodash.map = map;
  33953. lodash.mapKeys = mapKeys;
  33954. lodash.mapValues = mapValues;
  33955. lodash.matches = matches;
  33956. lodash.matchesProperty = matchesProperty;
  33957. lodash.memoize = memoize;
  33958. lodash.merge = merge;
  33959. lodash.mergeWith = mergeWith;
  33960. lodash.method = method;
  33961. lodash.methodOf = methodOf;
  33962. lodash.mixin = mixin;
  33963. lodash.negate = negate;
  33964. lodash.nthArg = nthArg;
  33965. lodash.omit = omit;
  33966. lodash.omitBy = omitBy;
  33967. lodash.once = once;
  33968. lodash.orderBy = orderBy;
  33969. lodash.over = over;
  33970. lodash.overArgs = overArgs;
  33971. lodash.overEvery = overEvery;
  33972. lodash.overSome = overSome;
  33973. lodash.partial = partial;
  33974. lodash.partialRight = partialRight;
  33975. lodash.partition = partition;
  33976. lodash.pick = pick;
  33977. lodash.pickBy = pickBy;
  33978. lodash.property = property;
  33979. lodash.propertyOf = propertyOf;
  33980. lodash.pull = pull;
  33981. lodash.pullAll = pullAll;
  33982. lodash.pullAllBy = pullAllBy;
  33983. lodash.pullAllWith = pullAllWith;
  33984. lodash.pullAt = pullAt;
  33985. lodash.range = range;
  33986. lodash.rangeRight = rangeRight;
  33987. lodash.rearg = rearg;
  33988. lodash.reject = reject;
  33989. lodash.remove = remove;
  33990. lodash.rest = rest;
  33991. lodash.reverse = reverse;
  33992. lodash.sampleSize = sampleSize;
  33993. lodash.set = set;
  33994. lodash.setWith = setWith;
  33995. lodash.shuffle = shuffle;
  33996. lodash.slice = slice;
  33997. lodash.sortBy = sortBy;
  33998. lodash.sortedUniq = sortedUniq;
  33999. lodash.sortedUniqBy = sortedUniqBy;
  34000. lodash.split = split;
  34001. lodash.spread = spread;
  34002. lodash.tail = tail;
  34003. lodash.take = take;
  34004. lodash.takeRight = takeRight;
  34005. lodash.takeRightWhile = takeRightWhile;
  34006. lodash.takeWhile = takeWhile;
  34007. lodash.tap = tap;
  34008. lodash.throttle = throttle;
  34009. lodash.thru = thru;
  34010. lodash.toArray = toArray;
  34011. lodash.toPairs = toPairs;
  34012. lodash.toPairsIn = toPairsIn;
  34013. lodash.toPath = toPath;
  34014. lodash.toPlainObject = toPlainObject;
  34015. lodash.transform = transform;
  34016. lodash.unary = unary;
  34017. lodash.union = union;
  34018. lodash.unionBy = unionBy;
  34019. lodash.unionWith = unionWith;
  34020. lodash.uniq = uniq;
  34021. lodash.uniqBy = uniqBy;
  34022. lodash.uniqWith = uniqWith;
  34023. lodash.unset = unset;
  34024. lodash.unzip = unzip;
  34025. lodash.unzipWith = unzipWith;
  34026. lodash.update = update;
  34027. lodash.updateWith = updateWith;
  34028. lodash.values = values;
  34029. lodash.valuesIn = valuesIn;
  34030. lodash.without = without;
  34031. lodash.words = words;
  34032. lodash.wrap = wrap;
  34033. lodash.xor = xor;
  34034. lodash.xorBy = xorBy;
  34035. lodash.xorWith = xorWith;
  34036. lodash.zip = zip;
  34037. lodash.zipObject = zipObject;
  34038. lodash.zipObjectDeep = zipObjectDeep;
  34039. lodash.zipWith = zipWith;
  34040. // Add aliases.
  34041. lodash.entries = toPairs;
  34042. lodash.entriesIn = toPairsIn;
  34043. lodash.extend = assignIn;
  34044. lodash.extendWith = assignInWith;
  34045. // Add methods to `lodash.prototype`.
  34046. mixin(lodash, lodash);
  34047. /*------------------------------------------------------------------------*/
  34048. // Add methods that return unwrapped values in chain sequences.
  34049. lodash.add = add;
  34050. lodash.attempt = attempt;
  34051. lodash.camelCase = camelCase;
  34052. lodash.capitalize = capitalize;
  34053. lodash.ceil = ceil;
  34054. lodash.clamp = clamp;
  34055. lodash.clone = clone;
  34056. lodash.cloneDeep = cloneDeep;
  34057. lodash.cloneDeepWith = cloneDeepWith;
  34058. lodash.cloneWith = cloneWith;
  34059. lodash.conformsTo = conformsTo;
  34060. lodash.deburr = deburr;
  34061. lodash.defaultTo = defaultTo;
  34062. lodash.divide = divide;
  34063. lodash.endsWith = endsWith;
  34064. lodash.eq = eq;
  34065. lodash.escape = escape;
  34066. lodash.escapeRegExp = escapeRegExp;
  34067. lodash.every = every;
  34068. lodash.find = find;
  34069. lodash.findIndex = findIndex;
  34070. lodash.findKey = findKey;
  34071. lodash.findLast = findLast;
  34072. lodash.findLastIndex = findLastIndex;
  34073. lodash.findLastKey = findLastKey;
  34074. lodash.floor = floor;
  34075. lodash.forEach = forEach;
  34076. lodash.forEachRight = forEachRight;
  34077. lodash.forIn = forIn;
  34078. lodash.forInRight = forInRight;
  34079. lodash.forOwn = forOwn;
  34080. lodash.forOwnRight = forOwnRight;
  34081. lodash.get = get;
  34082. lodash.gt = gt;
  34083. lodash.gte = gte;
  34084. lodash.has = has;
  34085. lodash.hasIn = hasIn;
  34086. lodash.head = head;
  34087. lodash.identity = identity;
  34088. lodash.includes = includes;
  34089. lodash.indexOf = indexOf;
  34090. lodash.inRange = inRange;
  34091. lodash.invoke = invoke;
  34092. lodash.isArguments = isArguments;
  34093. lodash.isArray = isArray;
  34094. lodash.isArrayBuffer = isArrayBuffer;
  34095. lodash.isArrayLike = isArrayLike;
  34096. lodash.isArrayLikeObject = isArrayLikeObject;
  34097. lodash.isBoolean = isBoolean;
  34098. lodash.isBuffer = isBuffer;
  34099. lodash.isDate = isDate;
  34100. lodash.isElement = isElement;
  34101. lodash.isEmpty = isEmpty;
  34102. lodash.isEqual = isEqual;
  34103. lodash.isEqualWith = isEqualWith;
  34104. lodash.isError = isError;
  34105. lodash.isFinite = isFinite;
  34106. lodash.isFunction = isFunction;
  34107. lodash.isInteger = isInteger;
  34108. lodash.isLength = isLength;
  34109. lodash.isMap = isMap;
  34110. lodash.isMatch = isMatch;
  34111. lodash.isMatchWith = isMatchWith;
  34112. lodash.isNaN = isNaN;
  34113. lodash.isNative = isNative;
  34114. lodash.isNil = isNil;
  34115. lodash.isNull = isNull;
  34116. lodash.isNumber = isNumber;
  34117. lodash.isObject = isObject;
  34118. lodash.isObjectLike = isObjectLike;
  34119. lodash.isPlainObject = isPlainObject;
  34120. lodash.isRegExp = isRegExp;
  34121. lodash.isSafeInteger = isSafeInteger;
  34122. lodash.isSet = isSet;
  34123. lodash.isString = isString;
  34124. lodash.isSymbol = isSymbol;
  34125. lodash.isTypedArray = isTypedArray;
  34126. lodash.isUndefined = isUndefined;
  34127. lodash.isWeakMap = isWeakMap;
  34128. lodash.isWeakSet = isWeakSet;
  34129. lodash.join = join;
  34130. lodash.kebabCase = kebabCase;
  34131. lodash.last = last;
  34132. lodash.lastIndexOf = lastIndexOf;
  34133. lodash.lowerCase = lowerCase;
  34134. lodash.lowerFirst = lowerFirst;
  34135. lodash.lt = lt;
  34136. lodash.lte = lte;
  34137. lodash.max = max;
  34138. lodash.maxBy = maxBy;
  34139. lodash.mean = mean;
  34140. lodash.meanBy = meanBy;
  34141. lodash.min = min;
  34142. lodash.minBy = minBy;
  34143. lodash.stubArray = stubArray;
  34144. lodash.stubFalse = stubFalse;
  34145. lodash.stubObject = stubObject;
  34146. lodash.stubString = stubString;
  34147. lodash.stubTrue = stubTrue;
  34148. lodash.multiply = multiply;
  34149. lodash.nth = nth;
  34150. lodash.noConflict = noConflict;
  34151. lodash.noop = noop;
  34152. lodash.now = now;
  34153. lodash.pad = pad;
  34154. lodash.padEnd = padEnd;
  34155. lodash.padStart = padStart;
  34156. lodash.parseInt = parseInt;
  34157. lodash.random = random;
  34158. lodash.reduce = reduce;
  34159. lodash.reduceRight = reduceRight;
  34160. lodash.repeat = repeat;
  34161. lodash.replace = replace;
  34162. lodash.result = result;
  34163. lodash.round = round;
  34164. lodash.runInContext = runInContext;
  34165. lodash.sample = sample;
  34166. lodash.size = size;
  34167. lodash.snakeCase = snakeCase;
  34168. lodash.some = some;
  34169. lodash.sortedIndex = sortedIndex;
  34170. lodash.sortedIndexBy = sortedIndexBy;
  34171. lodash.sortedIndexOf = sortedIndexOf;
  34172. lodash.sortedLastIndex = sortedLastIndex;
  34173. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34174. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34175. lodash.startCase = startCase;
  34176. lodash.startsWith = startsWith;
  34177. lodash.subtract = subtract;
  34178. lodash.sum = sum;
  34179. lodash.sumBy = sumBy;
  34180. lodash.template = template;
  34181. lodash.times = times;
  34182. lodash.toFinite = toFinite;
  34183. lodash.toInteger = toInteger;
  34184. lodash.toLength = toLength;
  34185. lodash.toLower = toLower;
  34186. lodash.toNumber = toNumber;
  34187. lodash.toSafeInteger = toSafeInteger;
  34188. lodash.toString = toString;
  34189. lodash.toUpper = toUpper;
  34190. lodash.trim = trim;
  34191. lodash.trimEnd = trimEnd;
  34192. lodash.trimStart = trimStart;
  34193. lodash.truncate = truncate;
  34194. lodash.unescape = unescape;
  34195. lodash.uniqueId = uniqueId;
  34196. lodash.upperCase = upperCase;
  34197. lodash.upperFirst = upperFirst;
  34198. // Add aliases.
  34199. lodash.each = forEach;
  34200. lodash.eachRight = forEachRight;
  34201. lodash.first = head;
  34202. mixin(lodash, (function() {
  34203. var source = {};
  34204. baseForOwn(lodash, function(func, methodName) {
  34205. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34206. source[methodName] = func;
  34207. }
  34208. });
  34209. return source;
  34210. }()), { 'chain': false });
  34211. /*------------------------------------------------------------------------*/
  34212. /**
  34213. * The semantic version number.
  34214. *
  34215. * @static
  34216. * @memberOf _
  34217. * @type {string}
  34218. */
  34219. lodash.VERSION = VERSION;
  34220. // Assign default placeholders.
  34221. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34222. lodash[methodName].placeholder = lodash;
  34223. });
  34224. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34225. arrayEach(['drop', 'take'], function(methodName, index) {
  34226. LazyWrapper.prototype[methodName] = function(n) {
  34227. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34228. var result = (this.__filtered__ && !index)
  34229. ? new LazyWrapper(this)
  34230. : this.clone();
  34231. if (result.__filtered__) {
  34232. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34233. } else {
  34234. result.__views__.push({
  34235. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34236. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34237. });
  34238. }
  34239. return result;
  34240. };
  34241. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34242. return this.reverse()[methodName](n).reverse();
  34243. };
  34244. });
  34245. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34246. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34247. var type = index + 1,
  34248. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34249. LazyWrapper.prototype[methodName] = function(iteratee) {
  34250. var result = this.clone();
  34251. result.__iteratees__.push({
  34252. 'iteratee': getIteratee(iteratee, 3),
  34253. 'type': type
  34254. });
  34255. result.__filtered__ = result.__filtered__ || isFilter;
  34256. return result;
  34257. };
  34258. });
  34259. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34260. arrayEach(['head', 'last'], function(methodName, index) {
  34261. var takeName = 'take' + (index ? 'Right' : '');
  34262. LazyWrapper.prototype[methodName] = function() {
  34263. return this[takeName](1).value()[0];
  34264. };
  34265. });
  34266. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34267. arrayEach(['initial', 'tail'], function(methodName, index) {
  34268. var dropName = 'drop' + (index ? '' : 'Right');
  34269. LazyWrapper.prototype[methodName] = function() {
  34270. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34271. };
  34272. });
  34273. LazyWrapper.prototype.compact = function() {
  34274. return this.filter(identity);
  34275. };
  34276. LazyWrapper.prototype.find = function(predicate) {
  34277. return this.filter(predicate).head();
  34278. };
  34279. LazyWrapper.prototype.findLast = function(predicate) {
  34280. return this.reverse().find(predicate);
  34281. };
  34282. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34283. if (typeof path == 'function') {
  34284. return new LazyWrapper(this);
  34285. }
  34286. return this.map(function(value) {
  34287. return baseInvoke(value, path, args);
  34288. });
  34289. });
  34290. LazyWrapper.prototype.reject = function(predicate) {
  34291. return this.filter(negate(getIteratee(predicate)));
  34292. };
  34293. LazyWrapper.prototype.slice = function(start, end) {
  34294. start = toInteger(start);
  34295. var result = this;
  34296. if (result.__filtered__ && (start > 0 || end < 0)) {
  34297. return new LazyWrapper(result);
  34298. }
  34299. if (start < 0) {
  34300. result = result.takeRight(-start);
  34301. } else if (start) {
  34302. result = result.drop(start);
  34303. }
  34304. if (end !== undefined) {
  34305. end = toInteger(end);
  34306. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34307. }
  34308. return result;
  34309. };
  34310. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34311. return this.reverse().takeWhile(predicate).reverse();
  34312. };
  34313. LazyWrapper.prototype.toArray = function() {
  34314. return this.take(MAX_ARRAY_LENGTH);
  34315. };
  34316. // Add `LazyWrapper` methods to `lodash.prototype`.
  34317. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34318. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34319. isTaker = /^(?:head|last)$/.test(methodName),
  34320. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34321. retUnwrapped = isTaker || /^find/.test(methodName);
  34322. if (!lodashFunc) {
  34323. return;
  34324. }
  34325. lodash.prototype[methodName] = function() {
  34326. var value = this.__wrapped__,
  34327. args = isTaker ? [1] : arguments,
  34328. isLazy = value instanceof LazyWrapper,
  34329. iteratee = args[0],
  34330. useLazy = isLazy || isArray(value);
  34331. var interceptor = function(value) {
  34332. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34333. return (isTaker && chainAll) ? result[0] : result;
  34334. };
  34335. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34336. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34337. isLazy = useLazy = false;
  34338. }
  34339. var chainAll = this.__chain__,
  34340. isHybrid = !!this.__actions__.length,
  34341. isUnwrapped = retUnwrapped && !chainAll,
  34342. onlyLazy = isLazy && !isHybrid;
  34343. if (!retUnwrapped && useLazy) {
  34344. value = onlyLazy ? value : new LazyWrapper(this);
  34345. var result = func.apply(value, args);
  34346. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34347. return new LodashWrapper(result, chainAll);
  34348. }
  34349. if (isUnwrapped && onlyLazy) {
  34350. return func.apply(this, args);
  34351. }
  34352. result = this.thru(interceptor);
  34353. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34354. };
  34355. });
  34356. // Add `Array` methods to `lodash.prototype`.
  34357. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34358. var func = arrayProto[methodName],
  34359. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34360. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34361. lodash.prototype[methodName] = function() {
  34362. var args = arguments;
  34363. if (retUnwrapped && !this.__chain__) {
  34364. var value = this.value();
  34365. return func.apply(isArray(value) ? value : [], args);
  34366. }
  34367. return this[chainName](function(value) {
  34368. return func.apply(isArray(value) ? value : [], args);
  34369. });
  34370. };
  34371. });
  34372. // Map minified method names to their real names.
  34373. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34374. var lodashFunc = lodash[methodName];
  34375. if (lodashFunc) {
  34376. var key = lodashFunc.name + '';
  34377. if (!hasOwnProperty.call(realNames, key)) {
  34378. realNames[key] = [];
  34379. }
  34380. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34381. }
  34382. });
  34383. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34384. 'name': 'wrapper',
  34385. 'func': undefined
  34386. }];
  34387. // Add methods to `LazyWrapper`.
  34388. LazyWrapper.prototype.clone = lazyClone;
  34389. LazyWrapper.prototype.reverse = lazyReverse;
  34390. LazyWrapper.prototype.value = lazyValue;
  34391. // Add chain sequence methods to the `lodash` wrapper.
  34392. lodash.prototype.at = wrapperAt;
  34393. lodash.prototype.chain = wrapperChain;
  34394. lodash.prototype.commit = wrapperCommit;
  34395. lodash.prototype.next = wrapperNext;
  34396. lodash.prototype.plant = wrapperPlant;
  34397. lodash.prototype.reverse = wrapperReverse;
  34398. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34399. // Add lazy aliases.
  34400. lodash.prototype.first = lodash.prototype.head;
  34401. if (symIterator) {
  34402. lodash.prototype[symIterator] = wrapperToIterator;
  34403. }
  34404. return lodash;
  34405. });
  34406. /*--------------------------------------------------------------------------*/
  34407. // Export lodash.
  34408. var _ = runInContext();
  34409. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34410. if (true) {
  34411. // Expose Lodash on the global object to prevent errors when Lodash is
  34412. // loaded by a script tag in the presence of an AMD loader.
  34413. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34414. // Use `_.noConflict` to remove Lodash from the global object.
  34415. root._ = _;
  34416. // Define as an anonymous module so, through path mapping, it can be
  34417. // referenced as the "underscore" module.
  34418. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34419. return _;
  34420. }).call(exports, __webpack_require__, exports, module),
  34421. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34422. }
  34423. // Check for `exports` after `define` in case a build optimizer adds it.
  34424. else {}
  34425. }.call(this));
  34426. /* 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)))
  34427. /***/ }),
  34428. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34429. /*!***************************************************!*\
  34430. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34431. \***************************************************/
  34432. /*! exports provided: default */
  34433. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34434. "use strict";
  34435. __webpack_require__.r(__webpack_exports__);
  34436. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34437. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34438. * @version 1.16.1
  34439. * @license
  34440. * Copyright (c) 2016 Federico Zivolo and contributors
  34441. *
  34442. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34443. * of this software and associated documentation files (the "Software"), to deal
  34444. * in the Software without restriction, including without limitation the rights
  34445. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34446. * copies of the Software, and to permit persons to whom the Software is
  34447. * furnished to do so, subject to the following conditions:
  34448. *
  34449. * The above copyright notice and this permission notice shall be included in all
  34450. * copies or substantial portions of the Software.
  34451. *
  34452. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34453. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34454. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34455. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34456. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34457. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34458. * SOFTWARE.
  34459. */
  34460. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34461. var timeoutDuration = function () {
  34462. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34463. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34464. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34465. return 1;
  34466. }
  34467. }
  34468. return 0;
  34469. }();
  34470. function microtaskDebounce(fn) {
  34471. var called = false;
  34472. return function () {
  34473. if (called) {
  34474. return;
  34475. }
  34476. called = true;
  34477. window.Promise.resolve().then(function () {
  34478. called = false;
  34479. fn();
  34480. });
  34481. };
  34482. }
  34483. function taskDebounce(fn) {
  34484. var scheduled = false;
  34485. return function () {
  34486. if (!scheduled) {
  34487. scheduled = true;
  34488. setTimeout(function () {
  34489. scheduled = false;
  34490. fn();
  34491. }, timeoutDuration);
  34492. }
  34493. };
  34494. }
  34495. var supportsMicroTasks = isBrowser && window.Promise;
  34496. /**
  34497. * Create a debounced version of a method, that's asynchronously deferred
  34498. * but called in the minimum time possible.
  34499. *
  34500. * @method
  34501. * @memberof Popper.Utils
  34502. * @argument {Function} fn
  34503. * @returns {Function}
  34504. */
  34505. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34506. /**
  34507. * Check if the given variable is a function
  34508. * @method
  34509. * @memberof Popper.Utils
  34510. * @argument {Any} functionToCheck - variable to check
  34511. * @returns {Boolean} answer to: is a function?
  34512. */
  34513. function isFunction(functionToCheck) {
  34514. var getType = {};
  34515. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34516. }
  34517. /**
  34518. * Get CSS computed property of the given element
  34519. * @method
  34520. * @memberof Popper.Utils
  34521. * @argument {Eement} element
  34522. * @argument {String} property
  34523. */
  34524. function getStyleComputedProperty(element, property) {
  34525. if (element.nodeType !== 1) {
  34526. return [];
  34527. }
  34528. // NOTE: 1 DOM access here
  34529. var window = element.ownerDocument.defaultView;
  34530. var css = window.getComputedStyle(element, null);
  34531. return property ? css[property] : css;
  34532. }
  34533. /**
  34534. * Returns the parentNode or the host of the element
  34535. * @method
  34536. * @memberof Popper.Utils
  34537. * @argument {Element} element
  34538. * @returns {Element} parent
  34539. */
  34540. function getParentNode(element) {
  34541. if (element.nodeName === 'HTML') {
  34542. return element;
  34543. }
  34544. return element.parentNode || element.host;
  34545. }
  34546. /**
  34547. * Returns the scrolling parent of the given element
  34548. * @method
  34549. * @memberof Popper.Utils
  34550. * @argument {Element} element
  34551. * @returns {Element} scroll parent
  34552. */
  34553. function getScrollParent(element) {
  34554. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34555. if (!element) {
  34556. return document.body;
  34557. }
  34558. switch (element.nodeName) {
  34559. case 'HTML':
  34560. case 'BODY':
  34561. return element.ownerDocument.body;
  34562. case '#document':
  34563. return element.body;
  34564. }
  34565. // Firefox want us to check `-x` and `-y` variations as well
  34566. var _getStyleComputedProp = getStyleComputedProperty(element),
  34567. overflow = _getStyleComputedProp.overflow,
  34568. overflowX = _getStyleComputedProp.overflowX,
  34569. overflowY = _getStyleComputedProp.overflowY;
  34570. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34571. return element;
  34572. }
  34573. return getScrollParent(getParentNode(element));
  34574. }
  34575. /**
  34576. * Returns the reference node of the reference object, or the reference object itself.
  34577. * @method
  34578. * @memberof Popper.Utils
  34579. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34580. * @returns {Element} parent
  34581. */
  34582. function getReferenceNode(reference) {
  34583. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34584. }
  34585. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34586. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34587. /**
  34588. * Determines if the browser is Internet Explorer
  34589. * @method
  34590. * @memberof Popper.Utils
  34591. * @param {Number} version to check
  34592. * @returns {Boolean} isIE
  34593. */
  34594. function isIE(version) {
  34595. if (version === 11) {
  34596. return isIE11;
  34597. }
  34598. if (version === 10) {
  34599. return isIE10;
  34600. }
  34601. return isIE11 || isIE10;
  34602. }
  34603. /**
  34604. * Returns the offset parent of the given element
  34605. * @method
  34606. * @memberof Popper.Utils
  34607. * @argument {Element} element
  34608. * @returns {Element} offset parent
  34609. */
  34610. function getOffsetParent(element) {
  34611. if (!element) {
  34612. return document.documentElement;
  34613. }
  34614. var noOffsetParent = isIE(10) ? document.body : null;
  34615. // NOTE: 1 DOM access here
  34616. var offsetParent = element.offsetParent || null;
  34617. // Skip hidden elements which don't have an offsetParent
  34618. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34619. offsetParent = (element = element.nextElementSibling).offsetParent;
  34620. }
  34621. var nodeName = offsetParent && offsetParent.nodeName;
  34622. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34623. return element ? element.ownerDocument.documentElement : document.documentElement;
  34624. }
  34625. // .offsetParent will return the closest TH, TD or TABLE in case
  34626. // no offsetParent is present, I hate this job...
  34627. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34628. return getOffsetParent(offsetParent);
  34629. }
  34630. return offsetParent;
  34631. }
  34632. function isOffsetContainer(element) {
  34633. var nodeName = element.nodeName;
  34634. if (nodeName === 'BODY') {
  34635. return false;
  34636. }
  34637. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34638. }
  34639. /**
  34640. * Finds the root node (document, shadowDOM root) of the given element
  34641. * @method
  34642. * @memberof Popper.Utils
  34643. * @argument {Element} node
  34644. * @returns {Element} root node
  34645. */
  34646. function getRoot(node) {
  34647. if (node.parentNode !== null) {
  34648. return getRoot(node.parentNode);
  34649. }
  34650. return node;
  34651. }
  34652. /**
  34653. * Finds the offset parent common to the two provided nodes
  34654. * @method
  34655. * @memberof Popper.Utils
  34656. * @argument {Element} element1
  34657. * @argument {Element} element2
  34658. * @returns {Element} common offset parent
  34659. */
  34660. function findCommonOffsetParent(element1, element2) {
  34661. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34662. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34663. return document.documentElement;
  34664. }
  34665. // Here we make sure to give as "start" the element that comes first in the DOM
  34666. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34667. var start = order ? element1 : element2;
  34668. var end = order ? element2 : element1;
  34669. // Get common ancestor container
  34670. var range = document.createRange();
  34671. range.setStart(start, 0);
  34672. range.setEnd(end, 0);
  34673. var commonAncestorContainer = range.commonAncestorContainer;
  34674. // Both nodes are inside #document
  34675. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34676. if (isOffsetContainer(commonAncestorContainer)) {
  34677. return commonAncestorContainer;
  34678. }
  34679. return getOffsetParent(commonAncestorContainer);
  34680. }
  34681. // one of the nodes is inside shadowDOM, find which one
  34682. var element1root = getRoot(element1);
  34683. if (element1root.host) {
  34684. return findCommonOffsetParent(element1root.host, element2);
  34685. } else {
  34686. return findCommonOffsetParent(element1, getRoot(element2).host);
  34687. }
  34688. }
  34689. /**
  34690. * Gets the scroll value of the given element in the given side (top and left)
  34691. * @method
  34692. * @memberof Popper.Utils
  34693. * @argument {Element} element
  34694. * @argument {String} side `top` or `left`
  34695. * @returns {number} amount of scrolled pixels
  34696. */
  34697. function getScroll(element) {
  34698. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34699. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34700. var nodeName = element.nodeName;
  34701. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34702. var html = element.ownerDocument.documentElement;
  34703. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34704. return scrollingElement[upperSide];
  34705. }
  34706. return element[upperSide];
  34707. }
  34708. /*
  34709. * Sum or subtract the element scroll values (left and top) from a given rect object
  34710. * @method
  34711. * @memberof Popper.Utils
  34712. * @param {Object} rect - Rect object you want to change
  34713. * @param {HTMLElement} element - The element from the function reads the scroll values
  34714. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34715. * @return {Object} rect - The modifier rect object
  34716. */
  34717. function includeScroll(rect, element) {
  34718. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34719. var scrollTop = getScroll(element, 'top');
  34720. var scrollLeft = getScroll(element, 'left');
  34721. var modifier = subtract ? -1 : 1;
  34722. rect.top += scrollTop * modifier;
  34723. rect.bottom += scrollTop * modifier;
  34724. rect.left += scrollLeft * modifier;
  34725. rect.right += scrollLeft * modifier;
  34726. return rect;
  34727. }
  34728. /*
  34729. * Helper to detect borders of a given element
  34730. * @method
  34731. * @memberof Popper.Utils
  34732. * @param {CSSStyleDeclaration} styles
  34733. * Result of `getStyleComputedProperty` on the given element
  34734. * @param {String} axis - `x` or `y`
  34735. * @return {number} borders - The borders size of the given axis
  34736. */
  34737. function getBordersSize(styles, axis) {
  34738. var sideA = axis === 'x' ? 'Left' : 'Top';
  34739. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34740. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34741. }
  34742. function getSize(axis, body, html, computedStyle) {
  34743. 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);
  34744. }
  34745. function getWindowSizes(document) {
  34746. var body = document.body;
  34747. var html = document.documentElement;
  34748. var computedStyle = isIE(10) && getComputedStyle(html);
  34749. return {
  34750. height: getSize('Height', body, html, computedStyle),
  34751. width: getSize('Width', body, html, computedStyle)
  34752. };
  34753. }
  34754. var classCallCheck = function (instance, Constructor) {
  34755. if (!(instance instanceof Constructor)) {
  34756. throw new TypeError("Cannot call a class as a function");
  34757. }
  34758. };
  34759. var createClass = function () {
  34760. function defineProperties(target, props) {
  34761. for (var i = 0; i < props.length; i++) {
  34762. var descriptor = props[i];
  34763. descriptor.enumerable = descriptor.enumerable || false;
  34764. descriptor.configurable = true;
  34765. if ("value" in descriptor) descriptor.writable = true;
  34766. Object.defineProperty(target, descriptor.key, descriptor);
  34767. }
  34768. }
  34769. return function (Constructor, protoProps, staticProps) {
  34770. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34771. if (staticProps) defineProperties(Constructor, staticProps);
  34772. return Constructor;
  34773. };
  34774. }();
  34775. var defineProperty = function (obj, key, value) {
  34776. if (key in obj) {
  34777. Object.defineProperty(obj, key, {
  34778. value: value,
  34779. enumerable: true,
  34780. configurable: true,
  34781. writable: true
  34782. });
  34783. } else {
  34784. obj[key] = value;
  34785. }
  34786. return obj;
  34787. };
  34788. var _extends = Object.assign || function (target) {
  34789. for (var i = 1; i < arguments.length; i++) {
  34790. var source = arguments[i];
  34791. for (var key in source) {
  34792. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34793. target[key] = source[key];
  34794. }
  34795. }
  34796. }
  34797. return target;
  34798. };
  34799. /**
  34800. * Given element offsets, generate an output similar to getBoundingClientRect
  34801. * @method
  34802. * @memberof Popper.Utils
  34803. * @argument {Object} offsets
  34804. * @returns {Object} ClientRect like output
  34805. */
  34806. function getClientRect(offsets) {
  34807. return _extends({}, offsets, {
  34808. right: offsets.left + offsets.width,
  34809. bottom: offsets.top + offsets.height
  34810. });
  34811. }
  34812. /**
  34813. * Get bounding client rect of given element
  34814. * @method
  34815. * @memberof Popper.Utils
  34816. * @param {HTMLElement} element
  34817. * @return {Object} client rect
  34818. */
  34819. function getBoundingClientRect(element) {
  34820. var rect = {};
  34821. // IE10 10 FIX: Please, don't ask, the element isn't
  34822. // considered in DOM in some circumstances...
  34823. // This isn't reproducible in IE10 compatibility mode of IE11
  34824. try {
  34825. if (isIE(10)) {
  34826. rect = element.getBoundingClientRect();
  34827. var scrollTop = getScroll(element, 'top');
  34828. var scrollLeft = getScroll(element, 'left');
  34829. rect.top += scrollTop;
  34830. rect.left += scrollLeft;
  34831. rect.bottom += scrollTop;
  34832. rect.right += scrollLeft;
  34833. } else {
  34834. rect = element.getBoundingClientRect();
  34835. }
  34836. } catch (e) {}
  34837. var result = {
  34838. left: rect.left,
  34839. top: rect.top,
  34840. width: rect.right - rect.left,
  34841. height: rect.bottom - rect.top
  34842. };
  34843. // subtract scrollbar size from sizes
  34844. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34845. var width = sizes.width || element.clientWidth || result.width;
  34846. var height = sizes.height || element.clientHeight || result.height;
  34847. var horizScrollbar = element.offsetWidth - width;
  34848. var vertScrollbar = element.offsetHeight - height;
  34849. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34850. // we make this check conditional for performance reasons
  34851. if (horizScrollbar || vertScrollbar) {
  34852. var styles = getStyleComputedProperty(element);
  34853. horizScrollbar -= getBordersSize(styles, 'x');
  34854. vertScrollbar -= getBordersSize(styles, 'y');
  34855. result.width -= horizScrollbar;
  34856. result.height -= vertScrollbar;
  34857. }
  34858. return getClientRect(result);
  34859. }
  34860. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34861. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34862. var isIE10 = isIE(10);
  34863. var isHTML = parent.nodeName === 'HTML';
  34864. var childrenRect = getBoundingClientRect(children);
  34865. var parentRect = getBoundingClientRect(parent);
  34866. var scrollParent = getScrollParent(children);
  34867. var styles = getStyleComputedProperty(parent);
  34868. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34869. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34870. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34871. if (fixedPosition && isHTML) {
  34872. parentRect.top = Math.max(parentRect.top, 0);
  34873. parentRect.left = Math.max(parentRect.left, 0);
  34874. }
  34875. var offsets = getClientRect({
  34876. top: childrenRect.top - parentRect.top - borderTopWidth,
  34877. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34878. width: childrenRect.width,
  34879. height: childrenRect.height
  34880. });
  34881. offsets.marginTop = 0;
  34882. offsets.marginLeft = 0;
  34883. // Subtract margins of documentElement in case it's being used as parent
  34884. // we do this only on HTML because it's the only element that behaves
  34885. // differently when margins are applied to it. The margins are included in
  34886. // the box of the documentElement, in the other cases not.
  34887. if (!isIE10 && isHTML) {
  34888. var marginTop = parseFloat(styles.marginTop);
  34889. var marginLeft = parseFloat(styles.marginLeft);
  34890. offsets.top -= borderTopWidth - marginTop;
  34891. offsets.bottom -= borderTopWidth - marginTop;
  34892. offsets.left -= borderLeftWidth - marginLeft;
  34893. offsets.right -= borderLeftWidth - marginLeft;
  34894. // Attach marginTop and marginLeft because in some circumstances we may need them
  34895. offsets.marginTop = marginTop;
  34896. offsets.marginLeft = marginLeft;
  34897. }
  34898. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34899. offsets = includeScroll(offsets, parent);
  34900. }
  34901. return offsets;
  34902. }
  34903. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34904. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34905. var html = element.ownerDocument.documentElement;
  34906. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34907. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34908. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34909. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34910. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34911. var offset = {
  34912. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34913. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34914. width: width,
  34915. height: height
  34916. };
  34917. return getClientRect(offset);
  34918. }
  34919. /**
  34920. * Check if the given element is fixed or is inside a fixed parent
  34921. * @method
  34922. * @memberof Popper.Utils
  34923. * @argument {Element} element
  34924. * @argument {Element} customContainer
  34925. * @returns {Boolean} answer to "isFixed?"
  34926. */
  34927. function isFixed(element) {
  34928. var nodeName = element.nodeName;
  34929. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34930. return false;
  34931. }
  34932. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34933. return true;
  34934. }
  34935. var parentNode = getParentNode(element);
  34936. if (!parentNode) {
  34937. return false;
  34938. }
  34939. return isFixed(parentNode);
  34940. }
  34941. /**
  34942. * Finds the first parent of an element that has a transformed property defined
  34943. * @method
  34944. * @memberof Popper.Utils
  34945. * @argument {Element} element
  34946. * @returns {Element} first transformed parent or documentElement
  34947. */
  34948. function getFixedPositionOffsetParent(element) {
  34949. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34950. if (!element || !element.parentElement || isIE()) {
  34951. return document.documentElement;
  34952. }
  34953. var el = element.parentElement;
  34954. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34955. el = el.parentElement;
  34956. }
  34957. return el || document.documentElement;
  34958. }
  34959. /**
  34960. * Computed the boundaries limits and return them
  34961. * @method
  34962. * @memberof Popper.Utils
  34963. * @param {HTMLElement} popper
  34964. * @param {HTMLElement} reference
  34965. * @param {number} padding
  34966. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34967. * @param {Boolean} fixedPosition - Is in fixed position mode
  34968. * @returns {Object} Coordinates of the boundaries
  34969. */
  34970. function getBoundaries(popper, reference, padding, boundariesElement) {
  34971. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34972. // NOTE: 1 DOM access here
  34973. var boundaries = { top: 0, left: 0 };
  34974. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34975. // Handle viewport case
  34976. if (boundariesElement === 'viewport') {
  34977. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34978. } else {
  34979. // Handle other cases based on DOM element used as boundaries
  34980. var boundariesNode = void 0;
  34981. if (boundariesElement === 'scrollParent') {
  34982. boundariesNode = getScrollParent(getParentNode(reference));
  34983. if (boundariesNode.nodeName === 'BODY') {
  34984. boundariesNode = popper.ownerDocument.documentElement;
  34985. }
  34986. } else if (boundariesElement === 'window') {
  34987. boundariesNode = popper.ownerDocument.documentElement;
  34988. } else {
  34989. boundariesNode = boundariesElement;
  34990. }
  34991. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34992. // In case of HTML, we need a different computation
  34993. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34994. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34995. height = _getWindowSizes.height,
  34996. width = _getWindowSizes.width;
  34997. boundaries.top += offsets.top - offsets.marginTop;
  34998. boundaries.bottom = height + offsets.top;
  34999. boundaries.left += offsets.left - offsets.marginLeft;
  35000. boundaries.right = width + offsets.left;
  35001. } else {
  35002. // for all the other DOM elements, this one is good
  35003. boundaries = offsets;
  35004. }
  35005. }
  35006. // Add paddings
  35007. padding = padding || 0;
  35008. var isPaddingNumber = typeof padding === 'number';
  35009. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35010. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35011. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35012. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35013. return boundaries;
  35014. }
  35015. function getArea(_ref) {
  35016. var width = _ref.width,
  35017. height = _ref.height;
  35018. return width * height;
  35019. }
  35020. /**
  35021. * Utility used to transform the `auto` placement to the placement with more
  35022. * available space.
  35023. * @method
  35024. * @memberof Popper.Utils
  35025. * @argument {Object} data - The data object generated by update method
  35026. * @argument {Object} options - Modifiers configuration and options
  35027. * @returns {Object} The data object, properly modified
  35028. */
  35029. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35030. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35031. if (placement.indexOf('auto') === -1) {
  35032. return placement;
  35033. }
  35034. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35035. var rects = {
  35036. top: {
  35037. width: boundaries.width,
  35038. height: refRect.top - boundaries.top
  35039. },
  35040. right: {
  35041. width: boundaries.right - refRect.right,
  35042. height: boundaries.height
  35043. },
  35044. bottom: {
  35045. width: boundaries.width,
  35046. height: boundaries.bottom - refRect.bottom
  35047. },
  35048. left: {
  35049. width: refRect.left - boundaries.left,
  35050. height: boundaries.height
  35051. }
  35052. };
  35053. var sortedAreas = Object.keys(rects).map(function (key) {
  35054. return _extends({
  35055. key: key
  35056. }, rects[key], {
  35057. area: getArea(rects[key])
  35058. });
  35059. }).sort(function (a, b) {
  35060. return b.area - a.area;
  35061. });
  35062. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35063. var width = _ref2.width,
  35064. height = _ref2.height;
  35065. return width >= popper.clientWidth && height >= popper.clientHeight;
  35066. });
  35067. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35068. var variation = placement.split('-')[1];
  35069. return computedPlacement + (variation ? '-' + variation : '');
  35070. }
  35071. /**
  35072. * Get offsets to the reference element
  35073. * @method
  35074. * @memberof Popper.Utils
  35075. * @param {Object} state
  35076. * @param {Element} popper - the popper element
  35077. * @param {Element} reference - the reference element (the popper will be relative to this)
  35078. * @param {Element} fixedPosition - is in fixed position mode
  35079. * @returns {Object} An object containing the offsets which will be applied to the popper
  35080. */
  35081. function getReferenceOffsets(state, popper, reference) {
  35082. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35083. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35084. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35085. }
  35086. /**
  35087. * Get the outer sizes of the given element (offset size + margins)
  35088. * @method
  35089. * @memberof Popper.Utils
  35090. * @argument {Element} element
  35091. * @returns {Object} object containing width and height properties
  35092. */
  35093. function getOuterSizes(element) {
  35094. var window = element.ownerDocument.defaultView;
  35095. var styles = window.getComputedStyle(element);
  35096. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35097. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35098. var result = {
  35099. width: element.offsetWidth + y,
  35100. height: element.offsetHeight + x
  35101. };
  35102. return result;
  35103. }
  35104. /**
  35105. * Get the opposite placement of the given one
  35106. * @method
  35107. * @memberof Popper.Utils
  35108. * @argument {String} placement
  35109. * @returns {String} flipped placement
  35110. */
  35111. function getOppositePlacement(placement) {
  35112. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35113. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35114. return hash[matched];
  35115. });
  35116. }
  35117. /**
  35118. * Get offsets to the popper
  35119. * @method
  35120. * @memberof Popper.Utils
  35121. * @param {Object} position - CSS position the Popper will get applied
  35122. * @param {HTMLElement} popper - the popper element
  35123. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35124. * @param {String} placement - one of the valid placement options
  35125. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35126. */
  35127. function getPopperOffsets(popper, referenceOffsets, placement) {
  35128. placement = placement.split('-')[0];
  35129. // Get popper node sizes
  35130. var popperRect = getOuterSizes(popper);
  35131. // Add position, width and height to our offsets object
  35132. var popperOffsets = {
  35133. width: popperRect.width,
  35134. height: popperRect.height
  35135. };
  35136. // depending by the popper placement we have to compute its offsets slightly differently
  35137. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35138. var mainSide = isHoriz ? 'top' : 'left';
  35139. var secondarySide = isHoriz ? 'left' : 'top';
  35140. var measurement = isHoriz ? 'height' : 'width';
  35141. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35142. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35143. if (placement === secondarySide) {
  35144. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35145. } else {
  35146. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35147. }
  35148. return popperOffsets;
  35149. }
  35150. /**
  35151. * Mimics the `find` method of Array
  35152. * @method
  35153. * @memberof Popper.Utils
  35154. * @argument {Array} arr
  35155. * @argument prop
  35156. * @argument value
  35157. * @returns index or -1
  35158. */
  35159. function find(arr, check) {
  35160. // use native find if supported
  35161. if (Array.prototype.find) {
  35162. return arr.find(check);
  35163. }
  35164. // use `filter` to obtain the same behavior of `find`
  35165. return arr.filter(check)[0];
  35166. }
  35167. /**
  35168. * Return the index of the matching object
  35169. * @method
  35170. * @memberof Popper.Utils
  35171. * @argument {Array} arr
  35172. * @argument prop
  35173. * @argument value
  35174. * @returns index or -1
  35175. */
  35176. function findIndex(arr, prop, value) {
  35177. // use native findIndex if supported
  35178. if (Array.prototype.findIndex) {
  35179. return arr.findIndex(function (cur) {
  35180. return cur[prop] === value;
  35181. });
  35182. }
  35183. // use `find` + `indexOf` if `findIndex` isn't supported
  35184. var match = find(arr, function (obj) {
  35185. return obj[prop] === value;
  35186. });
  35187. return arr.indexOf(match);
  35188. }
  35189. /**
  35190. * Loop trough the list of modifiers and run them in order,
  35191. * each of them will then edit the data object.
  35192. * @method
  35193. * @memberof Popper.Utils
  35194. * @param {dataObject} data
  35195. * @param {Array} modifiers
  35196. * @param {String} ends - Optional modifier name used as stopper
  35197. * @returns {dataObject}
  35198. */
  35199. function runModifiers(modifiers, data, ends) {
  35200. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35201. modifiersToRun.forEach(function (modifier) {
  35202. if (modifier['function']) {
  35203. // eslint-disable-line dot-notation
  35204. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35205. }
  35206. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35207. if (modifier.enabled && isFunction(fn)) {
  35208. // Add properties to offsets to make them a complete clientRect object
  35209. // we do this before each modifier to make sure the previous one doesn't
  35210. // mess with these values
  35211. data.offsets.popper = getClientRect(data.offsets.popper);
  35212. data.offsets.reference = getClientRect(data.offsets.reference);
  35213. data = fn(data, modifier);
  35214. }
  35215. });
  35216. return data;
  35217. }
  35218. /**
  35219. * Updates the position of the popper, computing the new offsets and applying
  35220. * the new style.<br />
  35221. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35222. * @method
  35223. * @memberof Popper
  35224. */
  35225. function update() {
  35226. // if popper is destroyed, don't perform any further update
  35227. if (this.state.isDestroyed) {
  35228. return;
  35229. }
  35230. var data = {
  35231. instance: this,
  35232. styles: {},
  35233. arrowStyles: {},
  35234. attributes: {},
  35235. flipped: false,
  35236. offsets: {}
  35237. };
  35238. // compute reference element offsets
  35239. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35240. // compute auto placement, store placement inside the data object,
  35241. // modifiers will be able to edit `placement` if needed
  35242. // and refer to originalPlacement to know the original value
  35243. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35244. // store the computed placement inside `originalPlacement`
  35245. data.originalPlacement = data.placement;
  35246. data.positionFixed = this.options.positionFixed;
  35247. // compute the popper offsets
  35248. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35249. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35250. // run the modifiers
  35251. data = runModifiers(this.modifiers, data);
  35252. // the first `update` will call `onCreate` callback
  35253. // the other ones will call `onUpdate` callback
  35254. if (!this.state.isCreated) {
  35255. this.state.isCreated = true;
  35256. this.options.onCreate(data);
  35257. } else {
  35258. this.options.onUpdate(data);
  35259. }
  35260. }
  35261. /**
  35262. * Helper used to know if the given modifier is enabled.
  35263. * @method
  35264. * @memberof Popper.Utils
  35265. * @returns {Boolean}
  35266. */
  35267. function isModifierEnabled(modifiers, modifierName) {
  35268. return modifiers.some(function (_ref) {
  35269. var name = _ref.name,
  35270. enabled = _ref.enabled;
  35271. return enabled && name === modifierName;
  35272. });
  35273. }
  35274. /**
  35275. * Get the prefixed supported property name
  35276. * @method
  35277. * @memberof Popper.Utils
  35278. * @argument {String} property (camelCase)
  35279. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35280. */
  35281. function getSupportedPropertyName(property) {
  35282. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35283. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35284. for (var i = 0; i < prefixes.length; i++) {
  35285. var prefix = prefixes[i];
  35286. var toCheck = prefix ? '' + prefix + upperProp : property;
  35287. if (typeof document.body.style[toCheck] !== 'undefined') {
  35288. return toCheck;
  35289. }
  35290. }
  35291. return null;
  35292. }
  35293. /**
  35294. * Destroys the popper.
  35295. * @method
  35296. * @memberof Popper
  35297. */
  35298. function destroy() {
  35299. this.state.isDestroyed = true;
  35300. // touch DOM only if `applyStyle` modifier is enabled
  35301. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35302. this.popper.removeAttribute('x-placement');
  35303. this.popper.style.position = '';
  35304. this.popper.style.top = '';
  35305. this.popper.style.left = '';
  35306. this.popper.style.right = '';
  35307. this.popper.style.bottom = '';
  35308. this.popper.style.willChange = '';
  35309. this.popper.style[getSupportedPropertyName('transform')] = '';
  35310. }
  35311. this.disableEventListeners();
  35312. // remove the popper if user explicitly asked for the deletion on destroy
  35313. // do not use `remove` because IE11 doesn't support it
  35314. if (this.options.removeOnDestroy) {
  35315. this.popper.parentNode.removeChild(this.popper);
  35316. }
  35317. return this;
  35318. }
  35319. /**
  35320. * Get the window associated with the element
  35321. * @argument {Element} element
  35322. * @returns {Window}
  35323. */
  35324. function getWindow(element) {
  35325. var ownerDocument = element.ownerDocument;
  35326. return ownerDocument ? ownerDocument.defaultView : window;
  35327. }
  35328. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35329. var isBody = scrollParent.nodeName === 'BODY';
  35330. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35331. target.addEventListener(event, callback, { passive: true });
  35332. if (!isBody) {
  35333. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35334. }
  35335. scrollParents.push(target);
  35336. }
  35337. /**
  35338. * Setup needed event listeners used to update the popper position
  35339. * @method
  35340. * @memberof Popper.Utils
  35341. * @private
  35342. */
  35343. function setupEventListeners(reference, options, state, updateBound) {
  35344. // Resize event listener on window
  35345. state.updateBound = updateBound;
  35346. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35347. // Scroll event listener on scroll parents
  35348. var scrollElement = getScrollParent(reference);
  35349. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35350. state.scrollElement = scrollElement;
  35351. state.eventsEnabled = true;
  35352. return state;
  35353. }
  35354. /**
  35355. * It will add resize/scroll events and start recalculating
  35356. * position of the popper element when they are triggered.
  35357. * @method
  35358. * @memberof Popper
  35359. */
  35360. function enableEventListeners() {
  35361. if (!this.state.eventsEnabled) {
  35362. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35363. }
  35364. }
  35365. /**
  35366. * Remove event listeners used to update the popper position
  35367. * @method
  35368. * @memberof Popper.Utils
  35369. * @private
  35370. */
  35371. function removeEventListeners(reference, state) {
  35372. // Remove resize event listener on window
  35373. getWindow(reference).removeEventListener('resize', state.updateBound);
  35374. // Remove scroll event listener on scroll parents
  35375. state.scrollParents.forEach(function (target) {
  35376. target.removeEventListener('scroll', state.updateBound);
  35377. });
  35378. // Reset state
  35379. state.updateBound = null;
  35380. state.scrollParents = [];
  35381. state.scrollElement = null;
  35382. state.eventsEnabled = false;
  35383. return state;
  35384. }
  35385. /**
  35386. * It will remove resize/scroll events and won't recalculate popper position
  35387. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35388. * unless you call `update` method manually.
  35389. * @method
  35390. * @memberof Popper
  35391. */
  35392. function disableEventListeners() {
  35393. if (this.state.eventsEnabled) {
  35394. cancelAnimationFrame(this.scheduleUpdate);
  35395. this.state = removeEventListeners(this.reference, this.state);
  35396. }
  35397. }
  35398. /**
  35399. * Tells if a given input is a number
  35400. * @method
  35401. * @memberof Popper.Utils
  35402. * @param {*} input to check
  35403. * @return {Boolean}
  35404. */
  35405. function isNumeric(n) {
  35406. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35407. }
  35408. /**
  35409. * Set the style to the given popper
  35410. * @method
  35411. * @memberof Popper.Utils
  35412. * @argument {Element} element - Element to apply the style to
  35413. * @argument {Object} styles
  35414. * Object with a list of properties and values which will be applied to the element
  35415. */
  35416. function setStyles(element, styles) {
  35417. Object.keys(styles).forEach(function (prop) {
  35418. var unit = '';
  35419. // add unit if the value is numeric and is one of the following
  35420. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35421. unit = 'px';
  35422. }
  35423. element.style[prop] = styles[prop] + unit;
  35424. });
  35425. }
  35426. /**
  35427. * Set the attributes to the given popper
  35428. * @method
  35429. * @memberof Popper.Utils
  35430. * @argument {Element} element - Element to apply the attributes to
  35431. * @argument {Object} styles
  35432. * Object with a list of properties and values which will be applied to the element
  35433. */
  35434. function setAttributes(element, attributes) {
  35435. Object.keys(attributes).forEach(function (prop) {
  35436. var value = attributes[prop];
  35437. if (value !== false) {
  35438. element.setAttribute(prop, attributes[prop]);
  35439. } else {
  35440. element.removeAttribute(prop);
  35441. }
  35442. });
  35443. }
  35444. /**
  35445. * @function
  35446. * @memberof Modifiers
  35447. * @argument {Object} data - The data object generated by `update` method
  35448. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35449. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35450. * @argument {Object} options - Modifiers configuration and options
  35451. * @returns {Object} The same data object
  35452. */
  35453. function applyStyle(data) {
  35454. // any property present in `data.styles` will be applied to the popper,
  35455. // in this way we can make the 3rd party modifiers add custom styles to it
  35456. // Be aware, modifiers could override the properties defined in the previous
  35457. // lines of this modifier!
  35458. setStyles(data.instance.popper, data.styles);
  35459. // any property present in `data.attributes` will be applied to the popper,
  35460. // they will be set as HTML attributes of the element
  35461. setAttributes(data.instance.popper, data.attributes);
  35462. // if arrowElement is defined and arrowStyles has some properties
  35463. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35464. setStyles(data.arrowElement, data.arrowStyles);
  35465. }
  35466. return data;
  35467. }
  35468. /**
  35469. * Set the x-placement attribute before everything else because it could be used
  35470. * to add margins to the popper margins needs to be calculated to get the
  35471. * correct popper offsets.
  35472. * @method
  35473. * @memberof Popper.modifiers
  35474. * @param {HTMLElement} reference - The reference element used to position the popper
  35475. * @param {HTMLElement} popper - The HTML element used as popper
  35476. * @param {Object} options - Popper.js options
  35477. */
  35478. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35479. // compute reference element offsets
  35480. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35481. // compute auto placement, store placement inside the data object,
  35482. // modifiers will be able to edit `placement` if needed
  35483. // and refer to originalPlacement to know the original value
  35484. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35485. popper.setAttribute('x-placement', placement);
  35486. // Apply `position` to popper before anything else because
  35487. // without the position applied we can't guarantee correct computations
  35488. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35489. return options;
  35490. }
  35491. /**
  35492. * @function
  35493. * @memberof Popper.Utils
  35494. * @argument {Object} data - The data object generated by `update` method
  35495. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35496. * @returns {Object} The popper's position offsets rounded
  35497. *
  35498. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35499. * good as it can be within reason.
  35500. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35501. *
  35502. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35503. * as well on High DPI screens).
  35504. *
  35505. * Firefox prefers no rounding for positioning and does not have blurriness on
  35506. * high DPI screens.
  35507. *
  35508. * Only horizontal placement and left/right values need to be considered.
  35509. */
  35510. function getRoundedOffsets(data, shouldRound) {
  35511. var _data$offsets = data.offsets,
  35512. popper = _data$offsets.popper,
  35513. reference = _data$offsets.reference;
  35514. var round = Math.round,
  35515. floor = Math.floor;
  35516. var noRound = function noRound(v) {
  35517. return v;
  35518. };
  35519. var referenceWidth = round(reference.width);
  35520. var popperWidth = round(popper.width);
  35521. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35522. var isVariation = data.placement.indexOf('-') !== -1;
  35523. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35524. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35525. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35526. var verticalToInteger = !shouldRound ? noRound : round;
  35527. return {
  35528. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35529. top: verticalToInteger(popper.top),
  35530. bottom: verticalToInteger(popper.bottom),
  35531. right: horizontalToInteger(popper.right)
  35532. };
  35533. }
  35534. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35535. /**
  35536. * @function
  35537. * @memberof Modifiers
  35538. * @argument {Object} data - The data object generated by `update` method
  35539. * @argument {Object} options - Modifiers configuration and options
  35540. * @returns {Object} The data object, properly modified
  35541. */
  35542. function computeStyle(data, options) {
  35543. var x = options.x,
  35544. y = options.y;
  35545. var popper = data.offsets.popper;
  35546. // Remove this legacy support in Popper.js v2
  35547. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35548. return modifier.name === 'applyStyle';
  35549. }).gpuAcceleration;
  35550. if (legacyGpuAccelerationOption !== undefined) {
  35551. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35552. }
  35553. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35554. var offsetParent = getOffsetParent(data.instance.popper);
  35555. var offsetParentRect = getBoundingClientRect(offsetParent);
  35556. // Styles
  35557. var styles = {
  35558. position: popper.position
  35559. };
  35560. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35561. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35562. var sideB = y === 'right' ? 'left' : 'right';
  35563. // if gpuAcceleration is set to `true` and transform is supported,
  35564. // we use `translate3d` to apply the position to the popper we
  35565. // automatically use the supported prefixed version if needed
  35566. var prefixedProperty = getSupportedPropertyName('transform');
  35567. // now, let's make a step back and look at this code closely (wtf?)
  35568. // If the content of the popper grows once it's been positioned, it
  35569. // may happen that the popper gets misplaced because of the new content
  35570. // overflowing its reference element
  35571. // To avoid this problem, we provide two options (x and y), which allow
  35572. // the consumer to define the offset origin.
  35573. // If we position a popper on top of a reference element, we can set
  35574. // `x` to `top` to make the popper grow towards its top instead of
  35575. // its bottom.
  35576. var left = void 0,
  35577. top = void 0;
  35578. if (sideA === 'bottom') {
  35579. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35580. // and not the bottom of the html element
  35581. if (offsetParent.nodeName === 'HTML') {
  35582. top = -offsetParent.clientHeight + offsets.bottom;
  35583. } else {
  35584. top = -offsetParentRect.height + offsets.bottom;
  35585. }
  35586. } else {
  35587. top = offsets.top;
  35588. }
  35589. if (sideB === 'right') {
  35590. if (offsetParent.nodeName === 'HTML') {
  35591. left = -offsetParent.clientWidth + offsets.right;
  35592. } else {
  35593. left = -offsetParentRect.width + offsets.right;
  35594. }
  35595. } else {
  35596. left = offsets.left;
  35597. }
  35598. if (gpuAcceleration && prefixedProperty) {
  35599. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35600. styles[sideA] = 0;
  35601. styles[sideB] = 0;
  35602. styles.willChange = 'transform';
  35603. } else {
  35604. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35605. var invertTop = sideA === 'bottom' ? -1 : 1;
  35606. var invertLeft = sideB === 'right' ? -1 : 1;
  35607. styles[sideA] = top * invertTop;
  35608. styles[sideB] = left * invertLeft;
  35609. styles.willChange = sideA + ', ' + sideB;
  35610. }
  35611. // Attributes
  35612. var attributes = {
  35613. 'x-placement': data.placement
  35614. };
  35615. // Update `data` attributes, styles and arrowStyles
  35616. data.attributes = _extends({}, attributes, data.attributes);
  35617. data.styles = _extends({}, styles, data.styles);
  35618. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35619. return data;
  35620. }
  35621. /**
  35622. * Helper used to know if the given modifier depends from another one.<br />
  35623. * It checks if the needed modifier is listed and enabled.
  35624. * @method
  35625. * @memberof Popper.Utils
  35626. * @param {Array} modifiers - list of modifiers
  35627. * @param {String} requestingName - name of requesting modifier
  35628. * @param {String} requestedName - name of requested modifier
  35629. * @returns {Boolean}
  35630. */
  35631. function isModifierRequired(modifiers, requestingName, requestedName) {
  35632. var requesting = find(modifiers, function (_ref) {
  35633. var name = _ref.name;
  35634. return name === requestingName;
  35635. });
  35636. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35637. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35638. });
  35639. if (!isRequired) {
  35640. var _requesting = '`' + requestingName + '`';
  35641. var requested = '`' + requestedName + '`';
  35642. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35643. }
  35644. return isRequired;
  35645. }
  35646. /**
  35647. * @function
  35648. * @memberof Modifiers
  35649. * @argument {Object} data - The data object generated by update method
  35650. * @argument {Object} options - Modifiers configuration and options
  35651. * @returns {Object} The data object, properly modified
  35652. */
  35653. function arrow(data, options) {
  35654. var _data$offsets$arrow;
  35655. // arrow depends on keepTogether in order to work
  35656. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35657. return data;
  35658. }
  35659. var arrowElement = options.element;
  35660. // if arrowElement is a string, suppose it's a CSS selector
  35661. if (typeof arrowElement === 'string') {
  35662. arrowElement = data.instance.popper.querySelector(arrowElement);
  35663. // if arrowElement is not found, don't run the modifier
  35664. if (!arrowElement) {
  35665. return data;
  35666. }
  35667. } else {
  35668. // if the arrowElement isn't a query selector we must check that the
  35669. // provided DOM node is child of its popper node
  35670. if (!data.instance.popper.contains(arrowElement)) {
  35671. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35672. return data;
  35673. }
  35674. }
  35675. var placement = data.placement.split('-')[0];
  35676. var _data$offsets = data.offsets,
  35677. popper = _data$offsets.popper,
  35678. reference = _data$offsets.reference;
  35679. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35680. var len = isVertical ? 'height' : 'width';
  35681. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35682. var side = sideCapitalized.toLowerCase();
  35683. var altSide = isVertical ? 'left' : 'top';
  35684. var opSide = isVertical ? 'bottom' : 'right';
  35685. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35686. //
  35687. // extends keepTogether behavior making sure the popper and its
  35688. // reference have enough pixels in conjunction
  35689. //
  35690. // top/left side
  35691. if (reference[opSide] - arrowElementSize < popper[side]) {
  35692. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35693. }
  35694. // bottom/right side
  35695. if (reference[side] + arrowElementSize > popper[opSide]) {
  35696. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35697. }
  35698. data.offsets.popper = getClientRect(data.offsets.popper);
  35699. // compute center of the popper
  35700. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35701. // Compute the sideValue using the updated popper offsets
  35702. // take popper margin in account because we don't have this info available
  35703. var css = getStyleComputedProperty(data.instance.popper);
  35704. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35705. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35706. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35707. // prevent arrowElement from being placed not contiguously to its popper
  35708. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35709. data.arrowElement = arrowElement;
  35710. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35711. return data;
  35712. }
  35713. /**
  35714. * Get the opposite placement variation of the given one
  35715. * @method
  35716. * @memberof Popper.Utils
  35717. * @argument {String} placement variation
  35718. * @returns {String} flipped placement variation
  35719. */
  35720. function getOppositeVariation(variation) {
  35721. if (variation === 'end') {
  35722. return 'start';
  35723. } else if (variation === 'start') {
  35724. return 'end';
  35725. }
  35726. return variation;
  35727. }
  35728. /**
  35729. * List of accepted placements to use as values of the `placement` option.<br />
  35730. * Valid placements are:
  35731. * - `auto`
  35732. * - `top`
  35733. * - `right`
  35734. * - `bottom`
  35735. * - `left`
  35736. *
  35737. * Each placement can have a variation from this list:
  35738. * - `-start`
  35739. * - `-end`
  35740. *
  35741. * Variations are interpreted easily if you think of them as the left to right
  35742. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35743. * is right.<br />
  35744. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35745. *
  35746. * Some valid examples are:
  35747. * - `top-end` (on top of reference, right aligned)
  35748. * - `right-start` (on right of reference, top aligned)
  35749. * - `bottom` (on bottom, centered)
  35750. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35751. *
  35752. * @static
  35753. * @type {Array}
  35754. * @enum {String}
  35755. * @readonly
  35756. * @method placements
  35757. * @memberof Popper
  35758. */
  35759. 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'];
  35760. // Get rid of `auto` `auto-start` and `auto-end`
  35761. var validPlacements = placements.slice(3);
  35762. /**
  35763. * Given an initial placement, returns all the subsequent placements
  35764. * clockwise (or counter-clockwise).
  35765. *
  35766. * @method
  35767. * @memberof Popper.Utils
  35768. * @argument {String} placement - A valid placement (it accepts variations)
  35769. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35770. * @returns {Array} placements including their variations
  35771. */
  35772. function clockwise(placement) {
  35773. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35774. var index = validPlacements.indexOf(placement);
  35775. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35776. return counter ? arr.reverse() : arr;
  35777. }
  35778. var BEHAVIORS = {
  35779. FLIP: 'flip',
  35780. CLOCKWISE: 'clockwise',
  35781. COUNTERCLOCKWISE: 'counterclockwise'
  35782. };
  35783. /**
  35784. * @function
  35785. * @memberof Modifiers
  35786. * @argument {Object} data - The data object generated by update method
  35787. * @argument {Object} options - Modifiers configuration and options
  35788. * @returns {Object} The data object, properly modified
  35789. */
  35790. function flip(data, options) {
  35791. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35792. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35793. return data;
  35794. }
  35795. if (data.flipped && data.placement === data.originalPlacement) {
  35796. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35797. return data;
  35798. }
  35799. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35800. var placement = data.placement.split('-')[0];
  35801. var placementOpposite = getOppositePlacement(placement);
  35802. var variation = data.placement.split('-')[1] || '';
  35803. var flipOrder = [];
  35804. switch (options.behavior) {
  35805. case BEHAVIORS.FLIP:
  35806. flipOrder = [placement, placementOpposite];
  35807. break;
  35808. case BEHAVIORS.CLOCKWISE:
  35809. flipOrder = clockwise(placement);
  35810. break;
  35811. case BEHAVIORS.COUNTERCLOCKWISE:
  35812. flipOrder = clockwise(placement, true);
  35813. break;
  35814. default:
  35815. flipOrder = options.behavior;
  35816. }
  35817. flipOrder.forEach(function (step, index) {
  35818. if (placement !== step || flipOrder.length === index + 1) {
  35819. return data;
  35820. }
  35821. placement = data.placement.split('-')[0];
  35822. placementOpposite = getOppositePlacement(placement);
  35823. var popperOffsets = data.offsets.popper;
  35824. var refOffsets = data.offsets.reference;
  35825. // using floor because the reference offsets may contain decimals we are not going to consider here
  35826. var floor = Math.floor;
  35827. 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);
  35828. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35829. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35830. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35831. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35832. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35833. // flip the variation if required
  35834. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35835. // flips variation if reference element overflows boundaries
  35836. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35837. // flips variation if popper content overflows boundaries
  35838. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35839. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35840. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35841. // this boolean to detect any flip loop
  35842. data.flipped = true;
  35843. if (overlapsRef || overflowsBoundaries) {
  35844. placement = flipOrder[index + 1];
  35845. }
  35846. if (flippedVariation) {
  35847. variation = getOppositeVariation(variation);
  35848. }
  35849. data.placement = placement + (variation ? '-' + variation : '');
  35850. // this object contains `position`, we want to preserve it along with
  35851. // any additional property we may add in the future
  35852. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35853. data = runModifiers(data.instance.modifiers, data, 'flip');
  35854. }
  35855. });
  35856. return data;
  35857. }
  35858. /**
  35859. * @function
  35860. * @memberof Modifiers
  35861. * @argument {Object} data - The data object generated by update method
  35862. * @argument {Object} options - Modifiers configuration and options
  35863. * @returns {Object} The data object, properly modified
  35864. */
  35865. function keepTogether(data) {
  35866. var _data$offsets = data.offsets,
  35867. popper = _data$offsets.popper,
  35868. reference = _data$offsets.reference;
  35869. var placement = data.placement.split('-')[0];
  35870. var floor = Math.floor;
  35871. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35872. var side = isVertical ? 'right' : 'bottom';
  35873. var opSide = isVertical ? 'left' : 'top';
  35874. var measurement = isVertical ? 'width' : 'height';
  35875. if (popper[side] < floor(reference[opSide])) {
  35876. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35877. }
  35878. if (popper[opSide] > floor(reference[side])) {
  35879. data.offsets.popper[opSide] = floor(reference[side]);
  35880. }
  35881. return data;
  35882. }
  35883. /**
  35884. * Converts a string containing value + unit into a px value number
  35885. * @function
  35886. * @memberof {modifiers~offset}
  35887. * @private
  35888. * @argument {String} str - Value + unit string
  35889. * @argument {String} measurement - `height` or `width`
  35890. * @argument {Object} popperOffsets
  35891. * @argument {Object} referenceOffsets
  35892. * @returns {Number|String}
  35893. * Value in pixels, or original string if no values were extracted
  35894. */
  35895. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35896. // separate value from unit
  35897. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35898. var value = +split[1];
  35899. var unit = split[2];
  35900. // If it's not a number it's an operator, I guess
  35901. if (!value) {
  35902. return str;
  35903. }
  35904. if (unit.indexOf('%') === 0) {
  35905. var element = void 0;
  35906. switch (unit) {
  35907. case '%p':
  35908. element = popperOffsets;
  35909. break;
  35910. case '%':
  35911. case '%r':
  35912. default:
  35913. element = referenceOffsets;
  35914. }
  35915. var rect = getClientRect(element);
  35916. return rect[measurement] / 100 * value;
  35917. } else if (unit === 'vh' || unit === 'vw') {
  35918. // if is a vh or vw, we calculate the size based on the viewport
  35919. var size = void 0;
  35920. if (unit === 'vh') {
  35921. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35922. } else {
  35923. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35924. }
  35925. return size / 100 * value;
  35926. } else {
  35927. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35928. // if is an implicit unit, it's px, and we return just the value
  35929. return value;
  35930. }
  35931. }
  35932. /**
  35933. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35934. * @function
  35935. * @memberof {modifiers~offset}
  35936. * @private
  35937. * @argument {String} offset
  35938. * @argument {Object} popperOffsets
  35939. * @argument {Object} referenceOffsets
  35940. * @argument {String} basePlacement
  35941. * @returns {Array} a two cells array with x and y offsets in numbers
  35942. */
  35943. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35944. var offsets = [0, 0];
  35945. // Use height if placement is left or right and index is 0 otherwise use width
  35946. // in this way the first offset will use an axis and the second one
  35947. // will use the other one
  35948. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35949. // Split the offset string to obtain a list of values and operands
  35950. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35951. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35952. return frag.trim();
  35953. });
  35954. // Detect if the offset string contains a pair of values or a single one
  35955. // they could be separated by comma or space
  35956. var divider = fragments.indexOf(find(fragments, function (frag) {
  35957. return frag.search(/,|\s/) !== -1;
  35958. }));
  35959. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35960. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35961. }
  35962. // If divider is found, we divide the list of values and operands to divide
  35963. // them by ofset X and Y.
  35964. var splitRegex = /\s*,\s*|\s+/;
  35965. 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];
  35966. // Convert the values with units to absolute pixels to allow our computations
  35967. ops = ops.map(function (op, index) {
  35968. // Most of the units rely on the orientation of the popper
  35969. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35970. var mergeWithPrevious = false;
  35971. return op
  35972. // This aggregates any `+` or `-` sign that aren't considered operators
  35973. // e.g.: 10 + +5 => [10, +, +5]
  35974. .reduce(function (a, b) {
  35975. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35976. a[a.length - 1] = b;
  35977. mergeWithPrevious = true;
  35978. return a;
  35979. } else if (mergeWithPrevious) {
  35980. a[a.length - 1] += b;
  35981. mergeWithPrevious = false;
  35982. return a;
  35983. } else {
  35984. return a.concat(b);
  35985. }
  35986. }, [])
  35987. // Here we convert the string values into number values (in px)
  35988. .map(function (str) {
  35989. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35990. });
  35991. });
  35992. // Loop trough the offsets arrays and execute the operations
  35993. ops.forEach(function (op, index) {
  35994. op.forEach(function (frag, index2) {
  35995. if (isNumeric(frag)) {
  35996. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35997. }
  35998. });
  35999. });
  36000. return offsets;
  36001. }
  36002. /**
  36003. * @function
  36004. * @memberof Modifiers
  36005. * @argument {Object} data - The data object generated by update method
  36006. * @argument {Object} options - Modifiers configuration and options
  36007. * @argument {Number|String} options.offset=0
  36008. * The offset value as described in the modifier description
  36009. * @returns {Object} The data object, properly modified
  36010. */
  36011. function offset(data, _ref) {
  36012. var offset = _ref.offset;
  36013. var placement = data.placement,
  36014. _data$offsets = data.offsets,
  36015. popper = _data$offsets.popper,
  36016. reference = _data$offsets.reference;
  36017. var basePlacement = placement.split('-')[0];
  36018. var offsets = void 0;
  36019. if (isNumeric(+offset)) {
  36020. offsets = [+offset, 0];
  36021. } else {
  36022. offsets = parseOffset(offset, popper, reference, basePlacement);
  36023. }
  36024. if (basePlacement === 'left') {
  36025. popper.top += offsets[0];
  36026. popper.left -= offsets[1];
  36027. } else if (basePlacement === 'right') {
  36028. popper.top += offsets[0];
  36029. popper.left += offsets[1];
  36030. } else if (basePlacement === 'top') {
  36031. popper.left += offsets[0];
  36032. popper.top -= offsets[1];
  36033. } else if (basePlacement === 'bottom') {
  36034. popper.left += offsets[0];
  36035. popper.top += offsets[1];
  36036. }
  36037. data.popper = popper;
  36038. return data;
  36039. }
  36040. /**
  36041. * @function
  36042. * @memberof Modifiers
  36043. * @argument {Object} data - The data object generated by `update` method
  36044. * @argument {Object} options - Modifiers configuration and options
  36045. * @returns {Object} The data object, properly modified
  36046. */
  36047. function preventOverflow(data, options) {
  36048. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36049. // If offsetParent is the reference element, we really want to
  36050. // go one step up and use the next offsetParent as reference to
  36051. // avoid to make this modifier completely useless and look like broken
  36052. if (data.instance.reference === boundariesElement) {
  36053. boundariesElement = getOffsetParent(boundariesElement);
  36054. }
  36055. // NOTE: DOM access here
  36056. // resets the popper's position so that the document size can be calculated excluding
  36057. // the size of the popper element itself
  36058. var transformProp = getSupportedPropertyName('transform');
  36059. var popperStyles = data.instance.popper.style; // assignment to help minification
  36060. var top = popperStyles.top,
  36061. left = popperStyles.left,
  36062. transform = popperStyles[transformProp];
  36063. popperStyles.top = '';
  36064. popperStyles.left = '';
  36065. popperStyles[transformProp] = '';
  36066. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36067. // NOTE: DOM access here
  36068. // restores the original style properties after the offsets have been computed
  36069. popperStyles.top = top;
  36070. popperStyles.left = left;
  36071. popperStyles[transformProp] = transform;
  36072. options.boundaries = boundaries;
  36073. var order = options.priority;
  36074. var popper = data.offsets.popper;
  36075. var check = {
  36076. primary: function primary(placement) {
  36077. var value = popper[placement];
  36078. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36079. value = Math.max(popper[placement], boundaries[placement]);
  36080. }
  36081. return defineProperty({}, placement, value);
  36082. },
  36083. secondary: function secondary(placement) {
  36084. var mainSide = placement === 'right' ? 'left' : 'top';
  36085. var value = popper[mainSide];
  36086. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36087. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36088. }
  36089. return defineProperty({}, mainSide, value);
  36090. }
  36091. };
  36092. order.forEach(function (placement) {
  36093. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36094. popper = _extends({}, popper, check[side](placement));
  36095. });
  36096. data.offsets.popper = popper;
  36097. return data;
  36098. }
  36099. /**
  36100. * @function
  36101. * @memberof Modifiers
  36102. * @argument {Object} data - The data object generated by `update` method
  36103. * @argument {Object} options - Modifiers configuration and options
  36104. * @returns {Object} The data object, properly modified
  36105. */
  36106. function shift(data) {
  36107. var placement = data.placement;
  36108. var basePlacement = placement.split('-')[0];
  36109. var shiftvariation = placement.split('-')[1];
  36110. // if shift shiftvariation is specified, run the modifier
  36111. if (shiftvariation) {
  36112. var _data$offsets = data.offsets,
  36113. reference = _data$offsets.reference,
  36114. popper = _data$offsets.popper;
  36115. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36116. var side = isVertical ? 'left' : 'top';
  36117. var measurement = isVertical ? 'width' : 'height';
  36118. var shiftOffsets = {
  36119. start: defineProperty({}, side, reference[side]),
  36120. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36121. };
  36122. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36123. }
  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 hide(data) {
  36134. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36135. return data;
  36136. }
  36137. var refRect = data.offsets.reference;
  36138. var bound = find(data.instance.modifiers, function (modifier) {
  36139. return modifier.name === 'preventOverflow';
  36140. }).boundaries;
  36141. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36142. // Avoid unnecessary DOM access if visibility hasn't changed
  36143. if (data.hide === true) {
  36144. return data;
  36145. }
  36146. data.hide = true;
  36147. data.attributes['x-out-of-boundaries'] = '';
  36148. } else {
  36149. // Avoid unnecessary DOM access if visibility hasn't changed
  36150. if (data.hide === false) {
  36151. return data;
  36152. }
  36153. data.hide = false;
  36154. data.attributes['x-out-of-boundaries'] = false;
  36155. }
  36156. return data;
  36157. }
  36158. /**
  36159. * @function
  36160. * @memberof Modifiers
  36161. * @argument {Object} data - The data object generated by `update` method
  36162. * @argument {Object} options - Modifiers configuration and options
  36163. * @returns {Object} The data object, properly modified
  36164. */
  36165. function inner(data) {
  36166. var placement = data.placement;
  36167. var basePlacement = placement.split('-')[0];
  36168. var _data$offsets = data.offsets,
  36169. popper = _data$offsets.popper,
  36170. reference = _data$offsets.reference;
  36171. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36172. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36173. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36174. data.placement = getOppositePlacement(placement);
  36175. data.offsets.popper = getClientRect(popper);
  36176. return data;
  36177. }
  36178. /**
  36179. * Modifier function, each modifier can have a function of this type assigned
  36180. * to its `fn` property.<br />
  36181. * These functions will be called on each update, this means that you must
  36182. * make sure they are performant enough to avoid performance bottlenecks.
  36183. *
  36184. * @function ModifierFn
  36185. * @argument {dataObject} data - The data object generated by `update` method
  36186. * @argument {Object} options - Modifiers configuration and options
  36187. * @returns {dataObject} The data object, properly modified
  36188. */
  36189. /**
  36190. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36191. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36192. * needed by the library.
  36193. *
  36194. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36195. * All the other properties are configurations that could be tweaked.
  36196. * @namespace modifiers
  36197. */
  36198. var modifiers = {
  36199. /**
  36200. * Modifier used to shift the popper on the start or end of its reference
  36201. * element.<br />
  36202. * It will read the variation of the `placement` property.<br />
  36203. * It can be one either `-end` or `-start`.
  36204. * @memberof modifiers
  36205. * @inner
  36206. */
  36207. shift: {
  36208. /** @prop {number} order=100 - Index used to define the order of execution */
  36209. order: 100,
  36210. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36211. enabled: true,
  36212. /** @prop {ModifierFn} */
  36213. fn: shift
  36214. },
  36215. /**
  36216. * The `offset` modifier can shift your popper on both its axis.
  36217. *
  36218. * It accepts the following units:
  36219. * - `px` or unit-less, interpreted as pixels
  36220. * - `%` or `%r`, percentage relative to the length of the reference element
  36221. * - `%p`, percentage relative to the length of the popper element
  36222. * - `vw`, CSS viewport width unit
  36223. * - `vh`, CSS viewport height unit
  36224. *
  36225. * For length is intended the main axis relative to the placement of the popper.<br />
  36226. * This means that if the placement is `top` or `bottom`, the length will be the
  36227. * `width`. In case of `left` or `right`, it will be the `height`.
  36228. *
  36229. * You can provide a single value (as `Number` or `String`), or a pair of values
  36230. * as `String` divided by a comma or one (or more) white spaces.<br />
  36231. * The latter is a deprecated method because it leads to confusion and will be
  36232. * removed in v2.<br />
  36233. * Additionally, it accepts additions and subtractions between different units.
  36234. * Note that multiplications and divisions aren't supported.
  36235. *
  36236. * Valid examples are:
  36237. * ```
  36238. * 10
  36239. * '10%'
  36240. * '10, 10'
  36241. * '10%, 10'
  36242. * '10 + 10%'
  36243. * '10 - 5vh + 3%'
  36244. * '-10px + 5vh, 5px - 6%'
  36245. * ```
  36246. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36247. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36248. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36249. *
  36250. * @memberof modifiers
  36251. * @inner
  36252. */
  36253. offset: {
  36254. /** @prop {number} order=200 - Index used to define the order of execution */
  36255. order: 200,
  36256. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36257. enabled: true,
  36258. /** @prop {ModifierFn} */
  36259. fn: offset,
  36260. /** @prop {Number|String} offset=0
  36261. * The offset value as described in the modifier description
  36262. */
  36263. offset: 0
  36264. },
  36265. /**
  36266. * Modifier used to prevent the popper from being positioned outside the boundary.
  36267. *
  36268. * A scenario exists where the reference itself is not within the boundaries.<br />
  36269. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36270. * In this case we need to decide whether the popper should either:
  36271. *
  36272. * - detach from the reference and remain "trapped" in the boundaries, or
  36273. * - if it should ignore the boundary and "escape with its reference"
  36274. *
  36275. * When `escapeWithReference` is set to`true` and reference is completely
  36276. * outside its boundaries, the popper will overflow (or completely leave)
  36277. * the boundaries in order to remain attached to the edge of the reference.
  36278. *
  36279. * @memberof modifiers
  36280. * @inner
  36281. */
  36282. preventOverflow: {
  36283. /** @prop {number} order=300 - Index used to define the order of execution */
  36284. order: 300,
  36285. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36286. enabled: true,
  36287. /** @prop {ModifierFn} */
  36288. fn: preventOverflow,
  36289. /**
  36290. * @prop {Array} [priority=['left','right','top','bottom']]
  36291. * Popper will try to prevent overflow following these priorities by default,
  36292. * then, it could overflow on the left and on top of the `boundariesElement`
  36293. */
  36294. priority: ['left', 'right', 'top', 'bottom'],
  36295. /**
  36296. * @prop {number} padding=5
  36297. * Amount of pixel used to define a minimum distance between the boundaries
  36298. * and the popper. This makes sure the popper always has a little padding
  36299. * between the edges of its container
  36300. */
  36301. padding: 5,
  36302. /**
  36303. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36304. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36305. * `viewport` or any DOM element.
  36306. */
  36307. boundariesElement: 'scrollParent'
  36308. },
  36309. /**
  36310. * Modifier used to make sure the reference and its popper stay near each other
  36311. * without leaving any gap between the two. Especially useful when the arrow is
  36312. * enabled and you want to ensure that it points to its reference element.
  36313. * It cares only about the first axis. You can still have poppers with margin
  36314. * between the popper and its reference element.
  36315. * @memberof modifiers
  36316. * @inner
  36317. */
  36318. keepTogether: {
  36319. /** @prop {number} order=400 - Index used to define the order of execution */
  36320. order: 400,
  36321. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36322. enabled: true,
  36323. /** @prop {ModifierFn} */
  36324. fn: keepTogether
  36325. },
  36326. /**
  36327. * This modifier is used to move the `arrowElement` of the popper to make
  36328. * sure it is positioned between the reference element and its popper element.
  36329. * It will read the outer size of the `arrowElement` node to detect how many
  36330. * pixels of conjunction are needed.
  36331. *
  36332. * It has no effect if no `arrowElement` is provided.
  36333. * @memberof modifiers
  36334. * @inner
  36335. */
  36336. arrow: {
  36337. /** @prop {number} order=500 - Index used to define the order of execution */
  36338. order: 500,
  36339. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36340. enabled: true,
  36341. /** @prop {ModifierFn} */
  36342. fn: arrow,
  36343. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36344. element: '[x-arrow]'
  36345. },
  36346. /**
  36347. * Modifier used to flip the popper's placement when it starts to overlap its
  36348. * reference element.
  36349. *
  36350. * Requires the `preventOverflow` modifier before it in order to work.
  36351. *
  36352. * **NOTE:** this modifier will interrupt the current update cycle and will
  36353. * restart it if it detects the need to flip the placement.
  36354. * @memberof modifiers
  36355. * @inner
  36356. */
  36357. flip: {
  36358. /** @prop {number} order=600 - Index used to define the order of execution */
  36359. order: 600,
  36360. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36361. enabled: true,
  36362. /** @prop {ModifierFn} */
  36363. fn: flip,
  36364. /**
  36365. * @prop {String|Array} behavior='flip'
  36366. * The behavior used to change the popper's placement. It can be one of
  36367. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36368. * placements (with optional variations)
  36369. */
  36370. behavior: 'flip',
  36371. /**
  36372. * @prop {number} padding=5
  36373. * The popper will flip if it hits the edges of the `boundariesElement`
  36374. */
  36375. padding: 5,
  36376. /**
  36377. * @prop {String|HTMLElement} boundariesElement='viewport'
  36378. * The element which will define the boundaries of the popper position.
  36379. * The popper will never be placed outside of the defined boundaries
  36380. * (except if `keepTogether` is enabled)
  36381. */
  36382. boundariesElement: 'viewport',
  36383. /**
  36384. * @prop {Boolean} flipVariations=false
  36385. * The popper will switch placement variation between `-start` and `-end` when
  36386. * the reference element overlaps its boundaries.
  36387. *
  36388. * The original placement should have a set variation.
  36389. */
  36390. flipVariations: false,
  36391. /**
  36392. * @prop {Boolean} flipVariationsByContent=false
  36393. * The popper will switch placement variation between `-start` and `-end` when
  36394. * the popper element overlaps its reference boundaries.
  36395. *
  36396. * The original placement should have a set variation.
  36397. */
  36398. flipVariationsByContent: false
  36399. },
  36400. /**
  36401. * Modifier used to make the popper flow toward the inner of the reference element.
  36402. * By default, when this modifier is disabled, the popper will be placed outside
  36403. * the reference element.
  36404. * @memberof modifiers
  36405. * @inner
  36406. */
  36407. inner: {
  36408. /** @prop {number} order=700 - Index used to define the order of execution */
  36409. order: 700,
  36410. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36411. enabled: false,
  36412. /** @prop {ModifierFn} */
  36413. fn: inner
  36414. },
  36415. /**
  36416. * Modifier used to hide the popper when its reference element is outside of the
  36417. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36418. * be used to hide with a CSS selector the popper when its reference is
  36419. * out of boundaries.
  36420. *
  36421. * Requires the `preventOverflow` modifier before it in order to work.
  36422. * @memberof modifiers
  36423. * @inner
  36424. */
  36425. hide: {
  36426. /** @prop {number} order=800 - Index used to define the order of execution */
  36427. order: 800,
  36428. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36429. enabled: true,
  36430. /** @prop {ModifierFn} */
  36431. fn: hide
  36432. },
  36433. /**
  36434. * Computes the style that will be applied to the popper element to gets
  36435. * properly positioned.
  36436. *
  36437. * Note that this modifier will not touch the DOM, it just prepares the styles
  36438. * so that `applyStyle` modifier can apply it. This separation is useful
  36439. * in case you need to replace `applyStyle` with a custom implementation.
  36440. *
  36441. * This modifier has `850` as `order` value to maintain backward compatibility
  36442. * with previous versions of Popper.js. Expect the modifiers ordering method
  36443. * to change in future major versions of the library.
  36444. *
  36445. * @memberof modifiers
  36446. * @inner
  36447. */
  36448. computeStyle: {
  36449. /** @prop {number} order=850 - Index used to define the order of execution */
  36450. order: 850,
  36451. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36452. enabled: true,
  36453. /** @prop {ModifierFn} */
  36454. fn: computeStyle,
  36455. /**
  36456. * @prop {Boolean} gpuAcceleration=true
  36457. * If true, it uses the CSS 3D transformation to position the popper.
  36458. * Otherwise, it will use the `top` and `left` properties
  36459. */
  36460. gpuAcceleration: true,
  36461. /**
  36462. * @prop {string} [x='bottom']
  36463. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36464. * Change this if your popper should grow in a direction different from `bottom`
  36465. */
  36466. x: 'bottom',
  36467. /**
  36468. * @prop {string} [x='left']
  36469. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36470. * Change this if your popper should grow in a direction different from `right`
  36471. */
  36472. y: 'right'
  36473. },
  36474. /**
  36475. * Applies the computed styles to the popper element.
  36476. *
  36477. * All the DOM manipulations are limited to this modifier. This is useful in case
  36478. * you want to integrate Popper.js inside a framework or view library and you
  36479. * want to delegate all the DOM manipulations to it.
  36480. *
  36481. * Note that if you disable this modifier, you must make sure the popper element
  36482. * has its position set to `absolute` before Popper.js can do its work!
  36483. *
  36484. * Just disable this modifier and define your own to achieve the desired effect.
  36485. *
  36486. * @memberof modifiers
  36487. * @inner
  36488. */
  36489. applyStyle: {
  36490. /** @prop {number} order=900 - Index used to define the order of execution */
  36491. order: 900,
  36492. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36493. enabled: true,
  36494. /** @prop {ModifierFn} */
  36495. fn: applyStyle,
  36496. /** @prop {Function} */
  36497. onLoad: applyStyleOnLoad,
  36498. /**
  36499. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36500. * @prop {Boolean} gpuAcceleration=true
  36501. * If true, it uses the CSS 3D transformation to position the popper.
  36502. * Otherwise, it will use the `top` and `left` properties
  36503. */
  36504. gpuAcceleration: undefined
  36505. }
  36506. };
  36507. /**
  36508. * The `dataObject` is an object containing all the information used by Popper.js.
  36509. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36510. * @name dataObject
  36511. * @property {Object} data.instance The Popper.js instance
  36512. * @property {String} data.placement Placement applied to popper
  36513. * @property {String} data.originalPlacement Placement originally defined on init
  36514. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36515. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36516. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36517. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36518. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36519. * @property {Object} data.boundaries Offsets of the popper boundaries
  36520. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36521. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36522. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36523. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36524. */
  36525. /**
  36526. * Default options provided to Popper.js constructor.<br />
  36527. * These can be overridden using the `options` argument of Popper.js.<br />
  36528. * To override an option, simply pass an object with the same
  36529. * structure of the `options` object, as the 3rd argument. For example:
  36530. * ```
  36531. * new Popper(ref, pop, {
  36532. * modifiers: {
  36533. * preventOverflow: { enabled: false }
  36534. * }
  36535. * })
  36536. * ```
  36537. * @type {Object}
  36538. * @static
  36539. * @memberof Popper
  36540. */
  36541. var Defaults = {
  36542. /**
  36543. * Popper's placement.
  36544. * @prop {Popper.placements} placement='bottom'
  36545. */
  36546. placement: 'bottom',
  36547. /**
  36548. * Set this to true if you want popper to position it self in 'fixed' mode
  36549. * @prop {Boolean} positionFixed=false
  36550. */
  36551. positionFixed: false,
  36552. /**
  36553. * Whether events (resize, scroll) are initially enabled.
  36554. * @prop {Boolean} eventsEnabled=true
  36555. */
  36556. eventsEnabled: true,
  36557. /**
  36558. * Set to true if you want to automatically remove the popper when
  36559. * you call the `destroy` method.
  36560. * @prop {Boolean} removeOnDestroy=false
  36561. */
  36562. removeOnDestroy: false,
  36563. /**
  36564. * Callback called when the popper is created.<br />
  36565. * By default, it is set to no-op.<br />
  36566. * Access Popper.js instance with `data.instance`.
  36567. * @prop {onCreate}
  36568. */
  36569. onCreate: function onCreate() {},
  36570. /**
  36571. * Callback called when the popper is updated. This callback is not called
  36572. * on the initialization/creation of the popper, but only on subsequent
  36573. * updates.<br />
  36574. * By default, it is set to no-op.<br />
  36575. * Access Popper.js instance with `data.instance`.
  36576. * @prop {onUpdate}
  36577. */
  36578. onUpdate: function onUpdate() {},
  36579. /**
  36580. * List of modifiers used to modify the offsets before they are applied to the popper.
  36581. * They provide most of the functionalities of Popper.js.
  36582. * @prop {modifiers}
  36583. */
  36584. modifiers: modifiers
  36585. };
  36586. /**
  36587. * @callback onCreate
  36588. * @param {dataObject} data
  36589. */
  36590. /**
  36591. * @callback onUpdate
  36592. * @param {dataObject} data
  36593. */
  36594. // Utils
  36595. // Methods
  36596. var Popper = function () {
  36597. /**
  36598. * Creates a new Popper.js instance.
  36599. * @class Popper
  36600. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36601. * @param {Element} popper - The HTML / XML element used as the popper
  36602. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36603. * @return {Object} instance - The generated Popper.js instance
  36604. */
  36605. function Popper(reference, popper) {
  36606. var _this = this;
  36607. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36608. classCallCheck(this, Popper);
  36609. this.scheduleUpdate = function () {
  36610. return requestAnimationFrame(_this.update);
  36611. };
  36612. // make update() debounced, so that it only runs at most once-per-tick
  36613. this.update = debounce(this.update.bind(this));
  36614. // with {} we create a new object with the options inside it
  36615. this.options = _extends({}, Popper.Defaults, options);
  36616. // init state
  36617. this.state = {
  36618. isDestroyed: false,
  36619. isCreated: false,
  36620. scrollParents: []
  36621. };
  36622. // get reference and popper elements (allow jQuery wrappers)
  36623. this.reference = reference && reference.jquery ? reference[0] : reference;
  36624. this.popper = popper && popper.jquery ? popper[0] : popper;
  36625. // Deep merge modifiers options
  36626. this.options.modifiers = {};
  36627. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36628. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36629. });
  36630. // Refactoring modifiers' list (Object => Array)
  36631. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36632. return _extends({
  36633. name: name
  36634. }, _this.options.modifiers[name]);
  36635. })
  36636. // sort the modifiers by order
  36637. .sort(function (a, b) {
  36638. return a.order - b.order;
  36639. });
  36640. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36641. // such code is executed in the same order of its modifier
  36642. // they could add new properties to their options configuration
  36643. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36644. this.modifiers.forEach(function (modifierOptions) {
  36645. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36646. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36647. }
  36648. });
  36649. // fire the first update to position the popper in the right place
  36650. this.update();
  36651. var eventsEnabled = this.options.eventsEnabled;
  36652. if (eventsEnabled) {
  36653. // setup event listeners, they will take care of update the position in specific situations
  36654. this.enableEventListeners();
  36655. }
  36656. this.state.eventsEnabled = eventsEnabled;
  36657. }
  36658. // We can't use class properties because they don't get listed in the
  36659. // class prototype and break stuff like Sinon stubs
  36660. createClass(Popper, [{
  36661. key: 'update',
  36662. value: function update$$1() {
  36663. return update.call(this);
  36664. }
  36665. }, {
  36666. key: 'destroy',
  36667. value: function destroy$$1() {
  36668. return destroy.call(this);
  36669. }
  36670. }, {
  36671. key: 'enableEventListeners',
  36672. value: function enableEventListeners$$1() {
  36673. return enableEventListeners.call(this);
  36674. }
  36675. }, {
  36676. key: 'disableEventListeners',
  36677. value: function disableEventListeners$$1() {
  36678. return disableEventListeners.call(this);
  36679. }
  36680. /**
  36681. * Schedules an update. It will run on the next UI update available.
  36682. * @method scheduleUpdate
  36683. * @memberof Popper
  36684. */
  36685. /**
  36686. * Collection of utilities useful when writing custom modifiers.
  36687. * Starting from version 1.7, this method is available only if you
  36688. * include `popper-utils.js` before `popper.js`.
  36689. *
  36690. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36691. * and will be removed in v2! Use the PopperUtils module directly instead.
  36692. * Due to the high instability of the methods contained in Utils, we can't
  36693. * guarantee them to follow semver. Use them at your own risk!
  36694. * @static
  36695. * @private
  36696. * @type {Object}
  36697. * @deprecated since version 1.8
  36698. * @member Utils
  36699. * @memberof Popper
  36700. */
  36701. }]);
  36702. return Popper;
  36703. }();
  36704. /**
  36705. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36706. * and lets you use it as replacement of a real DOM node.<br />
  36707. * You can use this method to position a popper relatively to a set of coordinates
  36708. * in case you don't have a DOM node to use as reference.
  36709. *
  36710. * ```
  36711. * new Popper(referenceObject, popperNode);
  36712. * ```
  36713. *
  36714. * NB: This feature isn't supported in Internet Explorer 10.
  36715. * @name referenceObject
  36716. * @property {Function} data.getBoundingClientRect
  36717. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36718. * @property {number} data.clientWidth
  36719. * An ES6 getter that will return the width of the virtual reference element.
  36720. * @property {number} data.clientHeight
  36721. * An ES6 getter that will return the height of the virtual reference element.
  36722. */
  36723. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36724. Popper.placements = placements;
  36725. Popper.Defaults = Defaults;
  36726. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36727. //# sourceMappingURL=popper.js.map
  36728. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36729. /***/ }),
  36730. /***/ "./node_modules/process/browser.js":
  36731. /*!*****************************************!*\
  36732. !*** ./node_modules/process/browser.js ***!
  36733. \*****************************************/
  36734. /*! no static exports found */
  36735. /***/ (function(module, exports) {
  36736. // shim for using process in browser
  36737. var process = module.exports = {};
  36738. // cached from whatever global is present so that test runners that stub it
  36739. // don't break things. But we need to wrap it in a try catch in case it is
  36740. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36741. // function because try/catches deoptimize in certain engines.
  36742. var cachedSetTimeout;
  36743. var cachedClearTimeout;
  36744. function defaultSetTimout() {
  36745. throw new Error('setTimeout has not been defined');
  36746. }
  36747. function defaultClearTimeout () {
  36748. throw new Error('clearTimeout has not been defined');
  36749. }
  36750. (function () {
  36751. try {
  36752. if (typeof setTimeout === 'function') {
  36753. cachedSetTimeout = setTimeout;
  36754. } else {
  36755. cachedSetTimeout = defaultSetTimout;
  36756. }
  36757. } catch (e) {
  36758. cachedSetTimeout = defaultSetTimout;
  36759. }
  36760. try {
  36761. if (typeof clearTimeout === 'function') {
  36762. cachedClearTimeout = clearTimeout;
  36763. } else {
  36764. cachedClearTimeout = defaultClearTimeout;
  36765. }
  36766. } catch (e) {
  36767. cachedClearTimeout = defaultClearTimeout;
  36768. }
  36769. } ())
  36770. function runTimeout(fun) {
  36771. if (cachedSetTimeout === setTimeout) {
  36772. //normal enviroments in sane situations
  36773. return setTimeout(fun, 0);
  36774. }
  36775. // if setTimeout wasn't available but was latter defined
  36776. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36777. cachedSetTimeout = setTimeout;
  36778. return setTimeout(fun, 0);
  36779. }
  36780. try {
  36781. // when when somebody has screwed with setTimeout but no I.E. maddness
  36782. return cachedSetTimeout(fun, 0);
  36783. } catch(e){
  36784. try {
  36785. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36786. return cachedSetTimeout.call(null, fun, 0);
  36787. } catch(e){
  36788. // 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
  36789. return cachedSetTimeout.call(this, fun, 0);
  36790. }
  36791. }
  36792. }
  36793. function runClearTimeout(marker) {
  36794. if (cachedClearTimeout === clearTimeout) {
  36795. //normal enviroments in sane situations
  36796. return clearTimeout(marker);
  36797. }
  36798. // if clearTimeout wasn't available but was latter defined
  36799. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36800. cachedClearTimeout = clearTimeout;
  36801. return clearTimeout(marker);
  36802. }
  36803. try {
  36804. // when when somebody has screwed with setTimeout but no I.E. maddness
  36805. return cachedClearTimeout(marker);
  36806. } catch (e){
  36807. try {
  36808. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36809. return cachedClearTimeout.call(null, marker);
  36810. } catch (e){
  36811. // 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.
  36812. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36813. return cachedClearTimeout.call(this, marker);
  36814. }
  36815. }
  36816. }
  36817. var queue = [];
  36818. var draining = false;
  36819. var currentQueue;
  36820. var queueIndex = -1;
  36821. function cleanUpNextTick() {
  36822. if (!draining || !currentQueue) {
  36823. return;
  36824. }
  36825. draining = false;
  36826. if (currentQueue.length) {
  36827. queue = currentQueue.concat(queue);
  36828. } else {
  36829. queueIndex = -1;
  36830. }
  36831. if (queue.length) {
  36832. drainQueue();
  36833. }
  36834. }
  36835. function drainQueue() {
  36836. if (draining) {
  36837. return;
  36838. }
  36839. var timeout = runTimeout(cleanUpNextTick);
  36840. draining = true;
  36841. var len = queue.length;
  36842. while(len) {
  36843. currentQueue = queue;
  36844. queue = [];
  36845. while (++queueIndex < len) {
  36846. if (currentQueue) {
  36847. currentQueue[queueIndex].run();
  36848. }
  36849. }
  36850. queueIndex = -1;
  36851. len = queue.length;
  36852. }
  36853. currentQueue = null;
  36854. draining = false;
  36855. runClearTimeout(timeout);
  36856. }
  36857. process.nextTick = function (fun) {
  36858. var args = new Array(arguments.length - 1);
  36859. if (arguments.length > 1) {
  36860. for (var i = 1; i < arguments.length; i++) {
  36861. args[i - 1] = arguments[i];
  36862. }
  36863. }
  36864. queue.push(new Item(fun, args));
  36865. if (queue.length === 1 && !draining) {
  36866. runTimeout(drainQueue);
  36867. }
  36868. };
  36869. // v8 likes predictible objects
  36870. function Item(fun, array) {
  36871. this.fun = fun;
  36872. this.array = array;
  36873. }
  36874. Item.prototype.run = function () {
  36875. this.fun.apply(null, this.array);
  36876. };
  36877. process.title = 'browser';
  36878. process.browser = true;
  36879. process.env = {};
  36880. process.argv = [];
  36881. process.version = ''; // empty string to avoid regexp issues
  36882. process.versions = {};
  36883. function noop() {}
  36884. process.on = noop;
  36885. process.addListener = noop;
  36886. process.once = noop;
  36887. process.off = noop;
  36888. process.removeListener = noop;
  36889. process.removeAllListeners = noop;
  36890. process.emit = noop;
  36891. process.prependListener = noop;
  36892. process.prependOnceListener = noop;
  36893. process.listeners = function (name) { return [] }
  36894. process.binding = function (name) {
  36895. throw new Error('process.binding is not supported');
  36896. };
  36897. process.cwd = function () { return '/' };
  36898. process.chdir = function (dir) {
  36899. throw new Error('process.chdir is not supported');
  36900. };
  36901. process.umask = function() { return 0; };
  36902. /***/ }),
  36903. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36904. /*!***************************************************!*\
  36905. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36906. \***************************************************/
  36907. /*! no static exports found */
  36908. /***/ (function(module, exports, __webpack_require__) {
  36909. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36910. * Pusher JavaScript Library v5.0.3
  36911. * https://pusher.com/
  36912. *
  36913. * Copyright 2017, Pusher
  36914. * Released under the MIT licence.
  36915. */
  36916. (function webpackUniversalModuleDefinition(root, factory) {
  36917. if(true)
  36918. module.exports = factory();
  36919. else {}
  36920. })(window, function() {
  36921. return /******/ (function(modules) { // webpackBootstrap
  36922. /******/ // The module cache
  36923. /******/ var installedModules = {};
  36924. /******/
  36925. /******/ // The require function
  36926. /******/ function __webpack_require__(moduleId) {
  36927. /******/
  36928. /******/ // Check if module is in cache
  36929. /******/ if(installedModules[moduleId]) {
  36930. /******/ return installedModules[moduleId].exports;
  36931. /******/ }
  36932. /******/ // Create a new module (and put it into the cache)
  36933. /******/ var module = installedModules[moduleId] = {
  36934. /******/ i: moduleId,
  36935. /******/ l: false,
  36936. /******/ exports: {}
  36937. /******/ };
  36938. /******/
  36939. /******/ // Execute the module function
  36940. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36941. /******/
  36942. /******/ // Flag the module as loaded
  36943. /******/ module.l = true;
  36944. /******/
  36945. /******/ // Return the exports of the module
  36946. /******/ return module.exports;
  36947. /******/ }
  36948. /******/
  36949. /******/
  36950. /******/ // expose the modules object (__webpack_modules__)
  36951. /******/ __webpack_require__.m = modules;
  36952. /******/
  36953. /******/ // expose the module cache
  36954. /******/ __webpack_require__.c = installedModules;
  36955. /******/
  36956. /******/ // define getter function for harmony exports
  36957. /******/ __webpack_require__.d = function(exports, name, getter) {
  36958. /******/ if(!__webpack_require__.o(exports, name)) {
  36959. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36960. /******/ }
  36961. /******/ };
  36962. /******/
  36963. /******/ // define __esModule on exports
  36964. /******/ __webpack_require__.r = function(exports) {
  36965. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36966. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36967. /******/ }
  36968. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36969. /******/ };
  36970. /******/
  36971. /******/ // create a fake namespace object
  36972. /******/ // mode & 1: value is a module id, require it
  36973. /******/ // mode & 2: merge all properties of value into the ns
  36974. /******/ // mode & 4: return value when already ns object
  36975. /******/ // mode & 8|1: behave like require
  36976. /******/ __webpack_require__.t = function(value, mode) {
  36977. /******/ if(mode & 1) value = __webpack_require__(value);
  36978. /******/ if(mode & 8) return value;
  36979. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36980. /******/ var ns = Object.create(null);
  36981. /******/ __webpack_require__.r(ns);
  36982. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36983. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36984. /******/ return ns;
  36985. /******/ };
  36986. /******/
  36987. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36988. /******/ __webpack_require__.n = function(module) {
  36989. /******/ var getter = module && module.__esModule ?
  36990. /******/ function getDefault() { return module['default']; } :
  36991. /******/ function getModuleExports() { return module; };
  36992. /******/ __webpack_require__.d(getter, 'a', getter);
  36993. /******/ return getter;
  36994. /******/ };
  36995. /******/
  36996. /******/ // Object.prototype.hasOwnProperty.call
  36997. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36998. /******/
  36999. /******/ // __webpack_public_path__
  37000. /******/ __webpack_require__.p = "";
  37001. /******/
  37002. /******/
  37003. /******/ // Load entry module and return exports
  37004. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37005. /******/ })
  37006. /************************************************************************/
  37007. /******/ ([
  37008. /* 0 */
  37009. /***/ (function(module, exports, __webpack_require__) {
  37010. (function(nacl) {
  37011. 'use strict';
  37012. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37013. // Public domain.
  37014. //
  37015. // Implementation derived from TweetNaCl version 20140427.
  37016. // See for details: http://tweetnacl.cr.yp.to/
  37017. var gf = function(init) {
  37018. var i, r = new Float64Array(16);
  37019. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37020. return r;
  37021. };
  37022. // Pluggable, initialized in high-level API below.
  37023. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37024. var _0 = new Uint8Array(16);
  37025. var _9 = new Uint8Array(32); _9[0] = 9;
  37026. var gf0 = gf(),
  37027. gf1 = gf([1]),
  37028. _121665 = gf([0xdb41, 1]),
  37029. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37030. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37031. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37032. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37033. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37034. function ts64(x, i, h, l) {
  37035. x[i] = (h >> 24) & 0xff;
  37036. x[i+1] = (h >> 16) & 0xff;
  37037. x[i+2] = (h >> 8) & 0xff;
  37038. x[i+3] = h & 0xff;
  37039. x[i+4] = (l >> 24) & 0xff;
  37040. x[i+5] = (l >> 16) & 0xff;
  37041. x[i+6] = (l >> 8) & 0xff;
  37042. x[i+7] = l & 0xff;
  37043. }
  37044. function vn(x, xi, y, yi, n) {
  37045. var i,d = 0;
  37046. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37047. return (1 & ((d - 1) >>> 8)) - 1;
  37048. }
  37049. function crypto_verify_16(x, xi, y, yi) {
  37050. return vn(x,xi,y,yi,16);
  37051. }
  37052. function crypto_verify_32(x, xi, y, yi) {
  37053. return vn(x,xi,y,yi,32);
  37054. }
  37055. function core_salsa20(o, p, k, c) {
  37056. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37057. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37058. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37059. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37060. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37061. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37062. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37063. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37064. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37065. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37066. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37067. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37068. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37069. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37070. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37071. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37072. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37073. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37074. x15 = j15, u;
  37075. for (var i = 0; i < 20; i += 2) {
  37076. u = x0 + x12 | 0;
  37077. x4 ^= u<<7 | u>>>(32-7);
  37078. u = x4 + x0 | 0;
  37079. x8 ^= u<<9 | u>>>(32-9);
  37080. u = x8 + x4 | 0;
  37081. x12 ^= u<<13 | u>>>(32-13);
  37082. u = x12 + x8 | 0;
  37083. x0 ^= u<<18 | u>>>(32-18);
  37084. u = x5 + x1 | 0;
  37085. x9 ^= u<<7 | u>>>(32-7);
  37086. u = x9 + x5 | 0;
  37087. x13 ^= u<<9 | u>>>(32-9);
  37088. u = x13 + x9 | 0;
  37089. x1 ^= u<<13 | u>>>(32-13);
  37090. u = x1 + x13 | 0;
  37091. x5 ^= u<<18 | u>>>(32-18);
  37092. u = x10 + x6 | 0;
  37093. x14 ^= u<<7 | u>>>(32-7);
  37094. u = x14 + x10 | 0;
  37095. x2 ^= u<<9 | u>>>(32-9);
  37096. u = x2 + x14 | 0;
  37097. x6 ^= u<<13 | u>>>(32-13);
  37098. u = x6 + x2 | 0;
  37099. x10 ^= u<<18 | u>>>(32-18);
  37100. u = x15 + x11 | 0;
  37101. x3 ^= u<<7 | u>>>(32-7);
  37102. u = x3 + x15 | 0;
  37103. x7 ^= u<<9 | u>>>(32-9);
  37104. u = x7 + x3 | 0;
  37105. x11 ^= u<<13 | u>>>(32-13);
  37106. u = x11 + x7 | 0;
  37107. x15 ^= u<<18 | u>>>(32-18);
  37108. u = x0 + x3 | 0;
  37109. x1 ^= u<<7 | u>>>(32-7);
  37110. u = x1 + x0 | 0;
  37111. x2 ^= u<<9 | u>>>(32-9);
  37112. u = x2 + x1 | 0;
  37113. x3 ^= u<<13 | u>>>(32-13);
  37114. u = x3 + x2 | 0;
  37115. x0 ^= u<<18 | u>>>(32-18);
  37116. u = x5 + x4 | 0;
  37117. x6 ^= u<<7 | u>>>(32-7);
  37118. u = x6 + x5 | 0;
  37119. x7 ^= u<<9 | u>>>(32-9);
  37120. u = x7 + x6 | 0;
  37121. x4 ^= u<<13 | u>>>(32-13);
  37122. u = x4 + x7 | 0;
  37123. x5 ^= u<<18 | u>>>(32-18);
  37124. u = x10 + x9 | 0;
  37125. x11 ^= u<<7 | u>>>(32-7);
  37126. u = x11 + x10 | 0;
  37127. x8 ^= u<<9 | u>>>(32-9);
  37128. u = x8 + x11 | 0;
  37129. x9 ^= u<<13 | u>>>(32-13);
  37130. u = x9 + x8 | 0;
  37131. x10 ^= u<<18 | u>>>(32-18);
  37132. u = x15 + x14 | 0;
  37133. x12 ^= u<<7 | u>>>(32-7);
  37134. u = x12 + x15 | 0;
  37135. x13 ^= u<<9 | u>>>(32-9);
  37136. u = x13 + x12 | 0;
  37137. x14 ^= u<<13 | u>>>(32-13);
  37138. u = x14 + x13 | 0;
  37139. x15 ^= u<<18 | u>>>(32-18);
  37140. }
  37141. x0 = x0 + j0 | 0;
  37142. x1 = x1 + j1 | 0;
  37143. x2 = x2 + j2 | 0;
  37144. x3 = x3 + j3 | 0;
  37145. x4 = x4 + j4 | 0;
  37146. x5 = x5 + j5 | 0;
  37147. x6 = x6 + j6 | 0;
  37148. x7 = x7 + j7 | 0;
  37149. x8 = x8 + j8 | 0;
  37150. x9 = x9 + j9 | 0;
  37151. x10 = x10 + j10 | 0;
  37152. x11 = x11 + j11 | 0;
  37153. x12 = x12 + j12 | 0;
  37154. x13 = x13 + j13 | 0;
  37155. x14 = x14 + j14 | 0;
  37156. x15 = x15 + j15 | 0;
  37157. o[ 0] = x0 >>> 0 & 0xff;
  37158. o[ 1] = x0 >>> 8 & 0xff;
  37159. o[ 2] = x0 >>> 16 & 0xff;
  37160. o[ 3] = x0 >>> 24 & 0xff;
  37161. o[ 4] = x1 >>> 0 & 0xff;
  37162. o[ 5] = x1 >>> 8 & 0xff;
  37163. o[ 6] = x1 >>> 16 & 0xff;
  37164. o[ 7] = x1 >>> 24 & 0xff;
  37165. o[ 8] = x2 >>> 0 & 0xff;
  37166. o[ 9] = x2 >>> 8 & 0xff;
  37167. o[10] = x2 >>> 16 & 0xff;
  37168. o[11] = x2 >>> 24 & 0xff;
  37169. o[12] = x3 >>> 0 & 0xff;
  37170. o[13] = x3 >>> 8 & 0xff;
  37171. o[14] = x3 >>> 16 & 0xff;
  37172. o[15] = x3 >>> 24 & 0xff;
  37173. o[16] = x4 >>> 0 & 0xff;
  37174. o[17] = x4 >>> 8 & 0xff;
  37175. o[18] = x4 >>> 16 & 0xff;
  37176. o[19] = x4 >>> 24 & 0xff;
  37177. o[20] = x5 >>> 0 & 0xff;
  37178. o[21] = x5 >>> 8 & 0xff;
  37179. o[22] = x5 >>> 16 & 0xff;
  37180. o[23] = x5 >>> 24 & 0xff;
  37181. o[24] = x6 >>> 0 & 0xff;
  37182. o[25] = x6 >>> 8 & 0xff;
  37183. o[26] = x6 >>> 16 & 0xff;
  37184. o[27] = x6 >>> 24 & 0xff;
  37185. o[28] = x7 >>> 0 & 0xff;
  37186. o[29] = x7 >>> 8 & 0xff;
  37187. o[30] = x7 >>> 16 & 0xff;
  37188. o[31] = x7 >>> 24 & 0xff;
  37189. o[32] = x8 >>> 0 & 0xff;
  37190. o[33] = x8 >>> 8 & 0xff;
  37191. o[34] = x8 >>> 16 & 0xff;
  37192. o[35] = x8 >>> 24 & 0xff;
  37193. o[36] = x9 >>> 0 & 0xff;
  37194. o[37] = x9 >>> 8 & 0xff;
  37195. o[38] = x9 >>> 16 & 0xff;
  37196. o[39] = x9 >>> 24 & 0xff;
  37197. o[40] = x10 >>> 0 & 0xff;
  37198. o[41] = x10 >>> 8 & 0xff;
  37199. o[42] = x10 >>> 16 & 0xff;
  37200. o[43] = x10 >>> 24 & 0xff;
  37201. o[44] = x11 >>> 0 & 0xff;
  37202. o[45] = x11 >>> 8 & 0xff;
  37203. o[46] = x11 >>> 16 & 0xff;
  37204. o[47] = x11 >>> 24 & 0xff;
  37205. o[48] = x12 >>> 0 & 0xff;
  37206. o[49] = x12 >>> 8 & 0xff;
  37207. o[50] = x12 >>> 16 & 0xff;
  37208. o[51] = x12 >>> 24 & 0xff;
  37209. o[52] = x13 >>> 0 & 0xff;
  37210. o[53] = x13 >>> 8 & 0xff;
  37211. o[54] = x13 >>> 16 & 0xff;
  37212. o[55] = x13 >>> 24 & 0xff;
  37213. o[56] = x14 >>> 0 & 0xff;
  37214. o[57] = x14 >>> 8 & 0xff;
  37215. o[58] = x14 >>> 16 & 0xff;
  37216. o[59] = x14 >>> 24 & 0xff;
  37217. o[60] = x15 >>> 0 & 0xff;
  37218. o[61] = x15 >>> 8 & 0xff;
  37219. o[62] = x15 >>> 16 & 0xff;
  37220. o[63] = x15 >>> 24 & 0xff;
  37221. }
  37222. function core_hsalsa20(o,p,k,c) {
  37223. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37224. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37225. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37226. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37227. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37228. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37229. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37230. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37231. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37232. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37233. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37234. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37235. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37236. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37237. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37238. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37239. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37240. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37241. x15 = j15, u;
  37242. for (var i = 0; i < 20; i += 2) {
  37243. u = x0 + x12 | 0;
  37244. x4 ^= u<<7 | u>>>(32-7);
  37245. u = x4 + x0 | 0;
  37246. x8 ^= u<<9 | u>>>(32-9);
  37247. u = x8 + x4 | 0;
  37248. x12 ^= u<<13 | u>>>(32-13);
  37249. u = x12 + x8 | 0;
  37250. x0 ^= u<<18 | u>>>(32-18);
  37251. u = x5 + x1 | 0;
  37252. x9 ^= u<<7 | u>>>(32-7);
  37253. u = x9 + x5 | 0;
  37254. x13 ^= u<<9 | u>>>(32-9);
  37255. u = x13 + x9 | 0;
  37256. x1 ^= u<<13 | u>>>(32-13);
  37257. u = x1 + x13 | 0;
  37258. x5 ^= u<<18 | u>>>(32-18);
  37259. u = x10 + x6 | 0;
  37260. x14 ^= u<<7 | u>>>(32-7);
  37261. u = x14 + x10 | 0;
  37262. x2 ^= u<<9 | u>>>(32-9);
  37263. u = x2 + x14 | 0;
  37264. x6 ^= u<<13 | u>>>(32-13);
  37265. u = x6 + x2 | 0;
  37266. x10 ^= u<<18 | u>>>(32-18);
  37267. u = x15 + x11 | 0;
  37268. x3 ^= u<<7 | u>>>(32-7);
  37269. u = x3 + x15 | 0;
  37270. x7 ^= u<<9 | u>>>(32-9);
  37271. u = x7 + x3 | 0;
  37272. x11 ^= u<<13 | u>>>(32-13);
  37273. u = x11 + x7 | 0;
  37274. x15 ^= u<<18 | u>>>(32-18);
  37275. u = x0 + x3 | 0;
  37276. x1 ^= u<<7 | u>>>(32-7);
  37277. u = x1 + x0 | 0;
  37278. x2 ^= u<<9 | u>>>(32-9);
  37279. u = x2 + x1 | 0;
  37280. x3 ^= u<<13 | u>>>(32-13);
  37281. u = x3 + x2 | 0;
  37282. x0 ^= u<<18 | u>>>(32-18);
  37283. u = x5 + x4 | 0;
  37284. x6 ^= u<<7 | u>>>(32-7);
  37285. u = x6 + x5 | 0;
  37286. x7 ^= u<<9 | u>>>(32-9);
  37287. u = x7 + x6 | 0;
  37288. x4 ^= u<<13 | u>>>(32-13);
  37289. u = x4 + x7 | 0;
  37290. x5 ^= u<<18 | u>>>(32-18);
  37291. u = x10 + x9 | 0;
  37292. x11 ^= u<<7 | u>>>(32-7);
  37293. u = x11 + x10 | 0;
  37294. x8 ^= u<<9 | u>>>(32-9);
  37295. u = x8 + x11 | 0;
  37296. x9 ^= u<<13 | u>>>(32-13);
  37297. u = x9 + x8 | 0;
  37298. x10 ^= u<<18 | u>>>(32-18);
  37299. u = x15 + x14 | 0;
  37300. x12 ^= u<<7 | u>>>(32-7);
  37301. u = x12 + x15 | 0;
  37302. x13 ^= u<<9 | u>>>(32-9);
  37303. u = x13 + x12 | 0;
  37304. x14 ^= u<<13 | u>>>(32-13);
  37305. u = x14 + x13 | 0;
  37306. x15 ^= u<<18 | u>>>(32-18);
  37307. }
  37308. o[ 0] = x0 >>> 0 & 0xff;
  37309. o[ 1] = x0 >>> 8 & 0xff;
  37310. o[ 2] = x0 >>> 16 & 0xff;
  37311. o[ 3] = x0 >>> 24 & 0xff;
  37312. o[ 4] = x5 >>> 0 & 0xff;
  37313. o[ 5] = x5 >>> 8 & 0xff;
  37314. o[ 6] = x5 >>> 16 & 0xff;
  37315. o[ 7] = x5 >>> 24 & 0xff;
  37316. o[ 8] = x10 >>> 0 & 0xff;
  37317. o[ 9] = x10 >>> 8 & 0xff;
  37318. o[10] = x10 >>> 16 & 0xff;
  37319. o[11] = x10 >>> 24 & 0xff;
  37320. o[12] = x15 >>> 0 & 0xff;
  37321. o[13] = x15 >>> 8 & 0xff;
  37322. o[14] = x15 >>> 16 & 0xff;
  37323. o[15] = x15 >>> 24 & 0xff;
  37324. o[16] = x6 >>> 0 & 0xff;
  37325. o[17] = x6 >>> 8 & 0xff;
  37326. o[18] = x6 >>> 16 & 0xff;
  37327. o[19] = x6 >>> 24 & 0xff;
  37328. o[20] = x7 >>> 0 & 0xff;
  37329. o[21] = x7 >>> 8 & 0xff;
  37330. o[22] = x7 >>> 16 & 0xff;
  37331. o[23] = x7 >>> 24 & 0xff;
  37332. o[24] = x8 >>> 0 & 0xff;
  37333. o[25] = x8 >>> 8 & 0xff;
  37334. o[26] = x8 >>> 16 & 0xff;
  37335. o[27] = x8 >>> 24 & 0xff;
  37336. o[28] = x9 >>> 0 & 0xff;
  37337. o[29] = x9 >>> 8 & 0xff;
  37338. o[30] = x9 >>> 16 & 0xff;
  37339. o[31] = x9 >>> 24 & 0xff;
  37340. }
  37341. function crypto_core_salsa20(out,inp,k,c) {
  37342. core_salsa20(out,inp,k,c);
  37343. }
  37344. function crypto_core_hsalsa20(out,inp,k,c) {
  37345. core_hsalsa20(out,inp,k,c);
  37346. }
  37347. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37348. // "expand 32-byte k"
  37349. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37350. var z = new Uint8Array(16), x = new Uint8Array(64);
  37351. var u, i;
  37352. for (i = 0; i < 16; i++) z[i] = 0;
  37353. for (i = 0; i < 8; i++) z[i] = n[i];
  37354. while (b >= 64) {
  37355. crypto_core_salsa20(x,z,k,sigma);
  37356. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37357. u = 1;
  37358. for (i = 8; i < 16; i++) {
  37359. u = u + (z[i] & 0xff) | 0;
  37360. z[i] = u & 0xff;
  37361. u >>>= 8;
  37362. }
  37363. b -= 64;
  37364. cpos += 64;
  37365. mpos += 64;
  37366. }
  37367. if (b > 0) {
  37368. crypto_core_salsa20(x,z,k,sigma);
  37369. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37370. }
  37371. return 0;
  37372. }
  37373. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37374. var z = new Uint8Array(16), x = new Uint8Array(64);
  37375. var u, i;
  37376. for (i = 0; i < 16; i++) z[i] = 0;
  37377. for (i = 0; i < 8; i++) z[i] = n[i];
  37378. while (b >= 64) {
  37379. crypto_core_salsa20(x,z,k,sigma);
  37380. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37381. u = 1;
  37382. for (i = 8; i < 16; i++) {
  37383. u = u + (z[i] & 0xff) | 0;
  37384. z[i] = u & 0xff;
  37385. u >>>= 8;
  37386. }
  37387. b -= 64;
  37388. cpos += 64;
  37389. }
  37390. if (b > 0) {
  37391. crypto_core_salsa20(x,z,k,sigma);
  37392. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37393. }
  37394. return 0;
  37395. }
  37396. function crypto_stream(c,cpos,d,n,k) {
  37397. var s = new Uint8Array(32);
  37398. crypto_core_hsalsa20(s,n,k,sigma);
  37399. var sn = new Uint8Array(8);
  37400. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37401. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37402. }
  37403. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37404. var s = new Uint8Array(32);
  37405. crypto_core_hsalsa20(s,n,k,sigma);
  37406. var sn = new Uint8Array(8);
  37407. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37408. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37409. }
  37410. /*
  37411. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37412. * https://github.com/floodyberry/poly1305-donna
  37413. */
  37414. var poly1305 = function(key) {
  37415. this.buffer = new Uint8Array(16);
  37416. this.r = new Uint16Array(10);
  37417. this.h = new Uint16Array(10);
  37418. this.pad = new Uint16Array(8);
  37419. this.leftover = 0;
  37420. this.fin = 0;
  37421. var t0, t1, t2, t3, t4, t5, t6, t7;
  37422. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37423. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37424. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37425. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37426. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37427. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37428. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37429. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37430. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37431. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37432. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37433. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37434. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37435. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37436. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37437. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37438. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37439. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37440. };
  37441. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37442. var hibit = this.fin ? 0 : (1 << 11);
  37443. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37444. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37445. var h0 = this.h[0],
  37446. h1 = this.h[1],
  37447. h2 = this.h[2],
  37448. h3 = this.h[3],
  37449. h4 = this.h[4],
  37450. h5 = this.h[5],
  37451. h6 = this.h[6],
  37452. h7 = this.h[7],
  37453. h8 = this.h[8],
  37454. h9 = this.h[9];
  37455. var r0 = this.r[0],
  37456. r1 = this.r[1],
  37457. r2 = this.r[2],
  37458. r3 = this.r[3],
  37459. r4 = this.r[4],
  37460. r5 = this.r[5],
  37461. r6 = this.r[6],
  37462. r7 = this.r[7],
  37463. r8 = this.r[8],
  37464. r9 = this.r[9];
  37465. while (bytes >= 16) {
  37466. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37467. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37468. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37469. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37470. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37471. h5 += ((t4 >>> 1)) & 0x1fff;
  37472. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37473. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37474. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37475. h9 += ((t7 >>> 5)) | hibit;
  37476. c = 0;
  37477. d0 = c;
  37478. d0 += h0 * r0;
  37479. d0 += h1 * (5 * r9);
  37480. d0 += h2 * (5 * r8);
  37481. d0 += h3 * (5 * r7);
  37482. d0 += h4 * (5 * r6);
  37483. c = (d0 >>> 13); d0 &= 0x1fff;
  37484. d0 += h5 * (5 * r5);
  37485. d0 += h6 * (5 * r4);
  37486. d0 += h7 * (5 * r3);
  37487. d0 += h8 * (5 * r2);
  37488. d0 += h9 * (5 * r1);
  37489. c += (d0 >>> 13); d0 &= 0x1fff;
  37490. d1 = c;
  37491. d1 += h0 * r1;
  37492. d1 += h1 * r0;
  37493. d1 += h2 * (5 * r9);
  37494. d1 += h3 * (5 * r8);
  37495. d1 += h4 * (5 * r7);
  37496. c = (d1 >>> 13); d1 &= 0x1fff;
  37497. d1 += h5 * (5 * r6);
  37498. d1 += h6 * (5 * r5);
  37499. d1 += h7 * (5 * r4);
  37500. d1 += h8 * (5 * r3);
  37501. d1 += h9 * (5 * r2);
  37502. c += (d1 >>> 13); d1 &= 0x1fff;
  37503. d2 = c;
  37504. d2 += h0 * r2;
  37505. d2 += h1 * r1;
  37506. d2 += h2 * r0;
  37507. d2 += h3 * (5 * r9);
  37508. d2 += h4 * (5 * r8);
  37509. c = (d2 >>> 13); d2 &= 0x1fff;
  37510. d2 += h5 * (5 * r7);
  37511. d2 += h6 * (5 * r6);
  37512. d2 += h7 * (5 * r5);
  37513. d2 += h8 * (5 * r4);
  37514. d2 += h9 * (5 * r3);
  37515. c += (d2 >>> 13); d2 &= 0x1fff;
  37516. d3 = c;
  37517. d3 += h0 * r3;
  37518. d3 += h1 * r2;
  37519. d3 += h2 * r1;
  37520. d3 += h3 * r0;
  37521. d3 += h4 * (5 * r9);
  37522. c = (d3 >>> 13); d3 &= 0x1fff;
  37523. d3 += h5 * (5 * r8);
  37524. d3 += h6 * (5 * r7);
  37525. d3 += h7 * (5 * r6);
  37526. d3 += h8 * (5 * r5);
  37527. d3 += h9 * (5 * r4);
  37528. c += (d3 >>> 13); d3 &= 0x1fff;
  37529. d4 = c;
  37530. d4 += h0 * r4;
  37531. d4 += h1 * r3;
  37532. d4 += h2 * r2;
  37533. d4 += h3 * r1;
  37534. d4 += h4 * r0;
  37535. c = (d4 >>> 13); d4 &= 0x1fff;
  37536. d4 += h5 * (5 * r9);
  37537. d4 += h6 * (5 * r8);
  37538. d4 += h7 * (5 * r7);
  37539. d4 += h8 * (5 * r6);
  37540. d4 += h9 * (5 * r5);
  37541. c += (d4 >>> 13); d4 &= 0x1fff;
  37542. d5 = c;
  37543. d5 += h0 * r5;
  37544. d5 += h1 * r4;
  37545. d5 += h2 * r3;
  37546. d5 += h3 * r2;
  37547. d5 += h4 * r1;
  37548. c = (d5 >>> 13); d5 &= 0x1fff;
  37549. d5 += h5 * r0;
  37550. d5 += h6 * (5 * r9);
  37551. d5 += h7 * (5 * r8);
  37552. d5 += h8 * (5 * r7);
  37553. d5 += h9 * (5 * r6);
  37554. c += (d5 >>> 13); d5 &= 0x1fff;
  37555. d6 = c;
  37556. d6 += h0 * r6;
  37557. d6 += h1 * r5;
  37558. d6 += h2 * r4;
  37559. d6 += h3 * r3;
  37560. d6 += h4 * r2;
  37561. c = (d6 >>> 13); d6 &= 0x1fff;
  37562. d6 += h5 * r1;
  37563. d6 += h6 * r0;
  37564. d6 += h7 * (5 * r9);
  37565. d6 += h8 * (5 * r8);
  37566. d6 += h9 * (5 * r7);
  37567. c += (d6 >>> 13); d6 &= 0x1fff;
  37568. d7 = c;
  37569. d7 += h0 * r7;
  37570. d7 += h1 * r6;
  37571. d7 += h2 * r5;
  37572. d7 += h3 * r4;
  37573. d7 += h4 * r3;
  37574. c = (d7 >>> 13); d7 &= 0x1fff;
  37575. d7 += h5 * r2;
  37576. d7 += h6 * r1;
  37577. d7 += h7 * r0;
  37578. d7 += h8 * (5 * r9);
  37579. d7 += h9 * (5 * r8);
  37580. c += (d7 >>> 13); d7 &= 0x1fff;
  37581. d8 = c;
  37582. d8 += h0 * r8;
  37583. d8 += h1 * r7;
  37584. d8 += h2 * r6;
  37585. d8 += h3 * r5;
  37586. d8 += h4 * r4;
  37587. c = (d8 >>> 13); d8 &= 0x1fff;
  37588. d8 += h5 * r3;
  37589. d8 += h6 * r2;
  37590. d8 += h7 * r1;
  37591. d8 += h8 * r0;
  37592. d8 += h9 * (5 * r9);
  37593. c += (d8 >>> 13); d8 &= 0x1fff;
  37594. d9 = c;
  37595. d9 += h0 * r9;
  37596. d9 += h1 * r8;
  37597. d9 += h2 * r7;
  37598. d9 += h3 * r6;
  37599. d9 += h4 * r5;
  37600. c = (d9 >>> 13); d9 &= 0x1fff;
  37601. d9 += h5 * r4;
  37602. d9 += h6 * r3;
  37603. d9 += h7 * r2;
  37604. d9 += h8 * r1;
  37605. d9 += h9 * r0;
  37606. c += (d9 >>> 13); d9 &= 0x1fff;
  37607. c = (((c << 2) + c)) | 0;
  37608. c = (c + d0) | 0;
  37609. d0 = c & 0x1fff;
  37610. c = (c >>> 13);
  37611. d1 += c;
  37612. h0 = d0;
  37613. h1 = d1;
  37614. h2 = d2;
  37615. h3 = d3;
  37616. h4 = d4;
  37617. h5 = d5;
  37618. h6 = d6;
  37619. h7 = d7;
  37620. h8 = d8;
  37621. h9 = d9;
  37622. mpos += 16;
  37623. bytes -= 16;
  37624. }
  37625. this.h[0] = h0;
  37626. this.h[1] = h1;
  37627. this.h[2] = h2;
  37628. this.h[3] = h3;
  37629. this.h[4] = h4;
  37630. this.h[5] = h5;
  37631. this.h[6] = h6;
  37632. this.h[7] = h7;
  37633. this.h[8] = h8;
  37634. this.h[9] = h9;
  37635. };
  37636. poly1305.prototype.finish = function(mac, macpos) {
  37637. var g = new Uint16Array(10);
  37638. var c, mask, f, i;
  37639. if (this.leftover) {
  37640. i = this.leftover;
  37641. this.buffer[i++] = 1;
  37642. for (; i < 16; i++) this.buffer[i] = 0;
  37643. this.fin = 1;
  37644. this.blocks(this.buffer, 0, 16);
  37645. }
  37646. c = this.h[1] >>> 13;
  37647. this.h[1] &= 0x1fff;
  37648. for (i = 2; i < 10; i++) {
  37649. this.h[i] += c;
  37650. c = this.h[i] >>> 13;
  37651. this.h[i] &= 0x1fff;
  37652. }
  37653. this.h[0] += (c * 5);
  37654. c = this.h[0] >>> 13;
  37655. this.h[0] &= 0x1fff;
  37656. this.h[1] += c;
  37657. c = this.h[1] >>> 13;
  37658. this.h[1] &= 0x1fff;
  37659. this.h[2] += c;
  37660. g[0] = this.h[0] + 5;
  37661. c = g[0] >>> 13;
  37662. g[0] &= 0x1fff;
  37663. for (i = 1; i < 10; i++) {
  37664. g[i] = this.h[i] + c;
  37665. c = g[i] >>> 13;
  37666. g[i] &= 0x1fff;
  37667. }
  37668. g[9] -= (1 << 13);
  37669. mask = (c ^ 1) - 1;
  37670. for (i = 0; i < 10; i++) g[i] &= mask;
  37671. mask = ~mask;
  37672. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37673. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37674. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37675. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37676. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37677. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37678. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37679. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37680. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37681. f = this.h[0] + this.pad[0];
  37682. this.h[0] = f & 0xffff;
  37683. for (i = 1; i < 8; i++) {
  37684. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37685. this.h[i] = f & 0xffff;
  37686. }
  37687. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37688. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37689. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37690. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37691. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37692. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37693. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37694. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37695. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37696. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37697. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37698. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37699. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37700. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37701. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37702. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37703. };
  37704. poly1305.prototype.update = function(m, mpos, bytes) {
  37705. var i, want;
  37706. if (this.leftover) {
  37707. want = (16 - this.leftover);
  37708. if (want > bytes)
  37709. want = bytes;
  37710. for (i = 0; i < want; i++)
  37711. this.buffer[this.leftover + i] = m[mpos+i];
  37712. bytes -= want;
  37713. mpos += want;
  37714. this.leftover += want;
  37715. if (this.leftover < 16)
  37716. return;
  37717. this.blocks(this.buffer, 0, 16);
  37718. this.leftover = 0;
  37719. }
  37720. if (bytes >= 16) {
  37721. want = bytes - (bytes % 16);
  37722. this.blocks(m, mpos, want);
  37723. mpos += want;
  37724. bytes -= want;
  37725. }
  37726. if (bytes) {
  37727. for (i = 0; i < bytes; i++)
  37728. this.buffer[this.leftover + i] = m[mpos+i];
  37729. this.leftover += bytes;
  37730. }
  37731. };
  37732. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37733. var s = new poly1305(k);
  37734. s.update(m, mpos, n);
  37735. s.finish(out, outpos);
  37736. return 0;
  37737. }
  37738. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37739. var x = new Uint8Array(16);
  37740. crypto_onetimeauth(x,0,m,mpos,n,k);
  37741. return crypto_verify_16(h,hpos,x,0);
  37742. }
  37743. function crypto_secretbox(c,m,d,n,k) {
  37744. var i;
  37745. if (d < 32) return -1;
  37746. crypto_stream_xor(c,0,m,0,d,n,k);
  37747. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37748. for (i = 0; i < 16; i++) c[i] = 0;
  37749. return 0;
  37750. }
  37751. function crypto_secretbox_open(m,c,d,n,k) {
  37752. var i;
  37753. var x = new Uint8Array(32);
  37754. if (d < 32) return -1;
  37755. crypto_stream(x,0,32,n,k);
  37756. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37757. crypto_stream_xor(m,0,c,0,d,n,k);
  37758. for (i = 0; i < 32; i++) m[i] = 0;
  37759. return 0;
  37760. }
  37761. function set25519(r, a) {
  37762. var i;
  37763. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37764. }
  37765. function car25519(o) {
  37766. var i, v, c = 1;
  37767. for (i = 0; i < 16; i++) {
  37768. v = o[i] + c + 65535;
  37769. c = Math.floor(v / 65536);
  37770. o[i] = v - c * 65536;
  37771. }
  37772. o[0] += c-1 + 37 * (c-1);
  37773. }
  37774. function sel25519(p, q, b) {
  37775. var t, c = ~(b-1);
  37776. for (var i = 0; i < 16; i++) {
  37777. t = c & (p[i] ^ q[i]);
  37778. p[i] ^= t;
  37779. q[i] ^= t;
  37780. }
  37781. }
  37782. function pack25519(o, n) {
  37783. var i, j, b;
  37784. var m = gf(), t = gf();
  37785. for (i = 0; i < 16; i++) t[i] = n[i];
  37786. car25519(t);
  37787. car25519(t);
  37788. car25519(t);
  37789. for (j = 0; j < 2; j++) {
  37790. m[0] = t[0] - 0xffed;
  37791. for (i = 1; i < 15; i++) {
  37792. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37793. m[i-1] &= 0xffff;
  37794. }
  37795. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37796. b = (m[15]>>16) & 1;
  37797. m[14] &= 0xffff;
  37798. sel25519(t, m, 1-b);
  37799. }
  37800. for (i = 0; i < 16; i++) {
  37801. o[2*i] = t[i] & 0xff;
  37802. o[2*i+1] = t[i]>>8;
  37803. }
  37804. }
  37805. function neq25519(a, b) {
  37806. var c = new Uint8Array(32), d = new Uint8Array(32);
  37807. pack25519(c, a);
  37808. pack25519(d, b);
  37809. return crypto_verify_32(c, 0, d, 0);
  37810. }
  37811. function par25519(a) {
  37812. var d = new Uint8Array(32);
  37813. pack25519(d, a);
  37814. return d[0] & 1;
  37815. }
  37816. function unpack25519(o, n) {
  37817. var i;
  37818. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37819. o[15] &= 0x7fff;
  37820. }
  37821. function A(o, a, b) {
  37822. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37823. }
  37824. function Z(o, a, b) {
  37825. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37826. }
  37827. function M(o, a, b) {
  37828. var v, c,
  37829. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37830. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37831. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37832. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37833. b0 = b[0],
  37834. b1 = b[1],
  37835. b2 = b[2],
  37836. b3 = b[3],
  37837. b4 = b[4],
  37838. b5 = b[5],
  37839. b6 = b[6],
  37840. b7 = b[7],
  37841. b8 = b[8],
  37842. b9 = b[9],
  37843. b10 = b[10],
  37844. b11 = b[11],
  37845. b12 = b[12],
  37846. b13 = b[13],
  37847. b14 = b[14],
  37848. b15 = b[15];
  37849. v = a[0];
  37850. t0 += v * b0;
  37851. t1 += v * b1;
  37852. t2 += v * b2;
  37853. t3 += v * b3;
  37854. t4 += v * b4;
  37855. t5 += v * b5;
  37856. t6 += v * b6;
  37857. t7 += v * b7;
  37858. t8 += v * b8;
  37859. t9 += v * b9;
  37860. t10 += v * b10;
  37861. t11 += v * b11;
  37862. t12 += v * b12;
  37863. t13 += v * b13;
  37864. t14 += v * b14;
  37865. t15 += v * b15;
  37866. v = a[1];
  37867. t1 += v * b0;
  37868. t2 += v * b1;
  37869. t3 += v * b2;
  37870. t4 += v * b3;
  37871. t5 += v * b4;
  37872. t6 += v * b5;
  37873. t7 += v * b6;
  37874. t8 += v * b7;
  37875. t9 += v * b8;
  37876. t10 += v * b9;
  37877. t11 += v * b10;
  37878. t12 += v * b11;
  37879. t13 += v * b12;
  37880. t14 += v * b13;
  37881. t15 += v * b14;
  37882. t16 += v * b15;
  37883. v = a[2];
  37884. t2 += v * b0;
  37885. t3 += v * b1;
  37886. t4 += v * b2;
  37887. t5 += v * b3;
  37888. t6 += v * b4;
  37889. t7 += v * b5;
  37890. t8 += v * b6;
  37891. t9 += v * b7;
  37892. t10 += v * b8;
  37893. t11 += v * b9;
  37894. t12 += v * b10;
  37895. t13 += v * b11;
  37896. t14 += v * b12;
  37897. t15 += v * b13;
  37898. t16 += v * b14;
  37899. t17 += v * b15;
  37900. v = a[3];
  37901. t3 += v * b0;
  37902. t4 += v * b1;
  37903. t5 += v * b2;
  37904. t6 += v * b3;
  37905. t7 += v * b4;
  37906. t8 += v * b5;
  37907. t9 += v * b6;
  37908. t10 += v * b7;
  37909. t11 += v * b8;
  37910. t12 += v * b9;
  37911. t13 += v * b10;
  37912. t14 += v * b11;
  37913. t15 += v * b12;
  37914. t16 += v * b13;
  37915. t17 += v * b14;
  37916. t18 += v * b15;
  37917. v = a[4];
  37918. t4 += v * b0;
  37919. t5 += v * b1;
  37920. t6 += v * b2;
  37921. t7 += v * b3;
  37922. t8 += v * b4;
  37923. t9 += v * b5;
  37924. t10 += v * b6;
  37925. t11 += v * b7;
  37926. t12 += v * b8;
  37927. t13 += v * b9;
  37928. t14 += v * b10;
  37929. t15 += v * b11;
  37930. t16 += v * b12;
  37931. t17 += v * b13;
  37932. t18 += v * b14;
  37933. t19 += v * b15;
  37934. v = a[5];
  37935. t5 += v * b0;
  37936. t6 += v * b1;
  37937. t7 += v * b2;
  37938. t8 += v * b3;
  37939. t9 += v * b4;
  37940. t10 += v * b5;
  37941. t11 += v * b6;
  37942. t12 += v * b7;
  37943. t13 += v * b8;
  37944. t14 += v * b9;
  37945. t15 += v * b10;
  37946. t16 += v * b11;
  37947. t17 += v * b12;
  37948. t18 += v * b13;
  37949. t19 += v * b14;
  37950. t20 += v * b15;
  37951. v = a[6];
  37952. t6 += v * b0;
  37953. t7 += v * b1;
  37954. t8 += v * b2;
  37955. t9 += v * b3;
  37956. t10 += v * b4;
  37957. t11 += v * b5;
  37958. t12 += v * b6;
  37959. t13 += v * b7;
  37960. t14 += v * b8;
  37961. t15 += v * b9;
  37962. t16 += v * b10;
  37963. t17 += v * b11;
  37964. t18 += v * b12;
  37965. t19 += v * b13;
  37966. t20 += v * b14;
  37967. t21 += v * b15;
  37968. v = a[7];
  37969. t7 += v * b0;
  37970. t8 += v * b1;
  37971. t9 += v * b2;
  37972. t10 += v * b3;
  37973. t11 += v * b4;
  37974. t12 += v * b5;
  37975. t13 += v * b6;
  37976. t14 += v * b7;
  37977. t15 += v * b8;
  37978. t16 += v * b9;
  37979. t17 += v * b10;
  37980. t18 += v * b11;
  37981. t19 += v * b12;
  37982. t20 += v * b13;
  37983. t21 += v * b14;
  37984. t22 += v * b15;
  37985. v = a[8];
  37986. t8 += v * b0;
  37987. t9 += v * b1;
  37988. t10 += v * b2;
  37989. t11 += v * b3;
  37990. t12 += v * b4;
  37991. t13 += v * b5;
  37992. t14 += v * b6;
  37993. t15 += v * b7;
  37994. t16 += v * b8;
  37995. t17 += v * b9;
  37996. t18 += v * b10;
  37997. t19 += v * b11;
  37998. t20 += v * b12;
  37999. t21 += v * b13;
  38000. t22 += v * b14;
  38001. t23 += v * b15;
  38002. v = a[9];
  38003. t9 += v * b0;
  38004. t10 += v * b1;
  38005. t11 += v * b2;
  38006. t12 += v * b3;
  38007. t13 += v * b4;
  38008. t14 += v * b5;
  38009. t15 += v * b6;
  38010. t16 += v * b7;
  38011. t17 += v * b8;
  38012. t18 += v * b9;
  38013. t19 += v * b10;
  38014. t20 += v * b11;
  38015. t21 += v * b12;
  38016. t22 += v * b13;
  38017. t23 += v * b14;
  38018. t24 += v * b15;
  38019. v = a[10];
  38020. t10 += v * b0;
  38021. t11 += v * b1;
  38022. t12 += v * b2;
  38023. t13 += v * b3;
  38024. t14 += v * b4;
  38025. t15 += v * b5;
  38026. t16 += v * b6;
  38027. t17 += v * b7;
  38028. t18 += v * b8;
  38029. t19 += v * b9;
  38030. t20 += v * b10;
  38031. t21 += v * b11;
  38032. t22 += v * b12;
  38033. t23 += v * b13;
  38034. t24 += v * b14;
  38035. t25 += v * b15;
  38036. v = a[11];
  38037. t11 += v * b0;
  38038. t12 += v * b1;
  38039. t13 += v * b2;
  38040. t14 += v * b3;
  38041. t15 += v * b4;
  38042. t16 += v * b5;
  38043. t17 += v * b6;
  38044. t18 += v * b7;
  38045. t19 += v * b8;
  38046. t20 += v * b9;
  38047. t21 += v * b10;
  38048. t22 += v * b11;
  38049. t23 += v * b12;
  38050. t24 += v * b13;
  38051. t25 += v * b14;
  38052. t26 += v * b15;
  38053. v = a[12];
  38054. t12 += v * b0;
  38055. t13 += v * b1;
  38056. t14 += v * b2;
  38057. t15 += v * b3;
  38058. t16 += v * b4;
  38059. t17 += v * b5;
  38060. t18 += v * b6;
  38061. t19 += v * b7;
  38062. t20 += v * b8;
  38063. t21 += v * b9;
  38064. t22 += v * b10;
  38065. t23 += v * b11;
  38066. t24 += v * b12;
  38067. t25 += v * b13;
  38068. t26 += v * b14;
  38069. t27 += v * b15;
  38070. v = a[13];
  38071. t13 += v * b0;
  38072. t14 += v * b1;
  38073. t15 += v * b2;
  38074. t16 += v * b3;
  38075. t17 += v * b4;
  38076. t18 += v * b5;
  38077. t19 += v * b6;
  38078. t20 += v * b7;
  38079. t21 += v * b8;
  38080. t22 += v * b9;
  38081. t23 += v * b10;
  38082. t24 += v * b11;
  38083. t25 += v * b12;
  38084. t26 += v * b13;
  38085. t27 += v * b14;
  38086. t28 += v * b15;
  38087. v = a[14];
  38088. t14 += v * b0;
  38089. t15 += v * b1;
  38090. t16 += v * b2;
  38091. t17 += v * b3;
  38092. t18 += v * b4;
  38093. t19 += v * b5;
  38094. t20 += v * b6;
  38095. t21 += v * b7;
  38096. t22 += v * b8;
  38097. t23 += v * b9;
  38098. t24 += v * b10;
  38099. t25 += v * b11;
  38100. t26 += v * b12;
  38101. t27 += v * b13;
  38102. t28 += v * b14;
  38103. t29 += v * b15;
  38104. v = a[15];
  38105. t15 += v * b0;
  38106. t16 += v * b1;
  38107. t17 += v * b2;
  38108. t18 += v * b3;
  38109. t19 += v * b4;
  38110. t20 += v * b5;
  38111. t21 += v * b6;
  38112. t22 += v * b7;
  38113. t23 += v * b8;
  38114. t24 += v * b9;
  38115. t25 += v * b10;
  38116. t26 += v * b11;
  38117. t27 += v * b12;
  38118. t28 += v * b13;
  38119. t29 += v * b14;
  38120. t30 += v * b15;
  38121. t0 += 38 * t16;
  38122. t1 += 38 * t17;
  38123. t2 += 38 * t18;
  38124. t3 += 38 * t19;
  38125. t4 += 38 * t20;
  38126. t5 += 38 * t21;
  38127. t6 += 38 * t22;
  38128. t7 += 38 * t23;
  38129. t8 += 38 * t24;
  38130. t9 += 38 * t25;
  38131. t10 += 38 * t26;
  38132. t11 += 38 * t27;
  38133. t12 += 38 * t28;
  38134. t13 += 38 * t29;
  38135. t14 += 38 * t30;
  38136. // t15 left as is
  38137. // first car
  38138. c = 1;
  38139. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38140. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38141. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38142. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38143. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38144. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38145. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38146. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38147. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38148. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38149. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38150. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38151. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38152. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38153. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38154. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38155. t0 += c-1 + 37 * (c-1);
  38156. // second car
  38157. c = 1;
  38158. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38159. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38160. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38161. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38162. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38163. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38164. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38165. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38166. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38167. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38168. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38169. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38170. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38171. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38172. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38173. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38174. t0 += c-1 + 37 * (c-1);
  38175. o[ 0] = t0;
  38176. o[ 1] = t1;
  38177. o[ 2] = t2;
  38178. o[ 3] = t3;
  38179. o[ 4] = t4;
  38180. o[ 5] = t5;
  38181. o[ 6] = t6;
  38182. o[ 7] = t7;
  38183. o[ 8] = t8;
  38184. o[ 9] = t9;
  38185. o[10] = t10;
  38186. o[11] = t11;
  38187. o[12] = t12;
  38188. o[13] = t13;
  38189. o[14] = t14;
  38190. o[15] = t15;
  38191. }
  38192. function S(o, a) {
  38193. M(o, a, a);
  38194. }
  38195. function inv25519(o, i) {
  38196. var c = gf();
  38197. var a;
  38198. for (a = 0; a < 16; a++) c[a] = i[a];
  38199. for (a = 253; a >= 0; a--) {
  38200. S(c, c);
  38201. if(a !== 2 && a !== 4) M(c, c, i);
  38202. }
  38203. for (a = 0; a < 16; a++) o[a] = c[a];
  38204. }
  38205. function pow2523(o, i) {
  38206. var c = gf();
  38207. var a;
  38208. for (a = 0; a < 16; a++) c[a] = i[a];
  38209. for (a = 250; a >= 0; a--) {
  38210. S(c, c);
  38211. if(a !== 1) M(c, c, i);
  38212. }
  38213. for (a = 0; a < 16; a++) o[a] = c[a];
  38214. }
  38215. function crypto_scalarmult(q, n, p) {
  38216. var z = new Uint8Array(32);
  38217. var x = new Float64Array(80), r, i;
  38218. var a = gf(), b = gf(), c = gf(),
  38219. d = gf(), e = gf(), f = gf();
  38220. for (i = 0; i < 31; i++) z[i] = n[i];
  38221. z[31]=(n[31]&127)|64;
  38222. z[0]&=248;
  38223. unpack25519(x,p);
  38224. for (i = 0; i < 16; i++) {
  38225. b[i]=x[i];
  38226. d[i]=a[i]=c[i]=0;
  38227. }
  38228. a[0]=d[0]=1;
  38229. for (i=254; i>=0; --i) {
  38230. r=(z[i>>>3]>>>(i&7))&1;
  38231. sel25519(a,b,r);
  38232. sel25519(c,d,r);
  38233. A(e,a,c);
  38234. Z(a,a,c);
  38235. A(c,b,d);
  38236. Z(b,b,d);
  38237. S(d,e);
  38238. S(f,a);
  38239. M(a,c,a);
  38240. M(c,b,e);
  38241. A(e,a,c);
  38242. Z(a,a,c);
  38243. S(b,a);
  38244. Z(c,d,f);
  38245. M(a,c,_121665);
  38246. A(a,a,d);
  38247. M(c,c,a);
  38248. M(a,d,f);
  38249. M(d,b,x);
  38250. S(b,e);
  38251. sel25519(a,b,r);
  38252. sel25519(c,d,r);
  38253. }
  38254. for (i = 0; i < 16; i++) {
  38255. x[i+16]=a[i];
  38256. x[i+32]=c[i];
  38257. x[i+48]=b[i];
  38258. x[i+64]=d[i];
  38259. }
  38260. var x32 = x.subarray(32);
  38261. var x16 = x.subarray(16);
  38262. inv25519(x32,x32);
  38263. M(x16,x16,x32);
  38264. pack25519(q,x16);
  38265. return 0;
  38266. }
  38267. function crypto_scalarmult_base(q, n) {
  38268. return crypto_scalarmult(q, n, _9);
  38269. }
  38270. function crypto_box_keypair(y, x) {
  38271. randombytes(x, 32);
  38272. return crypto_scalarmult_base(y, x);
  38273. }
  38274. function crypto_box_beforenm(k, y, x) {
  38275. var s = new Uint8Array(32);
  38276. crypto_scalarmult(s, x, y);
  38277. return crypto_core_hsalsa20(k, _0, s, sigma);
  38278. }
  38279. var crypto_box_afternm = crypto_secretbox;
  38280. var crypto_box_open_afternm = crypto_secretbox_open;
  38281. function crypto_box(c, m, d, n, y, x) {
  38282. var k = new Uint8Array(32);
  38283. crypto_box_beforenm(k, y, x);
  38284. return crypto_box_afternm(c, m, d, n, k);
  38285. }
  38286. function crypto_box_open(m, c, d, n, y, x) {
  38287. var k = new Uint8Array(32);
  38288. crypto_box_beforenm(k, y, x);
  38289. return crypto_box_open_afternm(m, c, d, n, k);
  38290. }
  38291. var K = [
  38292. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38293. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38294. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38295. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38296. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38297. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38298. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38299. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38300. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38301. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38302. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38303. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38304. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38305. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38306. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38307. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38308. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38309. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38310. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38311. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38312. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38313. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38314. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38315. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38316. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38317. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38318. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38319. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38320. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38321. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38322. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38323. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38324. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38325. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38326. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38327. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38328. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38329. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38330. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38331. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38332. ];
  38333. function crypto_hashblocks_hl(hh, hl, m, n) {
  38334. var wh = new Int32Array(16), wl = new Int32Array(16),
  38335. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38336. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38337. th, tl, i, j, h, l, a, b, c, d;
  38338. var ah0 = hh[0],
  38339. ah1 = hh[1],
  38340. ah2 = hh[2],
  38341. ah3 = hh[3],
  38342. ah4 = hh[4],
  38343. ah5 = hh[5],
  38344. ah6 = hh[6],
  38345. ah7 = hh[7],
  38346. al0 = hl[0],
  38347. al1 = hl[1],
  38348. al2 = hl[2],
  38349. al3 = hl[3],
  38350. al4 = hl[4],
  38351. al5 = hl[5],
  38352. al6 = hl[6],
  38353. al7 = hl[7];
  38354. var pos = 0;
  38355. while (n >= 128) {
  38356. for (i = 0; i < 16; i++) {
  38357. j = 8 * i + pos;
  38358. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38359. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38360. }
  38361. for (i = 0; i < 80; i++) {
  38362. bh0 = ah0;
  38363. bh1 = ah1;
  38364. bh2 = ah2;
  38365. bh3 = ah3;
  38366. bh4 = ah4;
  38367. bh5 = ah5;
  38368. bh6 = ah6;
  38369. bh7 = ah7;
  38370. bl0 = al0;
  38371. bl1 = al1;
  38372. bl2 = al2;
  38373. bl3 = al3;
  38374. bl4 = al4;
  38375. bl5 = al5;
  38376. bl6 = al6;
  38377. bl7 = al7;
  38378. // add
  38379. h = ah7;
  38380. l = al7;
  38381. a = l & 0xffff; b = l >>> 16;
  38382. c = h & 0xffff; d = h >>> 16;
  38383. // Sigma1
  38384. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38385. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38386. a += l & 0xffff; b += l >>> 16;
  38387. c += h & 0xffff; d += h >>> 16;
  38388. // Ch
  38389. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38390. l = (al4 & al5) ^ (~al4 & al6);
  38391. a += l & 0xffff; b += l >>> 16;
  38392. c += h & 0xffff; d += h >>> 16;
  38393. // K
  38394. h = K[i*2];
  38395. l = K[i*2+1];
  38396. a += l & 0xffff; b += l >>> 16;
  38397. c += h & 0xffff; d += h >>> 16;
  38398. // w
  38399. h = wh[i%16];
  38400. l = wl[i%16];
  38401. a += l & 0xffff; b += l >>> 16;
  38402. c += h & 0xffff; d += h >>> 16;
  38403. b += a >>> 16;
  38404. c += b >>> 16;
  38405. d += c >>> 16;
  38406. th = c & 0xffff | d << 16;
  38407. tl = a & 0xffff | b << 16;
  38408. // add
  38409. h = th;
  38410. l = tl;
  38411. a = l & 0xffff; b = l >>> 16;
  38412. c = h & 0xffff; d = h >>> 16;
  38413. // Sigma0
  38414. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38415. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38416. a += l & 0xffff; b += l >>> 16;
  38417. c += h & 0xffff; d += h >>> 16;
  38418. // Maj
  38419. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38420. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38421. a += l & 0xffff; b += l >>> 16;
  38422. c += h & 0xffff; d += h >>> 16;
  38423. b += a >>> 16;
  38424. c += b >>> 16;
  38425. d += c >>> 16;
  38426. bh7 = (c & 0xffff) | (d << 16);
  38427. bl7 = (a & 0xffff) | (b << 16);
  38428. // add
  38429. h = bh3;
  38430. l = bl3;
  38431. a = l & 0xffff; b = l >>> 16;
  38432. c = h & 0xffff; d = h >>> 16;
  38433. h = th;
  38434. l = tl;
  38435. a += l & 0xffff; b += l >>> 16;
  38436. c += h & 0xffff; d += h >>> 16;
  38437. b += a >>> 16;
  38438. c += b >>> 16;
  38439. d += c >>> 16;
  38440. bh3 = (c & 0xffff) | (d << 16);
  38441. bl3 = (a & 0xffff) | (b << 16);
  38442. ah1 = bh0;
  38443. ah2 = bh1;
  38444. ah3 = bh2;
  38445. ah4 = bh3;
  38446. ah5 = bh4;
  38447. ah6 = bh5;
  38448. ah7 = bh6;
  38449. ah0 = bh7;
  38450. al1 = bl0;
  38451. al2 = bl1;
  38452. al3 = bl2;
  38453. al4 = bl3;
  38454. al5 = bl4;
  38455. al6 = bl5;
  38456. al7 = bl6;
  38457. al0 = bl7;
  38458. if (i%16 === 15) {
  38459. for (j = 0; j < 16; j++) {
  38460. // add
  38461. h = wh[j];
  38462. l = wl[j];
  38463. a = l & 0xffff; b = l >>> 16;
  38464. c = h & 0xffff; d = h >>> 16;
  38465. h = wh[(j+9)%16];
  38466. l = wl[(j+9)%16];
  38467. a += l & 0xffff; b += l >>> 16;
  38468. c += h & 0xffff; d += h >>> 16;
  38469. // sigma0
  38470. th = wh[(j+1)%16];
  38471. tl = wl[(j+1)%16];
  38472. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38473. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38474. a += l & 0xffff; b += l >>> 16;
  38475. c += h & 0xffff; d += h >>> 16;
  38476. // sigma1
  38477. th = wh[(j+14)%16];
  38478. tl = wl[(j+14)%16];
  38479. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38480. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38481. a += l & 0xffff; b += l >>> 16;
  38482. c += h & 0xffff; d += h >>> 16;
  38483. b += a >>> 16;
  38484. c += b >>> 16;
  38485. d += c >>> 16;
  38486. wh[j] = (c & 0xffff) | (d << 16);
  38487. wl[j] = (a & 0xffff) | (b << 16);
  38488. }
  38489. }
  38490. }
  38491. // add
  38492. h = ah0;
  38493. l = al0;
  38494. a = l & 0xffff; b = l >>> 16;
  38495. c = h & 0xffff; d = h >>> 16;
  38496. h = hh[0];
  38497. l = hl[0];
  38498. a += l & 0xffff; b += l >>> 16;
  38499. c += h & 0xffff; d += h >>> 16;
  38500. b += a >>> 16;
  38501. c += b >>> 16;
  38502. d += c >>> 16;
  38503. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38504. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38505. h = ah1;
  38506. l = al1;
  38507. a = l & 0xffff; b = l >>> 16;
  38508. c = h & 0xffff; d = h >>> 16;
  38509. h = hh[1];
  38510. l = hl[1];
  38511. a += l & 0xffff; b += l >>> 16;
  38512. c += h & 0xffff; d += h >>> 16;
  38513. b += a >>> 16;
  38514. c += b >>> 16;
  38515. d += c >>> 16;
  38516. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38517. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38518. h = ah2;
  38519. l = al2;
  38520. a = l & 0xffff; b = l >>> 16;
  38521. c = h & 0xffff; d = h >>> 16;
  38522. h = hh[2];
  38523. l = hl[2];
  38524. a += l & 0xffff; b += l >>> 16;
  38525. c += h & 0xffff; d += h >>> 16;
  38526. b += a >>> 16;
  38527. c += b >>> 16;
  38528. d += c >>> 16;
  38529. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38530. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38531. h = ah3;
  38532. l = al3;
  38533. a = l & 0xffff; b = l >>> 16;
  38534. c = h & 0xffff; d = h >>> 16;
  38535. h = hh[3];
  38536. l = hl[3];
  38537. a += l & 0xffff; b += l >>> 16;
  38538. c += h & 0xffff; d += h >>> 16;
  38539. b += a >>> 16;
  38540. c += b >>> 16;
  38541. d += c >>> 16;
  38542. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38543. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38544. h = ah4;
  38545. l = al4;
  38546. a = l & 0xffff; b = l >>> 16;
  38547. c = h & 0xffff; d = h >>> 16;
  38548. h = hh[4];
  38549. l = hl[4];
  38550. a += l & 0xffff; b += l >>> 16;
  38551. c += h & 0xffff; d += h >>> 16;
  38552. b += a >>> 16;
  38553. c += b >>> 16;
  38554. d += c >>> 16;
  38555. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38556. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38557. h = ah5;
  38558. l = al5;
  38559. a = l & 0xffff; b = l >>> 16;
  38560. c = h & 0xffff; d = h >>> 16;
  38561. h = hh[5];
  38562. l = hl[5];
  38563. a += l & 0xffff; b += l >>> 16;
  38564. c += h & 0xffff; d += h >>> 16;
  38565. b += a >>> 16;
  38566. c += b >>> 16;
  38567. d += c >>> 16;
  38568. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38569. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38570. h = ah6;
  38571. l = al6;
  38572. a = l & 0xffff; b = l >>> 16;
  38573. c = h & 0xffff; d = h >>> 16;
  38574. h = hh[6];
  38575. l = hl[6];
  38576. a += l & 0xffff; b += l >>> 16;
  38577. c += h & 0xffff; d += h >>> 16;
  38578. b += a >>> 16;
  38579. c += b >>> 16;
  38580. d += c >>> 16;
  38581. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38582. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38583. h = ah7;
  38584. l = al7;
  38585. a = l & 0xffff; b = l >>> 16;
  38586. c = h & 0xffff; d = h >>> 16;
  38587. h = hh[7];
  38588. l = hl[7];
  38589. a += l & 0xffff; b += l >>> 16;
  38590. c += h & 0xffff; d += h >>> 16;
  38591. b += a >>> 16;
  38592. c += b >>> 16;
  38593. d += c >>> 16;
  38594. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38595. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38596. pos += 128;
  38597. n -= 128;
  38598. }
  38599. return n;
  38600. }
  38601. function crypto_hash(out, m, n) {
  38602. var hh = new Int32Array(8),
  38603. hl = new Int32Array(8),
  38604. x = new Uint8Array(256),
  38605. i, b = n;
  38606. hh[0] = 0x6a09e667;
  38607. hh[1] = 0xbb67ae85;
  38608. hh[2] = 0x3c6ef372;
  38609. hh[3] = 0xa54ff53a;
  38610. hh[4] = 0x510e527f;
  38611. hh[5] = 0x9b05688c;
  38612. hh[6] = 0x1f83d9ab;
  38613. hh[7] = 0x5be0cd19;
  38614. hl[0] = 0xf3bcc908;
  38615. hl[1] = 0x84caa73b;
  38616. hl[2] = 0xfe94f82b;
  38617. hl[3] = 0x5f1d36f1;
  38618. hl[4] = 0xade682d1;
  38619. hl[5] = 0x2b3e6c1f;
  38620. hl[6] = 0xfb41bd6b;
  38621. hl[7] = 0x137e2179;
  38622. crypto_hashblocks_hl(hh, hl, m, n);
  38623. n %= 128;
  38624. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38625. x[n] = 128;
  38626. n = 256-128*(n<112?1:0);
  38627. x[n-9] = 0;
  38628. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38629. crypto_hashblocks_hl(hh, hl, x, n);
  38630. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38631. return 0;
  38632. }
  38633. function add(p, q) {
  38634. var a = gf(), b = gf(), c = gf(),
  38635. d = gf(), e = gf(), f = gf(),
  38636. g = gf(), h = gf(), t = gf();
  38637. Z(a, p[1], p[0]);
  38638. Z(t, q[1], q[0]);
  38639. M(a, a, t);
  38640. A(b, p[0], p[1]);
  38641. A(t, q[0], q[1]);
  38642. M(b, b, t);
  38643. M(c, p[3], q[3]);
  38644. M(c, c, D2);
  38645. M(d, p[2], q[2]);
  38646. A(d, d, d);
  38647. Z(e, b, a);
  38648. Z(f, d, c);
  38649. A(g, d, c);
  38650. A(h, b, a);
  38651. M(p[0], e, f);
  38652. M(p[1], h, g);
  38653. M(p[2], g, f);
  38654. M(p[3], e, h);
  38655. }
  38656. function cswap(p, q, b) {
  38657. var i;
  38658. for (i = 0; i < 4; i++) {
  38659. sel25519(p[i], q[i], b);
  38660. }
  38661. }
  38662. function pack(r, p) {
  38663. var tx = gf(), ty = gf(), zi = gf();
  38664. inv25519(zi, p[2]);
  38665. M(tx, p[0], zi);
  38666. M(ty, p[1], zi);
  38667. pack25519(r, ty);
  38668. r[31] ^= par25519(tx) << 7;
  38669. }
  38670. function scalarmult(p, q, s) {
  38671. var b, i;
  38672. set25519(p[0], gf0);
  38673. set25519(p[1], gf1);
  38674. set25519(p[2], gf1);
  38675. set25519(p[3], gf0);
  38676. for (i = 255; i >= 0; --i) {
  38677. b = (s[(i/8)|0] >> (i&7)) & 1;
  38678. cswap(p, q, b);
  38679. add(q, p);
  38680. add(p, p);
  38681. cswap(p, q, b);
  38682. }
  38683. }
  38684. function scalarbase(p, s) {
  38685. var q = [gf(), gf(), gf(), gf()];
  38686. set25519(q[0], X);
  38687. set25519(q[1], Y);
  38688. set25519(q[2], gf1);
  38689. M(q[3], X, Y);
  38690. scalarmult(p, q, s);
  38691. }
  38692. function crypto_sign_keypair(pk, sk, seeded) {
  38693. var d = new Uint8Array(64);
  38694. var p = [gf(), gf(), gf(), gf()];
  38695. var i;
  38696. if (!seeded) randombytes(sk, 32);
  38697. crypto_hash(d, sk, 32);
  38698. d[0] &= 248;
  38699. d[31] &= 127;
  38700. d[31] |= 64;
  38701. scalarbase(p, d);
  38702. pack(pk, p);
  38703. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38704. return 0;
  38705. }
  38706. 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]);
  38707. function modL(r, x) {
  38708. var carry, i, j, k;
  38709. for (i = 63; i >= 32; --i) {
  38710. carry = 0;
  38711. for (j = i - 32, k = i - 12; j < k; ++j) {
  38712. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38713. carry = (x[j] + 128) >> 8;
  38714. x[j] -= carry * 256;
  38715. }
  38716. x[j] += carry;
  38717. x[i] = 0;
  38718. }
  38719. carry = 0;
  38720. for (j = 0; j < 32; j++) {
  38721. x[j] += carry - (x[31] >> 4) * L[j];
  38722. carry = x[j] >> 8;
  38723. x[j] &= 255;
  38724. }
  38725. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38726. for (i = 0; i < 32; i++) {
  38727. x[i+1] += x[i] >> 8;
  38728. r[i] = x[i] & 255;
  38729. }
  38730. }
  38731. function reduce(r) {
  38732. var x = new Float64Array(64), i;
  38733. for (i = 0; i < 64; i++) x[i] = r[i];
  38734. for (i = 0; i < 64; i++) r[i] = 0;
  38735. modL(r, x);
  38736. }
  38737. // Note: difference from C - smlen returned, not passed as argument.
  38738. function crypto_sign(sm, m, n, sk) {
  38739. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38740. var i, j, x = new Float64Array(64);
  38741. var p = [gf(), gf(), gf(), gf()];
  38742. crypto_hash(d, sk, 32);
  38743. d[0] &= 248;
  38744. d[31] &= 127;
  38745. d[31] |= 64;
  38746. var smlen = n + 64;
  38747. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38748. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38749. crypto_hash(r, sm.subarray(32), n+32);
  38750. reduce(r);
  38751. scalarbase(p, r);
  38752. pack(sm, p);
  38753. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38754. crypto_hash(h, sm, n + 64);
  38755. reduce(h);
  38756. for (i = 0; i < 64; i++) x[i] = 0;
  38757. for (i = 0; i < 32; i++) x[i] = r[i];
  38758. for (i = 0; i < 32; i++) {
  38759. for (j = 0; j < 32; j++) {
  38760. x[i+j] += h[i] * d[j];
  38761. }
  38762. }
  38763. modL(sm.subarray(32), x);
  38764. return smlen;
  38765. }
  38766. function unpackneg(r, p) {
  38767. var t = gf(), chk = gf(), num = gf(),
  38768. den = gf(), den2 = gf(), den4 = gf(),
  38769. den6 = gf();
  38770. set25519(r[2], gf1);
  38771. unpack25519(r[1], p);
  38772. S(num, r[1]);
  38773. M(den, num, D);
  38774. Z(num, num, r[2]);
  38775. A(den, r[2], den);
  38776. S(den2, den);
  38777. S(den4, den2);
  38778. M(den6, den4, den2);
  38779. M(t, den6, num);
  38780. M(t, t, den);
  38781. pow2523(t, t);
  38782. M(t, t, num);
  38783. M(t, t, den);
  38784. M(t, t, den);
  38785. M(r[0], t, den);
  38786. S(chk, r[0]);
  38787. M(chk, chk, den);
  38788. if (neq25519(chk, num)) M(r[0], r[0], I);
  38789. S(chk, r[0]);
  38790. M(chk, chk, den);
  38791. if (neq25519(chk, num)) return -1;
  38792. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38793. M(r[3], r[0], r[1]);
  38794. return 0;
  38795. }
  38796. function crypto_sign_open(m, sm, n, pk) {
  38797. var i, mlen;
  38798. var t = new Uint8Array(32), h = new Uint8Array(64);
  38799. var p = [gf(), gf(), gf(), gf()],
  38800. q = [gf(), gf(), gf(), gf()];
  38801. mlen = -1;
  38802. if (n < 64) return -1;
  38803. if (unpackneg(q, pk)) return -1;
  38804. for (i = 0; i < n; i++) m[i] = sm[i];
  38805. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38806. crypto_hash(h, m, n);
  38807. reduce(h);
  38808. scalarmult(p, q, h);
  38809. scalarbase(q, sm.subarray(32));
  38810. add(p, q);
  38811. pack(t, p);
  38812. n -= 64;
  38813. if (crypto_verify_32(sm, 0, t, 0)) {
  38814. for (i = 0; i < n; i++) m[i] = 0;
  38815. return -1;
  38816. }
  38817. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38818. mlen = n;
  38819. return mlen;
  38820. }
  38821. var crypto_secretbox_KEYBYTES = 32,
  38822. crypto_secretbox_NONCEBYTES = 24,
  38823. crypto_secretbox_ZEROBYTES = 32,
  38824. crypto_secretbox_BOXZEROBYTES = 16,
  38825. crypto_scalarmult_BYTES = 32,
  38826. crypto_scalarmult_SCALARBYTES = 32,
  38827. crypto_box_PUBLICKEYBYTES = 32,
  38828. crypto_box_SECRETKEYBYTES = 32,
  38829. crypto_box_BEFORENMBYTES = 32,
  38830. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38831. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38832. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38833. crypto_sign_BYTES = 64,
  38834. crypto_sign_PUBLICKEYBYTES = 32,
  38835. crypto_sign_SECRETKEYBYTES = 64,
  38836. crypto_sign_SEEDBYTES = 32,
  38837. crypto_hash_BYTES = 64;
  38838. nacl.lowlevel = {
  38839. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38840. crypto_stream_xor: crypto_stream_xor,
  38841. crypto_stream: crypto_stream,
  38842. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38843. crypto_stream_salsa20: crypto_stream_salsa20,
  38844. crypto_onetimeauth: crypto_onetimeauth,
  38845. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38846. crypto_verify_16: crypto_verify_16,
  38847. crypto_verify_32: crypto_verify_32,
  38848. crypto_secretbox: crypto_secretbox,
  38849. crypto_secretbox_open: crypto_secretbox_open,
  38850. crypto_scalarmult: crypto_scalarmult,
  38851. crypto_scalarmult_base: crypto_scalarmult_base,
  38852. crypto_box_beforenm: crypto_box_beforenm,
  38853. crypto_box_afternm: crypto_box_afternm,
  38854. crypto_box: crypto_box,
  38855. crypto_box_open: crypto_box_open,
  38856. crypto_box_keypair: crypto_box_keypair,
  38857. crypto_hash: crypto_hash,
  38858. crypto_sign: crypto_sign,
  38859. crypto_sign_keypair: crypto_sign_keypair,
  38860. crypto_sign_open: crypto_sign_open,
  38861. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38862. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38863. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38864. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38865. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38866. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38867. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38868. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38869. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38870. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38871. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38872. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38873. crypto_sign_BYTES: crypto_sign_BYTES,
  38874. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38875. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38876. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38877. crypto_hash_BYTES: crypto_hash_BYTES
  38878. };
  38879. /* High-level API */
  38880. function checkLengths(k, n) {
  38881. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38882. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38883. }
  38884. function checkBoxLengths(pk, sk) {
  38885. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38886. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38887. }
  38888. function checkArrayTypes() {
  38889. for (var i = 0; i < arguments.length; i++) {
  38890. if (!(arguments[i] instanceof Uint8Array))
  38891. throw new TypeError('unexpected type, use Uint8Array');
  38892. }
  38893. }
  38894. function cleanup(arr) {
  38895. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38896. }
  38897. nacl.randomBytes = function(n) {
  38898. var b = new Uint8Array(n);
  38899. randombytes(b, n);
  38900. return b;
  38901. };
  38902. nacl.secretbox = function(msg, nonce, key) {
  38903. checkArrayTypes(msg, nonce, key);
  38904. checkLengths(key, nonce);
  38905. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38906. var c = new Uint8Array(m.length);
  38907. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38908. crypto_secretbox(c, m, m.length, nonce, key);
  38909. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38910. };
  38911. nacl.secretbox.open = function(box, nonce, key) {
  38912. checkArrayTypes(box, nonce, key);
  38913. checkLengths(key, nonce);
  38914. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38915. var m = new Uint8Array(c.length);
  38916. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38917. if (c.length < 32) return null;
  38918. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38919. return m.subarray(crypto_secretbox_ZEROBYTES);
  38920. };
  38921. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38922. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38923. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38924. nacl.scalarMult = function(n, p) {
  38925. checkArrayTypes(n, p);
  38926. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38927. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38928. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38929. crypto_scalarmult(q, n, p);
  38930. return q;
  38931. };
  38932. nacl.scalarMult.base = function(n) {
  38933. checkArrayTypes(n);
  38934. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38935. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38936. crypto_scalarmult_base(q, n);
  38937. return q;
  38938. };
  38939. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38940. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38941. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38942. var k = nacl.box.before(publicKey, secretKey);
  38943. return nacl.secretbox(msg, nonce, k);
  38944. };
  38945. nacl.box.before = function(publicKey, secretKey) {
  38946. checkArrayTypes(publicKey, secretKey);
  38947. checkBoxLengths(publicKey, secretKey);
  38948. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38949. crypto_box_beforenm(k, publicKey, secretKey);
  38950. return k;
  38951. };
  38952. nacl.box.after = nacl.secretbox;
  38953. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38954. var k = nacl.box.before(publicKey, secretKey);
  38955. return nacl.secretbox.open(msg, nonce, k);
  38956. };
  38957. nacl.box.open.after = nacl.secretbox.open;
  38958. nacl.box.keyPair = function() {
  38959. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38960. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38961. crypto_box_keypair(pk, sk);
  38962. return {publicKey: pk, secretKey: sk};
  38963. };
  38964. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38965. checkArrayTypes(secretKey);
  38966. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38967. throw new Error('bad secret key size');
  38968. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38969. crypto_scalarmult_base(pk, secretKey);
  38970. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38971. };
  38972. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38973. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38974. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38975. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38976. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38977. nacl.sign = function(msg, secretKey) {
  38978. checkArrayTypes(msg, secretKey);
  38979. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38980. throw new Error('bad secret key size');
  38981. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38982. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38983. return signedMsg;
  38984. };
  38985. nacl.sign.open = function(signedMsg, publicKey) {
  38986. checkArrayTypes(signedMsg, publicKey);
  38987. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38988. throw new Error('bad public key size');
  38989. var tmp = new Uint8Array(signedMsg.length);
  38990. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38991. if (mlen < 0) return null;
  38992. var m = new Uint8Array(mlen);
  38993. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38994. return m;
  38995. };
  38996. nacl.sign.detached = function(msg, secretKey) {
  38997. var signedMsg = nacl.sign(msg, secretKey);
  38998. var sig = new Uint8Array(crypto_sign_BYTES);
  38999. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39000. return sig;
  39001. };
  39002. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39003. checkArrayTypes(msg, sig, publicKey);
  39004. if (sig.length !== crypto_sign_BYTES)
  39005. throw new Error('bad signature size');
  39006. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39007. throw new Error('bad public key size');
  39008. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39009. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39010. var i;
  39011. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39012. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39013. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39014. };
  39015. nacl.sign.keyPair = function() {
  39016. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39017. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39018. crypto_sign_keypair(pk, sk);
  39019. return {publicKey: pk, secretKey: sk};
  39020. };
  39021. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39022. checkArrayTypes(secretKey);
  39023. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39024. throw new Error('bad secret key size');
  39025. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39026. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39027. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39028. };
  39029. nacl.sign.keyPair.fromSeed = function(seed) {
  39030. checkArrayTypes(seed);
  39031. if (seed.length !== crypto_sign_SEEDBYTES)
  39032. throw new Error('bad seed size');
  39033. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39034. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39035. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39036. crypto_sign_keypair(pk, sk, true);
  39037. return {publicKey: pk, secretKey: sk};
  39038. };
  39039. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39040. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39041. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39042. nacl.sign.signatureLength = crypto_sign_BYTES;
  39043. nacl.hash = function(msg) {
  39044. checkArrayTypes(msg);
  39045. var h = new Uint8Array(crypto_hash_BYTES);
  39046. crypto_hash(h, msg, msg.length);
  39047. return h;
  39048. };
  39049. nacl.hash.hashLength = crypto_hash_BYTES;
  39050. nacl.verify = function(x, y) {
  39051. checkArrayTypes(x, y);
  39052. // Zero length arguments are considered not equal.
  39053. if (x.length === 0 || y.length === 0) return false;
  39054. if (x.length !== y.length) return false;
  39055. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39056. };
  39057. nacl.setPRNG = function(fn) {
  39058. randombytes = fn;
  39059. };
  39060. (function() {
  39061. // Initialize PRNG if environment provides CSPRNG.
  39062. // If not, methods calling randombytes will throw.
  39063. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39064. if (crypto && crypto.getRandomValues) {
  39065. // Browsers.
  39066. var QUOTA = 65536;
  39067. nacl.setPRNG(function(x, n) {
  39068. var i, v = new Uint8Array(n);
  39069. for (i = 0; i < n; i += QUOTA) {
  39070. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39071. }
  39072. for (i = 0; i < n; i++) x[i] = v[i];
  39073. cleanup(v);
  39074. });
  39075. } else if (true) {
  39076. // Node.js.
  39077. crypto = __webpack_require__(3);
  39078. if (crypto && crypto.randomBytes) {
  39079. nacl.setPRNG(function(x, n) {
  39080. var i, v = crypto.randomBytes(n);
  39081. for (i = 0; i < n; i++) x[i] = v[i];
  39082. cleanup(v);
  39083. });
  39084. }
  39085. }
  39086. })();
  39087. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39088. /***/ }),
  39089. /* 1 */
  39090. /***/ (function(module, exports, __webpack_require__) {
  39091. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39092. // Public domain.
  39093. (function(root, f) {
  39094. 'use strict';
  39095. if ( true && module.exports) module.exports = f();
  39096. else if (root.nacl) root.nacl.util = f();
  39097. else {
  39098. root.nacl = {};
  39099. root.nacl.util = f();
  39100. }
  39101. }(this, function() {
  39102. 'use strict';
  39103. var util = {};
  39104. function validateBase64(s) {
  39105. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39106. throw new TypeError('invalid encoding');
  39107. }
  39108. }
  39109. util.decodeUTF8 = function(s) {
  39110. if (typeof s !== 'string') throw new TypeError('expected string');
  39111. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39112. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39113. return b;
  39114. };
  39115. util.encodeUTF8 = function(arr) {
  39116. var i, s = [];
  39117. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39118. return decodeURIComponent(escape(s.join('')));
  39119. };
  39120. if (typeof atob === 'undefined') {
  39121. // Node.js
  39122. if (typeof Buffer.from !== 'undefined') {
  39123. // Node v6 and later
  39124. util.encodeBase64 = function (arr) { // v6 and later
  39125. return Buffer.from(arr).toString('base64');
  39126. };
  39127. util.decodeBase64 = function (s) {
  39128. validateBase64(s);
  39129. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39130. };
  39131. } else {
  39132. // Node earlier than v6
  39133. util.encodeBase64 = function (arr) { // v6 and later
  39134. return (new Buffer(arr)).toString('base64');
  39135. };
  39136. util.decodeBase64 = function(s) {
  39137. validateBase64(s);
  39138. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39139. };
  39140. }
  39141. } else {
  39142. // Browsers
  39143. util.encodeBase64 = function(arr) {
  39144. var i, s = [], len = arr.length;
  39145. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39146. return btoa(s.join(''));
  39147. };
  39148. util.decodeBase64 = function(s) {
  39149. validateBase64(s);
  39150. var i, d = atob(s), b = new Uint8Array(d.length);
  39151. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39152. return b;
  39153. };
  39154. }
  39155. return util;
  39156. }));
  39157. /***/ }),
  39158. /* 2 */
  39159. /***/ (function(module, exports, __webpack_require__) {
  39160. // required so we don't have to do require('pusher').default etc.
  39161. module.exports = __webpack_require__(4).default;
  39162. /***/ }),
  39163. /* 3 */
  39164. /***/ (function(module, exports) {
  39165. /* (ignored) */
  39166. /***/ }),
  39167. /* 4 */
  39168. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39169. "use strict";
  39170. __webpack_require__.r(__webpack_exports__);
  39171. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39172. var ScriptReceiverFactory = (function () {
  39173. function ScriptReceiverFactory(prefix, name) {
  39174. this.lastId = 0;
  39175. this.prefix = prefix;
  39176. this.name = name;
  39177. }
  39178. ScriptReceiverFactory.prototype.create = function (callback) {
  39179. this.lastId++;
  39180. var number = this.lastId;
  39181. var id = this.prefix + number;
  39182. var name = this.name + "[" + number + "]";
  39183. var called = false;
  39184. var callbackWrapper = function () {
  39185. if (!called) {
  39186. callback.apply(null, arguments);
  39187. called = true;
  39188. }
  39189. };
  39190. this[number] = callbackWrapper;
  39191. return { number: number, id: id, name: name, callback: callbackWrapper };
  39192. };
  39193. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39194. delete this[receiver.number];
  39195. };
  39196. return ScriptReceiverFactory;
  39197. }());
  39198. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39199. // CONCATENATED MODULE: ./src/core/defaults.ts
  39200. var Defaults = {
  39201. VERSION: "5.0.3",
  39202. PROTOCOL: 7,
  39203. host: 'ws.pusherapp.com',
  39204. ws_port: 80,
  39205. wss_port: 443,
  39206. ws_path: '',
  39207. sockjs_host: 'sockjs.pusher.com',
  39208. sockjs_http_port: 80,
  39209. sockjs_https_port: 443,
  39210. sockjs_path: '/pusher',
  39211. stats_host: 'stats.pusher.com',
  39212. channel_auth_endpoint: '/pusher/auth',
  39213. channel_auth_transport: 'ajax',
  39214. activity_timeout: 120000,
  39215. pong_timeout: 30000,
  39216. unavailable_timeout: 10000,
  39217. cdn_http: "http://js.pusher.com",
  39218. cdn_https: "https://js.pusher.com",
  39219. dependency_suffix: ""
  39220. };
  39221. /* harmony default export */ var defaults = (Defaults);
  39222. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39223. var dependency_loader_DependencyLoader = (function () {
  39224. function DependencyLoader(options) {
  39225. this.options = options;
  39226. this.receivers = options.receivers || ScriptReceivers;
  39227. this.loading = {};
  39228. }
  39229. DependencyLoader.prototype.load = function (name, options, callback) {
  39230. var self = this;
  39231. if (self.loading[name] && self.loading[name].length > 0) {
  39232. self.loading[name].push(callback);
  39233. }
  39234. else {
  39235. self.loading[name] = [callback];
  39236. var request = runtime.createScriptRequest(self.getPath(name, options));
  39237. var receiver = self.receivers.create(function (error) {
  39238. self.receivers.remove(receiver);
  39239. if (self.loading[name]) {
  39240. var callbacks = self.loading[name];
  39241. delete self.loading[name];
  39242. var successCallback = function (wasSuccessful) {
  39243. if (!wasSuccessful) {
  39244. request.cleanup();
  39245. }
  39246. };
  39247. for (var i = 0; i < callbacks.length; i++) {
  39248. callbacks[i](error, successCallback);
  39249. }
  39250. }
  39251. });
  39252. request.send(receiver);
  39253. }
  39254. };
  39255. DependencyLoader.prototype.getRoot = function (options) {
  39256. var cdn;
  39257. var protocol = runtime.getDocument().location.protocol;
  39258. if ((options && options.useTLS) || protocol === "https:") {
  39259. cdn = this.options.cdn_https;
  39260. }
  39261. else {
  39262. cdn = this.options.cdn_http;
  39263. }
  39264. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39265. };
  39266. DependencyLoader.prototype.getPath = function (name, options) {
  39267. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39268. };
  39269. ;
  39270. return DependencyLoader;
  39271. }());
  39272. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39273. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39274. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39275. var Dependencies = new dependency_loader({
  39276. cdn_http: defaults.cdn_http,
  39277. cdn_https: defaults.cdn_https,
  39278. version: defaults.VERSION,
  39279. suffix: defaults.dependency_suffix,
  39280. receivers: DependenciesReceivers
  39281. });
  39282. // CONCATENATED MODULE: ./src/core/base64.ts
  39283. function encode(s) {
  39284. return btoa(utob(s));
  39285. }
  39286. var fromCharCode = String.fromCharCode;
  39287. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39288. var b64tab = {};
  39289. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39290. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39291. }
  39292. var cb_utob = function (c) {
  39293. var cc = c.charCodeAt(0);
  39294. return cc < 0x80
  39295. ? c
  39296. : cc < 0x800
  39297. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39298. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39299. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39300. fromCharCode(0x80 | (cc & 0x3f));
  39301. };
  39302. var utob = function (u) {
  39303. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39304. };
  39305. var cb_encode = function (ccc) {
  39306. var padlen = [0, 2, 1][ccc.length % 3];
  39307. var ord = (ccc.charCodeAt(0) << 16) |
  39308. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39309. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39310. var chars = [
  39311. b64chars.charAt(ord >>> 18),
  39312. b64chars.charAt((ord >>> 12) & 63),
  39313. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39314. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39315. ];
  39316. return chars.join('');
  39317. };
  39318. var btoa = window.btoa ||
  39319. function (b) {
  39320. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39321. };
  39322. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39323. var Timer = (function () {
  39324. function Timer(set, clear, delay, callback) {
  39325. var _this = this;
  39326. this.clear = clear;
  39327. this.timer = set(function () {
  39328. if (_this.timer) {
  39329. _this.timer = callback(_this.timer);
  39330. }
  39331. }, delay);
  39332. }
  39333. Timer.prototype.isRunning = function () {
  39334. return this.timer !== null;
  39335. };
  39336. Timer.prototype.ensureAborted = function () {
  39337. if (this.timer) {
  39338. this.clear(this.timer);
  39339. this.timer = null;
  39340. }
  39341. };
  39342. return Timer;
  39343. }());
  39344. /* harmony default export */ var abstract_timer = (Timer);
  39345. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39346. var __extends = (undefined && undefined.__extends) || (function () {
  39347. var extendStatics = function (d, b) {
  39348. extendStatics = Object.setPrototypeOf ||
  39349. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39350. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39351. return extendStatics(d, b);
  39352. };
  39353. return function (d, b) {
  39354. extendStatics(d, b);
  39355. function __() { this.constructor = d; }
  39356. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39357. };
  39358. })();
  39359. function timers_clearTimeout(timer) {
  39360. window.clearTimeout(timer);
  39361. }
  39362. function timers_clearInterval(timer) {
  39363. window.clearInterval(timer);
  39364. }
  39365. var OneOffTimer = (function (_super) {
  39366. __extends(OneOffTimer, _super);
  39367. function OneOffTimer(delay, callback) {
  39368. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39369. callback();
  39370. return null;
  39371. }) || this;
  39372. }
  39373. return OneOffTimer;
  39374. }(abstract_timer));
  39375. var PeriodicTimer = (function (_super) {
  39376. __extends(PeriodicTimer, _super);
  39377. function PeriodicTimer(delay, callback) {
  39378. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39379. callback();
  39380. return timer;
  39381. }) || this;
  39382. }
  39383. return PeriodicTimer;
  39384. }(abstract_timer));
  39385. // CONCATENATED MODULE: ./src/core/util.ts
  39386. var Util = {
  39387. now: function () {
  39388. if (Date.now) {
  39389. return Date.now();
  39390. }
  39391. else {
  39392. return new Date().valueOf();
  39393. }
  39394. },
  39395. defer: function (callback) {
  39396. return new OneOffTimer(0, callback);
  39397. },
  39398. method: function (name) {
  39399. var args = [];
  39400. for (var _i = 1; _i < arguments.length; _i++) {
  39401. args[_i - 1] = arguments[_i];
  39402. }
  39403. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39404. return function (object) {
  39405. return object[name].apply(object, boundArguments.concat(arguments));
  39406. };
  39407. }
  39408. };
  39409. /* harmony default export */ var util = (Util);
  39410. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39411. function extend(target) {
  39412. var sources = [];
  39413. for (var _i = 1; _i < arguments.length; _i++) {
  39414. sources[_i - 1] = arguments[_i];
  39415. }
  39416. for (var i = 0; i < sources.length; i++) {
  39417. var extensions = sources[i];
  39418. for (var property in extensions) {
  39419. if (extensions[property] && extensions[property].constructor &&
  39420. extensions[property].constructor === Object) {
  39421. target[property] = extend(target[property] || {}, extensions[property]);
  39422. }
  39423. else {
  39424. target[property] = extensions[property];
  39425. }
  39426. }
  39427. }
  39428. return target;
  39429. }
  39430. function stringify() {
  39431. var m = ["Pusher"];
  39432. for (var i = 0; i < arguments.length; i++) {
  39433. if (typeof arguments[i] === "string") {
  39434. m.push(arguments[i]);
  39435. }
  39436. else {
  39437. m.push(safeJSONStringify(arguments[i]));
  39438. }
  39439. }
  39440. return m.join(" : ");
  39441. }
  39442. function arrayIndexOf(array, item) {
  39443. var nativeIndexOf = Array.prototype.indexOf;
  39444. if (array === null) {
  39445. return -1;
  39446. }
  39447. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39448. return array.indexOf(item);
  39449. }
  39450. for (var i = 0, l = array.length; i < l; i++) {
  39451. if (array[i] === item) {
  39452. return i;
  39453. }
  39454. }
  39455. return -1;
  39456. }
  39457. function objectApply(object, f) {
  39458. for (var key in object) {
  39459. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39460. f(object[key], key, object);
  39461. }
  39462. }
  39463. }
  39464. function keys(object) {
  39465. var keys = [];
  39466. objectApply(object, function (_, key) {
  39467. keys.push(key);
  39468. });
  39469. return keys;
  39470. }
  39471. function values(object) {
  39472. var values = [];
  39473. objectApply(object, function (value) {
  39474. values.push(value);
  39475. });
  39476. return values;
  39477. }
  39478. function apply(array, f, context) {
  39479. for (var i = 0; i < array.length; i++) {
  39480. f.call(context || window, array[i], i, array);
  39481. }
  39482. }
  39483. function map(array, f) {
  39484. var result = [];
  39485. for (var i = 0; i < array.length; i++) {
  39486. result.push(f(array[i], i, array, result));
  39487. }
  39488. return result;
  39489. }
  39490. function mapObject(object, f) {
  39491. var result = {};
  39492. objectApply(object, function (value, key) {
  39493. result[key] = f(value);
  39494. });
  39495. return result;
  39496. }
  39497. function filter(array, test) {
  39498. test = test || function (value) { return !!value; };
  39499. var result = [];
  39500. for (var i = 0; i < array.length; i++) {
  39501. if (test(array[i], i, array, result)) {
  39502. result.push(array[i]);
  39503. }
  39504. }
  39505. return result;
  39506. }
  39507. function filterObject(object, test) {
  39508. var result = {};
  39509. objectApply(object, function (value, key) {
  39510. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39511. result[key] = value;
  39512. }
  39513. });
  39514. return result;
  39515. }
  39516. function flatten(object) {
  39517. var result = [];
  39518. objectApply(object, function (value, key) {
  39519. result.push([key, value]);
  39520. });
  39521. return result;
  39522. }
  39523. function any(array, test) {
  39524. for (var i = 0; i < array.length; i++) {
  39525. if (test(array[i], i, array)) {
  39526. return true;
  39527. }
  39528. }
  39529. return false;
  39530. }
  39531. function collections_all(array, test) {
  39532. for (var i = 0; i < array.length; i++) {
  39533. if (!test(array[i], i, array)) {
  39534. return false;
  39535. }
  39536. }
  39537. return true;
  39538. }
  39539. function encodeParamsObject(data) {
  39540. return mapObject(data, function (value) {
  39541. if (typeof value === "object") {
  39542. value = safeJSONStringify(value);
  39543. }
  39544. return encodeURIComponent(encode(value.toString()));
  39545. });
  39546. }
  39547. function buildQueryString(data) {
  39548. var params = filterObject(data, function (value) {
  39549. return value !== undefined;
  39550. });
  39551. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39552. return query;
  39553. }
  39554. function decycleObject(object) {
  39555. var objects = [], paths = [];
  39556. return (function derez(value, path) {
  39557. var i, name, nu;
  39558. switch (typeof value) {
  39559. case 'object':
  39560. if (!value) {
  39561. return null;
  39562. }
  39563. for (i = 0; i < objects.length; i += 1) {
  39564. if (objects[i] === value) {
  39565. return { $ref: paths[i] };
  39566. }
  39567. }
  39568. objects.push(value);
  39569. paths.push(path);
  39570. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39571. nu = [];
  39572. for (i = 0; i < value.length; i += 1) {
  39573. nu[i] = derez(value[i], path + '[' + i + ']');
  39574. }
  39575. }
  39576. else {
  39577. nu = {};
  39578. for (name in value) {
  39579. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39580. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39581. }
  39582. }
  39583. }
  39584. return nu;
  39585. case 'number':
  39586. case 'string':
  39587. case 'boolean':
  39588. return value;
  39589. }
  39590. }(object, '$'));
  39591. }
  39592. function safeJSONStringify(source) {
  39593. try {
  39594. return JSON.stringify(source);
  39595. }
  39596. catch (e) {
  39597. return JSON.stringify(decycleObject(source));
  39598. }
  39599. }
  39600. // CONCATENATED MODULE: ./src/core/logger.ts
  39601. var logger_Logger = (function () {
  39602. function Logger() {
  39603. this.globalLog = function (message) {
  39604. if (window.console && window.console.log) {
  39605. window.console.log(message);
  39606. }
  39607. };
  39608. }
  39609. Logger.prototype.debug = function () {
  39610. var args = [];
  39611. for (var _i = 0; _i < arguments.length; _i++) {
  39612. args[_i] = arguments[_i];
  39613. }
  39614. this.log(this.globalLog, args);
  39615. };
  39616. Logger.prototype.warn = function () {
  39617. var args = [];
  39618. for (var _i = 0; _i < arguments.length; _i++) {
  39619. args[_i] = arguments[_i];
  39620. }
  39621. this.log(this.globalLogWarn, args);
  39622. };
  39623. Logger.prototype.error = function () {
  39624. var args = [];
  39625. for (var _i = 0; _i < arguments.length; _i++) {
  39626. args[_i] = arguments[_i];
  39627. }
  39628. this.log(this.globalLogError, args);
  39629. };
  39630. Logger.prototype.globalLogWarn = function (message) {
  39631. if (window.console && window.console.warn) {
  39632. window.console.warn(message);
  39633. }
  39634. else {
  39635. this.globalLog(message);
  39636. }
  39637. };
  39638. Logger.prototype.globalLogError = function (message) {
  39639. if (window.console && window.console.error) {
  39640. window.console.error(message);
  39641. }
  39642. else {
  39643. this.globalLogWarn(message);
  39644. }
  39645. };
  39646. Logger.prototype.log = function (defaultLoggingFunction) {
  39647. var args = [];
  39648. for (var _i = 1; _i < arguments.length; _i++) {
  39649. args[_i - 1] = arguments[_i];
  39650. }
  39651. var message = stringify.apply(this, arguments);
  39652. if (core_pusher.log) {
  39653. core_pusher.log(message);
  39654. }
  39655. else if (core_pusher.logToConsole) {
  39656. var log = defaultLoggingFunction.bind(this);
  39657. log(message);
  39658. }
  39659. };
  39660. return Logger;
  39661. }());
  39662. /* harmony default export */ var logger = (new logger_Logger());
  39663. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39664. var urlStore = {
  39665. baseUrl: "https://pusher.com",
  39666. urls: {
  39667. authenticationEndpoint: {
  39668. path: "/docs/authenticating_users",
  39669. },
  39670. javascriptQuickStart: {
  39671. path: "/docs/javascript_quick_start"
  39672. },
  39673. triggeringClientEvents: {
  39674. path: "/docs/client_api_guide/client_events#trigger-events"
  39675. }
  39676. }
  39677. };
  39678. var buildLogSuffix = function (key) {
  39679. var urlPrefix = "See:";
  39680. var urlObj = urlStore.urls[key];
  39681. if (!urlObj)
  39682. return "";
  39683. var url;
  39684. if (urlObj.fullUrl) {
  39685. url = urlObj.fullUrl;
  39686. }
  39687. else if (urlObj.path) {
  39688. url = urlStore.baseUrl + urlObj.path;
  39689. }
  39690. if (!url)
  39691. return "";
  39692. return urlPrefix + " " + url;
  39693. };
  39694. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39695. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39696. var ajax = function (context, socketId, callback) {
  39697. var self = this, xhr;
  39698. xhr = runtime.createXHR();
  39699. xhr.open("POST", self.options.authEndpoint, true);
  39700. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39701. for (var headerName in this.authOptions.headers) {
  39702. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39703. }
  39704. xhr.onreadystatechange = function () {
  39705. if (xhr.readyState === 4) {
  39706. if (xhr.status === 200) {
  39707. var data, parsed = false;
  39708. try {
  39709. data = JSON.parse(xhr.responseText);
  39710. parsed = true;
  39711. }
  39712. catch (e) {
  39713. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39714. }
  39715. if (parsed) {
  39716. callback(false, data);
  39717. }
  39718. }
  39719. else {
  39720. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39721. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39722. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39723. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39724. callback(true, xhr.status);
  39725. }
  39726. }
  39727. };
  39728. xhr.send(this.composeQuery(socketId));
  39729. return xhr;
  39730. };
  39731. /* harmony default export */ var xhr_auth = (ajax);
  39732. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39733. var jsonp = function (context, socketId, callback) {
  39734. if (this.authOptions.headers !== undefined) {
  39735. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39736. }
  39737. var callbackName = context.nextAuthCallbackID.toString();
  39738. context.nextAuthCallbackID++;
  39739. var document = context.getDocument();
  39740. var script = document.createElement("script");
  39741. context.auth_callbacks[callbackName] = function (data) {
  39742. callback(false, data);
  39743. };
  39744. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39745. script.src = this.options.authEndpoint +
  39746. '?callback=' +
  39747. encodeURIComponent(callback_name) +
  39748. '&' +
  39749. this.composeQuery(socketId);
  39750. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39751. head.insertBefore(script, head.firstChild);
  39752. };
  39753. /* harmony default export */ var jsonp_auth = (jsonp);
  39754. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39755. var ScriptRequest = (function () {
  39756. function ScriptRequest(src) {
  39757. this.src = src;
  39758. }
  39759. ScriptRequest.prototype.send = function (receiver) {
  39760. var self = this;
  39761. var errorString = "Error loading " + self.src;
  39762. self.script = document.createElement("script");
  39763. self.script.id = receiver.id;
  39764. self.script.src = self.src;
  39765. self.script.type = "text/javascript";
  39766. self.script.charset = "UTF-8";
  39767. if (self.script.addEventListener) {
  39768. self.script.onerror = function () {
  39769. receiver.callback(errorString);
  39770. };
  39771. self.script.onload = function () {
  39772. receiver.callback(null);
  39773. };
  39774. }
  39775. else {
  39776. self.script.onreadystatechange = function () {
  39777. if (self.script.readyState === 'loaded' ||
  39778. self.script.readyState === 'complete') {
  39779. receiver.callback(null);
  39780. }
  39781. };
  39782. }
  39783. if (self.script.async === undefined && document.attachEvent &&
  39784. /opera/i.test(navigator.userAgent)) {
  39785. self.errorScript = document.createElement("script");
  39786. self.errorScript.id = receiver.id + "_error";
  39787. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39788. self.script.async = self.errorScript.async = false;
  39789. }
  39790. else {
  39791. self.script.async = true;
  39792. }
  39793. var head = document.getElementsByTagName('head')[0];
  39794. head.insertBefore(self.script, head.firstChild);
  39795. if (self.errorScript) {
  39796. head.insertBefore(self.errorScript, self.script.nextSibling);
  39797. }
  39798. };
  39799. ScriptRequest.prototype.cleanup = function () {
  39800. if (this.script) {
  39801. this.script.onload = this.script.onerror = null;
  39802. this.script.onreadystatechange = null;
  39803. }
  39804. if (this.script && this.script.parentNode) {
  39805. this.script.parentNode.removeChild(this.script);
  39806. }
  39807. if (this.errorScript && this.errorScript.parentNode) {
  39808. this.errorScript.parentNode.removeChild(this.errorScript);
  39809. }
  39810. this.script = null;
  39811. this.errorScript = null;
  39812. };
  39813. return ScriptRequest;
  39814. }());
  39815. /* harmony default export */ var script_request = (ScriptRequest);
  39816. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39817. var jsonp_request_JSONPRequest = (function () {
  39818. function JSONPRequest(url, data) {
  39819. this.url = url;
  39820. this.data = data;
  39821. }
  39822. JSONPRequest.prototype.send = function (receiver) {
  39823. if (this.request) {
  39824. return;
  39825. }
  39826. var query = buildQueryString(this.data);
  39827. var url = this.url + "/" + receiver.number + "?" + query;
  39828. this.request = runtime.createScriptRequest(url);
  39829. this.request.send(receiver);
  39830. };
  39831. JSONPRequest.prototype.cleanup = function () {
  39832. if (this.request) {
  39833. this.request.cleanup();
  39834. }
  39835. };
  39836. return JSONPRequest;
  39837. }());
  39838. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39839. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39840. var getAgent = function (sender, useTLS) {
  39841. return function (data, callback) {
  39842. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39843. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39844. var request = runtime.createJSONPRequest(url, data);
  39845. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39846. ScriptReceivers.remove(receiver);
  39847. request.cleanup();
  39848. if (result && result.host) {
  39849. sender.host = result.host;
  39850. }
  39851. if (callback) {
  39852. callback(error, result);
  39853. }
  39854. });
  39855. request.send(receiver);
  39856. };
  39857. };
  39858. var jsonp_timeline_jsonp = {
  39859. name: 'jsonp',
  39860. getAgent: getAgent
  39861. };
  39862. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39863. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39864. function getGenericURL(baseScheme, params, path) {
  39865. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39866. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39867. return scheme + "://" + host + path;
  39868. }
  39869. function getGenericPath(key, queryString) {
  39870. var path = "/app/" + key;
  39871. var query = "?protocol=" + defaults.PROTOCOL +
  39872. "&client=js" +
  39873. "&version=" + defaults.VERSION +
  39874. (queryString ? ("&" + queryString) : "");
  39875. return path + query;
  39876. }
  39877. var ws = {
  39878. getInitial: function (key, params) {
  39879. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39880. return getGenericURL("ws", params, path);
  39881. }
  39882. };
  39883. var http = {
  39884. getInitial: function (key, params) {
  39885. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39886. return getGenericURL("http", params, path);
  39887. }
  39888. };
  39889. var sockjs = {
  39890. getInitial: function (key, params) {
  39891. return getGenericURL("http", params, params.httpPath || "/pusher");
  39892. },
  39893. getPath: function (key, params) {
  39894. return getGenericPath(key);
  39895. }
  39896. };
  39897. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39898. var callback_registry_CallbackRegistry = (function () {
  39899. function CallbackRegistry() {
  39900. this._callbacks = {};
  39901. }
  39902. CallbackRegistry.prototype.get = function (name) {
  39903. return this._callbacks[prefix(name)];
  39904. };
  39905. CallbackRegistry.prototype.add = function (name, callback, context) {
  39906. var prefixedEventName = prefix(name);
  39907. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39908. this._callbacks[prefixedEventName].push({
  39909. fn: callback,
  39910. context: context
  39911. });
  39912. };
  39913. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39914. if (!name && !callback && !context) {
  39915. this._callbacks = {};
  39916. return;
  39917. }
  39918. var names = name ? [prefix(name)] : keys(this._callbacks);
  39919. if (callback || context) {
  39920. this.removeCallback(names, callback, context);
  39921. }
  39922. else {
  39923. this.removeAllCallbacks(names);
  39924. }
  39925. };
  39926. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39927. apply(names, function (name) {
  39928. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39929. return (callback && callback !== binding.fn) ||
  39930. (context && context !== binding.context);
  39931. });
  39932. if (this._callbacks[name].length === 0) {
  39933. delete this._callbacks[name];
  39934. }
  39935. }, this);
  39936. };
  39937. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39938. apply(names, function (name) {
  39939. delete this._callbacks[name];
  39940. }, this);
  39941. };
  39942. return CallbackRegistry;
  39943. }());
  39944. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39945. function prefix(name) {
  39946. return "_" + name;
  39947. }
  39948. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39949. var dispatcher_Dispatcher = (function () {
  39950. function Dispatcher(failThrough) {
  39951. this.callbacks = new callback_registry();
  39952. this.global_callbacks = [];
  39953. this.failThrough = failThrough;
  39954. }
  39955. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39956. this.callbacks.add(eventName, callback, context);
  39957. return this;
  39958. };
  39959. Dispatcher.prototype.bind_global = function (callback) {
  39960. this.global_callbacks.push(callback);
  39961. return this;
  39962. };
  39963. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39964. this.callbacks.remove(eventName, callback, context);
  39965. return this;
  39966. };
  39967. Dispatcher.prototype.unbind_global = function (callback) {
  39968. if (!callback) {
  39969. this.global_callbacks = [];
  39970. return this;
  39971. }
  39972. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39973. return this;
  39974. };
  39975. Dispatcher.prototype.unbind_all = function () {
  39976. this.unbind();
  39977. this.unbind_global();
  39978. return this;
  39979. };
  39980. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39981. for (var i = 0; i < this.global_callbacks.length; i++) {
  39982. this.global_callbacks[i](eventName, data);
  39983. }
  39984. var callbacks = this.callbacks.get(eventName);
  39985. var args = [];
  39986. if (metadata) {
  39987. args.push(data, metadata);
  39988. }
  39989. else if (data) {
  39990. args.push(data);
  39991. }
  39992. if (callbacks && callbacks.length > 0) {
  39993. for (var i = 0; i < callbacks.length; i++) {
  39994. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39995. }
  39996. }
  39997. else if (this.failThrough) {
  39998. this.failThrough(eventName, data);
  39999. }
  40000. return this;
  40001. };
  40002. return Dispatcher;
  40003. }());
  40004. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40005. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40006. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40007. var extendStatics = function (d, b) {
  40008. extendStatics = Object.setPrototypeOf ||
  40009. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40010. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40011. return extendStatics(d, b);
  40012. };
  40013. return function (d, b) {
  40014. extendStatics(d, b);
  40015. function __() { this.constructor = d; }
  40016. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40017. };
  40018. })();
  40019. var transport_connection_TransportConnection = (function (_super) {
  40020. transport_connection_extends(TransportConnection, _super);
  40021. function TransportConnection(hooks, name, priority, key, options) {
  40022. var _this = _super.call(this) || this;
  40023. _this.initialize = runtime.transportConnectionInitializer;
  40024. _this.hooks = hooks;
  40025. _this.name = name;
  40026. _this.priority = priority;
  40027. _this.key = key;
  40028. _this.options = options;
  40029. _this.state = "new";
  40030. _this.timeline = options.timeline;
  40031. _this.activityTimeout = options.activityTimeout;
  40032. _this.id = _this.timeline.generateUniqueID();
  40033. return _this;
  40034. }
  40035. TransportConnection.prototype.handlesActivityChecks = function () {
  40036. return Boolean(this.hooks.handlesActivityChecks);
  40037. };
  40038. TransportConnection.prototype.supportsPing = function () {
  40039. return Boolean(this.hooks.supportsPing);
  40040. };
  40041. TransportConnection.prototype.connect = function () {
  40042. var _this = this;
  40043. if (this.socket || this.state !== "initialized") {
  40044. return false;
  40045. }
  40046. var url = this.hooks.urls.getInitial(this.key, this.options);
  40047. try {
  40048. this.socket = this.hooks.getSocket(url, this.options);
  40049. }
  40050. catch (e) {
  40051. util.defer(function () {
  40052. _this.onError(e);
  40053. _this.changeState("closed");
  40054. });
  40055. return false;
  40056. }
  40057. this.bindListeners();
  40058. logger.debug("Connecting", { transport: this.name, url: url });
  40059. this.changeState("connecting");
  40060. return true;
  40061. };
  40062. TransportConnection.prototype.close = function () {
  40063. if (this.socket) {
  40064. this.socket.close();
  40065. return true;
  40066. }
  40067. else {
  40068. return false;
  40069. }
  40070. };
  40071. TransportConnection.prototype.send = function (data) {
  40072. var _this = this;
  40073. if (this.state === "open") {
  40074. util.defer(function () {
  40075. if (_this.socket) {
  40076. _this.socket.send(data);
  40077. }
  40078. });
  40079. return true;
  40080. }
  40081. else {
  40082. return false;
  40083. }
  40084. };
  40085. TransportConnection.prototype.ping = function () {
  40086. if (this.state === "open" && this.supportsPing()) {
  40087. this.socket.ping();
  40088. }
  40089. };
  40090. TransportConnection.prototype.onOpen = function () {
  40091. if (this.hooks.beforeOpen) {
  40092. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40093. }
  40094. this.changeState("open");
  40095. this.socket.onopen = undefined;
  40096. };
  40097. TransportConnection.prototype.onError = function (error) {
  40098. this.emit("error", { type: 'WebSocketError', error: error });
  40099. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40100. };
  40101. TransportConnection.prototype.onClose = function (closeEvent) {
  40102. if (closeEvent) {
  40103. this.changeState("closed", {
  40104. code: closeEvent.code,
  40105. reason: closeEvent.reason,
  40106. wasClean: closeEvent.wasClean
  40107. });
  40108. }
  40109. else {
  40110. this.changeState("closed");
  40111. }
  40112. this.unbindListeners();
  40113. this.socket = undefined;
  40114. };
  40115. TransportConnection.prototype.onMessage = function (message) {
  40116. this.emit("message", message);
  40117. };
  40118. TransportConnection.prototype.onActivity = function () {
  40119. this.emit("activity");
  40120. };
  40121. TransportConnection.prototype.bindListeners = function () {
  40122. var _this = this;
  40123. this.socket.onopen = function () {
  40124. _this.onOpen();
  40125. };
  40126. this.socket.onerror = function (error) {
  40127. _this.onError(error);
  40128. };
  40129. this.socket.onclose = function (closeEvent) {
  40130. _this.onClose(closeEvent);
  40131. };
  40132. this.socket.onmessage = function (message) {
  40133. _this.onMessage(message);
  40134. };
  40135. if (this.supportsPing()) {
  40136. this.socket.onactivity = function () { _this.onActivity(); };
  40137. }
  40138. };
  40139. TransportConnection.prototype.unbindListeners = function () {
  40140. if (this.socket) {
  40141. this.socket.onopen = undefined;
  40142. this.socket.onerror = undefined;
  40143. this.socket.onclose = undefined;
  40144. this.socket.onmessage = undefined;
  40145. if (this.supportsPing()) {
  40146. this.socket.onactivity = undefined;
  40147. }
  40148. }
  40149. };
  40150. TransportConnection.prototype.changeState = function (state, params) {
  40151. this.state = state;
  40152. this.timeline.info(this.buildTimelineMessage({
  40153. state: state,
  40154. params: params
  40155. }));
  40156. this.emit(state, params);
  40157. };
  40158. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40159. return extend({ cid: this.id }, message);
  40160. };
  40161. return TransportConnection;
  40162. }(dispatcher));
  40163. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40164. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40165. var transport_Transport = (function () {
  40166. function Transport(hooks) {
  40167. this.hooks = hooks;
  40168. }
  40169. Transport.prototype.isSupported = function (environment) {
  40170. return this.hooks.isSupported(environment);
  40171. };
  40172. Transport.prototype.createConnection = function (name, priority, key, options) {
  40173. return new transport_connection(this.hooks, name, priority, key, options);
  40174. };
  40175. return Transport;
  40176. }());
  40177. /* harmony default export */ var transports_transport = (transport_Transport);
  40178. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40179. var WSTransport = new transports_transport({
  40180. urls: ws,
  40181. handlesActivityChecks: false,
  40182. supportsPing: false,
  40183. isInitialized: function () {
  40184. return Boolean(runtime.getWebSocketAPI());
  40185. },
  40186. isSupported: function () {
  40187. return Boolean(runtime.getWebSocketAPI());
  40188. },
  40189. getSocket: function (url) {
  40190. return runtime.createWebSocket(url);
  40191. }
  40192. });
  40193. var httpConfiguration = {
  40194. urls: http,
  40195. handlesActivityChecks: false,
  40196. supportsPing: true,
  40197. isInitialized: function () {
  40198. return true;
  40199. }
  40200. };
  40201. var streamingConfiguration = extend({ getSocket: function (url) {
  40202. return runtime.HTTPFactory.createStreamingSocket(url);
  40203. }
  40204. }, httpConfiguration);
  40205. var pollingConfiguration = extend({ getSocket: function (url) {
  40206. return runtime.HTTPFactory.createPollingSocket(url);
  40207. }
  40208. }, httpConfiguration);
  40209. var xhrConfiguration = {
  40210. isSupported: function () {
  40211. return runtime.isXHRSupported();
  40212. }
  40213. };
  40214. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40215. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40216. var Transports = {
  40217. ws: WSTransport,
  40218. xhr_streaming: XHRStreamingTransport,
  40219. xhr_polling: XHRPollingTransport
  40220. };
  40221. /* harmony default export */ var transports = (Transports);
  40222. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40223. var SockJSTransport = new transports_transport({
  40224. file: "sockjs",
  40225. urls: sockjs,
  40226. handlesActivityChecks: true,
  40227. supportsPing: false,
  40228. isSupported: function () {
  40229. return true;
  40230. },
  40231. isInitialized: function () {
  40232. return window.SockJS !== undefined;
  40233. },
  40234. getSocket: function (url, options) {
  40235. return new window.SockJS(url, null, {
  40236. js_path: Dependencies.getPath("sockjs", {
  40237. useTLS: options.useTLS
  40238. }),
  40239. ignore_null_origin: options.ignoreNullOrigin
  40240. });
  40241. },
  40242. beforeOpen: function (socket, path) {
  40243. socket.send(JSON.stringify({
  40244. path: path
  40245. }));
  40246. }
  40247. });
  40248. var xdrConfiguration = {
  40249. isSupported: function (environment) {
  40250. var yes = runtime.isXDRSupported(environment.useTLS);
  40251. return yes;
  40252. }
  40253. };
  40254. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40255. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40256. transports.xdr_streaming = XDRStreamingTransport;
  40257. transports.xdr_polling = XDRPollingTransport;
  40258. transports.sockjs = SockJSTransport;
  40259. /* harmony default export */ var transports_transports = (transports);
  40260. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40261. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40262. var extendStatics = function (d, b) {
  40263. extendStatics = Object.setPrototypeOf ||
  40264. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40265. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40266. return extendStatics(d, b);
  40267. };
  40268. return function (d, b) {
  40269. extendStatics(d, b);
  40270. function __() { this.constructor = d; }
  40271. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40272. };
  40273. })();
  40274. var NetInfo = (function (_super) {
  40275. net_info_extends(NetInfo, _super);
  40276. function NetInfo() {
  40277. var _this = _super.call(this) || this;
  40278. var self = _this;
  40279. if (window.addEventListener !== undefined) {
  40280. window.addEventListener("online", function () {
  40281. self.emit('online');
  40282. }, false);
  40283. window.addEventListener("offline", function () {
  40284. self.emit('offline');
  40285. }, false);
  40286. }
  40287. return _this;
  40288. }
  40289. NetInfo.prototype.isOnline = function () {
  40290. if (window.navigator.onLine === undefined) {
  40291. return true;
  40292. }
  40293. else {
  40294. return window.navigator.onLine;
  40295. }
  40296. };
  40297. return NetInfo;
  40298. }(dispatcher));
  40299. var net_info_Network = new NetInfo();
  40300. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40301. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40302. function AssistantToTheTransportManager(manager, transport, options) {
  40303. this.manager = manager;
  40304. this.transport = transport;
  40305. this.minPingDelay = options.minPingDelay;
  40306. this.maxPingDelay = options.maxPingDelay;
  40307. this.pingDelay = undefined;
  40308. }
  40309. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40310. var _this = this;
  40311. options = extend({}, options, {
  40312. activityTimeout: this.pingDelay
  40313. });
  40314. var connection = this.transport.createConnection(name, priority, key, options);
  40315. var openTimestamp = null;
  40316. var onOpen = function () {
  40317. connection.unbind("open", onOpen);
  40318. connection.bind("closed", onClosed);
  40319. openTimestamp = util.now();
  40320. };
  40321. var onClosed = function (closeEvent) {
  40322. connection.unbind("closed", onClosed);
  40323. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40324. _this.manager.reportDeath();
  40325. }
  40326. else if (!closeEvent.wasClean && openTimestamp) {
  40327. var lifespan = util.now() - openTimestamp;
  40328. if (lifespan < 2 * _this.maxPingDelay) {
  40329. _this.manager.reportDeath();
  40330. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40331. }
  40332. }
  40333. };
  40334. connection.bind("open", onOpen);
  40335. return connection;
  40336. };
  40337. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40338. return this.manager.isAlive() && this.transport.isSupported(environment);
  40339. };
  40340. return AssistantToTheTransportManager;
  40341. }());
  40342. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40343. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40344. var Protocol = {
  40345. decodeMessage: function (messageEvent) {
  40346. try {
  40347. var messageData = JSON.parse(messageEvent.data);
  40348. var pusherEventData = messageData.data;
  40349. if (typeof pusherEventData === 'string') {
  40350. try {
  40351. pusherEventData = JSON.parse(messageData.data);
  40352. }
  40353. catch (e) { }
  40354. }
  40355. var pusherEvent = {
  40356. event: messageData.event,
  40357. channel: messageData.channel,
  40358. data: pusherEventData,
  40359. };
  40360. if (messageData.user_id) {
  40361. pusherEvent.user_id = messageData.user_id;
  40362. }
  40363. return pusherEvent;
  40364. }
  40365. catch (e) {
  40366. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40367. }
  40368. },
  40369. encodeMessage: function (event) {
  40370. return JSON.stringify(event);
  40371. },
  40372. processHandshake: function (messageEvent) {
  40373. var message = Protocol.decodeMessage(messageEvent);
  40374. if (message.event === "pusher:connection_established") {
  40375. if (!message.data.activity_timeout) {
  40376. throw "No activity timeout specified in handshake";
  40377. }
  40378. return {
  40379. action: "connected",
  40380. id: message.data.socket_id,
  40381. activityTimeout: message.data.activity_timeout * 1000
  40382. };
  40383. }
  40384. else if (message.event === "pusher:error") {
  40385. return {
  40386. action: this.getCloseAction(message.data),
  40387. error: this.getCloseError(message.data)
  40388. };
  40389. }
  40390. else {
  40391. throw "Invalid handshake";
  40392. }
  40393. },
  40394. getCloseAction: function (closeEvent) {
  40395. if (closeEvent.code < 4000) {
  40396. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40397. return "backoff";
  40398. }
  40399. else {
  40400. return null;
  40401. }
  40402. }
  40403. else if (closeEvent.code === 4000) {
  40404. return "tls_only";
  40405. }
  40406. else if (closeEvent.code < 4100) {
  40407. return "refused";
  40408. }
  40409. else if (closeEvent.code < 4200) {
  40410. return "backoff";
  40411. }
  40412. else if (closeEvent.code < 4300) {
  40413. return "retry";
  40414. }
  40415. else {
  40416. return "refused";
  40417. }
  40418. },
  40419. getCloseError: function (closeEvent) {
  40420. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40421. return {
  40422. type: 'PusherError',
  40423. data: {
  40424. code: closeEvent.code,
  40425. message: closeEvent.reason || closeEvent.message
  40426. }
  40427. };
  40428. }
  40429. else {
  40430. return null;
  40431. }
  40432. }
  40433. };
  40434. /* harmony default export */ var protocol_protocol = (Protocol);
  40435. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40436. var connection_extends = (undefined && undefined.__extends) || (function () {
  40437. var extendStatics = function (d, b) {
  40438. extendStatics = Object.setPrototypeOf ||
  40439. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40440. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40441. return extendStatics(d, b);
  40442. };
  40443. return function (d, b) {
  40444. extendStatics(d, b);
  40445. function __() { this.constructor = d; }
  40446. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40447. };
  40448. })();
  40449. var connection_Connection = (function (_super) {
  40450. connection_extends(Connection, _super);
  40451. function Connection(id, transport) {
  40452. var _this = _super.call(this) || this;
  40453. _this.id = id;
  40454. _this.transport = transport;
  40455. _this.activityTimeout = transport.activityTimeout;
  40456. _this.bindListeners();
  40457. return _this;
  40458. }
  40459. Connection.prototype.handlesActivityChecks = function () {
  40460. return this.transport.handlesActivityChecks();
  40461. };
  40462. Connection.prototype.send = function (data) {
  40463. return this.transport.send(data);
  40464. };
  40465. Connection.prototype.send_event = function (name, data, channel) {
  40466. var event = { event: name, data: data };
  40467. if (channel) {
  40468. event.channel = channel;
  40469. }
  40470. logger.debug('Event sent', event);
  40471. return this.send(protocol_protocol.encodeMessage(event));
  40472. };
  40473. Connection.prototype.ping = function () {
  40474. if (this.transport.supportsPing()) {
  40475. this.transport.ping();
  40476. }
  40477. else {
  40478. this.send_event('pusher:ping', {});
  40479. }
  40480. };
  40481. Connection.prototype.close = function () {
  40482. this.transport.close();
  40483. };
  40484. Connection.prototype.bindListeners = function () {
  40485. var _this = this;
  40486. var listeners = {
  40487. message: function (messageEvent) {
  40488. var pusherEvent;
  40489. try {
  40490. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40491. }
  40492. catch (e) {
  40493. _this.emit('error', {
  40494. type: 'MessageParseError',
  40495. error: e,
  40496. data: messageEvent.data
  40497. });
  40498. }
  40499. if (pusherEvent !== undefined) {
  40500. logger.debug('Event recd', pusherEvent);
  40501. switch (pusherEvent.event) {
  40502. case 'pusher:error':
  40503. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40504. break;
  40505. case 'pusher:ping':
  40506. _this.emit("ping");
  40507. break;
  40508. case 'pusher:pong':
  40509. _this.emit("pong");
  40510. break;
  40511. }
  40512. _this.emit('message', pusherEvent);
  40513. }
  40514. },
  40515. activity: function () {
  40516. _this.emit("activity");
  40517. },
  40518. error: function (error) {
  40519. _this.emit("error", { type: "WebSocketError", error: error });
  40520. },
  40521. closed: function (closeEvent) {
  40522. unbindListeners();
  40523. if (closeEvent && closeEvent.code) {
  40524. _this.handleCloseEvent(closeEvent);
  40525. }
  40526. _this.transport = null;
  40527. _this.emit("closed");
  40528. }
  40529. };
  40530. var unbindListeners = function () {
  40531. objectApply(listeners, function (listener, event) {
  40532. _this.transport.unbind(event, listener);
  40533. });
  40534. };
  40535. objectApply(listeners, function (listener, event) {
  40536. _this.transport.bind(event, listener);
  40537. });
  40538. };
  40539. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40540. var action = protocol_protocol.getCloseAction(closeEvent);
  40541. var error = protocol_protocol.getCloseError(closeEvent);
  40542. if (error) {
  40543. this.emit('error', error);
  40544. }
  40545. if (action) {
  40546. this.emit(action, { action: action, error: error });
  40547. }
  40548. };
  40549. return Connection;
  40550. }(dispatcher));
  40551. /* harmony default export */ var connection_connection = (connection_Connection);
  40552. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40553. var handshake_Handshake = (function () {
  40554. function Handshake(transport, callback) {
  40555. this.transport = transport;
  40556. this.callback = callback;
  40557. this.bindListeners();
  40558. }
  40559. Handshake.prototype.close = function () {
  40560. this.unbindListeners();
  40561. this.transport.close();
  40562. };
  40563. Handshake.prototype.bindListeners = function () {
  40564. var _this = this;
  40565. this.onMessage = function (m) {
  40566. _this.unbindListeners();
  40567. var result;
  40568. try {
  40569. result = protocol_protocol.processHandshake(m);
  40570. }
  40571. catch (e) {
  40572. _this.finish("error", { error: e });
  40573. _this.transport.close();
  40574. return;
  40575. }
  40576. if (result.action === "connected") {
  40577. _this.finish("connected", {
  40578. connection: new connection_connection(result.id, _this.transport),
  40579. activityTimeout: result.activityTimeout
  40580. });
  40581. }
  40582. else {
  40583. _this.finish(result.action, { error: result.error });
  40584. _this.transport.close();
  40585. }
  40586. };
  40587. this.onClosed = function (closeEvent) {
  40588. _this.unbindListeners();
  40589. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40590. var error = protocol_protocol.getCloseError(closeEvent);
  40591. _this.finish(action, { error: error });
  40592. };
  40593. this.transport.bind("message", this.onMessage);
  40594. this.transport.bind("closed", this.onClosed);
  40595. };
  40596. Handshake.prototype.unbindListeners = function () {
  40597. this.transport.unbind("message", this.onMessage);
  40598. this.transport.unbind("closed", this.onClosed);
  40599. };
  40600. Handshake.prototype.finish = function (action, params) {
  40601. this.callback(extend({ transport: this.transport, action: action }, params));
  40602. };
  40603. return Handshake;
  40604. }());
  40605. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40606. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40607. var pusher_authorizer_PusherAuthorizer = (function () {
  40608. function PusherAuthorizer(channel, options) {
  40609. this.channel = channel;
  40610. var authTransport = options.authTransport;
  40611. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40612. throw "'" + authTransport + "' is not a recognized auth transport";
  40613. }
  40614. this.type = authTransport;
  40615. this.options = options;
  40616. this.authOptions = (options || {}).auth || {};
  40617. }
  40618. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40619. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40620. '&channel_name=' + encodeURIComponent(this.channel.name);
  40621. for (var i in this.authOptions.params) {
  40622. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40623. }
  40624. return query;
  40625. };
  40626. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40627. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40628. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40629. };
  40630. return PusherAuthorizer;
  40631. }());
  40632. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40633. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40634. var timeline_sender_TimelineSender = (function () {
  40635. function TimelineSender(timeline, options) {
  40636. this.timeline = timeline;
  40637. this.options = options || {};
  40638. }
  40639. TimelineSender.prototype.send = function (useTLS, callback) {
  40640. if (this.timeline.isEmpty()) {
  40641. return;
  40642. }
  40643. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40644. };
  40645. return TimelineSender;
  40646. }());
  40647. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40648. // CONCATENATED MODULE: ./src/core/errors.ts
  40649. var errors_extends = (undefined && undefined.__extends) || (function () {
  40650. var extendStatics = function (d, b) {
  40651. extendStatics = Object.setPrototypeOf ||
  40652. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40653. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40654. return extendStatics(d, b);
  40655. };
  40656. return function (d, b) {
  40657. extendStatics(d, b);
  40658. function __() { this.constructor = d; }
  40659. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40660. };
  40661. })();
  40662. var BadEventName = (function (_super) {
  40663. errors_extends(BadEventName, _super);
  40664. function BadEventName(msg) {
  40665. var _newTarget = this.constructor;
  40666. var _this = _super.call(this, msg) || this;
  40667. Object.setPrototypeOf(_this, _newTarget.prototype);
  40668. return _this;
  40669. }
  40670. return BadEventName;
  40671. }(Error));
  40672. var RequestTimedOut = (function (_super) {
  40673. errors_extends(RequestTimedOut, _super);
  40674. function RequestTimedOut(msg) {
  40675. var _newTarget = this.constructor;
  40676. var _this = _super.call(this, msg) || this;
  40677. Object.setPrototypeOf(_this, _newTarget.prototype);
  40678. return _this;
  40679. }
  40680. return RequestTimedOut;
  40681. }(Error));
  40682. var TransportPriorityTooLow = (function (_super) {
  40683. errors_extends(TransportPriorityTooLow, _super);
  40684. function TransportPriorityTooLow(msg) {
  40685. var _newTarget = this.constructor;
  40686. var _this = _super.call(this, msg) || this;
  40687. Object.setPrototypeOf(_this, _newTarget.prototype);
  40688. return _this;
  40689. }
  40690. return TransportPriorityTooLow;
  40691. }(Error));
  40692. var TransportClosed = (function (_super) {
  40693. errors_extends(TransportClosed, _super);
  40694. function TransportClosed(msg) {
  40695. var _newTarget = this.constructor;
  40696. var _this = _super.call(this, msg) || this;
  40697. Object.setPrototypeOf(_this, _newTarget.prototype);
  40698. return _this;
  40699. }
  40700. return TransportClosed;
  40701. }(Error));
  40702. var UnsupportedFeature = (function (_super) {
  40703. errors_extends(UnsupportedFeature, _super);
  40704. function UnsupportedFeature(msg) {
  40705. var _newTarget = this.constructor;
  40706. var _this = _super.call(this, msg) || this;
  40707. Object.setPrototypeOf(_this, _newTarget.prototype);
  40708. return _this;
  40709. }
  40710. return UnsupportedFeature;
  40711. }(Error));
  40712. var UnsupportedTransport = (function (_super) {
  40713. errors_extends(UnsupportedTransport, _super);
  40714. function UnsupportedTransport(msg) {
  40715. var _newTarget = this.constructor;
  40716. var _this = _super.call(this, msg) || this;
  40717. Object.setPrototypeOf(_this, _newTarget.prototype);
  40718. return _this;
  40719. }
  40720. return UnsupportedTransport;
  40721. }(Error));
  40722. var UnsupportedStrategy = (function (_super) {
  40723. errors_extends(UnsupportedStrategy, _super);
  40724. function UnsupportedStrategy(msg) {
  40725. var _newTarget = this.constructor;
  40726. var _this = _super.call(this, msg) || this;
  40727. Object.setPrototypeOf(_this, _newTarget.prototype);
  40728. return _this;
  40729. }
  40730. return UnsupportedStrategy;
  40731. }(Error));
  40732. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40733. var channel_extends = (undefined && undefined.__extends) || (function () {
  40734. var extendStatics = function (d, b) {
  40735. extendStatics = Object.setPrototypeOf ||
  40736. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40737. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40738. return extendStatics(d, b);
  40739. };
  40740. return function (d, b) {
  40741. extendStatics(d, b);
  40742. function __() { this.constructor = d; }
  40743. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40744. };
  40745. })();
  40746. var channel_Channel = (function (_super) {
  40747. channel_extends(Channel, _super);
  40748. function Channel(name, pusher) {
  40749. var _this = _super.call(this, function (event, data) {
  40750. logger.debug('No callbacks on ' + name + ' for ' + event);
  40751. }) || this;
  40752. _this.name = name;
  40753. _this.pusher = pusher;
  40754. _this.subscribed = false;
  40755. _this.subscriptionPending = false;
  40756. _this.subscriptionCancelled = false;
  40757. return _this;
  40758. }
  40759. Channel.prototype.authorize = function (socketId, callback) {
  40760. return callback(false, {});
  40761. };
  40762. Channel.prototype.trigger = function (event, data) {
  40763. if (event.indexOf("client-") !== 0) {
  40764. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40765. }
  40766. if (!this.subscribed) {
  40767. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40768. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40769. }
  40770. return this.pusher.send_event(event, data, this.name);
  40771. };
  40772. Channel.prototype.disconnect = function () {
  40773. this.subscribed = false;
  40774. this.subscriptionPending = false;
  40775. };
  40776. Channel.prototype.handleEvent = function (event) {
  40777. var eventName = event.event;
  40778. var data = event.data;
  40779. if (eventName === "pusher_internal:subscription_succeeded") {
  40780. this.handleSubscriptionSucceededEvent(event);
  40781. }
  40782. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40783. var metadata = {};
  40784. this.emit(eventName, data, metadata);
  40785. }
  40786. };
  40787. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40788. this.subscriptionPending = false;
  40789. this.subscribed = true;
  40790. if (this.subscriptionCancelled) {
  40791. this.pusher.unsubscribe(this.name);
  40792. }
  40793. else {
  40794. this.emit("pusher:subscription_succeeded", event.data);
  40795. }
  40796. };
  40797. Channel.prototype.subscribe = function () {
  40798. var _this = this;
  40799. if (this.subscribed) {
  40800. return;
  40801. }
  40802. this.subscriptionPending = true;
  40803. this.subscriptionCancelled = false;
  40804. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40805. if (error) {
  40806. logger.error(data);
  40807. _this.emit('pusher:subscription_error', data);
  40808. }
  40809. else {
  40810. _this.pusher.send_event('pusher:subscribe', {
  40811. auth: data.auth,
  40812. channel_data: data.channel_data,
  40813. channel: _this.name
  40814. });
  40815. }
  40816. });
  40817. };
  40818. Channel.prototype.unsubscribe = function () {
  40819. this.subscribed = false;
  40820. this.pusher.send_event('pusher:unsubscribe', {
  40821. channel: this.name
  40822. });
  40823. };
  40824. Channel.prototype.cancelSubscription = function () {
  40825. this.subscriptionCancelled = true;
  40826. };
  40827. Channel.prototype.reinstateSubscription = function () {
  40828. this.subscriptionCancelled = false;
  40829. };
  40830. return Channel;
  40831. }(dispatcher));
  40832. /* harmony default export */ var channels_channel = (channel_Channel);
  40833. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40834. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40835. var extendStatics = function (d, b) {
  40836. extendStatics = Object.setPrototypeOf ||
  40837. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40838. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40839. return extendStatics(d, b);
  40840. };
  40841. return function (d, b) {
  40842. extendStatics(d, b);
  40843. function __() { this.constructor = d; }
  40844. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40845. };
  40846. })();
  40847. var private_channel_PrivateChannel = (function (_super) {
  40848. private_channel_extends(PrivateChannel, _super);
  40849. function PrivateChannel() {
  40850. return _super !== null && _super.apply(this, arguments) || this;
  40851. }
  40852. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40853. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40854. return authorizer.authorize(socketId, callback);
  40855. };
  40856. return PrivateChannel;
  40857. }(channels_channel));
  40858. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40859. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40860. var members_Members = (function () {
  40861. function Members() {
  40862. this.reset();
  40863. }
  40864. Members.prototype.get = function (id) {
  40865. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40866. return {
  40867. id: id,
  40868. info: this.members[id]
  40869. };
  40870. }
  40871. else {
  40872. return null;
  40873. }
  40874. };
  40875. Members.prototype.each = function (callback) {
  40876. var _this = this;
  40877. objectApply(this.members, function (member, id) {
  40878. callback(_this.get(id));
  40879. });
  40880. };
  40881. Members.prototype.setMyID = function (id) {
  40882. this.myID = id;
  40883. };
  40884. Members.prototype.onSubscription = function (subscriptionData) {
  40885. this.members = subscriptionData.presence.hash;
  40886. this.count = subscriptionData.presence.count;
  40887. this.me = this.get(this.myID);
  40888. };
  40889. Members.prototype.addMember = function (memberData) {
  40890. if (this.get(memberData.user_id) === null) {
  40891. this.count++;
  40892. }
  40893. this.members[memberData.user_id] = memberData.user_info;
  40894. return this.get(memberData.user_id);
  40895. };
  40896. Members.prototype.removeMember = function (memberData) {
  40897. var member = this.get(memberData.user_id);
  40898. if (member) {
  40899. delete this.members[memberData.user_id];
  40900. this.count--;
  40901. }
  40902. return member;
  40903. };
  40904. Members.prototype.reset = function () {
  40905. this.members = {};
  40906. this.count = 0;
  40907. this.myID = null;
  40908. this.me = null;
  40909. };
  40910. return Members;
  40911. }());
  40912. /* harmony default export */ var members = (members_Members);
  40913. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40914. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40915. var extendStatics = function (d, b) {
  40916. extendStatics = Object.setPrototypeOf ||
  40917. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40918. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40919. return extendStatics(d, b);
  40920. };
  40921. return function (d, b) {
  40922. extendStatics(d, b);
  40923. function __() { this.constructor = d; }
  40924. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40925. };
  40926. })();
  40927. var presence_channel_PresenceChannel = (function (_super) {
  40928. presence_channel_extends(PresenceChannel, _super);
  40929. function PresenceChannel(name, pusher) {
  40930. var _this = _super.call(this, name, pusher) || this;
  40931. _this.members = new members();
  40932. return _this;
  40933. }
  40934. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40935. var _this = this;
  40936. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40937. if (!error) {
  40938. if (authData.channel_data === undefined) {
  40939. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40940. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40941. ("expected 'channel_data' field. " + suffix));
  40942. callback("Invalid auth response");
  40943. return;
  40944. }
  40945. var channelData = JSON.parse(authData.channel_data);
  40946. _this.members.setMyID(channelData.user_id);
  40947. }
  40948. callback(error, authData);
  40949. });
  40950. };
  40951. PresenceChannel.prototype.handleEvent = function (event) {
  40952. var eventName = event.event;
  40953. if (eventName.indexOf("pusher_internal:") === 0) {
  40954. this.handleInternalEvent(event);
  40955. }
  40956. else {
  40957. var data = event.data;
  40958. var metadata = {};
  40959. if (event.user_id) {
  40960. metadata.user_id = event.user_id;
  40961. }
  40962. this.emit(eventName, data, metadata);
  40963. }
  40964. };
  40965. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40966. var eventName = event.event;
  40967. var data = event.data;
  40968. switch (eventName) {
  40969. case "pusher_internal:subscription_succeeded":
  40970. this.handleSubscriptionSucceededEvent(event);
  40971. break;
  40972. case "pusher_internal:member_added":
  40973. var addedMember = this.members.addMember(data);
  40974. this.emit('pusher:member_added', addedMember);
  40975. break;
  40976. case "pusher_internal:member_removed":
  40977. var removedMember = this.members.removeMember(data);
  40978. if (removedMember) {
  40979. this.emit('pusher:member_removed', removedMember);
  40980. }
  40981. break;
  40982. }
  40983. };
  40984. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40985. this.subscriptionPending = false;
  40986. this.subscribed = true;
  40987. if (this.subscriptionCancelled) {
  40988. this.pusher.unsubscribe(this.name);
  40989. }
  40990. else {
  40991. this.members.onSubscription(event.data);
  40992. this.emit("pusher:subscription_succeeded", this.members);
  40993. }
  40994. };
  40995. PresenceChannel.prototype.disconnect = function () {
  40996. this.members.reset();
  40997. _super.prototype.disconnect.call(this);
  40998. };
  40999. return PresenceChannel;
  41000. }(private_channel));
  41001. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41002. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41003. var nacl_fast = __webpack_require__(0);
  41004. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41005. var nacl_util = __webpack_require__(1);
  41006. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41007. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41008. var extendStatics = function (d, b) {
  41009. extendStatics = Object.setPrototypeOf ||
  41010. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41011. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41012. return extendStatics(d, b);
  41013. };
  41014. return function (d, b) {
  41015. extendStatics(d, b);
  41016. function __() { this.constructor = d; }
  41017. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41018. };
  41019. })();
  41020. var encrypted_channel_EncryptedChannel = (function (_super) {
  41021. encrypted_channel_extends(EncryptedChannel, _super);
  41022. function EncryptedChannel() {
  41023. var _this = _super !== null && _super.apply(this, arguments) || this;
  41024. _this.key = null;
  41025. return _this;
  41026. }
  41027. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41028. var _this = this;
  41029. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41030. if (error) {
  41031. callback(true, authData);
  41032. return;
  41033. }
  41034. var sharedSecret = authData["shared_secret"];
  41035. if (!sharedSecret) {
  41036. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41037. callback(true, errorMsg);
  41038. return;
  41039. }
  41040. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41041. delete authData["shared_secret"];
  41042. callback(false, authData);
  41043. });
  41044. };
  41045. EncryptedChannel.prototype.trigger = function (event, data) {
  41046. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41047. };
  41048. EncryptedChannel.prototype.handleEvent = function (event) {
  41049. var eventName = event.event;
  41050. var data = event.data;
  41051. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41052. _super.prototype.handleEvent.call(this, event);
  41053. return;
  41054. }
  41055. this.handleEncryptedEvent(eventName, data);
  41056. };
  41057. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41058. var _this = this;
  41059. if (!this.key) {
  41060. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41061. return;
  41062. }
  41063. if (!data.ciphertext || !data.nonce) {
  41064. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41065. return;
  41066. }
  41067. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41068. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41069. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41070. return;
  41071. }
  41072. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41073. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41074. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41075. return;
  41076. }
  41077. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41078. if (bytes === null) {
  41079. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41080. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41081. if (error) {
  41082. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41083. return;
  41084. }
  41085. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41086. if (bytes === null) {
  41087. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41088. return;
  41089. }
  41090. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41091. return;
  41092. });
  41093. return;
  41094. }
  41095. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41096. };
  41097. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41098. try {
  41099. this.emit(eventName, JSON.parse(data));
  41100. }
  41101. catch (e) {
  41102. this.emit(eventName, data);
  41103. }
  41104. return this;
  41105. };
  41106. return EncryptedChannel;
  41107. }(private_channel));
  41108. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41109. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41110. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41111. var extendStatics = function (d, b) {
  41112. extendStatics = Object.setPrototypeOf ||
  41113. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41114. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41115. return extendStatics(d, b);
  41116. };
  41117. return function (d, b) {
  41118. extendStatics(d, b);
  41119. function __() { this.constructor = d; }
  41120. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41121. };
  41122. })();
  41123. var connection_manager_ConnectionManager = (function (_super) {
  41124. connection_manager_extends(ConnectionManager, _super);
  41125. function ConnectionManager(key, options) {
  41126. var _this = _super.call(this) || this;
  41127. _this.key = key;
  41128. _this.options = options || {};
  41129. _this.state = "initialized";
  41130. _this.connection = null;
  41131. _this.usingTLS = !!options.useTLS;
  41132. _this.timeline = _this.options.timeline;
  41133. _this.errorCallbacks = _this.buildErrorCallbacks();
  41134. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41135. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41136. var Network = runtime.getNetwork();
  41137. Network.bind("online", function () {
  41138. _this.timeline.info({ netinfo: "online" });
  41139. if (_this.state === "connecting" || _this.state === "unavailable") {
  41140. _this.retryIn(0);
  41141. }
  41142. });
  41143. Network.bind("offline", function () {
  41144. _this.timeline.info({ netinfo: "offline" });
  41145. if (_this.connection) {
  41146. _this.sendActivityCheck();
  41147. }
  41148. });
  41149. _this.updateStrategy();
  41150. return _this;
  41151. }
  41152. ConnectionManager.prototype.connect = function () {
  41153. if (this.connection || this.runner) {
  41154. return;
  41155. }
  41156. if (!this.strategy.isSupported()) {
  41157. this.updateState("failed");
  41158. return;
  41159. }
  41160. this.updateState("connecting");
  41161. this.startConnecting();
  41162. this.setUnavailableTimer();
  41163. };
  41164. ;
  41165. ConnectionManager.prototype.send = function (data) {
  41166. if (this.connection) {
  41167. return this.connection.send(data);
  41168. }
  41169. else {
  41170. return false;
  41171. }
  41172. };
  41173. ;
  41174. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41175. if (this.connection) {
  41176. return this.connection.send_event(name, data, channel);
  41177. }
  41178. else {
  41179. return false;
  41180. }
  41181. };
  41182. ;
  41183. ConnectionManager.prototype.disconnect = function () {
  41184. this.disconnectInternally();
  41185. this.updateState("disconnected");
  41186. };
  41187. ;
  41188. ConnectionManager.prototype.isUsingTLS = function () {
  41189. return this.usingTLS;
  41190. };
  41191. ;
  41192. ConnectionManager.prototype.startConnecting = function () {
  41193. var _this = this;
  41194. var callback = function (error, handshake) {
  41195. if (error) {
  41196. _this.runner = _this.strategy.connect(0, callback);
  41197. }
  41198. else {
  41199. if (handshake.action === "error") {
  41200. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41201. _this.timeline.error({ handshakeError: handshake.error });
  41202. }
  41203. else {
  41204. _this.abortConnecting();
  41205. _this.handshakeCallbacks[handshake.action](handshake);
  41206. }
  41207. }
  41208. };
  41209. this.runner = this.strategy.connect(0, callback);
  41210. };
  41211. ;
  41212. ConnectionManager.prototype.abortConnecting = function () {
  41213. if (this.runner) {
  41214. this.runner.abort();
  41215. this.runner = null;
  41216. }
  41217. };
  41218. ;
  41219. ConnectionManager.prototype.disconnectInternally = function () {
  41220. this.abortConnecting();
  41221. this.clearRetryTimer();
  41222. this.clearUnavailableTimer();
  41223. if (this.connection) {
  41224. var connection = this.abandonConnection();
  41225. connection.close();
  41226. }
  41227. };
  41228. ;
  41229. ConnectionManager.prototype.updateStrategy = function () {
  41230. this.strategy = this.options.getStrategy({
  41231. key: this.key,
  41232. timeline: this.timeline,
  41233. useTLS: this.usingTLS
  41234. });
  41235. };
  41236. ;
  41237. ConnectionManager.prototype.retryIn = function (delay) {
  41238. var _this = this;
  41239. this.timeline.info({ action: "retry", delay: delay });
  41240. if (delay > 0) {
  41241. this.emit("connecting_in", Math.round(delay / 1000));
  41242. }
  41243. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41244. _this.disconnectInternally();
  41245. _this.connect();
  41246. });
  41247. };
  41248. ;
  41249. ConnectionManager.prototype.clearRetryTimer = function () {
  41250. if (this.retryTimer) {
  41251. this.retryTimer.ensureAborted();
  41252. this.retryTimer = null;
  41253. }
  41254. };
  41255. ;
  41256. ConnectionManager.prototype.setUnavailableTimer = function () {
  41257. var _this = this;
  41258. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41259. _this.updateState("unavailable");
  41260. });
  41261. };
  41262. ;
  41263. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41264. if (this.unavailableTimer) {
  41265. this.unavailableTimer.ensureAborted();
  41266. }
  41267. };
  41268. ;
  41269. ConnectionManager.prototype.sendActivityCheck = function () {
  41270. var _this = this;
  41271. this.stopActivityCheck();
  41272. this.connection.ping();
  41273. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41274. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41275. _this.retryIn(0);
  41276. });
  41277. };
  41278. ;
  41279. ConnectionManager.prototype.resetActivityCheck = function () {
  41280. var _this = this;
  41281. this.stopActivityCheck();
  41282. if (this.connection && !this.connection.handlesActivityChecks()) {
  41283. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41284. _this.sendActivityCheck();
  41285. });
  41286. }
  41287. };
  41288. ;
  41289. ConnectionManager.prototype.stopActivityCheck = function () {
  41290. if (this.activityTimer) {
  41291. this.activityTimer.ensureAborted();
  41292. }
  41293. };
  41294. ;
  41295. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41296. var _this = this;
  41297. return extend({}, errorCallbacks, {
  41298. message: function (message) {
  41299. _this.resetActivityCheck();
  41300. _this.emit('message', message);
  41301. },
  41302. ping: function () {
  41303. _this.send_event('pusher:pong', {});
  41304. },
  41305. activity: function () {
  41306. _this.resetActivityCheck();
  41307. },
  41308. error: function (error) {
  41309. _this.emit("error", { type: "WebSocketError", error: error });
  41310. },
  41311. closed: function () {
  41312. _this.abandonConnection();
  41313. if (_this.shouldRetry()) {
  41314. _this.retryIn(1000);
  41315. }
  41316. }
  41317. });
  41318. };
  41319. ;
  41320. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41321. var _this = this;
  41322. return extend({}, errorCallbacks, {
  41323. connected: function (handshake) {
  41324. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41325. _this.clearUnavailableTimer();
  41326. _this.setConnection(handshake.connection);
  41327. _this.socket_id = _this.connection.id;
  41328. _this.updateState("connected", { socket_id: _this.socket_id });
  41329. }
  41330. });
  41331. };
  41332. ;
  41333. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41334. var _this = this;
  41335. var withErrorEmitted = function (callback) {
  41336. return function (result) {
  41337. if (result.error) {
  41338. _this.emit("error", { type: "WebSocketError", error: result.error });
  41339. }
  41340. callback(result);
  41341. };
  41342. };
  41343. return {
  41344. tls_only: withErrorEmitted(function () {
  41345. _this.usingTLS = true;
  41346. _this.updateStrategy();
  41347. _this.retryIn(0);
  41348. }),
  41349. refused: withErrorEmitted(function () {
  41350. _this.disconnect();
  41351. }),
  41352. backoff: withErrorEmitted(function () {
  41353. _this.retryIn(1000);
  41354. }),
  41355. retry: withErrorEmitted(function () {
  41356. _this.retryIn(0);
  41357. })
  41358. };
  41359. };
  41360. ;
  41361. ConnectionManager.prototype.setConnection = function (connection) {
  41362. this.connection = connection;
  41363. for (var event in this.connectionCallbacks) {
  41364. this.connection.bind(event, this.connectionCallbacks[event]);
  41365. }
  41366. this.resetActivityCheck();
  41367. };
  41368. ;
  41369. ConnectionManager.prototype.abandonConnection = function () {
  41370. if (!this.connection) {
  41371. return;
  41372. }
  41373. this.stopActivityCheck();
  41374. for (var event in this.connectionCallbacks) {
  41375. this.connection.unbind(event, this.connectionCallbacks[event]);
  41376. }
  41377. var connection = this.connection;
  41378. this.connection = null;
  41379. return connection;
  41380. };
  41381. ConnectionManager.prototype.updateState = function (newState, data) {
  41382. var previousState = this.state;
  41383. this.state = newState;
  41384. if (previousState !== newState) {
  41385. var newStateDescription = newState;
  41386. if (newStateDescription === "connected") {
  41387. newStateDescription += " with new socket ID " + data.socket_id;
  41388. }
  41389. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41390. this.timeline.info({ state: newState, params: data });
  41391. this.emit('state_change', { previous: previousState, current: newState });
  41392. this.emit(newState, data);
  41393. }
  41394. };
  41395. ConnectionManager.prototype.shouldRetry = function () {
  41396. return this.state === "connecting" || this.state === "connected";
  41397. };
  41398. return ConnectionManager;
  41399. }(dispatcher));
  41400. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41401. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41402. var channels_Channels = (function () {
  41403. function Channels() {
  41404. this.channels = {};
  41405. }
  41406. Channels.prototype.add = function (name, pusher) {
  41407. if (!this.channels[name]) {
  41408. this.channels[name] = createChannel(name, pusher);
  41409. }
  41410. return this.channels[name];
  41411. };
  41412. Channels.prototype.all = function () {
  41413. return values(this.channels);
  41414. };
  41415. Channels.prototype.find = function (name) {
  41416. return this.channels[name];
  41417. };
  41418. Channels.prototype.remove = function (name) {
  41419. var channel = this.channels[name];
  41420. delete this.channels[name];
  41421. return channel;
  41422. };
  41423. Channels.prototype.disconnect = function () {
  41424. objectApply(this.channels, function (channel) {
  41425. channel.disconnect();
  41426. });
  41427. };
  41428. return Channels;
  41429. }());
  41430. /* harmony default export */ var channels = (channels_Channels);
  41431. function createChannel(name, pusher) {
  41432. if (name.indexOf('private-encrypted-') === 0) {
  41433. if (false) { var errorMsg; }
  41434. return factory.createEncryptedChannel(name, pusher);
  41435. }
  41436. else if (name.indexOf('private-') === 0) {
  41437. return factory.createPrivateChannel(name, pusher);
  41438. }
  41439. else if (name.indexOf('presence-') === 0) {
  41440. return factory.createPresenceChannel(name, pusher);
  41441. }
  41442. else {
  41443. return factory.createChannel(name, pusher);
  41444. }
  41445. }
  41446. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41447. var Factory = {
  41448. createChannels: function () {
  41449. return new channels();
  41450. },
  41451. createConnectionManager: function (key, options) {
  41452. return new connection_manager(key, options);
  41453. },
  41454. createChannel: function (name, pusher) {
  41455. return new channels_channel(name, pusher);
  41456. },
  41457. createPrivateChannel: function (name, pusher) {
  41458. return new private_channel(name, pusher);
  41459. },
  41460. createPresenceChannel: function (name, pusher) {
  41461. return new presence_channel(name, pusher);
  41462. },
  41463. createEncryptedChannel: function (name, pusher) {
  41464. return new encrypted_channel(name, pusher);
  41465. },
  41466. createTimelineSender: function (timeline, options) {
  41467. return new timeline_sender(timeline, options);
  41468. },
  41469. createAuthorizer: function (channel, options) {
  41470. if (options.authorizer) {
  41471. return options.authorizer(channel, options);
  41472. }
  41473. return new pusher_authorizer(channel, options);
  41474. },
  41475. createHandshake: function (transport, callback) {
  41476. return new connection_handshake(transport, callback);
  41477. },
  41478. createAssistantToTheTransportManager: function (manager, transport, options) {
  41479. return new assistant_to_the_transport_manager(manager, transport, options);
  41480. }
  41481. };
  41482. /* harmony default export */ var factory = (Factory);
  41483. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41484. var transport_manager_TransportManager = (function () {
  41485. function TransportManager(options) {
  41486. this.options = options || {};
  41487. this.livesLeft = this.options.lives || Infinity;
  41488. }
  41489. TransportManager.prototype.getAssistant = function (transport) {
  41490. return factory.createAssistantToTheTransportManager(this, transport, {
  41491. minPingDelay: this.options.minPingDelay,
  41492. maxPingDelay: this.options.maxPingDelay
  41493. });
  41494. };
  41495. TransportManager.prototype.isAlive = function () {
  41496. return this.livesLeft > 0;
  41497. };
  41498. TransportManager.prototype.reportDeath = function () {
  41499. this.livesLeft -= 1;
  41500. };
  41501. return TransportManager;
  41502. }());
  41503. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41504. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41505. var sequential_strategy_SequentialStrategy = (function () {
  41506. function SequentialStrategy(strategies, options) {
  41507. this.strategies = strategies;
  41508. this.loop = Boolean(options.loop);
  41509. this.failFast = Boolean(options.failFast);
  41510. this.timeout = options.timeout;
  41511. this.timeoutLimit = options.timeoutLimit;
  41512. }
  41513. SequentialStrategy.prototype.isSupported = function () {
  41514. return any(this.strategies, util.method("isSupported"));
  41515. };
  41516. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41517. var _this = this;
  41518. var strategies = this.strategies;
  41519. var current = 0;
  41520. var timeout = this.timeout;
  41521. var runner = null;
  41522. var tryNextStrategy = function (error, handshake) {
  41523. if (handshake) {
  41524. callback(null, handshake);
  41525. }
  41526. else {
  41527. current = current + 1;
  41528. if (_this.loop) {
  41529. current = current % strategies.length;
  41530. }
  41531. if (current < strategies.length) {
  41532. if (timeout) {
  41533. timeout = timeout * 2;
  41534. if (_this.timeoutLimit) {
  41535. timeout = Math.min(timeout, _this.timeoutLimit);
  41536. }
  41537. }
  41538. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41539. }
  41540. else {
  41541. callback(true);
  41542. }
  41543. }
  41544. };
  41545. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41546. return {
  41547. abort: function () {
  41548. runner.abort();
  41549. },
  41550. forceMinPriority: function (p) {
  41551. minPriority = p;
  41552. if (runner) {
  41553. runner.forceMinPriority(p);
  41554. }
  41555. }
  41556. };
  41557. };
  41558. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41559. var timer = null;
  41560. var runner = null;
  41561. if (options.timeout > 0) {
  41562. timer = new OneOffTimer(options.timeout, function () {
  41563. runner.abort();
  41564. callback(true);
  41565. });
  41566. }
  41567. runner = strategy.connect(minPriority, function (error, handshake) {
  41568. if (error && timer && timer.isRunning() && !options.failFast) {
  41569. return;
  41570. }
  41571. if (timer) {
  41572. timer.ensureAborted();
  41573. }
  41574. callback(error, handshake);
  41575. });
  41576. return {
  41577. abort: function () {
  41578. if (timer) {
  41579. timer.ensureAborted();
  41580. }
  41581. runner.abort();
  41582. },
  41583. forceMinPriority: function (p) {
  41584. runner.forceMinPriority(p);
  41585. }
  41586. };
  41587. };
  41588. return SequentialStrategy;
  41589. }());
  41590. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41591. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41592. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41593. function BestConnectedEverStrategy(strategies) {
  41594. this.strategies = strategies;
  41595. }
  41596. BestConnectedEverStrategy.prototype.isSupported = function () {
  41597. return any(this.strategies, util.method("isSupported"));
  41598. };
  41599. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41600. return connect(this.strategies, minPriority, function (i, runners) {
  41601. return function (error, handshake) {
  41602. runners[i].error = error;
  41603. if (error) {
  41604. if (allRunnersFailed(runners)) {
  41605. callback(true);
  41606. }
  41607. return;
  41608. }
  41609. apply(runners, function (runner) {
  41610. runner.forceMinPriority(handshake.transport.priority);
  41611. });
  41612. callback(null, handshake);
  41613. };
  41614. });
  41615. };
  41616. return BestConnectedEverStrategy;
  41617. }());
  41618. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41619. function connect(strategies, minPriority, callbackBuilder) {
  41620. var runners = map(strategies, function (strategy, i, _, rs) {
  41621. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41622. });
  41623. return {
  41624. abort: function () {
  41625. apply(runners, abortRunner);
  41626. },
  41627. forceMinPriority: function (p) {
  41628. apply(runners, function (runner) {
  41629. runner.forceMinPriority(p);
  41630. });
  41631. }
  41632. };
  41633. }
  41634. function allRunnersFailed(runners) {
  41635. return collections_all(runners, function (runner) {
  41636. return Boolean(runner.error);
  41637. });
  41638. }
  41639. function abortRunner(runner) {
  41640. if (!runner.error && !runner.aborted) {
  41641. runner.abort();
  41642. runner.aborted = true;
  41643. }
  41644. }
  41645. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41646. var cached_strategy_CachedStrategy = (function () {
  41647. function CachedStrategy(strategy, transports, options) {
  41648. this.strategy = strategy;
  41649. this.transports = transports;
  41650. this.ttl = options.ttl || 1800 * 1000;
  41651. this.usingTLS = options.useTLS;
  41652. this.timeline = options.timeline;
  41653. }
  41654. CachedStrategy.prototype.isSupported = function () {
  41655. return this.strategy.isSupported();
  41656. };
  41657. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41658. var usingTLS = this.usingTLS;
  41659. var info = fetchTransportCache(usingTLS);
  41660. var strategies = [this.strategy];
  41661. if (info && info.timestamp + this.ttl >= util.now()) {
  41662. var transport = this.transports[info.transport];
  41663. if (transport) {
  41664. this.timeline.info({
  41665. cached: true,
  41666. transport: info.transport,
  41667. latency: info.latency
  41668. });
  41669. strategies.push(new sequential_strategy([transport], {
  41670. timeout: info.latency * 2 + 1000,
  41671. failFast: true
  41672. }));
  41673. }
  41674. }
  41675. var startTimestamp = util.now();
  41676. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41677. if (error) {
  41678. flushTransportCache(usingTLS);
  41679. if (strategies.length > 0) {
  41680. startTimestamp = util.now();
  41681. runner = strategies.pop().connect(minPriority, cb);
  41682. }
  41683. else {
  41684. callback(error);
  41685. }
  41686. }
  41687. else {
  41688. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41689. callback(null, handshake);
  41690. }
  41691. });
  41692. return {
  41693. abort: function () {
  41694. runner.abort();
  41695. },
  41696. forceMinPriority: function (p) {
  41697. minPriority = p;
  41698. if (runner) {
  41699. runner.forceMinPriority(p);
  41700. }
  41701. }
  41702. };
  41703. };
  41704. return CachedStrategy;
  41705. }());
  41706. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41707. function getTransportCacheKey(usingTLS) {
  41708. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41709. }
  41710. function fetchTransportCache(usingTLS) {
  41711. var storage = runtime.getLocalStorage();
  41712. if (storage) {
  41713. try {
  41714. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41715. if (serializedCache) {
  41716. return JSON.parse(serializedCache);
  41717. }
  41718. }
  41719. catch (e) {
  41720. flushTransportCache(usingTLS);
  41721. }
  41722. }
  41723. return null;
  41724. }
  41725. function storeTransportCache(usingTLS, transport, latency) {
  41726. var storage = runtime.getLocalStorage();
  41727. if (storage) {
  41728. try {
  41729. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41730. timestamp: util.now(),
  41731. transport: transport,
  41732. latency: latency
  41733. });
  41734. }
  41735. catch (e) {
  41736. }
  41737. }
  41738. }
  41739. function flushTransportCache(usingTLS) {
  41740. var storage = runtime.getLocalStorage();
  41741. if (storage) {
  41742. try {
  41743. delete storage[getTransportCacheKey(usingTLS)];
  41744. }
  41745. catch (e) {
  41746. }
  41747. }
  41748. }
  41749. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41750. var delayed_strategy_DelayedStrategy = (function () {
  41751. function DelayedStrategy(strategy, _a) {
  41752. var number = _a.delay;
  41753. this.strategy = strategy;
  41754. this.options = { delay: number };
  41755. }
  41756. DelayedStrategy.prototype.isSupported = function () {
  41757. return this.strategy.isSupported();
  41758. };
  41759. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41760. var strategy = this.strategy;
  41761. var runner;
  41762. var timer = new OneOffTimer(this.options.delay, function () {
  41763. runner = strategy.connect(minPriority, callback);
  41764. });
  41765. return {
  41766. abort: function () {
  41767. timer.ensureAborted();
  41768. if (runner) {
  41769. runner.abort();
  41770. }
  41771. },
  41772. forceMinPriority: function (p) {
  41773. minPriority = p;
  41774. if (runner) {
  41775. runner.forceMinPriority(p);
  41776. }
  41777. }
  41778. };
  41779. };
  41780. return DelayedStrategy;
  41781. }());
  41782. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41783. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41784. var IfStrategy = (function () {
  41785. function IfStrategy(test, trueBranch, falseBranch) {
  41786. this.test = test;
  41787. this.trueBranch = trueBranch;
  41788. this.falseBranch = falseBranch;
  41789. }
  41790. IfStrategy.prototype.isSupported = function () {
  41791. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41792. return branch.isSupported();
  41793. };
  41794. IfStrategy.prototype.connect = function (minPriority, callback) {
  41795. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41796. return branch.connect(minPriority, callback);
  41797. };
  41798. return IfStrategy;
  41799. }());
  41800. /* harmony default export */ var if_strategy = (IfStrategy);
  41801. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41802. var FirstConnectedStrategy = (function () {
  41803. function FirstConnectedStrategy(strategy) {
  41804. this.strategy = strategy;
  41805. }
  41806. FirstConnectedStrategy.prototype.isSupported = function () {
  41807. return this.strategy.isSupported();
  41808. };
  41809. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41810. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41811. if (handshake) {
  41812. runner.abort();
  41813. }
  41814. callback(error, handshake);
  41815. });
  41816. return runner;
  41817. };
  41818. return FirstConnectedStrategy;
  41819. }());
  41820. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41821. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41822. function testSupportsStrategy(strategy) {
  41823. return function () {
  41824. return strategy.isSupported();
  41825. };
  41826. }
  41827. var getDefaultStrategy = function (config, defineTransport) {
  41828. var definedTransports = {};
  41829. function defineTransportStrategy(name, type, priority, options, manager) {
  41830. var transport = defineTransport(config, name, type, priority, options, manager);
  41831. definedTransports[name] = transport;
  41832. return transport;
  41833. }
  41834. var ws_options = {
  41835. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41836. hostTLS: config.wsHost + ":" + config.wssPort,
  41837. httpPath: config.wsPath
  41838. };
  41839. var wss_options = extend({}, ws_options, {
  41840. useTLS: true
  41841. });
  41842. var sockjs_options = {
  41843. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41844. hostTLS: config.httpHost + ":" + config.httpsPort,
  41845. httpPath: config.httpPath
  41846. };
  41847. var timeouts = {
  41848. loop: true,
  41849. timeout: 15000,
  41850. timeoutLimit: 60000
  41851. };
  41852. var ws_manager = new transport_manager({
  41853. lives: 2,
  41854. minPingDelay: 10000,
  41855. maxPingDelay: config.activity_timeout
  41856. });
  41857. var streaming_manager = new transport_manager({
  41858. lives: 2,
  41859. minPingDelay: 10000,
  41860. maxPingDelay: config.activity_timeout
  41861. });
  41862. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41863. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41864. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41865. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41866. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41867. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41868. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41869. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41870. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41871. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41872. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41873. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41874. 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);
  41875. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41876. var wsStrategy;
  41877. if (config.useTLS) {
  41878. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41879. }
  41880. else {
  41881. wsStrategy = new best_connected_ever_strategy([
  41882. ws_loop,
  41883. new delayed_strategy(wss_loop, { delay: 2000 }),
  41884. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41885. ]);
  41886. }
  41887. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41888. ttl: 1800000,
  41889. timeline: config.timeline,
  41890. useTLS: config.useTLS
  41891. });
  41892. };
  41893. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41894. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41895. /* harmony default export */ var transport_connection_initializer = (function () {
  41896. var self = this;
  41897. self.timeline.info(self.buildTimelineMessage({
  41898. transport: self.name + (self.options.useTLS ? "s" : "")
  41899. }));
  41900. if (self.hooks.isInitialized()) {
  41901. self.changeState("initialized");
  41902. }
  41903. else if (self.hooks.file) {
  41904. self.changeState("initializing");
  41905. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41906. if (self.hooks.isInitialized()) {
  41907. self.changeState("initialized");
  41908. callback(true);
  41909. }
  41910. else {
  41911. if (error) {
  41912. self.onError(error);
  41913. }
  41914. self.onClose();
  41915. callback(false);
  41916. }
  41917. });
  41918. }
  41919. else {
  41920. self.onClose();
  41921. }
  41922. });
  41923. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41924. var http_xdomain_request_hooks = {
  41925. getRequest: function (socket) {
  41926. var xdr = new window.XDomainRequest();
  41927. xdr.ontimeout = function () {
  41928. socket.emit("error", new RequestTimedOut());
  41929. socket.close();
  41930. };
  41931. xdr.onerror = function (e) {
  41932. socket.emit("error", e);
  41933. socket.close();
  41934. };
  41935. xdr.onprogress = function () {
  41936. if (xdr.responseText && xdr.responseText.length > 0) {
  41937. socket.onChunk(200, xdr.responseText);
  41938. }
  41939. };
  41940. xdr.onload = function () {
  41941. if (xdr.responseText && xdr.responseText.length > 0) {
  41942. socket.onChunk(200, xdr.responseText);
  41943. }
  41944. socket.emit("finished", 200);
  41945. socket.close();
  41946. };
  41947. return xdr;
  41948. },
  41949. abortRequest: function (xdr) {
  41950. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41951. xdr.abort();
  41952. }
  41953. };
  41954. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41955. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41956. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41957. var extendStatics = function (d, b) {
  41958. extendStatics = Object.setPrototypeOf ||
  41959. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41960. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41961. return extendStatics(d, b);
  41962. };
  41963. return function (d, b) {
  41964. extendStatics(d, b);
  41965. function __() { this.constructor = d; }
  41966. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41967. };
  41968. })();
  41969. var MAX_BUFFER_LENGTH = 256 * 1024;
  41970. var http_request_HTTPRequest = (function (_super) {
  41971. http_request_extends(HTTPRequest, _super);
  41972. function HTTPRequest(hooks, method, url) {
  41973. var _this = _super.call(this) || this;
  41974. _this.hooks = hooks;
  41975. _this.method = method;
  41976. _this.url = url;
  41977. return _this;
  41978. }
  41979. HTTPRequest.prototype.start = function (payload) {
  41980. var _this = this;
  41981. this.position = 0;
  41982. this.xhr = this.hooks.getRequest(this);
  41983. this.unloader = function () {
  41984. _this.close();
  41985. };
  41986. runtime.addUnloadListener(this.unloader);
  41987. this.xhr.open(this.method, this.url, true);
  41988. if (this.xhr.setRequestHeader) {
  41989. this.xhr.setRequestHeader("Content-Type", "application/json");
  41990. }
  41991. this.xhr.send(payload);
  41992. };
  41993. HTTPRequest.prototype.close = function () {
  41994. if (this.unloader) {
  41995. runtime.removeUnloadListener(this.unloader);
  41996. this.unloader = null;
  41997. }
  41998. if (this.xhr) {
  41999. this.hooks.abortRequest(this.xhr);
  42000. this.xhr = null;
  42001. }
  42002. };
  42003. HTTPRequest.prototype.onChunk = function (status, data) {
  42004. while (true) {
  42005. var chunk = this.advanceBuffer(data);
  42006. if (chunk) {
  42007. this.emit("chunk", { status: status, data: chunk });
  42008. }
  42009. else {
  42010. break;
  42011. }
  42012. }
  42013. if (this.isBufferTooLong(data)) {
  42014. this.emit("buffer_too_long");
  42015. }
  42016. };
  42017. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42018. var unreadData = buffer.slice(this.position);
  42019. var endOfLinePosition = unreadData.indexOf("\n");
  42020. if (endOfLinePosition !== -1) {
  42021. this.position += endOfLinePosition + 1;
  42022. return unreadData.slice(0, endOfLinePosition);
  42023. }
  42024. else {
  42025. return null;
  42026. }
  42027. };
  42028. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42029. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42030. };
  42031. return HTTPRequest;
  42032. }(dispatcher));
  42033. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42034. // CONCATENATED MODULE: ./src/core/http/state.ts
  42035. var State;
  42036. (function (State) {
  42037. State[State["CONNECTING"] = 0] = "CONNECTING";
  42038. State[State["OPEN"] = 1] = "OPEN";
  42039. State[State["CLOSED"] = 3] = "CLOSED";
  42040. })(State || (State = {}));
  42041. /* harmony default export */ var state = (State);
  42042. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42043. var autoIncrement = 1;
  42044. var http_socket_HTTPSocket = (function () {
  42045. function HTTPSocket(hooks, url) {
  42046. this.hooks = hooks;
  42047. this.session = randomNumber(1000) + "/" + randomString(8);
  42048. this.location = getLocation(url);
  42049. this.readyState = state.CONNECTING;
  42050. this.openStream();
  42051. }
  42052. HTTPSocket.prototype.send = function (payload) {
  42053. return this.sendRaw(JSON.stringify([payload]));
  42054. };
  42055. HTTPSocket.prototype.ping = function () {
  42056. this.hooks.sendHeartbeat(this);
  42057. };
  42058. HTTPSocket.prototype.close = function (code, reason) {
  42059. this.onClose(code, reason, true);
  42060. };
  42061. HTTPSocket.prototype.sendRaw = function (payload) {
  42062. if (this.readyState === state.OPEN) {
  42063. try {
  42064. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42065. return true;
  42066. }
  42067. catch (e) {
  42068. return false;
  42069. }
  42070. }
  42071. else {
  42072. return false;
  42073. }
  42074. };
  42075. HTTPSocket.prototype.reconnect = function () {
  42076. this.closeStream();
  42077. this.openStream();
  42078. };
  42079. ;
  42080. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42081. this.closeStream();
  42082. this.readyState = state.CLOSED;
  42083. if (this.onclose) {
  42084. this.onclose({
  42085. code: code,
  42086. reason: reason,
  42087. wasClean: wasClean
  42088. });
  42089. }
  42090. };
  42091. HTTPSocket.prototype.onChunk = function (chunk) {
  42092. if (chunk.status !== 200) {
  42093. return;
  42094. }
  42095. if (this.readyState === state.OPEN) {
  42096. this.onActivity();
  42097. }
  42098. var payload;
  42099. var type = chunk.data.slice(0, 1);
  42100. switch (type) {
  42101. case 'o':
  42102. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42103. this.onOpen(payload);
  42104. break;
  42105. case 'a':
  42106. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42107. for (var i = 0; i < payload.length; i++) {
  42108. this.onEvent(payload[i]);
  42109. }
  42110. break;
  42111. case 'm':
  42112. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42113. this.onEvent(payload);
  42114. break;
  42115. case 'h':
  42116. this.hooks.onHeartbeat(this);
  42117. break;
  42118. case 'c':
  42119. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42120. this.onClose(payload[0], payload[1], true);
  42121. break;
  42122. }
  42123. };
  42124. HTTPSocket.prototype.onOpen = function (options) {
  42125. if (this.readyState === state.CONNECTING) {
  42126. if (options && options.hostname) {
  42127. this.location.base = replaceHost(this.location.base, options.hostname);
  42128. }
  42129. this.readyState = state.OPEN;
  42130. if (this.onopen) {
  42131. this.onopen();
  42132. }
  42133. }
  42134. else {
  42135. this.onClose(1006, "Server lost session", true);
  42136. }
  42137. };
  42138. HTTPSocket.prototype.onEvent = function (event) {
  42139. if (this.readyState === state.OPEN && this.onmessage) {
  42140. this.onmessage({ data: event });
  42141. }
  42142. };
  42143. HTTPSocket.prototype.onActivity = function () {
  42144. if (this.onactivity) {
  42145. this.onactivity();
  42146. }
  42147. };
  42148. HTTPSocket.prototype.onError = function (error) {
  42149. if (this.onerror) {
  42150. this.onerror(error);
  42151. }
  42152. };
  42153. HTTPSocket.prototype.openStream = function () {
  42154. var _this = this;
  42155. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42156. this.stream.bind("chunk", function (chunk) {
  42157. _this.onChunk(chunk);
  42158. });
  42159. this.stream.bind("finished", function (status) {
  42160. _this.hooks.onFinished(_this, status);
  42161. });
  42162. this.stream.bind("buffer_too_long", function () {
  42163. _this.reconnect();
  42164. });
  42165. try {
  42166. this.stream.start();
  42167. }
  42168. catch (error) {
  42169. util.defer(function () {
  42170. _this.onError(error);
  42171. _this.onClose(1006, "Could not start streaming", false);
  42172. });
  42173. }
  42174. };
  42175. HTTPSocket.prototype.closeStream = function () {
  42176. if (this.stream) {
  42177. this.stream.unbind_all();
  42178. this.stream.close();
  42179. this.stream = null;
  42180. }
  42181. };
  42182. return HTTPSocket;
  42183. }());
  42184. function getLocation(url) {
  42185. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42186. return {
  42187. base: parts[1],
  42188. queryString: parts[2]
  42189. };
  42190. }
  42191. function getSendURL(url, session) {
  42192. return url.base + "/" + session + "/xhr_send";
  42193. }
  42194. function getUniqueURL(url) {
  42195. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42196. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42197. }
  42198. function replaceHost(url, hostname) {
  42199. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42200. return urlParts[1] + hostname + urlParts[3];
  42201. }
  42202. function randomNumber(max) {
  42203. return Math.floor(Math.random() * max);
  42204. }
  42205. function randomString(length) {
  42206. var result = [];
  42207. for (var i = 0; i < length; i++) {
  42208. result.push(randomNumber(32).toString(32));
  42209. }
  42210. return result.join('');
  42211. }
  42212. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42213. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42214. var http_streaming_socket_hooks = {
  42215. getReceiveURL: function (url, session) {
  42216. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42217. },
  42218. onHeartbeat: function (socket) {
  42219. socket.sendRaw("[]");
  42220. },
  42221. sendHeartbeat: function (socket) {
  42222. socket.sendRaw("[]");
  42223. },
  42224. onFinished: function (socket, status) {
  42225. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42226. }
  42227. };
  42228. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42229. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42230. var http_polling_socket_hooks = {
  42231. getReceiveURL: function (url, session) {
  42232. return url.base + "/" + session + "/xhr" + url.queryString;
  42233. },
  42234. onHeartbeat: function () {
  42235. },
  42236. sendHeartbeat: function (socket) {
  42237. socket.sendRaw("[]");
  42238. },
  42239. onFinished: function (socket, status) {
  42240. if (status === 200) {
  42241. socket.reconnect();
  42242. }
  42243. else {
  42244. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42245. }
  42246. }
  42247. };
  42248. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42249. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42250. var http_xhr_request_hooks = {
  42251. getRequest: function (socket) {
  42252. var Constructor = runtime.getXHRAPI();
  42253. var xhr = new Constructor();
  42254. xhr.onreadystatechange = xhr.onprogress = function () {
  42255. switch (xhr.readyState) {
  42256. case 3:
  42257. if (xhr.responseText && xhr.responseText.length > 0) {
  42258. socket.onChunk(xhr.status, xhr.responseText);
  42259. }
  42260. break;
  42261. case 4:
  42262. if (xhr.responseText && xhr.responseText.length > 0) {
  42263. socket.onChunk(xhr.status, xhr.responseText);
  42264. }
  42265. socket.emit("finished", xhr.status);
  42266. socket.close();
  42267. break;
  42268. }
  42269. };
  42270. return xhr;
  42271. },
  42272. abortRequest: function (xhr) {
  42273. xhr.onreadystatechange = null;
  42274. xhr.abort();
  42275. }
  42276. };
  42277. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42278. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42279. var HTTP = {
  42280. createStreamingSocket: function (url) {
  42281. return this.createSocket(http_streaming_socket, url);
  42282. },
  42283. createPollingSocket: function (url) {
  42284. return this.createSocket(http_polling_socket, url);
  42285. },
  42286. createSocket: function (hooks, url) {
  42287. return new http_socket(hooks, url);
  42288. },
  42289. createXHR: function (method, url) {
  42290. return this.createRequest(http_xhr_request, method, url);
  42291. },
  42292. createRequest: function (hooks, method, url) {
  42293. return new http_request(hooks, method, url);
  42294. }
  42295. };
  42296. /* harmony default export */ var http_http = (HTTP);
  42297. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42298. http_http.createXDR = function (method, url) {
  42299. return this.createRequest(http_xdomain_request, method, url);
  42300. };
  42301. /* harmony default export */ var web_http_http = (http_http);
  42302. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42303. var Runtime = {
  42304. nextAuthCallbackID: 1,
  42305. auth_callbacks: {},
  42306. ScriptReceivers: ScriptReceivers,
  42307. DependenciesReceivers: DependenciesReceivers,
  42308. getDefaultStrategy: default_strategy,
  42309. Transports: transports_transports,
  42310. transportConnectionInitializer: transport_connection_initializer,
  42311. HTTPFactory: web_http_http,
  42312. TimelineTransport: jsonp_timeline,
  42313. getXHRAPI: function () {
  42314. return window.XMLHttpRequest;
  42315. },
  42316. getWebSocketAPI: function () {
  42317. return window.WebSocket || window.MozWebSocket;
  42318. },
  42319. setup: function (PusherClass) {
  42320. var _this = this;
  42321. window.Pusher = PusherClass;
  42322. var initializeOnDocumentBody = function () {
  42323. _this.onDocumentBody(PusherClass.ready);
  42324. };
  42325. if (!window.JSON) {
  42326. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42327. }
  42328. else {
  42329. initializeOnDocumentBody();
  42330. }
  42331. },
  42332. getDocument: function () {
  42333. return document;
  42334. },
  42335. getProtocol: function () {
  42336. return this.getDocument().location.protocol;
  42337. },
  42338. getAuthorizers: function () {
  42339. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42340. },
  42341. onDocumentBody: function (callback) {
  42342. var _this = this;
  42343. if (document.body) {
  42344. callback();
  42345. }
  42346. else {
  42347. setTimeout(function () {
  42348. _this.onDocumentBody(callback);
  42349. }, 0);
  42350. }
  42351. },
  42352. createJSONPRequest: function (url, data) {
  42353. return new jsonp_request(url, data);
  42354. },
  42355. createScriptRequest: function (src) {
  42356. return new script_request(src);
  42357. },
  42358. getLocalStorage: function () {
  42359. try {
  42360. return window.localStorage;
  42361. }
  42362. catch (e) {
  42363. return undefined;
  42364. }
  42365. },
  42366. createXHR: function () {
  42367. if (this.getXHRAPI()) {
  42368. return this.createXMLHttpRequest();
  42369. }
  42370. else {
  42371. return this.createMicrosoftXHR();
  42372. }
  42373. },
  42374. createXMLHttpRequest: function () {
  42375. var Constructor = this.getXHRAPI();
  42376. return new Constructor();
  42377. },
  42378. createMicrosoftXHR: function () {
  42379. return new ActiveXObject("Microsoft.XMLHTTP");
  42380. },
  42381. getNetwork: function () {
  42382. return net_info_Network;
  42383. },
  42384. createWebSocket: function (url) {
  42385. var Constructor = this.getWebSocketAPI();
  42386. return new Constructor(url);
  42387. },
  42388. createSocketRequest: function (method, url) {
  42389. if (this.isXHRSupported()) {
  42390. return this.HTTPFactory.createXHR(method, url);
  42391. }
  42392. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42393. return this.HTTPFactory.createXDR(method, url);
  42394. }
  42395. else {
  42396. throw "Cross-origin HTTP requests are not supported";
  42397. }
  42398. },
  42399. isXHRSupported: function () {
  42400. var Constructor = this.getXHRAPI();
  42401. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42402. },
  42403. isXDRSupported: function (useTLS) {
  42404. var protocol = useTLS ? "https:" : "http:";
  42405. var documentProtocol = this.getProtocol();
  42406. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42407. },
  42408. addUnloadListener: function (listener) {
  42409. if (window.addEventListener !== undefined) {
  42410. window.addEventListener("unload", listener, false);
  42411. }
  42412. else if (window.attachEvent !== undefined) {
  42413. window.attachEvent("onunload", listener);
  42414. }
  42415. },
  42416. removeUnloadListener: function (listener) {
  42417. if (window.addEventListener !== undefined) {
  42418. window.removeEventListener("unload", listener, false);
  42419. }
  42420. else if (window.detachEvent !== undefined) {
  42421. window.detachEvent("onunload", listener);
  42422. }
  42423. }
  42424. };
  42425. /* harmony default export */ var runtime = (Runtime);
  42426. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42427. var TimelineLevel;
  42428. (function (TimelineLevel) {
  42429. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42430. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42431. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42432. })(TimelineLevel || (TimelineLevel = {}));
  42433. /* harmony default export */ var timeline_level = (TimelineLevel);
  42434. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42435. var timeline_Timeline = (function () {
  42436. function Timeline(key, session, options) {
  42437. this.key = key;
  42438. this.session = session;
  42439. this.events = [];
  42440. this.options = options || {};
  42441. this.sent = 0;
  42442. this.uniqueID = 0;
  42443. }
  42444. Timeline.prototype.log = function (level, event) {
  42445. if (level <= this.options.level) {
  42446. this.events.push(extend({}, event, { timestamp: util.now() }));
  42447. if (this.options.limit && this.events.length > this.options.limit) {
  42448. this.events.shift();
  42449. }
  42450. }
  42451. };
  42452. Timeline.prototype.error = function (event) {
  42453. this.log(timeline_level.ERROR, event);
  42454. };
  42455. Timeline.prototype.info = function (event) {
  42456. this.log(timeline_level.INFO, event);
  42457. };
  42458. Timeline.prototype.debug = function (event) {
  42459. this.log(timeline_level.DEBUG, event);
  42460. };
  42461. Timeline.prototype.isEmpty = function () {
  42462. return this.events.length === 0;
  42463. };
  42464. Timeline.prototype.send = function (sendfn, callback) {
  42465. var _this = this;
  42466. var data = extend({
  42467. session: this.session,
  42468. bundle: this.sent + 1,
  42469. key: this.key,
  42470. lib: "js",
  42471. version: this.options.version,
  42472. cluster: this.options.cluster,
  42473. features: this.options.features,
  42474. timeline: this.events
  42475. }, this.options.params);
  42476. this.events = [];
  42477. sendfn(data, function (error, result) {
  42478. if (!error) {
  42479. _this.sent++;
  42480. }
  42481. if (callback) {
  42482. callback(error, result);
  42483. }
  42484. });
  42485. return true;
  42486. };
  42487. Timeline.prototype.generateUniqueID = function () {
  42488. this.uniqueID++;
  42489. return this.uniqueID;
  42490. };
  42491. return Timeline;
  42492. }());
  42493. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42494. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42495. var transport_strategy_TransportStrategy = (function () {
  42496. function TransportStrategy(name, priority, transport, options) {
  42497. this.name = name;
  42498. this.priority = priority;
  42499. this.transport = transport;
  42500. this.options = options || {};
  42501. }
  42502. TransportStrategy.prototype.isSupported = function () {
  42503. return this.transport.isSupported({
  42504. useTLS: this.options.useTLS
  42505. });
  42506. };
  42507. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42508. var _this = this;
  42509. if (!this.isSupported()) {
  42510. return failAttempt(new UnsupportedStrategy(), callback);
  42511. }
  42512. else if (this.priority < minPriority) {
  42513. return failAttempt(new TransportPriorityTooLow(), callback);
  42514. }
  42515. var connected = false;
  42516. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42517. var handshake = null;
  42518. var onInitialized = function () {
  42519. transport.unbind("initialized", onInitialized);
  42520. transport.connect();
  42521. };
  42522. var onOpen = function () {
  42523. handshake = factory.createHandshake(transport, function (result) {
  42524. connected = true;
  42525. unbindListeners();
  42526. callback(null, result);
  42527. });
  42528. };
  42529. var onError = function (error) {
  42530. unbindListeners();
  42531. callback(error);
  42532. };
  42533. var onClosed = function () {
  42534. unbindListeners();
  42535. var serializedTransport;
  42536. serializedTransport = safeJSONStringify(transport);
  42537. callback(new TransportClosed(serializedTransport));
  42538. };
  42539. var unbindListeners = function () {
  42540. transport.unbind("initialized", onInitialized);
  42541. transport.unbind("open", onOpen);
  42542. transport.unbind("error", onError);
  42543. transport.unbind("closed", onClosed);
  42544. };
  42545. transport.bind("initialized", onInitialized);
  42546. transport.bind("open", onOpen);
  42547. transport.bind("error", onError);
  42548. transport.bind("closed", onClosed);
  42549. transport.initialize();
  42550. return {
  42551. abort: function () {
  42552. if (connected) {
  42553. return;
  42554. }
  42555. unbindListeners();
  42556. if (handshake) {
  42557. handshake.close();
  42558. }
  42559. else {
  42560. transport.close();
  42561. }
  42562. },
  42563. forceMinPriority: function (p) {
  42564. if (connected) {
  42565. return;
  42566. }
  42567. if (_this.priority < p) {
  42568. if (handshake) {
  42569. handshake.close();
  42570. }
  42571. else {
  42572. transport.close();
  42573. }
  42574. }
  42575. }
  42576. };
  42577. };
  42578. return TransportStrategy;
  42579. }());
  42580. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42581. function failAttempt(error, callback) {
  42582. util.defer(function () {
  42583. callback(error);
  42584. });
  42585. return {
  42586. abort: function () { },
  42587. forceMinPriority: function () { }
  42588. };
  42589. }
  42590. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42591. var strategy_builder_Transports = runtime.Transports;
  42592. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42593. var transportClass = strategy_builder_Transports[type];
  42594. if (!transportClass) {
  42595. throw new UnsupportedTransport(type);
  42596. }
  42597. var enabled = (!config.enabledTransports ||
  42598. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42599. (!config.disabledTransports ||
  42600. arrayIndexOf(config.disabledTransports, name) === -1);
  42601. var transport;
  42602. if (enabled) {
  42603. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42604. key: config.key,
  42605. useTLS: config.useTLS,
  42606. timeline: config.timeline,
  42607. ignoreNullOrigin: config.ignoreNullOrigin
  42608. }, options));
  42609. }
  42610. else {
  42611. transport = strategy_builder_UnsupportedStrategy;
  42612. }
  42613. return transport;
  42614. };
  42615. var strategy_builder_UnsupportedStrategy = {
  42616. isSupported: function () {
  42617. return false;
  42618. },
  42619. connect: function (_, callback) {
  42620. var deferred = util.defer(function () {
  42621. callback(new UnsupportedStrategy());
  42622. });
  42623. return {
  42624. abort: function () {
  42625. deferred.ensureAborted();
  42626. },
  42627. forceMinPriority: function () { }
  42628. };
  42629. }
  42630. };
  42631. // CONCATENATED MODULE: ./src/core/config.ts
  42632. var getGlobalConfig = function () {
  42633. return {
  42634. wsHost: defaults.host,
  42635. wsPort: defaults.ws_port,
  42636. wssPort: defaults.wss_port,
  42637. wsPath: defaults.ws_path,
  42638. httpHost: defaults.sockjs_host,
  42639. httpPort: defaults.sockjs_http_port,
  42640. httpsPort: defaults.sockjs_https_port,
  42641. httpPath: defaults.sockjs_path,
  42642. statsHost: defaults.stats_host,
  42643. authEndpoint: defaults.channel_auth_endpoint,
  42644. authTransport: defaults.channel_auth_transport,
  42645. activity_timeout: defaults.activity_timeout,
  42646. pong_timeout: defaults.pong_timeout,
  42647. unavailable_timeout: defaults.unavailable_timeout
  42648. };
  42649. };
  42650. var getClusterConfig = function (clusterName) {
  42651. return {
  42652. wsHost: 'ws-' + clusterName + '.pusher.com',
  42653. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42654. };
  42655. };
  42656. // CONCATENATED MODULE: ./src/core/pusher.ts
  42657. var pusher_Pusher = (function () {
  42658. function Pusher(app_key, options) {
  42659. var _this = this;
  42660. checkAppKey(app_key);
  42661. options = options || {};
  42662. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42663. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42664. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42665. }
  42666. this.key = app_key;
  42667. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42668. this.channels = factory.createChannels();
  42669. this.global_emitter = new dispatcher();
  42670. this.sessionID = Math.floor(Math.random() * 1000000000);
  42671. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42672. cluster: this.config.cluster,
  42673. features: Pusher.getClientFeatures(),
  42674. params: this.config.timelineParams || {},
  42675. limit: 50,
  42676. level: timeline_level.INFO,
  42677. version: defaults.VERSION
  42678. });
  42679. if (!this.config.disableStats) {
  42680. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42681. host: this.config.statsHost,
  42682. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42683. });
  42684. }
  42685. var getStrategy = function (options) {
  42686. var config = extend({}, _this.config, options);
  42687. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42688. };
  42689. this.connection = factory.createConnectionManager(this.key, extend({
  42690. getStrategy: getStrategy,
  42691. timeline: this.timeline,
  42692. activityTimeout: this.config.activity_timeout,
  42693. pongTimeout: this.config.pong_timeout,
  42694. unavailableTimeout: this.config.unavailable_timeout
  42695. }, this.config, { useTLS: this.shouldUseTLS() }));
  42696. this.connection.bind('connected', function () {
  42697. _this.subscribeAll();
  42698. if (_this.timelineSender) {
  42699. _this.timelineSender.send(_this.connection.isUsingTLS());
  42700. }
  42701. });
  42702. this.connection.bind('message', function (event) {
  42703. var eventName = event.event;
  42704. var internal = eventName.indexOf('pusher_internal:') === 0;
  42705. if (event.channel) {
  42706. var channel = _this.channel(event.channel);
  42707. if (channel) {
  42708. channel.handleEvent(event);
  42709. }
  42710. }
  42711. if (!internal) {
  42712. _this.global_emitter.emit(event.event, event.data);
  42713. }
  42714. });
  42715. this.connection.bind('connecting', function () {
  42716. _this.channels.disconnect();
  42717. });
  42718. this.connection.bind('disconnected', function () {
  42719. _this.channels.disconnect();
  42720. });
  42721. this.connection.bind('error', function (err) {
  42722. logger.warn(err);
  42723. });
  42724. Pusher.instances.push(this);
  42725. this.timeline.info({ instances: Pusher.instances.length });
  42726. if (Pusher.isReady) {
  42727. this.connect();
  42728. }
  42729. }
  42730. Pusher.ready = function () {
  42731. Pusher.isReady = true;
  42732. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42733. Pusher.instances[i].connect();
  42734. }
  42735. };
  42736. Pusher.getClientFeatures = function () {
  42737. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42738. return t.isSupported({});
  42739. }));
  42740. };
  42741. Pusher.prototype.channel = function (name) {
  42742. return this.channels.find(name);
  42743. };
  42744. Pusher.prototype.allChannels = function () {
  42745. return this.channels.all();
  42746. };
  42747. Pusher.prototype.connect = function () {
  42748. this.connection.connect();
  42749. if (this.timelineSender) {
  42750. if (!this.timelineSenderTimer) {
  42751. var usingTLS = this.connection.isUsingTLS();
  42752. var timelineSender = this.timelineSender;
  42753. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42754. timelineSender.send(usingTLS);
  42755. });
  42756. }
  42757. }
  42758. };
  42759. Pusher.prototype.disconnect = function () {
  42760. this.connection.disconnect();
  42761. if (this.timelineSenderTimer) {
  42762. this.timelineSenderTimer.ensureAborted();
  42763. this.timelineSenderTimer = null;
  42764. }
  42765. };
  42766. Pusher.prototype.bind = function (event_name, callback, context) {
  42767. this.global_emitter.bind(event_name, callback, context);
  42768. return this;
  42769. };
  42770. Pusher.prototype.unbind = function (event_name, callback, context) {
  42771. this.global_emitter.unbind(event_name, callback, context);
  42772. return this;
  42773. };
  42774. Pusher.prototype.bind_global = function (callback) {
  42775. this.global_emitter.bind_global(callback);
  42776. return this;
  42777. };
  42778. Pusher.prototype.unbind_global = function (callback) {
  42779. this.global_emitter.unbind_global(callback);
  42780. return this;
  42781. };
  42782. Pusher.prototype.unbind_all = function (callback) {
  42783. this.global_emitter.unbind_all();
  42784. return this;
  42785. };
  42786. Pusher.prototype.subscribeAll = function () {
  42787. var channelName;
  42788. for (channelName in this.channels.channels) {
  42789. if (this.channels.channels.hasOwnProperty(channelName)) {
  42790. this.subscribe(channelName);
  42791. }
  42792. }
  42793. };
  42794. Pusher.prototype.subscribe = function (channel_name) {
  42795. var channel = this.channels.add(channel_name, this);
  42796. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42797. channel.reinstateSubscription();
  42798. }
  42799. else if (!channel.subscriptionPending &&
  42800. this.connection.state === 'connected') {
  42801. channel.subscribe();
  42802. }
  42803. return channel;
  42804. };
  42805. Pusher.prototype.unsubscribe = function (channel_name) {
  42806. var channel = this.channels.find(channel_name);
  42807. if (channel && channel.subscriptionPending) {
  42808. channel.cancelSubscription();
  42809. }
  42810. else {
  42811. channel = this.channels.remove(channel_name);
  42812. if (channel && this.connection.state === 'connected') {
  42813. channel.unsubscribe();
  42814. }
  42815. }
  42816. };
  42817. Pusher.prototype.send_event = function (event_name, data, channel) {
  42818. return this.connection.send_event(event_name, data, channel);
  42819. };
  42820. Pusher.prototype.shouldUseTLS = function () {
  42821. if (runtime.getProtocol() === 'https:') {
  42822. return true;
  42823. }
  42824. else if (this.config.forceTLS === true) {
  42825. return true;
  42826. }
  42827. else {
  42828. return Boolean(this.config.encrypted);
  42829. }
  42830. };
  42831. Pusher.instances = [];
  42832. Pusher.isReady = false;
  42833. Pusher.logToConsole = false;
  42834. Pusher.Runtime = runtime;
  42835. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42836. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42837. Pusher.auth_callbacks = runtime.auth_callbacks;
  42838. return Pusher;
  42839. }());
  42840. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42841. function checkAppKey(key) {
  42842. if (key === null || key === undefined) {
  42843. throw 'You must pass your app key when you instantiate Pusher.';
  42844. }
  42845. }
  42846. runtime.setup(pusher_Pusher);
  42847. /***/ })
  42848. /******/ ]);
  42849. });
  42850. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42851. /***/ }),
  42852. /***/ "./node_modules/setimmediate/setImmediate.js":
  42853. /*!***************************************************!*\
  42854. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42855. \***************************************************/
  42856. /*! no static exports found */
  42857. /***/ (function(module, exports, __webpack_require__) {
  42858. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42859. "use strict";
  42860. if (global.setImmediate) {
  42861. return;
  42862. }
  42863. var nextHandle = 1; // Spec says greater than zero
  42864. var tasksByHandle = {};
  42865. var currentlyRunningATask = false;
  42866. var doc = global.document;
  42867. var registerImmediate;
  42868. function setImmediate(callback) {
  42869. // Callback can either be a function or a string
  42870. if (typeof callback !== "function") {
  42871. callback = new Function("" + callback);
  42872. }
  42873. // Copy function arguments
  42874. var args = new Array(arguments.length - 1);
  42875. for (var i = 0; i < args.length; i++) {
  42876. args[i] = arguments[i + 1];
  42877. }
  42878. // Store and register the task
  42879. var task = { callback: callback, args: args };
  42880. tasksByHandle[nextHandle] = task;
  42881. registerImmediate(nextHandle);
  42882. return nextHandle++;
  42883. }
  42884. function clearImmediate(handle) {
  42885. delete tasksByHandle[handle];
  42886. }
  42887. function run(task) {
  42888. var callback = task.callback;
  42889. var args = task.args;
  42890. switch (args.length) {
  42891. case 0:
  42892. callback();
  42893. break;
  42894. case 1:
  42895. callback(args[0]);
  42896. break;
  42897. case 2:
  42898. callback(args[0], args[1]);
  42899. break;
  42900. case 3:
  42901. callback(args[0], args[1], args[2]);
  42902. break;
  42903. default:
  42904. callback.apply(undefined, args);
  42905. break;
  42906. }
  42907. }
  42908. function runIfPresent(handle) {
  42909. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42910. // So if we're currently running a task, we'll need to delay this invocation.
  42911. if (currentlyRunningATask) {
  42912. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42913. // "too much recursion" error.
  42914. setTimeout(runIfPresent, 0, handle);
  42915. } else {
  42916. var task = tasksByHandle[handle];
  42917. if (task) {
  42918. currentlyRunningATask = true;
  42919. try {
  42920. run(task);
  42921. } finally {
  42922. clearImmediate(handle);
  42923. currentlyRunningATask = false;
  42924. }
  42925. }
  42926. }
  42927. }
  42928. function installNextTickImplementation() {
  42929. registerImmediate = function(handle) {
  42930. process.nextTick(function () { runIfPresent(handle); });
  42931. };
  42932. }
  42933. function canUsePostMessage() {
  42934. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42935. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42936. if (global.postMessage && !global.importScripts) {
  42937. var postMessageIsAsynchronous = true;
  42938. var oldOnMessage = global.onmessage;
  42939. global.onmessage = function() {
  42940. postMessageIsAsynchronous = false;
  42941. };
  42942. global.postMessage("", "*");
  42943. global.onmessage = oldOnMessage;
  42944. return postMessageIsAsynchronous;
  42945. }
  42946. }
  42947. function installPostMessageImplementation() {
  42948. // Installs an event handler on `global` for the `message` event: see
  42949. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42950. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42951. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42952. var onGlobalMessage = function(event) {
  42953. if (event.source === global &&
  42954. typeof event.data === "string" &&
  42955. event.data.indexOf(messagePrefix) === 0) {
  42956. runIfPresent(+event.data.slice(messagePrefix.length));
  42957. }
  42958. };
  42959. if (global.addEventListener) {
  42960. global.addEventListener("message", onGlobalMessage, false);
  42961. } else {
  42962. global.attachEvent("onmessage", onGlobalMessage);
  42963. }
  42964. registerImmediate = function(handle) {
  42965. global.postMessage(messagePrefix + handle, "*");
  42966. };
  42967. }
  42968. function installMessageChannelImplementation() {
  42969. var channel = new MessageChannel();
  42970. channel.port1.onmessage = function(event) {
  42971. var handle = event.data;
  42972. runIfPresent(handle);
  42973. };
  42974. registerImmediate = function(handle) {
  42975. channel.port2.postMessage(handle);
  42976. };
  42977. }
  42978. function installReadyStateChangeImplementation() {
  42979. var html = doc.documentElement;
  42980. registerImmediate = function(handle) {
  42981. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42982. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42983. var script = doc.createElement("script");
  42984. script.onreadystatechange = function () {
  42985. runIfPresent(handle);
  42986. script.onreadystatechange = null;
  42987. html.removeChild(script);
  42988. script = null;
  42989. };
  42990. html.appendChild(script);
  42991. };
  42992. }
  42993. function installSetTimeoutImplementation() {
  42994. registerImmediate = function(handle) {
  42995. setTimeout(runIfPresent, 0, handle);
  42996. };
  42997. }
  42998. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42999. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43000. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43001. // Don't get fooled by e.g. browserify environments.
  43002. if ({}.toString.call(global.process) === "[object process]") {
  43003. // For Node.js before 0.9
  43004. installNextTickImplementation();
  43005. } else if (canUsePostMessage()) {
  43006. // For non-IE10 modern browsers
  43007. installPostMessageImplementation();
  43008. } else if (global.MessageChannel) {
  43009. // For web workers, where supported
  43010. installMessageChannelImplementation();
  43011. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43012. // For IE 6–8
  43013. installReadyStateChangeImplementation();
  43014. } else {
  43015. // For older browsers
  43016. installSetTimeoutImplementation();
  43017. }
  43018. attachTo.setImmediate = setImmediate;
  43019. attachTo.clearImmediate = clearImmediate;
  43020. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43021. /* 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")))
  43022. /***/ }),
  43023. /***/ "./node_modules/timers-browserify/main.js":
  43024. /*!************************************************!*\
  43025. !*** ./node_modules/timers-browserify/main.js ***!
  43026. \************************************************/
  43027. /*! no static exports found */
  43028. /***/ (function(module, exports, __webpack_require__) {
  43029. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43030. (typeof self !== "undefined" && self) ||
  43031. window;
  43032. var apply = Function.prototype.apply;
  43033. // DOM APIs, for completeness
  43034. exports.setTimeout = function() {
  43035. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43036. };
  43037. exports.setInterval = function() {
  43038. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43039. };
  43040. exports.clearTimeout =
  43041. exports.clearInterval = function(timeout) {
  43042. if (timeout) {
  43043. timeout.close();
  43044. }
  43045. };
  43046. function Timeout(id, clearFn) {
  43047. this._id = id;
  43048. this._clearFn = clearFn;
  43049. }
  43050. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43051. Timeout.prototype.close = function() {
  43052. this._clearFn.call(scope, this._id);
  43053. };
  43054. // Does not start the time, just sets up the members needed.
  43055. exports.enroll = function(item, msecs) {
  43056. clearTimeout(item._idleTimeoutId);
  43057. item._idleTimeout = msecs;
  43058. };
  43059. exports.unenroll = function(item) {
  43060. clearTimeout(item._idleTimeoutId);
  43061. item._idleTimeout = -1;
  43062. };
  43063. exports._unrefActive = exports.active = function(item) {
  43064. clearTimeout(item._idleTimeoutId);
  43065. var msecs = item._idleTimeout;
  43066. if (msecs >= 0) {
  43067. item._idleTimeoutId = setTimeout(function onTimeout() {
  43068. if (item._onTimeout)
  43069. item._onTimeout();
  43070. }, msecs);
  43071. }
  43072. };
  43073. // setimmediate attaches itself to the global object
  43074. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43075. // On some exotic environments, it's not clear which object `setimmediate` was
  43076. // able to install onto. Search each possibility in the same order as the
  43077. // `setimmediate` library.
  43078. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43079. (typeof global !== "undefined" && global.setImmediate) ||
  43080. (this && this.setImmediate);
  43081. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43082. (typeof global !== "undefined" && global.clearImmediate) ||
  43083. (this && this.clearImmediate);
  43084. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43085. /***/ }),
  43086. /***/ "./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&":
  43087. /*!*******************************************************************************************************************************************************************************************************************!*\
  43088. !*** ./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& ***!
  43089. \*******************************************************************************************************************************************************************************************************************/
  43090. /*! exports provided: render, staticRenderFns */
  43091. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43092. "use strict";
  43093. __webpack_require__.r(__webpack_exports__);
  43094. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43095. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43096. var render = function() {
  43097. var _vm = this
  43098. var _h = _vm.$createElement
  43099. var _c = _vm._self._c || _h
  43100. return _vm._m(0)
  43101. }
  43102. var staticRenderFns = [
  43103. function() {
  43104. var _vm = this
  43105. var _h = _vm.$createElement
  43106. var _c = _vm._self._c || _h
  43107. return _c("div", { staticClass: "container" }, [
  43108. _c("div", { staticClass: "row justify-content-center" }, [
  43109. _c("div", { staticClass: "col-md-8" }, [
  43110. _c("div", { staticClass: "card" }, [
  43111. _c("div", { staticClass: "card-header" }, [
  43112. _vm._v("Example Component")
  43113. ]),
  43114. _vm._v(" "),
  43115. _c("div", { staticClass: "card-body" }, [
  43116. _vm._v(
  43117. "\n I'm an example component.\n "
  43118. )
  43119. ])
  43120. ])
  43121. ])
  43122. ])
  43123. ])
  43124. }
  43125. ]
  43126. render._withStripped = true
  43127. /***/ }),
  43128. /***/ "./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&":
  43129. /*!************************************************************************************************************************************************************************************************************!*\
  43130. !*** ./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& ***!
  43131. \************************************************************************************************************************************************************************************************************/
  43132. /*! exports provided: render, staticRenderFns */
  43133. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43134. "use strict";
  43135. __webpack_require__.r(__webpack_exports__);
  43136. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43137. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43138. var render = function() {
  43139. var _vm = this
  43140. var _h = _vm.$createElement
  43141. var _c = _vm._self._c || _h
  43142. return _c(
  43143. "div",
  43144. [
  43145. _c(
  43146. "modal",
  43147. {
  43148. attrs: {
  43149. id: "asseteditModal",
  43150. tabindex: "-1",
  43151. role: "dialog",
  43152. "aria-labelledby": "asseteditModalLabel"
  43153. }
  43154. },
  43155. [
  43156. _c(
  43157. "h5",
  43158. {
  43159. staticClass: "modal-title",
  43160. attrs: { slot: "header", id: "asseteditModalLabel" },
  43161. slot: "header"
  43162. },
  43163. [_vm._v("\n Edit Work Order Information\n ")]
  43164. ),
  43165. _vm._v(" "),
  43166. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43167. _c("div", { staticClass: "form-group" }, [
  43168. _c("label", { attrs: { for: "manufacturer" } }, [
  43169. _vm._v("Manufacturer")
  43170. ]),
  43171. _vm._v(" "),
  43172. _c("input", {
  43173. directives: [
  43174. {
  43175. name: "model",
  43176. rawName: "v-model.lazy",
  43177. value: _vm.data.pcmanu,
  43178. expression: "data.pcmanu",
  43179. modifiers: { lazy: true }
  43180. }
  43181. ],
  43182. staticClass: "form-control",
  43183. attrs: {
  43184. type: "text",
  43185. name: "manufacturer",
  43186. id: "manufacturer"
  43187. },
  43188. domProps: { value: _vm.data.pcmanu },
  43189. on: {
  43190. change: function($event) {
  43191. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43192. }
  43193. }
  43194. })
  43195. ]),
  43196. _vm._v(" "),
  43197. _c("div", { staticClass: "form-group" }, [
  43198. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43199. _vm._v(" "),
  43200. _c("input", {
  43201. directives: [
  43202. {
  43203. name: "model",
  43204. rawName: "v-model.lazy",
  43205. value: _vm.data.pcmake,
  43206. expression: "data.pcmake",
  43207. modifiers: { lazy: true }
  43208. }
  43209. ],
  43210. staticClass: "form-control",
  43211. attrs: { type: "text", name: "make", id: "make" },
  43212. domProps: { value: _vm.data.pcmake },
  43213. on: {
  43214. change: function($event) {
  43215. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43216. }
  43217. }
  43218. })
  43219. ]),
  43220. _vm._v(" "),
  43221. _c("div", { staticClass: "form-group" }, [
  43222. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43223. _vm._v(" "),
  43224. _c("input", {
  43225. directives: [
  43226. {
  43227. name: "model",
  43228. rawName: "v-model.lazy",
  43229. value: _vm.data.pcnickname,
  43230. expression: "data.pcnickname",
  43231. modifiers: { lazy: true }
  43232. }
  43233. ],
  43234. staticClass: "form-control",
  43235. attrs: { type: "text", name: "nickname", id: "nickname" },
  43236. domProps: { value: _vm.data.pcnickname },
  43237. on: {
  43238. change: function($event) {
  43239. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43240. }
  43241. }
  43242. })
  43243. ]),
  43244. _vm._v(" "),
  43245. _c("div", { staticClass: "form-group" }, [
  43246. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43247. _vm._v(" "),
  43248. _c("input", {
  43249. directives: [
  43250. {
  43251. name: "model",
  43252. rawName: "v-model.lazy",
  43253. value: _vm.pcextra[2],
  43254. expression: "pcextra[2]",
  43255. modifiers: { lazy: true }
  43256. }
  43257. ],
  43258. staticClass: "form-control",
  43259. attrs: { type: "text", name: "os", id: "os" },
  43260. domProps: { value: _vm.pcextra[2] },
  43261. on: {
  43262. change: function($event) {
  43263. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43264. }
  43265. }
  43266. })
  43267. ]),
  43268. _vm._v(" "),
  43269. _c("div", { staticClass: "form-group" }, [
  43270. _c("label", { attrs: { for: "serial" } }, [
  43271. _vm._v("Serial Number")
  43272. ]),
  43273. _vm._v(" "),
  43274. _c("input", {
  43275. directives: [
  43276. {
  43277. name: "model",
  43278. rawName: "v-model.lazy",
  43279. value: _vm.pcextra[104],
  43280. expression: "pcextra[104]",
  43281. modifiers: { lazy: true }
  43282. }
  43283. ],
  43284. staticClass: "form-control",
  43285. attrs: { type: "text", id: "serial", name: "serial" },
  43286. domProps: { value: _vm.pcextra[104] },
  43287. on: {
  43288. change: function($event) {
  43289. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43290. }
  43291. }
  43292. })
  43293. ]),
  43294. _vm._v(" "),
  43295. _c("div", { staticClass: "form-group" }, [
  43296. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43297. _vm._v(" "),
  43298. _c("input", {
  43299. directives: [
  43300. {
  43301. name: "model",
  43302. rawName: "v-model.lazy",
  43303. value: _vm.pcextra[101],
  43304. expression: "pcextra[101]",
  43305. modifiers: { lazy: true }
  43306. }
  43307. ],
  43308. staticClass: "form-control",
  43309. attrs: { type: "text", id: "cpu", name: "cpu" },
  43310. domProps: { value: _vm.pcextra[101] },
  43311. on: {
  43312. change: function($event) {
  43313. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43314. }
  43315. }
  43316. })
  43317. ]),
  43318. _vm._v(" "),
  43319. _c("div", { staticClass: "form-group" }, [
  43320. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43321. _vm._v(" "),
  43322. _c("input", {
  43323. directives: [
  43324. {
  43325. name: "model",
  43326. rawName: "v-model.lazy",
  43327. value: _vm.pcextra[100],
  43328. expression: "pcextra[100]",
  43329. modifiers: { lazy: true }
  43330. }
  43331. ],
  43332. staticClass: "form-control",
  43333. attrs: { type: "text", name: "ram", id: "ram" },
  43334. domProps: { value: _vm.pcextra[100] },
  43335. on: {
  43336. change: function($event) {
  43337. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43338. }
  43339. }
  43340. })
  43341. ]),
  43342. _vm._v(" "),
  43343. _c("div", { staticClass: "form-group" }, [
  43344. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43345. _vm._v(" "),
  43346. _c("input", {
  43347. directives: [
  43348. {
  43349. name: "model",
  43350. rawName: "v-model.lazy",
  43351. value: _vm.pcextra[4],
  43352. expression: "pcextra[4]",
  43353. modifiers: { lazy: true }
  43354. }
  43355. ],
  43356. staticClass: "form-control",
  43357. attrs: { type: "text", name: "graphics", id: "grapics" },
  43358. domProps: { value: _vm.pcextra[4] },
  43359. on: {
  43360. change: function($event) {
  43361. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43362. }
  43363. }
  43364. })
  43365. ])
  43366. ]),
  43367. _vm._v(" "),
  43368. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43369. _c(
  43370. "button",
  43371. {
  43372. staticClass: "btn btn-secondary",
  43373. attrs: { type: "button", "data-dismiss": "modal" }
  43374. },
  43375. [_vm._v("Close")]
  43376. ),
  43377. _vm._v(" "),
  43378. _c(
  43379. "button",
  43380. {
  43381. staticClass: "btn btn-primary",
  43382. attrs: { type: "button" },
  43383. on: {
  43384. click: function($event) {
  43385. return _vm.updateAsset()
  43386. }
  43387. }
  43388. },
  43389. [_vm._v("Save")]
  43390. )
  43391. ])
  43392. ]
  43393. ),
  43394. _vm._v(" "),
  43395. _c("h4", { staticClass: "text-center" }, [
  43396. _vm._v(
  43397. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43398. ),
  43399. _c("small", { staticClass: "text-muted" }, [
  43400. _vm._v(_vm._s(this.data.pcnickname))
  43401. ])
  43402. ]),
  43403. _vm._v(" "),
  43404. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43405. _vm._v(" "),
  43406. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43407. _vm._v(" "),
  43408. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43409. _vm._v(" "),
  43410. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43411. _vm._v(" "),
  43412. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43413. _vm._v(" "),
  43414. _c(
  43415. "button",
  43416. {
  43417. staticClass: "btn btn-primary",
  43418. attrs: {
  43419. type: "button",
  43420. "data-toggle": "modal",
  43421. "data-target": "#asseteditModal"
  43422. }
  43423. },
  43424. [_vm._v("Edit")]
  43425. )
  43426. ],
  43427. 1
  43428. )
  43429. }
  43430. var staticRenderFns = []
  43431. render._withStripped = true
  43432. /***/ }),
  43433. /***/ "./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&":
  43434. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43435. !*** ./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& ***!
  43436. \*******************************************************************************************************************************************************************************************************************************/
  43437. /*! exports provided: render, staticRenderFns */
  43438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43439. "use strict";
  43440. __webpack_require__.r(__webpack_exports__);
  43441. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43442. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43443. var render = function() {
  43444. var _vm = this
  43445. var _h = _vm.$createElement
  43446. var _c = _vm._self._c || _h
  43447. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43448. _c("div", { staticClass: "input-group" }, [
  43449. _c("input", {
  43450. directives: [
  43451. {
  43452. name: "model",
  43453. rawName: "v-model",
  43454. value: _vm.searchText,
  43455. expression: "searchText"
  43456. }
  43457. ],
  43458. staticClass: "form-control",
  43459. attrs: { type: "text" },
  43460. domProps: { value: _vm.searchText },
  43461. on: {
  43462. input: [
  43463. function($event) {
  43464. if ($event.target.composing) {
  43465. return
  43466. }
  43467. _vm.searchText = $event.target.value
  43468. },
  43469. _vm.searchChanged
  43470. ]
  43471. }
  43472. }),
  43473. _vm._v(" "),
  43474. _c("div", { staticClass: "form-group-append" }, [
  43475. _c(
  43476. "a",
  43477. {
  43478. staticClass: "toggle input-group-text bg-primary text-light",
  43479. on: {
  43480. mousedown: function($event) {
  43481. $event.preventDefault()
  43482. },
  43483. click: function($event) {
  43484. return _vm.setOpen(!_vm.open)
  43485. }
  43486. }
  43487. },
  43488. [
  43489. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43490. _vm._v(" "),
  43491. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43492. ]
  43493. )
  43494. ])
  43495. ]),
  43496. _vm._v(" "),
  43497. _c(
  43498. "ul",
  43499. { staticClass: "suggestion-list list-unstyled" },
  43500. _vm._l(_vm.matches, function(suggestion, index) {
  43501. return _c(
  43502. "li",
  43503. {
  43504. key: index,
  43505. on: {
  43506. mousedown: function($event) {
  43507. $event.preventDefault()
  43508. },
  43509. click: function($event) {
  43510. return _vm.suggestionSelected(suggestion)
  43511. }
  43512. }
  43513. },
  43514. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43515. )
  43516. }),
  43517. 0
  43518. )
  43519. ])
  43520. }
  43521. var staticRenderFns = []
  43522. render._withStripped = true
  43523. /***/ }),
  43524. /***/ "./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&":
  43525. /*!************************************************************************************************************************************************************************************************************************!*\
  43526. !*** ./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& ***!
  43527. \************************************************************************************************************************************************************************************************************************/
  43528. /*! exports provided: render, staticRenderFns */
  43529. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43530. "use strict";
  43531. __webpack_require__.r(__webpack_exports__);
  43532. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43533. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43534. var render = function() {
  43535. var _vm = this
  43536. var _h = _vm.$createElement
  43537. var _c = _vm._self._c || _h
  43538. return _c(
  43539. "modal",
  43540. {
  43541. attrs: {
  43542. id: _vm.id,
  43543. tabindex: "-1",
  43544. role: "dialog",
  43545. "aria-labelledby": _vm.id + "Label"
  43546. }
  43547. },
  43548. [
  43549. _c(
  43550. "h5",
  43551. {
  43552. staticClass: "modal-title",
  43553. attrs: { slot: "header", id: _vm.id + "Label" },
  43554. slot: "header"
  43555. },
  43556. [_vm._v("\n Edit Credential\n ")]
  43557. ),
  43558. _vm._v(" "),
  43559. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43560. _c(
  43561. "div",
  43562. { staticClass: "form" },
  43563. [
  43564. _c("autocomplete-custom-dropdown", {
  43565. attrs: {
  43566. options: _vm.descriptions,
  43567. value: _vm.creddesc,
  43568. "allow-custom": true
  43569. },
  43570. model: {
  43571. value: _vm.creddesc,
  43572. callback: function($$v) {
  43573. _vm.creddesc = $$v
  43574. },
  43575. expression: "creddesc"
  43576. }
  43577. })
  43578. ],
  43579. 1
  43580. ),
  43581. _vm._v(" "),
  43582. _c("div", { staticClass: "form-group" }, [
  43583. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43584. _vm._v(" "),
  43585. _c("input", {
  43586. directives: [
  43587. {
  43588. name: "model",
  43589. rawName: "v-model",
  43590. value: _vm.data.creduser,
  43591. expression: "data.creduser"
  43592. }
  43593. ],
  43594. staticClass: "form-control credential",
  43595. attrs: {
  43596. type: "text",
  43597. name: "newusername" + _vm.data.credid,
  43598. id: "newusername" + _vm.data.credid
  43599. },
  43600. domProps: { value: _vm.data.creduser },
  43601. on: {
  43602. input: function($event) {
  43603. if ($event.target.composing) {
  43604. return
  43605. }
  43606. _vm.$set(_vm.data, "creduser", $event.target.value)
  43607. }
  43608. }
  43609. })
  43610. ]),
  43611. _vm._v(" "),
  43612. _c("div", { staticClass: "form-group" }, [
  43613. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43614. _vm._v(" "),
  43615. _c("input", {
  43616. directives: [
  43617. {
  43618. name: "model",
  43619. rawName: "v-model",
  43620. value: _vm.data.credpass,
  43621. expression: "data.credpass"
  43622. }
  43623. ],
  43624. staticClass: "form-control credential",
  43625. attrs: {
  43626. type: "text",
  43627. name: "newpassword" + _vm.data.credid,
  43628. id: "newpassword" + _vm.data.credid
  43629. },
  43630. domProps: { value: _vm.data.credpass },
  43631. on: {
  43632. input: function($event) {
  43633. if ($event.target.composing) {
  43634. return
  43635. }
  43636. _vm.$set(_vm.data, "credpass", $event.target.value)
  43637. }
  43638. }
  43639. }),
  43640. _vm._v(" "),
  43641. _c(
  43642. "button",
  43643. {
  43644. staticClass: "btn btn-secondary",
  43645. attrs: { type: "button" },
  43646. on: {
  43647. click: function($event) {
  43648. return _vm.getRandomPassword(_vm.data.credid)
  43649. }
  43650. }
  43651. },
  43652. [_vm._v("Generate Random")]
  43653. )
  43654. ]),
  43655. _vm._v(" "),
  43656. _c("div", { staticClass: "form-group" })
  43657. ]),
  43658. _vm._v(" "),
  43659. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43660. _c(
  43661. "button",
  43662. {
  43663. staticClass: "btn btn-secondary",
  43664. attrs: { type: "button", "data-dismiss": "modal" }
  43665. },
  43666. [_vm._v("Close")]
  43667. ),
  43668. _vm._v(" "),
  43669. _c(
  43670. "button",
  43671. {
  43672. staticClass: "btn btn-primary",
  43673. attrs: { type: "button" },
  43674. on: {
  43675. click: function($event) {
  43676. return _vm.updateCredential()
  43677. }
  43678. }
  43679. },
  43680. [_vm._v("Save")]
  43681. )
  43682. ])
  43683. ]
  43684. )
  43685. }
  43686. var staticRenderFns = []
  43687. render._withStripped = true
  43688. /***/ }),
  43689. /***/ "./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&":
  43690. /*!******************************************************************************************************************************************************************************************************************!*\
  43691. !*** ./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& ***!
  43692. \******************************************************************************************************************************************************************************************************************/
  43693. /*! exports provided: render, staticRenderFns */
  43694. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43695. "use strict";
  43696. __webpack_require__.r(__webpack_exports__);
  43697. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43698. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43699. var render = function() {
  43700. var _vm = this
  43701. var _h = _vm.$createElement
  43702. var _c = _vm._self._c || _h
  43703. return _c(
  43704. "div",
  43705. [
  43706. _c("credential-form-modal", {
  43707. attrs: {
  43708. "modal-id": "newCredentialModal",
  43709. descriptions: _vm.creddescList,
  43710. create: true,
  43711. pcid: _vm.pcid
  43712. }
  43713. }),
  43714. _vm._v(" "),
  43715. _c(
  43716. "button",
  43717. {
  43718. staticClass: "btn btn-primary",
  43719. attrs: {
  43720. type: "button",
  43721. "data-toggle": "modal",
  43722. "data-target": "#newCredentialModal"
  43723. }
  43724. },
  43725. [_vm._v("New Credential")]
  43726. ),
  43727. _vm._v(" "),
  43728. _vm._l(_vm.credentials, function(credential) {
  43729. return _c(
  43730. "div",
  43731. { key: credential.credid },
  43732. [
  43733. _c("credential", {
  43734. attrs: { credential: credential, descriptions: _vm.creddescList }
  43735. })
  43736. ],
  43737. 1
  43738. )
  43739. })
  43740. ],
  43741. 2
  43742. )
  43743. }
  43744. var staticRenderFns = []
  43745. render._withStripped = true
  43746. /***/ }),
  43747. /***/ "./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&":
  43748. /*!*************************************************************************************************************************************************************************************************************!*\
  43749. !*** ./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& ***!
  43750. \*************************************************************************************************************************************************************************************************************/
  43751. /*! exports provided: render, staticRenderFns */
  43752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43753. "use strict";
  43754. __webpack_require__.r(__webpack_exports__);
  43755. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43756. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43757. var render = function() {
  43758. var _vm = this
  43759. var _h = _vm.$createElement
  43760. var _c = _vm._self._c || _h
  43761. return _c(
  43762. "div",
  43763. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43764. [
  43765. _c("credential-form-modal", {
  43766. attrs: {
  43767. descriptions: _vm.creddescList,
  43768. "modal-id": "credential" + this.data.credid + "editModal",
  43769. populateWith: this.data
  43770. }
  43771. }),
  43772. _vm._v(" "),
  43773. _c(
  43774. "modal",
  43775. {
  43776. attrs: {
  43777. id: "credential" + this.data.credid + "deleteModal",
  43778. tabindex: "-1"
  43779. }
  43780. },
  43781. [
  43782. _c(
  43783. "h5",
  43784. {
  43785. staticClass: "modal-title",
  43786. attrs: {
  43787. slot: "header",
  43788. id: "credential" + this.data.credid + "deleteModalLabel"
  43789. },
  43790. slot: "header"
  43791. },
  43792. [_vm._v("\r\n Delete Credential\r\n ")]
  43793. ),
  43794. _vm._v(" "),
  43795. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43796. _vm._v("\r\n Are you sure?\r\n ")
  43797. ]),
  43798. _vm._v(" "),
  43799. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43800. _c(
  43801. "button",
  43802. {
  43803. staticClass: "btn btn-secondary",
  43804. attrs: { type: "button", "data-dismiss": "modal" }
  43805. },
  43806. [_vm._v("Cancel")]
  43807. ),
  43808. _vm._v(" "),
  43809. _c(
  43810. "button",
  43811. {
  43812. staticClass: "btn btn-danger",
  43813. attrs: { type: "button" },
  43814. on: {
  43815. click: function($event) {
  43816. return _vm.deleteCredential()
  43817. }
  43818. }
  43819. },
  43820. [_vm._v("Confirm")]
  43821. )
  43822. ])
  43823. ]
  43824. ),
  43825. _vm._v(" "),
  43826. _c("div", { staticClass: "row no-gutters" }, [
  43827. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43828. _vm._v(_vm._s(this.data.creddesc))
  43829. ]),
  43830. _vm._v(" "),
  43831. _c("div", { staticClass: "col-9 text-right" }, [
  43832. _vm._v(_vm._s(this.data.creddate))
  43833. ])
  43834. ]),
  43835. _vm._v(" "),
  43836. _c("div", { staticClass: "row" }, [
  43837. _c("div", { staticClass: "col-lg-9" }, [
  43838. _c("div", [
  43839. _vm._m(0),
  43840. _vm._v(" "),
  43841. _c("input", {
  43842. staticClass: "border-0 credential",
  43843. attrs: {
  43844. type: "text",
  43845. id: "username" + this.data.credid,
  43846. readonly: ""
  43847. },
  43848. domProps: { value: this.data.creduser }
  43849. }),
  43850. _vm._v(" "),
  43851. _c(
  43852. "button",
  43853. {
  43854. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43855. attrs: {
  43856. id: "btn-username" + this.data.credid,
  43857. "data-clipboard-target": "#username" + this.data.credid
  43858. }
  43859. },
  43860. [_c("i", { staticClass: "far fa-clone" })]
  43861. )
  43862. ]),
  43863. _vm._v(" "),
  43864. _c("div", [
  43865. _vm._m(1),
  43866. _vm._v(" "),
  43867. _c("input", {
  43868. staticClass: "border-0 credential",
  43869. attrs: {
  43870. type: "text",
  43871. id: "password" + this.data.credid,
  43872. readonly: ""
  43873. },
  43874. domProps: { value: this.data.credpass }
  43875. }),
  43876. _vm._v(" "),
  43877. _c(
  43878. "button",
  43879. {
  43880. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43881. attrs: {
  43882. id: "btn-password" + this.data.credid,
  43883. "data-clipboard-target": "#password" + this.data.credid
  43884. }
  43885. },
  43886. [_c("i", { staticClass: "far fa-clone" })]
  43887. )
  43888. ])
  43889. ]),
  43890. _vm._v(" "),
  43891. _c(
  43892. "div",
  43893. {
  43894. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43895. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43896. },
  43897. [
  43898. _c(
  43899. "button",
  43900. {
  43901. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43902. attrs: {
  43903. type: "button",
  43904. "data-toggle": "modal",
  43905. "data-target": "#credential" + this.data.credid + "editModal"
  43906. }
  43907. },
  43908. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43909. ),
  43910. _vm._v(" "),
  43911. _c(
  43912. "button",
  43913. {
  43914. staticClass: "btn btn-sm btn-danger p-lg-1",
  43915. attrs: {
  43916. type: "button",
  43917. "data-toggle": "modal",
  43918. "data-target":
  43919. "#credential" + this.data.credid + "deleteModal"
  43920. }
  43921. },
  43922. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43923. )
  43924. ]
  43925. )
  43926. ])
  43927. ],
  43928. 1
  43929. )
  43930. }
  43931. var staticRenderFns = [
  43932. function() {
  43933. var _vm = this
  43934. var _h = _vm.$createElement
  43935. var _c = _vm._self._c || _h
  43936. return _c("label", { attrs: { for: "username" } }, [
  43937. _c("i", { staticClass: "fas fa-fw fa-user" })
  43938. ])
  43939. },
  43940. function() {
  43941. var _vm = this
  43942. var _h = _vm.$createElement
  43943. var _c = _vm._self._c || _h
  43944. return _c("label", { attrs: { for: "password" } }, [
  43945. _c("i", { staticClass: "fas fa-fw fa-key" })
  43946. ])
  43947. }
  43948. ]
  43949. render._withStripped = true
  43950. /***/ }),
  43951. /***/ "./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&":
  43952. /*!************************************************************************************************************************************************************************************************************!*\
  43953. !*** ./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& ***!
  43954. \************************************************************************************************************************************************************************************************************/
  43955. /*! exports provided: render, staticRenderFns */
  43956. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43957. "use strict";
  43958. __webpack_require__.r(__webpack_exports__);
  43959. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43960. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43961. var render = function() {
  43962. var _vm = this
  43963. var _h = _vm.$createElement
  43964. var _c = _vm._self._c || _h
  43965. return _c(
  43966. "ul",
  43967. { staticClass: "list-unstyled" },
  43968. _vm._l(_vm.errorList, function(error) {
  43969. return _c("li", { key: error, staticClass: "text-danger" }, [
  43970. _vm._v(" " + _vm._s(error) + " ")
  43971. ])
  43972. }),
  43973. 0
  43974. )
  43975. }
  43976. var staticRenderFns = []
  43977. render._withStripped = true
  43978. /***/ }),
  43979. /***/ "./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&":
  43980. /*!********************************************************************************************************************************************************************************************************!*\
  43981. !*** ./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& ***!
  43982. \********************************************************************************************************************************************************************************************************/
  43983. /*! exports provided: render, staticRenderFns */
  43984. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43985. "use strict";
  43986. __webpack_require__.r(__webpack_exports__);
  43987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43988. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43989. var render = function() {
  43990. var _vm = this
  43991. var _h = _vm.$createElement
  43992. var _c = _vm._self._c || _h
  43993. return _c("div", { staticClass: "modal fade" }, [
  43994. _c(
  43995. "div",
  43996. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43997. [
  43998. _c("div", { staticClass: "modal-content" }, [
  43999. _c(
  44000. "div",
  44001. { staticClass: "modal-header" },
  44002. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44003. 2
  44004. ),
  44005. _vm._v(" "),
  44006. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44007. _vm._v(" "),
  44008. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44009. ])
  44010. ]
  44011. )
  44012. ])
  44013. }
  44014. var staticRenderFns = [
  44015. function() {
  44016. var _vm = this
  44017. var _h = _vm.$createElement
  44018. var _c = _vm._self._c || _h
  44019. return _c(
  44020. "button",
  44021. {
  44022. staticClass: "close",
  44023. attrs: {
  44024. type: "button",
  44025. "data-dismiss": "modal",
  44026. "aria-label": "Close"
  44027. }
  44028. },
  44029. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44030. )
  44031. }
  44032. ]
  44033. render._withStripped = true
  44034. /***/ }),
  44035. /***/ "./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&":
  44036. /*!******************************************************************************************************************************************************************************************************************!*\
  44037. !*** ./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& ***!
  44038. \******************************************************************************************************************************************************************************************************************/
  44039. /*! exports provided: render, staticRenderFns */
  44040. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44041. "use strict";
  44042. __webpack_require__.r(__webpack_exports__);
  44043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44044. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44045. var render = function() {
  44046. var _vm = this
  44047. var _h = _vm.$createElement
  44048. var _c = _vm._self._c || _h
  44049. return _c(
  44050. "modal",
  44051. {
  44052. attrs: {
  44053. id: _vm.modalId,
  44054. tabindex: "-1",
  44055. role: "dialog",
  44056. "aria-labelledby": _vm.modalId + "Label"
  44057. }
  44058. },
  44059. [
  44060. _c(
  44061. "h5",
  44062. {
  44063. staticClass: "modal-title",
  44064. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44065. slot: "header"
  44066. },
  44067. [_vm._v("\n Edit Note\n ")]
  44068. ),
  44069. _vm._v(" "),
  44070. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44071. _c("div", { staticClass: "form-group" }, [
  44072. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44073. _vm._v(" "),
  44074. _c("textarea", {
  44075. directives: [
  44076. {
  44077. name: "model",
  44078. rawName: "v-model",
  44079. value: _vm.note.thenote,
  44080. expression: "note.thenote"
  44081. }
  44082. ],
  44083. staticClass: "form-control",
  44084. attrs: {
  44085. name: "content" + _vm.note.noteid,
  44086. id: "content" + _vm.note.noteid
  44087. },
  44088. domProps: { value: _vm.note.thenote },
  44089. on: {
  44090. input: function($event) {
  44091. if ($event.target.composing) {
  44092. return
  44093. }
  44094. _vm.$set(_vm.note, "thenote", $event.target.value)
  44095. }
  44096. }
  44097. })
  44098. ])
  44099. ]),
  44100. _vm._v(" "),
  44101. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44102. _c(
  44103. "button",
  44104. {
  44105. staticClass: "btn btn-secondary",
  44106. attrs: { type: "button", "data-dismiss": "modal" }
  44107. },
  44108. [_vm._v("Close")]
  44109. ),
  44110. _vm._v(" "),
  44111. _c(
  44112. "button",
  44113. {
  44114. staticClass: "btn btn-primary",
  44115. attrs: { type: "button" },
  44116. on: {
  44117. click: function($event) {
  44118. return _vm.updateNote(_vm.note)
  44119. }
  44120. }
  44121. },
  44122. [_vm._v("Save")]
  44123. )
  44124. ])
  44125. ]
  44126. )
  44127. }
  44128. var staticRenderFns = []
  44129. render._withStripped = true
  44130. /***/ }),
  44131. /***/ "./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&":
  44132. /*!********************************************************************************************************************************************************************************************************!*\
  44133. !*** ./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& ***!
  44134. \********************************************************************************************************************************************************************************************************/
  44135. /*! exports provided: render, staticRenderFns */
  44136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44137. "use strict";
  44138. __webpack_require__.r(__webpack_exports__);
  44139. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44140. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44141. var render = function() {
  44142. var _vm = this
  44143. var _h = _vm.$createElement
  44144. var _c = _vm._self._c || _h
  44145. return _c(
  44146. "ul",
  44147. { staticClass: "list-unstyled" },
  44148. [
  44149. _c("note-form-modal", {
  44150. attrs: {
  44151. "modal-id": "note" + _vm.noteType + "CreateModal",
  44152. "note-type": _vm.noteType,
  44153. woid: _vm.noteWoid,
  44154. "note-user": _vm.authusername
  44155. }
  44156. }),
  44157. _vm._v(" "),
  44158. _c(
  44159. "button",
  44160. {
  44161. staticClass: "btn btn-primary",
  44162. attrs: {
  44163. type: "button",
  44164. "data-toggle": "modal",
  44165. "data-target": "#note" + _vm.noteType + "CreateModal"
  44166. }
  44167. },
  44168. [_c("i", { staticClass: "fas fa-fw fa-plus" }), _vm._v(" Add New Note")]
  44169. ),
  44170. _vm._v(" "),
  44171. _vm._l(this.notes, function(note, index) {
  44172. return _c(
  44173. "li",
  44174. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  44175. [
  44176. _c("note-form-modal", {
  44177. attrs: {
  44178. "modal-id": "note" + note.noteid + "editModal",
  44179. "populate-with": note
  44180. }
  44181. }),
  44182. _vm._v(" "),
  44183. _c(
  44184. "div",
  44185. {
  44186. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44187. class: { "order-last": _vm.userChanged(index) }
  44188. },
  44189. [
  44190. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44191. _vm._v(_vm._s(note.noteuser))
  44192. ]),
  44193. _vm._v(" "),
  44194. _c(
  44195. "div",
  44196. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44197. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44198. ),
  44199. _vm._v(" "),
  44200. _c(
  44201. "div",
  44202. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44203. [
  44204. _vm.authusername === note.noteuser ||
  44205. _vm.authusername === "admin"
  44206. ? [
  44207. _c(
  44208. "button",
  44209. {
  44210. staticClass: "btn btn-sm btn-primary m-1",
  44211. attrs: {
  44212. "data-toggle": "modal",
  44213. "data-target":
  44214. "#note" + note.noteid + "editModal"
  44215. }
  44216. },
  44217. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44218. ),
  44219. _vm._v(" "),
  44220. _vm._m(0, true),
  44221. _vm._v(" "),
  44222. _vm._m(1, true)
  44223. ]
  44224. : _vm._e()
  44225. ],
  44226. 2
  44227. )
  44228. ]
  44229. ),
  44230. _vm._v(" "),
  44231. _c("div", { staticClass: "col-md-10" }, [
  44232. _c("div", { staticClass: "card m-2" }, [
  44233. _c("div", { staticClass: "card-body p-2" }, [
  44234. _vm._v(
  44235. "\n " +
  44236. _vm._s(note.thenote) +
  44237. "\n "
  44238. )
  44239. ])
  44240. ])
  44241. ])
  44242. ],
  44243. 1
  44244. )
  44245. })
  44246. ],
  44247. 2
  44248. )
  44249. }
  44250. var staticRenderFns = [
  44251. function() {
  44252. var _vm = this
  44253. var _h = _vm.$createElement
  44254. var _c = _vm._self._c || _h
  44255. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44256. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44257. ])
  44258. },
  44259. function() {
  44260. var _vm = this
  44261. var _h = _vm.$createElement
  44262. var _c = _vm._self._c || _h
  44263. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44264. _c("i", { staticClass: "fa fa-fw fa-random" })
  44265. ])
  44266. }
  44267. ]
  44268. render._withStripped = true
  44269. /***/ }),
  44270. /***/ "./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&":
  44271. /*!********************************************************************************************************************************************************************************************************************!*\
  44272. !*** ./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& ***!
  44273. \********************************************************************************************************************************************************************************************************************/
  44274. /*! exports provided: render, staticRenderFns */
  44275. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44276. "use strict";
  44277. __webpack_require__.r(__webpack_exports__);
  44278. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44279. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44280. var render = function() {
  44281. var _vm = this
  44282. var _h = _vm.$createElement
  44283. var _c = _vm._self._c || _h
  44284. return _c(
  44285. "modal",
  44286. {
  44287. attrs: {
  44288. id: _vm.id,
  44289. tabindex: "-1",
  44290. role: "dialog",
  44291. "aria-labelledby": _vm.id + "Label"
  44292. }
  44293. },
  44294. [
  44295. _c(
  44296. "h5",
  44297. {
  44298. staticClass: "modal-title",
  44299. attrs: { slot: "header", id: _vm.id + "Label" },
  44300. slot: "header"
  44301. },
  44302. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44303. ),
  44304. _vm._v(" "),
  44305. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44306. _c(
  44307. "div",
  44308. { staticClass: "form-group" },
  44309. [
  44310. _c("label", { attrs: { for: "probdesc" } }, [
  44311. _vm._v("Problem Description")
  44312. ]),
  44313. _vm._v(" "),
  44314. _c("textarea", {
  44315. directives: [
  44316. {
  44317. name: "model",
  44318. rawName: "v-model",
  44319. value: _vm.data.probdesc,
  44320. expression: "data.probdesc"
  44321. }
  44322. ],
  44323. class: {
  44324. "form-control": true,
  44325. "is-invalid": _vm.errors.probdesc
  44326. },
  44327. attrs: { id: "probdesc", name: "probdesc" },
  44328. domProps: { value: _vm.data.probdesc },
  44329. on: {
  44330. input: function($event) {
  44331. if ($event.target.composing) {
  44332. return
  44333. }
  44334. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44335. }
  44336. }
  44337. }),
  44338. _vm._v(" "),
  44339. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44340. ],
  44341. 1
  44342. ),
  44343. _vm._v(" "),
  44344. _c(
  44345. "div",
  44346. { staticClass: "form-group" },
  44347. [
  44348. _c("label", { attrs: { for: "suggested" } }, [
  44349. _vm._v("Suggested Solution")
  44350. ]),
  44351. _vm._v(" "),
  44352. _c("textarea", {
  44353. directives: [
  44354. {
  44355. name: "model",
  44356. rawName: "v-model",
  44357. value: _vm.data.suggested,
  44358. expression: "data.suggested"
  44359. }
  44360. ],
  44361. class: {
  44362. "form-control": true,
  44363. "is-invalid": _vm.errors.suggested
  44364. },
  44365. attrs: { id: "suggested", name: "suggested" },
  44366. domProps: { value: _vm.data.suggested },
  44367. on: {
  44368. input: function($event) {
  44369. if ($event.target.composing) {
  44370. return
  44371. }
  44372. _vm.$set(_vm.data, "suggested", $event.target.value)
  44373. }
  44374. }
  44375. }),
  44376. _vm._v(" "),
  44377. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44378. ],
  44379. 1
  44380. ),
  44381. _vm._v(" "),
  44382. _c(
  44383. "div",
  44384. { staticClass: "form-group" },
  44385. [
  44386. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44387. _vm._v(" "),
  44388. _c("autocomplete-custom-dropdown", {
  44389. attrs: { options: _vm.storeList, value: this.store },
  44390. model: {
  44391. value: _vm.store,
  44392. callback: function($$v) {
  44393. _vm.store = $$v
  44394. },
  44395. expression: "store"
  44396. }
  44397. })
  44398. ],
  44399. 1
  44400. )
  44401. ]),
  44402. _vm._v(" "),
  44403. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44404. _c(
  44405. "button",
  44406. {
  44407. staticClass: "btn btn-secondary",
  44408. attrs: { type: "button", "data-dismiss": "modal" }
  44409. },
  44410. [_vm._v("Close")]
  44411. ),
  44412. _vm._v(" "),
  44413. _c(
  44414. "button",
  44415. {
  44416. staticClass: "btn btn-primary",
  44417. attrs: { type: "button" },
  44418. on: {
  44419. click: function($event) {
  44420. return _vm.updateWorkOrder()
  44421. }
  44422. }
  44423. },
  44424. [_vm._v("Save")]
  44425. )
  44426. ])
  44427. ]
  44428. )
  44429. }
  44430. var staticRenderFns = []
  44431. render._withStripped = true
  44432. /***/ }),
  44433. /***/ "./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&":
  44434. /*!*********************************************************************************************************************************************************************************************************!*\
  44435. !*** ./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& ***!
  44436. \*********************************************************************************************************************************************************************************************************/
  44437. /*! exports provided: render, staticRenderFns */
  44438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44439. "use strict";
  44440. __webpack_require__.r(__webpack_exports__);
  44441. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44442. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44443. var render = function() {
  44444. var _vm = this
  44445. var _h = _vm.$createElement
  44446. var _c = _vm._self._c || _h
  44447. return _c(
  44448. "div",
  44449. [
  44450. _c("woinfo-edit-modal", {
  44451. attrs: {
  44452. "modal-id": "workordereditModal",
  44453. "populate-with": this.data,
  44454. "store-list": this.storeList
  44455. }
  44456. }),
  44457. _vm._v(" "),
  44458. _c("p", [
  44459. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44460. _vm._v(" "),
  44461. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44462. ]),
  44463. _vm._v(" "),
  44464. _c("p", [
  44465. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44466. _vm._v(" "),
  44467. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44468. ]),
  44469. _vm._v(" "),
  44470. _c("p", [
  44471. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44472. _vm._v(" "),
  44473. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44474. ]),
  44475. _vm._v(" "),
  44476. _c("p", [
  44477. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44478. _vm._v(" "),
  44479. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44480. ]),
  44481. _vm._v(" "),
  44482. _c("p", [
  44483. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44484. _vm._v(" "),
  44485. _c(
  44486. "span",
  44487. {
  44488. staticClass: "dashed-underline",
  44489. attrs: {
  44490. "data-toggle": "tooltip",
  44491. "data-placement": "bottom",
  44492. title: this.getHRDate(this.data.dropdate)
  44493. }
  44494. },
  44495. [
  44496. _vm._v(
  44497. "\n " +
  44498. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44499. " days ago\n "
  44500. )
  44501. ]
  44502. )
  44503. ]),
  44504. _vm._v(" "),
  44505. _c("p", [
  44506. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44507. _vm._v(" "),
  44508. !this.isZero(this.data.pickupdate)
  44509. ? _c(
  44510. "span",
  44511. {
  44512. staticClass: "dashed-underline",
  44513. attrs: {
  44514. "data-toggle": "tooltip",
  44515. "data-placement": "bottom",
  44516. title: this.getHRDate(this.data.pickupdate)
  44517. }
  44518. },
  44519. [
  44520. _vm._v(
  44521. "\n " +
  44522. _vm._s(
  44523. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44524. ) +
  44525. " days ago\n "
  44526. )
  44527. ]
  44528. )
  44529. : _vm._e()
  44530. ]),
  44531. _vm._v(" "),
  44532. _c(
  44533. "button",
  44534. {
  44535. staticClass: "btn btn-primary",
  44536. attrs: {
  44537. type: "button",
  44538. "data-toggle": "modal",
  44539. "data-target": "#workordereditModal"
  44540. }
  44541. },
  44542. [_vm._v("Edit")]
  44543. )
  44544. ],
  44545. 1
  44546. )
  44547. }
  44548. var staticRenderFns = []
  44549. render._withStripped = true
  44550. /***/ }),
  44551. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44552. /*!********************************************************************!*\
  44553. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44554. \********************************************************************/
  44555. /*! exports provided: default */
  44556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44557. "use strict";
  44558. __webpack_require__.r(__webpack_exports__);
  44559. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44560. /* globals __VUE_SSR_CONTEXT__ */
  44561. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44562. // This module is a runtime utility for cleaner component module output and will
  44563. // be included in the final webpack user bundle.
  44564. function normalizeComponent (
  44565. scriptExports,
  44566. render,
  44567. staticRenderFns,
  44568. functionalTemplate,
  44569. injectStyles,
  44570. scopeId,
  44571. moduleIdentifier, /* server only */
  44572. shadowMode /* vue-cli only */
  44573. ) {
  44574. // Vue.extend constructor export interop
  44575. var options = typeof scriptExports === 'function'
  44576. ? scriptExports.options
  44577. : scriptExports
  44578. // render functions
  44579. if (render) {
  44580. options.render = render
  44581. options.staticRenderFns = staticRenderFns
  44582. options._compiled = true
  44583. }
  44584. // functional template
  44585. if (functionalTemplate) {
  44586. options.functional = true
  44587. }
  44588. // scopedId
  44589. if (scopeId) {
  44590. options._scopeId = 'data-v-' + scopeId
  44591. }
  44592. var hook
  44593. if (moduleIdentifier) { // server build
  44594. hook = function (context) {
  44595. // 2.3 injection
  44596. context =
  44597. context || // cached call
  44598. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44599. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44600. // 2.2 with runInNewContext: true
  44601. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44602. context = __VUE_SSR_CONTEXT__
  44603. }
  44604. // inject component styles
  44605. if (injectStyles) {
  44606. injectStyles.call(this, context)
  44607. }
  44608. // register component module identifier for async chunk inferrence
  44609. if (context && context._registeredComponents) {
  44610. context._registeredComponents.add(moduleIdentifier)
  44611. }
  44612. }
  44613. // used by ssr in case component is cached and beforeCreate
  44614. // never gets called
  44615. options._ssrRegister = hook
  44616. } else if (injectStyles) {
  44617. hook = shadowMode
  44618. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44619. : injectStyles
  44620. }
  44621. if (hook) {
  44622. if (options.functional) {
  44623. // for template-only hot-reload because in that case the render fn doesn't
  44624. // go through the normalizer
  44625. options._injectStyles = hook
  44626. // register for functioal component in vue file
  44627. var originalRender = options.render
  44628. options.render = function renderWithStyleInjection (h, context) {
  44629. hook.call(context)
  44630. return originalRender(h, context)
  44631. }
  44632. } else {
  44633. // inject component registration as beforeCreate hook
  44634. var existing = options.beforeCreate
  44635. options.beforeCreate = existing
  44636. ? [].concat(existing, hook)
  44637. : [hook]
  44638. }
  44639. }
  44640. return {
  44641. exports: scriptExports,
  44642. options: options
  44643. }
  44644. }
  44645. /***/ }),
  44646. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44647. /*!*************************************************!*\
  44648. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44649. \*************************************************/
  44650. /*! no static exports found */
  44651. /***/ (function(module, exports, __webpack_require__) {
  44652. "use strict";
  44653. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44654. * Vue.js v2.6.11
  44655. * (c) 2014-2019 Evan You
  44656. * Released under the MIT License.
  44657. */
  44658. /* */
  44659. var emptyObject = Object.freeze({});
  44660. // These helpers produce better VM code in JS engines due to their
  44661. // explicitness and function inlining.
  44662. function isUndef (v) {
  44663. return v === undefined || v === null
  44664. }
  44665. function isDef (v) {
  44666. return v !== undefined && v !== null
  44667. }
  44668. function isTrue (v) {
  44669. return v === true
  44670. }
  44671. function isFalse (v) {
  44672. return v === false
  44673. }
  44674. /**
  44675. * Check if value is primitive.
  44676. */
  44677. function isPrimitive (value) {
  44678. return (
  44679. typeof value === 'string' ||
  44680. typeof value === 'number' ||
  44681. // $flow-disable-line
  44682. typeof value === 'symbol' ||
  44683. typeof value === 'boolean'
  44684. )
  44685. }
  44686. /**
  44687. * Quick object check - this is primarily used to tell
  44688. * Objects from primitive values when we know the value
  44689. * is a JSON-compliant type.
  44690. */
  44691. function isObject (obj) {
  44692. return obj !== null && typeof obj === 'object'
  44693. }
  44694. /**
  44695. * Get the raw type string of a value, e.g., [object Object].
  44696. */
  44697. var _toString = Object.prototype.toString;
  44698. function toRawType (value) {
  44699. return _toString.call(value).slice(8, -1)
  44700. }
  44701. /**
  44702. * Strict object type check. Only returns true
  44703. * for plain JavaScript objects.
  44704. */
  44705. function isPlainObject (obj) {
  44706. return _toString.call(obj) === '[object Object]'
  44707. }
  44708. function isRegExp (v) {
  44709. return _toString.call(v) === '[object RegExp]'
  44710. }
  44711. /**
  44712. * Check if val is a valid array index.
  44713. */
  44714. function isValidArrayIndex (val) {
  44715. var n = parseFloat(String(val));
  44716. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44717. }
  44718. function isPromise (val) {
  44719. return (
  44720. isDef(val) &&
  44721. typeof val.then === 'function' &&
  44722. typeof val.catch === 'function'
  44723. )
  44724. }
  44725. /**
  44726. * Convert a value to a string that is actually rendered.
  44727. */
  44728. function toString (val) {
  44729. return val == null
  44730. ? ''
  44731. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44732. ? JSON.stringify(val, null, 2)
  44733. : String(val)
  44734. }
  44735. /**
  44736. * Convert an input value to a number for persistence.
  44737. * If the conversion fails, return original string.
  44738. */
  44739. function toNumber (val) {
  44740. var n = parseFloat(val);
  44741. return isNaN(n) ? val : n
  44742. }
  44743. /**
  44744. * Make a map and return a function for checking if a key
  44745. * is in that map.
  44746. */
  44747. function makeMap (
  44748. str,
  44749. expectsLowerCase
  44750. ) {
  44751. var map = Object.create(null);
  44752. var list = str.split(',');
  44753. for (var i = 0; i < list.length; i++) {
  44754. map[list[i]] = true;
  44755. }
  44756. return expectsLowerCase
  44757. ? function (val) { return map[val.toLowerCase()]; }
  44758. : function (val) { return map[val]; }
  44759. }
  44760. /**
  44761. * Check if a tag is a built-in tag.
  44762. */
  44763. var isBuiltInTag = makeMap('slot,component', true);
  44764. /**
  44765. * Check if an attribute is a reserved attribute.
  44766. */
  44767. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44768. /**
  44769. * Remove an item from an array.
  44770. */
  44771. function remove (arr, item) {
  44772. if (arr.length) {
  44773. var index = arr.indexOf(item);
  44774. if (index > -1) {
  44775. return arr.splice(index, 1)
  44776. }
  44777. }
  44778. }
  44779. /**
  44780. * Check whether an object has the property.
  44781. */
  44782. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44783. function hasOwn (obj, key) {
  44784. return hasOwnProperty.call(obj, key)
  44785. }
  44786. /**
  44787. * Create a cached version of a pure function.
  44788. */
  44789. function cached (fn) {
  44790. var cache = Object.create(null);
  44791. return (function cachedFn (str) {
  44792. var hit = cache[str];
  44793. return hit || (cache[str] = fn(str))
  44794. })
  44795. }
  44796. /**
  44797. * Camelize a hyphen-delimited string.
  44798. */
  44799. var camelizeRE = /-(\w)/g;
  44800. var camelize = cached(function (str) {
  44801. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44802. });
  44803. /**
  44804. * Capitalize a string.
  44805. */
  44806. var capitalize = cached(function (str) {
  44807. return str.charAt(0).toUpperCase() + str.slice(1)
  44808. });
  44809. /**
  44810. * Hyphenate a camelCase string.
  44811. */
  44812. var hyphenateRE = /\B([A-Z])/g;
  44813. var hyphenate = cached(function (str) {
  44814. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44815. });
  44816. /**
  44817. * Simple bind polyfill for environments that do not support it,
  44818. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44819. * since native bind is now performant enough in most browsers.
  44820. * But removing it would mean breaking code that was able to run in
  44821. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44822. */
  44823. /* istanbul ignore next */
  44824. function polyfillBind (fn, ctx) {
  44825. function boundFn (a) {
  44826. var l = arguments.length;
  44827. return l
  44828. ? l > 1
  44829. ? fn.apply(ctx, arguments)
  44830. : fn.call(ctx, a)
  44831. : fn.call(ctx)
  44832. }
  44833. boundFn._length = fn.length;
  44834. return boundFn
  44835. }
  44836. function nativeBind (fn, ctx) {
  44837. return fn.bind(ctx)
  44838. }
  44839. var bind = Function.prototype.bind
  44840. ? nativeBind
  44841. : polyfillBind;
  44842. /**
  44843. * Convert an Array-like object to a real Array.
  44844. */
  44845. function toArray (list, start) {
  44846. start = start || 0;
  44847. var i = list.length - start;
  44848. var ret = new Array(i);
  44849. while (i--) {
  44850. ret[i] = list[i + start];
  44851. }
  44852. return ret
  44853. }
  44854. /**
  44855. * Mix properties into target object.
  44856. */
  44857. function extend (to, _from) {
  44858. for (var key in _from) {
  44859. to[key] = _from[key];
  44860. }
  44861. return to
  44862. }
  44863. /**
  44864. * Merge an Array of Objects into a single Object.
  44865. */
  44866. function toObject (arr) {
  44867. var res = {};
  44868. for (var i = 0; i < arr.length; i++) {
  44869. if (arr[i]) {
  44870. extend(res, arr[i]);
  44871. }
  44872. }
  44873. return res
  44874. }
  44875. /* eslint-disable no-unused-vars */
  44876. /**
  44877. * Perform no operation.
  44878. * Stubbing args to make Flow happy without leaving useless transpiled code
  44879. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44880. */
  44881. function noop (a, b, c) {}
  44882. /**
  44883. * Always return false.
  44884. */
  44885. var no = function (a, b, c) { return false; };
  44886. /* eslint-enable no-unused-vars */
  44887. /**
  44888. * Return the same value.
  44889. */
  44890. var identity = function (_) { return _; };
  44891. /**
  44892. * Generate a string containing static keys from compiler modules.
  44893. */
  44894. function genStaticKeys (modules) {
  44895. return modules.reduce(function (keys, m) {
  44896. return keys.concat(m.staticKeys || [])
  44897. }, []).join(',')
  44898. }
  44899. /**
  44900. * Check if two values are loosely equal - that is,
  44901. * if they are plain objects, do they have the same shape?
  44902. */
  44903. function looseEqual (a, b) {
  44904. if (a === b) { return true }
  44905. var isObjectA = isObject(a);
  44906. var isObjectB = isObject(b);
  44907. if (isObjectA && isObjectB) {
  44908. try {
  44909. var isArrayA = Array.isArray(a);
  44910. var isArrayB = Array.isArray(b);
  44911. if (isArrayA && isArrayB) {
  44912. return a.length === b.length && a.every(function (e, i) {
  44913. return looseEqual(e, b[i])
  44914. })
  44915. } else if (a instanceof Date && b instanceof Date) {
  44916. return a.getTime() === b.getTime()
  44917. } else if (!isArrayA && !isArrayB) {
  44918. var keysA = Object.keys(a);
  44919. var keysB = Object.keys(b);
  44920. return keysA.length === keysB.length && keysA.every(function (key) {
  44921. return looseEqual(a[key], b[key])
  44922. })
  44923. } else {
  44924. /* istanbul ignore next */
  44925. return false
  44926. }
  44927. } catch (e) {
  44928. /* istanbul ignore next */
  44929. return false
  44930. }
  44931. } else if (!isObjectA && !isObjectB) {
  44932. return String(a) === String(b)
  44933. } else {
  44934. return false
  44935. }
  44936. }
  44937. /**
  44938. * Return the first index at which a loosely equal value can be
  44939. * found in the array (if value is a plain object, the array must
  44940. * contain an object of the same shape), or -1 if it is not present.
  44941. */
  44942. function looseIndexOf (arr, val) {
  44943. for (var i = 0; i < arr.length; i++) {
  44944. if (looseEqual(arr[i], val)) { return i }
  44945. }
  44946. return -1
  44947. }
  44948. /**
  44949. * Ensure a function is called only once.
  44950. */
  44951. function once (fn) {
  44952. var called = false;
  44953. return function () {
  44954. if (!called) {
  44955. called = true;
  44956. fn.apply(this, arguments);
  44957. }
  44958. }
  44959. }
  44960. var SSR_ATTR = 'data-server-rendered';
  44961. var ASSET_TYPES = [
  44962. 'component',
  44963. 'directive',
  44964. 'filter'
  44965. ];
  44966. var LIFECYCLE_HOOKS = [
  44967. 'beforeCreate',
  44968. 'created',
  44969. 'beforeMount',
  44970. 'mounted',
  44971. 'beforeUpdate',
  44972. 'updated',
  44973. 'beforeDestroy',
  44974. 'destroyed',
  44975. 'activated',
  44976. 'deactivated',
  44977. 'errorCaptured',
  44978. 'serverPrefetch'
  44979. ];
  44980. /* */
  44981. var config = ({
  44982. /**
  44983. * Option merge strategies (used in core/util/options)
  44984. */
  44985. // $flow-disable-line
  44986. optionMergeStrategies: Object.create(null),
  44987. /**
  44988. * Whether to suppress warnings.
  44989. */
  44990. silent: false,
  44991. /**
  44992. * Show production mode tip message on boot?
  44993. */
  44994. productionTip: "development" !== 'production',
  44995. /**
  44996. * Whether to enable devtools
  44997. */
  44998. devtools: "development" !== 'production',
  44999. /**
  45000. * Whether to record perf
  45001. */
  45002. performance: false,
  45003. /**
  45004. * Error handler for watcher errors
  45005. */
  45006. errorHandler: null,
  45007. /**
  45008. * Warn handler for watcher warns
  45009. */
  45010. warnHandler: null,
  45011. /**
  45012. * Ignore certain custom elements
  45013. */
  45014. ignoredElements: [],
  45015. /**
  45016. * Custom user key aliases for v-on
  45017. */
  45018. // $flow-disable-line
  45019. keyCodes: Object.create(null),
  45020. /**
  45021. * Check if a tag is reserved so that it cannot be registered as a
  45022. * component. This is platform-dependent and may be overwritten.
  45023. */
  45024. isReservedTag: no,
  45025. /**
  45026. * Check if an attribute is reserved so that it cannot be used as a component
  45027. * prop. This is platform-dependent and may be overwritten.
  45028. */
  45029. isReservedAttr: no,
  45030. /**
  45031. * Check if a tag is an unknown element.
  45032. * Platform-dependent.
  45033. */
  45034. isUnknownElement: no,
  45035. /**
  45036. * Get the namespace of an element
  45037. */
  45038. getTagNamespace: noop,
  45039. /**
  45040. * Parse the real tag name for the specific platform.
  45041. */
  45042. parsePlatformTagName: identity,
  45043. /**
  45044. * Check if an attribute must be bound using property, e.g. value
  45045. * Platform-dependent.
  45046. */
  45047. mustUseProp: no,
  45048. /**
  45049. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45050. * This will significantly reduce performance if set to false.
  45051. */
  45052. async: true,
  45053. /**
  45054. * Exposed for legacy reasons
  45055. */
  45056. _lifecycleHooks: LIFECYCLE_HOOKS
  45057. });
  45058. /* */
  45059. /**
  45060. * unicode letters used for parsing html tags, component names and property paths.
  45061. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45062. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45063. */
  45064. 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/;
  45065. /**
  45066. * Check if a string starts with $ or _
  45067. */
  45068. function isReserved (str) {
  45069. var c = (str + '').charCodeAt(0);
  45070. return c === 0x24 || c === 0x5F
  45071. }
  45072. /**
  45073. * Define a property.
  45074. */
  45075. function def (obj, key, val, enumerable) {
  45076. Object.defineProperty(obj, key, {
  45077. value: val,
  45078. enumerable: !!enumerable,
  45079. writable: true,
  45080. configurable: true
  45081. });
  45082. }
  45083. /**
  45084. * Parse simple path.
  45085. */
  45086. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45087. function parsePath (path) {
  45088. if (bailRE.test(path)) {
  45089. return
  45090. }
  45091. var segments = path.split('.');
  45092. return function (obj) {
  45093. for (var i = 0; i < segments.length; i++) {
  45094. if (!obj) { return }
  45095. obj = obj[segments[i]];
  45096. }
  45097. return obj
  45098. }
  45099. }
  45100. /* */
  45101. // can we use __proto__?
  45102. var hasProto = '__proto__' in {};
  45103. // Browser environment sniffing
  45104. var inBrowser = typeof window !== 'undefined';
  45105. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45106. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45107. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45108. var isIE = UA && /msie|trident/.test(UA);
  45109. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45110. var isEdge = UA && UA.indexOf('edge/') > 0;
  45111. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45112. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45113. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45114. var isPhantomJS = UA && /phantomjs/.test(UA);
  45115. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45116. // Firefox has a "watch" function on Object.prototype...
  45117. var nativeWatch = ({}).watch;
  45118. var supportsPassive = false;
  45119. if (inBrowser) {
  45120. try {
  45121. var opts = {};
  45122. Object.defineProperty(opts, 'passive', ({
  45123. get: function get () {
  45124. /* istanbul ignore next */
  45125. supportsPassive = true;
  45126. }
  45127. })); // https://github.com/facebook/flow/issues/285
  45128. window.addEventListener('test-passive', null, opts);
  45129. } catch (e) {}
  45130. }
  45131. // this needs to be lazy-evaled because vue may be required before
  45132. // vue-server-renderer can set VUE_ENV
  45133. var _isServer;
  45134. var isServerRendering = function () {
  45135. if (_isServer === undefined) {
  45136. /* istanbul ignore if */
  45137. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45138. // detect presence of vue-server-renderer and avoid
  45139. // Webpack shimming the process
  45140. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45141. } else {
  45142. _isServer = false;
  45143. }
  45144. }
  45145. return _isServer
  45146. };
  45147. // detect devtools
  45148. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45149. /* istanbul ignore next */
  45150. function isNative (Ctor) {
  45151. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45152. }
  45153. var hasSymbol =
  45154. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45155. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45156. var _Set;
  45157. /* istanbul ignore if */ // $flow-disable-line
  45158. if (typeof Set !== 'undefined' && isNative(Set)) {
  45159. // use native Set when available.
  45160. _Set = Set;
  45161. } else {
  45162. // a non-standard Set polyfill that only works with primitive keys.
  45163. _Set = /*@__PURE__*/(function () {
  45164. function Set () {
  45165. this.set = Object.create(null);
  45166. }
  45167. Set.prototype.has = function has (key) {
  45168. return this.set[key] === true
  45169. };
  45170. Set.prototype.add = function add (key) {
  45171. this.set[key] = true;
  45172. };
  45173. Set.prototype.clear = function clear () {
  45174. this.set = Object.create(null);
  45175. };
  45176. return Set;
  45177. }());
  45178. }
  45179. /* */
  45180. var warn = noop;
  45181. var tip = noop;
  45182. var generateComponentTrace = (noop); // work around flow check
  45183. var formatComponentName = (noop);
  45184. {
  45185. var hasConsole = typeof console !== 'undefined';
  45186. var classifyRE = /(?:^|[-_])(\w)/g;
  45187. var classify = function (str) { return str
  45188. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45189. .replace(/[-_]/g, ''); };
  45190. warn = function (msg, vm) {
  45191. var trace = vm ? generateComponentTrace(vm) : '';
  45192. if (config.warnHandler) {
  45193. config.warnHandler.call(null, msg, vm, trace);
  45194. } else if (hasConsole && (!config.silent)) {
  45195. console.error(("[Vue warn]: " + msg + trace));
  45196. }
  45197. };
  45198. tip = function (msg, vm) {
  45199. if (hasConsole && (!config.silent)) {
  45200. console.warn("[Vue tip]: " + msg + (
  45201. vm ? generateComponentTrace(vm) : ''
  45202. ));
  45203. }
  45204. };
  45205. formatComponentName = function (vm, includeFile) {
  45206. if (vm.$root === vm) {
  45207. return '<Root>'
  45208. }
  45209. var options = typeof vm === 'function' && vm.cid != null
  45210. ? vm.options
  45211. : vm._isVue
  45212. ? vm.$options || vm.constructor.options
  45213. : vm;
  45214. var name = options.name || options._componentTag;
  45215. var file = options.__file;
  45216. if (!name && file) {
  45217. var match = file.match(/([^/\\]+)\.vue$/);
  45218. name = match && match[1];
  45219. }
  45220. return (
  45221. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45222. (file && includeFile !== false ? (" at " + file) : '')
  45223. )
  45224. };
  45225. var repeat = function (str, n) {
  45226. var res = '';
  45227. while (n) {
  45228. if (n % 2 === 1) { res += str; }
  45229. if (n > 1) { str += str; }
  45230. n >>= 1;
  45231. }
  45232. return res
  45233. };
  45234. generateComponentTrace = function (vm) {
  45235. if (vm._isVue && vm.$parent) {
  45236. var tree = [];
  45237. var currentRecursiveSequence = 0;
  45238. while (vm) {
  45239. if (tree.length > 0) {
  45240. var last = tree[tree.length - 1];
  45241. if (last.constructor === vm.constructor) {
  45242. currentRecursiveSequence++;
  45243. vm = vm.$parent;
  45244. continue
  45245. } else if (currentRecursiveSequence > 0) {
  45246. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45247. currentRecursiveSequence = 0;
  45248. }
  45249. }
  45250. tree.push(vm);
  45251. vm = vm.$parent;
  45252. }
  45253. return '\n\nfound in\n\n' + tree
  45254. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45255. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45256. : formatComponentName(vm))); })
  45257. .join('\n')
  45258. } else {
  45259. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45260. }
  45261. };
  45262. }
  45263. /* */
  45264. var uid = 0;
  45265. /**
  45266. * A dep is an observable that can have multiple
  45267. * directives subscribing to it.
  45268. */
  45269. var Dep = function Dep () {
  45270. this.id = uid++;
  45271. this.subs = [];
  45272. };
  45273. Dep.prototype.addSub = function addSub (sub) {
  45274. this.subs.push(sub);
  45275. };
  45276. Dep.prototype.removeSub = function removeSub (sub) {
  45277. remove(this.subs, sub);
  45278. };
  45279. Dep.prototype.depend = function depend () {
  45280. if (Dep.target) {
  45281. Dep.target.addDep(this);
  45282. }
  45283. };
  45284. Dep.prototype.notify = function notify () {
  45285. // stabilize the subscriber list first
  45286. var subs = this.subs.slice();
  45287. if (!config.async) {
  45288. // subs aren't sorted in scheduler if not running async
  45289. // we need to sort them now to make sure they fire in correct
  45290. // order
  45291. subs.sort(function (a, b) { return a.id - b.id; });
  45292. }
  45293. for (var i = 0, l = subs.length; i < l; i++) {
  45294. subs[i].update();
  45295. }
  45296. };
  45297. // The current target watcher being evaluated.
  45298. // This is globally unique because only one watcher
  45299. // can be evaluated at a time.
  45300. Dep.target = null;
  45301. var targetStack = [];
  45302. function pushTarget (target) {
  45303. targetStack.push(target);
  45304. Dep.target = target;
  45305. }
  45306. function popTarget () {
  45307. targetStack.pop();
  45308. Dep.target = targetStack[targetStack.length - 1];
  45309. }
  45310. /* */
  45311. var VNode = function VNode (
  45312. tag,
  45313. data,
  45314. children,
  45315. text,
  45316. elm,
  45317. context,
  45318. componentOptions,
  45319. asyncFactory
  45320. ) {
  45321. this.tag = tag;
  45322. this.data = data;
  45323. this.children = children;
  45324. this.text = text;
  45325. this.elm = elm;
  45326. this.ns = undefined;
  45327. this.context = context;
  45328. this.fnContext = undefined;
  45329. this.fnOptions = undefined;
  45330. this.fnScopeId = undefined;
  45331. this.key = data && data.key;
  45332. this.componentOptions = componentOptions;
  45333. this.componentInstance = undefined;
  45334. this.parent = undefined;
  45335. this.raw = false;
  45336. this.isStatic = false;
  45337. this.isRootInsert = true;
  45338. this.isComment = false;
  45339. this.isCloned = false;
  45340. this.isOnce = false;
  45341. this.asyncFactory = asyncFactory;
  45342. this.asyncMeta = undefined;
  45343. this.isAsyncPlaceholder = false;
  45344. };
  45345. var prototypeAccessors = { child: { configurable: true } };
  45346. // DEPRECATED: alias for componentInstance for backwards compat.
  45347. /* istanbul ignore next */
  45348. prototypeAccessors.child.get = function () {
  45349. return this.componentInstance
  45350. };
  45351. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45352. var createEmptyVNode = function (text) {
  45353. if ( text === void 0 ) text = '';
  45354. var node = new VNode();
  45355. node.text = text;
  45356. node.isComment = true;
  45357. return node
  45358. };
  45359. function createTextVNode (val) {
  45360. return new VNode(undefined, undefined, undefined, String(val))
  45361. }
  45362. // optimized shallow clone
  45363. // used for static nodes and slot nodes because they may be reused across
  45364. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45365. // on their elm reference.
  45366. function cloneVNode (vnode) {
  45367. var cloned = new VNode(
  45368. vnode.tag,
  45369. vnode.data,
  45370. // #7975
  45371. // clone children array to avoid mutating original in case of cloning
  45372. // a child.
  45373. vnode.children && vnode.children.slice(),
  45374. vnode.text,
  45375. vnode.elm,
  45376. vnode.context,
  45377. vnode.componentOptions,
  45378. vnode.asyncFactory
  45379. );
  45380. cloned.ns = vnode.ns;
  45381. cloned.isStatic = vnode.isStatic;
  45382. cloned.key = vnode.key;
  45383. cloned.isComment = vnode.isComment;
  45384. cloned.fnContext = vnode.fnContext;
  45385. cloned.fnOptions = vnode.fnOptions;
  45386. cloned.fnScopeId = vnode.fnScopeId;
  45387. cloned.asyncMeta = vnode.asyncMeta;
  45388. cloned.isCloned = true;
  45389. return cloned
  45390. }
  45391. /*
  45392. * not type checking this file because flow doesn't play well with
  45393. * dynamically accessing methods on Array prototype
  45394. */
  45395. var arrayProto = Array.prototype;
  45396. var arrayMethods = Object.create(arrayProto);
  45397. var methodsToPatch = [
  45398. 'push',
  45399. 'pop',
  45400. 'shift',
  45401. 'unshift',
  45402. 'splice',
  45403. 'sort',
  45404. 'reverse'
  45405. ];
  45406. /**
  45407. * Intercept mutating methods and emit events
  45408. */
  45409. methodsToPatch.forEach(function (method) {
  45410. // cache original method
  45411. var original = arrayProto[method];
  45412. def(arrayMethods, method, function mutator () {
  45413. var args = [], len = arguments.length;
  45414. while ( len-- ) args[ len ] = arguments[ len ];
  45415. var result = original.apply(this, args);
  45416. var ob = this.__ob__;
  45417. var inserted;
  45418. switch (method) {
  45419. case 'push':
  45420. case 'unshift':
  45421. inserted = args;
  45422. break
  45423. case 'splice':
  45424. inserted = args.slice(2);
  45425. break
  45426. }
  45427. if (inserted) { ob.observeArray(inserted); }
  45428. // notify change
  45429. ob.dep.notify();
  45430. return result
  45431. });
  45432. });
  45433. /* */
  45434. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45435. /**
  45436. * In some cases we may want to disable observation inside a component's
  45437. * update computation.
  45438. */
  45439. var shouldObserve = true;
  45440. function toggleObserving (value) {
  45441. shouldObserve = value;
  45442. }
  45443. /**
  45444. * Observer class that is attached to each observed
  45445. * object. Once attached, the observer converts the target
  45446. * object's property keys into getter/setters that
  45447. * collect dependencies and dispatch updates.
  45448. */
  45449. var Observer = function Observer (value) {
  45450. this.value = value;
  45451. this.dep = new Dep();
  45452. this.vmCount = 0;
  45453. def(value, '__ob__', this);
  45454. if (Array.isArray(value)) {
  45455. if (hasProto) {
  45456. protoAugment(value, arrayMethods);
  45457. } else {
  45458. copyAugment(value, arrayMethods, arrayKeys);
  45459. }
  45460. this.observeArray(value);
  45461. } else {
  45462. this.walk(value);
  45463. }
  45464. };
  45465. /**
  45466. * Walk through all properties and convert them into
  45467. * getter/setters. This method should only be called when
  45468. * value type is Object.
  45469. */
  45470. Observer.prototype.walk = function walk (obj) {
  45471. var keys = Object.keys(obj);
  45472. for (var i = 0; i < keys.length; i++) {
  45473. defineReactive$$1(obj, keys[i]);
  45474. }
  45475. };
  45476. /**
  45477. * Observe a list of Array items.
  45478. */
  45479. Observer.prototype.observeArray = function observeArray (items) {
  45480. for (var i = 0, l = items.length; i < l; i++) {
  45481. observe(items[i]);
  45482. }
  45483. };
  45484. // helpers
  45485. /**
  45486. * Augment a target Object or Array by intercepting
  45487. * the prototype chain using __proto__
  45488. */
  45489. function protoAugment (target, src) {
  45490. /* eslint-disable no-proto */
  45491. target.__proto__ = src;
  45492. /* eslint-enable no-proto */
  45493. }
  45494. /**
  45495. * Augment a target Object or Array by defining
  45496. * hidden properties.
  45497. */
  45498. /* istanbul ignore next */
  45499. function copyAugment (target, src, keys) {
  45500. for (var i = 0, l = keys.length; i < l; i++) {
  45501. var key = keys[i];
  45502. def(target, key, src[key]);
  45503. }
  45504. }
  45505. /**
  45506. * Attempt to create an observer instance for a value,
  45507. * returns the new observer if successfully observed,
  45508. * or the existing observer if the value already has one.
  45509. */
  45510. function observe (value, asRootData) {
  45511. if (!isObject(value) || value instanceof VNode) {
  45512. return
  45513. }
  45514. var ob;
  45515. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45516. ob = value.__ob__;
  45517. } else if (
  45518. shouldObserve &&
  45519. !isServerRendering() &&
  45520. (Array.isArray(value) || isPlainObject(value)) &&
  45521. Object.isExtensible(value) &&
  45522. !value._isVue
  45523. ) {
  45524. ob = new Observer(value);
  45525. }
  45526. if (asRootData && ob) {
  45527. ob.vmCount++;
  45528. }
  45529. return ob
  45530. }
  45531. /**
  45532. * Define a reactive property on an Object.
  45533. */
  45534. function defineReactive$$1 (
  45535. obj,
  45536. key,
  45537. val,
  45538. customSetter,
  45539. shallow
  45540. ) {
  45541. var dep = new Dep();
  45542. var property = Object.getOwnPropertyDescriptor(obj, key);
  45543. if (property && property.configurable === false) {
  45544. return
  45545. }
  45546. // cater for pre-defined getter/setters
  45547. var getter = property && property.get;
  45548. var setter = property && property.set;
  45549. if ((!getter || setter) && arguments.length === 2) {
  45550. val = obj[key];
  45551. }
  45552. var childOb = !shallow && observe(val);
  45553. Object.defineProperty(obj, key, {
  45554. enumerable: true,
  45555. configurable: true,
  45556. get: function reactiveGetter () {
  45557. var value = getter ? getter.call(obj) : val;
  45558. if (Dep.target) {
  45559. dep.depend();
  45560. if (childOb) {
  45561. childOb.dep.depend();
  45562. if (Array.isArray(value)) {
  45563. dependArray(value);
  45564. }
  45565. }
  45566. }
  45567. return value
  45568. },
  45569. set: function reactiveSetter (newVal) {
  45570. var value = getter ? getter.call(obj) : val;
  45571. /* eslint-disable no-self-compare */
  45572. if (newVal === value || (newVal !== newVal && value !== value)) {
  45573. return
  45574. }
  45575. /* eslint-enable no-self-compare */
  45576. if (customSetter) {
  45577. customSetter();
  45578. }
  45579. // #7981: for accessor properties without setter
  45580. if (getter && !setter) { return }
  45581. if (setter) {
  45582. setter.call(obj, newVal);
  45583. } else {
  45584. val = newVal;
  45585. }
  45586. childOb = !shallow && observe(newVal);
  45587. dep.notify();
  45588. }
  45589. });
  45590. }
  45591. /**
  45592. * Set a property on an object. Adds the new property and
  45593. * triggers change notification if the property doesn't
  45594. * already exist.
  45595. */
  45596. function set (target, key, val) {
  45597. if (isUndef(target) || isPrimitive(target)
  45598. ) {
  45599. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45600. }
  45601. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45602. target.length = Math.max(target.length, key);
  45603. target.splice(key, 1, val);
  45604. return val
  45605. }
  45606. if (key in target && !(key in Object.prototype)) {
  45607. target[key] = val;
  45608. return val
  45609. }
  45610. var ob = (target).__ob__;
  45611. if (target._isVue || (ob && ob.vmCount)) {
  45612. warn(
  45613. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45614. 'at runtime - declare it upfront in the data option.'
  45615. );
  45616. return val
  45617. }
  45618. if (!ob) {
  45619. target[key] = val;
  45620. return val
  45621. }
  45622. defineReactive$$1(ob.value, key, val);
  45623. ob.dep.notify();
  45624. return val
  45625. }
  45626. /**
  45627. * Delete a property and trigger change if necessary.
  45628. */
  45629. function del (target, key) {
  45630. if (isUndef(target) || isPrimitive(target)
  45631. ) {
  45632. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45633. }
  45634. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45635. target.splice(key, 1);
  45636. return
  45637. }
  45638. var ob = (target).__ob__;
  45639. if (target._isVue || (ob && ob.vmCount)) {
  45640. warn(
  45641. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45642. '- just set it to null.'
  45643. );
  45644. return
  45645. }
  45646. if (!hasOwn(target, key)) {
  45647. return
  45648. }
  45649. delete target[key];
  45650. if (!ob) {
  45651. return
  45652. }
  45653. ob.dep.notify();
  45654. }
  45655. /**
  45656. * Collect dependencies on array elements when the array is touched, since
  45657. * we cannot intercept array element access like property getters.
  45658. */
  45659. function dependArray (value) {
  45660. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45661. e = value[i];
  45662. e && e.__ob__ && e.__ob__.dep.depend();
  45663. if (Array.isArray(e)) {
  45664. dependArray(e);
  45665. }
  45666. }
  45667. }
  45668. /* */
  45669. /**
  45670. * Option overwriting strategies are functions that handle
  45671. * how to merge a parent option value and a child option
  45672. * value into the final value.
  45673. */
  45674. var strats = config.optionMergeStrategies;
  45675. /**
  45676. * Options with restrictions
  45677. */
  45678. {
  45679. strats.el = strats.propsData = function (parent, child, vm, key) {
  45680. if (!vm) {
  45681. warn(
  45682. "option \"" + key + "\" can only be used during instance " +
  45683. 'creation with the `new` keyword.'
  45684. );
  45685. }
  45686. return defaultStrat(parent, child)
  45687. };
  45688. }
  45689. /**
  45690. * Helper that recursively merges two data objects together.
  45691. */
  45692. function mergeData (to, from) {
  45693. if (!from) { return to }
  45694. var key, toVal, fromVal;
  45695. var keys = hasSymbol
  45696. ? Reflect.ownKeys(from)
  45697. : Object.keys(from);
  45698. for (var i = 0; i < keys.length; i++) {
  45699. key = keys[i];
  45700. // in case the object is already observed...
  45701. if (key === '__ob__') { continue }
  45702. toVal = to[key];
  45703. fromVal = from[key];
  45704. if (!hasOwn(to, key)) {
  45705. set(to, key, fromVal);
  45706. } else if (
  45707. toVal !== fromVal &&
  45708. isPlainObject(toVal) &&
  45709. isPlainObject(fromVal)
  45710. ) {
  45711. mergeData(toVal, fromVal);
  45712. }
  45713. }
  45714. return to
  45715. }
  45716. /**
  45717. * Data
  45718. */
  45719. function mergeDataOrFn (
  45720. parentVal,
  45721. childVal,
  45722. vm
  45723. ) {
  45724. if (!vm) {
  45725. // in a Vue.extend merge, both should be functions
  45726. if (!childVal) {
  45727. return parentVal
  45728. }
  45729. if (!parentVal) {
  45730. return childVal
  45731. }
  45732. // when parentVal & childVal are both present,
  45733. // we need to return a function that returns the
  45734. // merged result of both functions... no need to
  45735. // check if parentVal is a function here because
  45736. // it has to be a function to pass previous merges.
  45737. return function mergedDataFn () {
  45738. return mergeData(
  45739. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45740. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45741. )
  45742. }
  45743. } else {
  45744. return function mergedInstanceDataFn () {
  45745. // instance merge
  45746. var instanceData = typeof childVal === 'function'
  45747. ? childVal.call(vm, vm)
  45748. : childVal;
  45749. var defaultData = typeof parentVal === 'function'
  45750. ? parentVal.call(vm, vm)
  45751. : parentVal;
  45752. if (instanceData) {
  45753. return mergeData(instanceData, defaultData)
  45754. } else {
  45755. return defaultData
  45756. }
  45757. }
  45758. }
  45759. }
  45760. strats.data = function (
  45761. parentVal,
  45762. childVal,
  45763. vm
  45764. ) {
  45765. if (!vm) {
  45766. if (childVal && typeof childVal !== 'function') {
  45767. warn(
  45768. 'The "data" option should be a function ' +
  45769. 'that returns a per-instance value in component ' +
  45770. 'definitions.',
  45771. vm
  45772. );
  45773. return parentVal
  45774. }
  45775. return mergeDataOrFn(parentVal, childVal)
  45776. }
  45777. return mergeDataOrFn(parentVal, childVal, vm)
  45778. };
  45779. /**
  45780. * Hooks and props are merged as arrays.
  45781. */
  45782. function mergeHook (
  45783. parentVal,
  45784. childVal
  45785. ) {
  45786. var res = childVal
  45787. ? parentVal
  45788. ? parentVal.concat(childVal)
  45789. : Array.isArray(childVal)
  45790. ? childVal
  45791. : [childVal]
  45792. : parentVal;
  45793. return res
  45794. ? dedupeHooks(res)
  45795. : res
  45796. }
  45797. function dedupeHooks (hooks) {
  45798. var res = [];
  45799. for (var i = 0; i < hooks.length; i++) {
  45800. if (res.indexOf(hooks[i]) === -1) {
  45801. res.push(hooks[i]);
  45802. }
  45803. }
  45804. return res
  45805. }
  45806. LIFECYCLE_HOOKS.forEach(function (hook) {
  45807. strats[hook] = mergeHook;
  45808. });
  45809. /**
  45810. * Assets
  45811. *
  45812. * When a vm is present (instance creation), we need to do
  45813. * a three-way merge between constructor options, instance
  45814. * options and parent options.
  45815. */
  45816. function mergeAssets (
  45817. parentVal,
  45818. childVal,
  45819. vm,
  45820. key
  45821. ) {
  45822. var res = Object.create(parentVal || null);
  45823. if (childVal) {
  45824. assertObjectType(key, childVal, vm);
  45825. return extend(res, childVal)
  45826. } else {
  45827. return res
  45828. }
  45829. }
  45830. ASSET_TYPES.forEach(function (type) {
  45831. strats[type + 's'] = mergeAssets;
  45832. });
  45833. /**
  45834. * Watchers.
  45835. *
  45836. * Watchers hashes should not overwrite one
  45837. * another, so we merge them as arrays.
  45838. */
  45839. strats.watch = function (
  45840. parentVal,
  45841. childVal,
  45842. vm,
  45843. key
  45844. ) {
  45845. // work around Firefox's Object.prototype.watch...
  45846. if (parentVal === nativeWatch) { parentVal = undefined; }
  45847. if (childVal === nativeWatch) { childVal = undefined; }
  45848. /* istanbul ignore if */
  45849. if (!childVal) { return Object.create(parentVal || null) }
  45850. {
  45851. assertObjectType(key, childVal, vm);
  45852. }
  45853. if (!parentVal) { return childVal }
  45854. var ret = {};
  45855. extend(ret, parentVal);
  45856. for (var key$1 in childVal) {
  45857. var parent = ret[key$1];
  45858. var child = childVal[key$1];
  45859. if (parent && !Array.isArray(parent)) {
  45860. parent = [parent];
  45861. }
  45862. ret[key$1] = parent
  45863. ? parent.concat(child)
  45864. : Array.isArray(child) ? child : [child];
  45865. }
  45866. return ret
  45867. };
  45868. /**
  45869. * Other object hashes.
  45870. */
  45871. strats.props =
  45872. strats.methods =
  45873. strats.inject =
  45874. strats.computed = function (
  45875. parentVal,
  45876. childVal,
  45877. vm,
  45878. key
  45879. ) {
  45880. if (childVal && "development" !== 'production') {
  45881. assertObjectType(key, childVal, vm);
  45882. }
  45883. if (!parentVal) { return childVal }
  45884. var ret = Object.create(null);
  45885. extend(ret, parentVal);
  45886. if (childVal) { extend(ret, childVal); }
  45887. return ret
  45888. };
  45889. strats.provide = mergeDataOrFn;
  45890. /**
  45891. * Default strategy.
  45892. */
  45893. var defaultStrat = function (parentVal, childVal) {
  45894. return childVal === undefined
  45895. ? parentVal
  45896. : childVal
  45897. };
  45898. /**
  45899. * Validate component names
  45900. */
  45901. function checkComponents (options) {
  45902. for (var key in options.components) {
  45903. validateComponentName(key);
  45904. }
  45905. }
  45906. function validateComponentName (name) {
  45907. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45908. warn(
  45909. 'Invalid component name: "' + name + '". Component names ' +
  45910. 'should conform to valid custom element name in html5 specification.'
  45911. );
  45912. }
  45913. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45914. warn(
  45915. 'Do not use built-in or reserved HTML elements as component ' +
  45916. 'id: ' + name
  45917. );
  45918. }
  45919. }
  45920. /**
  45921. * Ensure all props option syntax are normalized into the
  45922. * Object-based format.
  45923. */
  45924. function normalizeProps (options, vm) {
  45925. var props = options.props;
  45926. if (!props) { return }
  45927. var res = {};
  45928. var i, val, name;
  45929. if (Array.isArray(props)) {
  45930. i = props.length;
  45931. while (i--) {
  45932. val = props[i];
  45933. if (typeof val === 'string') {
  45934. name = camelize(val);
  45935. res[name] = { type: null };
  45936. } else {
  45937. warn('props must be strings when using array syntax.');
  45938. }
  45939. }
  45940. } else if (isPlainObject(props)) {
  45941. for (var key in props) {
  45942. val = props[key];
  45943. name = camelize(key);
  45944. res[name] = isPlainObject(val)
  45945. ? val
  45946. : { type: val };
  45947. }
  45948. } else {
  45949. warn(
  45950. "Invalid value for option \"props\": expected an Array or an Object, " +
  45951. "but got " + (toRawType(props)) + ".",
  45952. vm
  45953. );
  45954. }
  45955. options.props = res;
  45956. }
  45957. /**
  45958. * Normalize all injections into Object-based format
  45959. */
  45960. function normalizeInject (options, vm) {
  45961. var inject = options.inject;
  45962. if (!inject) { return }
  45963. var normalized = options.inject = {};
  45964. if (Array.isArray(inject)) {
  45965. for (var i = 0; i < inject.length; i++) {
  45966. normalized[inject[i]] = { from: inject[i] };
  45967. }
  45968. } else if (isPlainObject(inject)) {
  45969. for (var key in inject) {
  45970. var val = inject[key];
  45971. normalized[key] = isPlainObject(val)
  45972. ? extend({ from: key }, val)
  45973. : { from: val };
  45974. }
  45975. } else {
  45976. warn(
  45977. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45978. "but got " + (toRawType(inject)) + ".",
  45979. vm
  45980. );
  45981. }
  45982. }
  45983. /**
  45984. * Normalize raw function directives into object format.
  45985. */
  45986. function normalizeDirectives (options) {
  45987. var dirs = options.directives;
  45988. if (dirs) {
  45989. for (var key in dirs) {
  45990. var def$$1 = dirs[key];
  45991. if (typeof def$$1 === 'function') {
  45992. dirs[key] = { bind: def$$1, update: def$$1 };
  45993. }
  45994. }
  45995. }
  45996. }
  45997. function assertObjectType (name, value, vm) {
  45998. if (!isPlainObject(value)) {
  45999. warn(
  46000. "Invalid value for option \"" + name + "\": expected an Object, " +
  46001. "but got " + (toRawType(value)) + ".",
  46002. vm
  46003. );
  46004. }
  46005. }
  46006. /**
  46007. * Merge two option objects into a new one.
  46008. * Core utility used in both instantiation and inheritance.
  46009. */
  46010. function mergeOptions (
  46011. parent,
  46012. child,
  46013. vm
  46014. ) {
  46015. {
  46016. checkComponents(child);
  46017. }
  46018. if (typeof child === 'function') {
  46019. child = child.options;
  46020. }
  46021. normalizeProps(child, vm);
  46022. normalizeInject(child, vm);
  46023. normalizeDirectives(child);
  46024. // Apply extends and mixins on the child options,
  46025. // but only if it is a raw options object that isn't
  46026. // the result of another mergeOptions call.
  46027. // Only merged options has the _base property.
  46028. if (!child._base) {
  46029. if (child.extends) {
  46030. parent = mergeOptions(parent, child.extends, vm);
  46031. }
  46032. if (child.mixins) {
  46033. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46034. parent = mergeOptions(parent, child.mixins[i], vm);
  46035. }
  46036. }
  46037. }
  46038. var options = {};
  46039. var key;
  46040. for (key in parent) {
  46041. mergeField(key);
  46042. }
  46043. for (key in child) {
  46044. if (!hasOwn(parent, key)) {
  46045. mergeField(key);
  46046. }
  46047. }
  46048. function mergeField (key) {
  46049. var strat = strats[key] || defaultStrat;
  46050. options[key] = strat(parent[key], child[key], vm, key);
  46051. }
  46052. return options
  46053. }
  46054. /**
  46055. * Resolve an asset.
  46056. * This function is used because child instances need access
  46057. * to assets defined in its ancestor chain.
  46058. */
  46059. function resolveAsset (
  46060. options,
  46061. type,
  46062. id,
  46063. warnMissing
  46064. ) {
  46065. /* istanbul ignore if */
  46066. if (typeof id !== 'string') {
  46067. return
  46068. }
  46069. var assets = options[type];
  46070. // check local registration variations first
  46071. if (hasOwn(assets, id)) { return assets[id] }
  46072. var camelizedId = camelize(id);
  46073. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46074. var PascalCaseId = capitalize(camelizedId);
  46075. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46076. // fallback to prototype chain
  46077. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46078. if (warnMissing && !res) {
  46079. warn(
  46080. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46081. options
  46082. );
  46083. }
  46084. return res
  46085. }
  46086. /* */
  46087. function validateProp (
  46088. key,
  46089. propOptions,
  46090. propsData,
  46091. vm
  46092. ) {
  46093. var prop = propOptions[key];
  46094. var absent = !hasOwn(propsData, key);
  46095. var value = propsData[key];
  46096. // boolean casting
  46097. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46098. if (booleanIndex > -1) {
  46099. if (absent && !hasOwn(prop, 'default')) {
  46100. value = false;
  46101. } else if (value === '' || value === hyphenate(key)) {
  46102. // only cast empty string / same name to boolean if
  46103. // boolean has higher priority
  46104. var stringIndex = getTypeIndex(String, prop.type);
  46105. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46106. value = true;
  46107. }
  46108. }
  46109. }
  46110. // check default value
  46111. if (value === undefined) {
  46112. value = getPropDefaultValue(vm, prop, key);
  46113. // since the default value is a fresh copy,
  46114. // make sure to observe it.
  46115. var prevShouldObserve = shouldObserve;
  46116. toggleObserving(true);
  46117. observe(value);
  46118. toggleObserving(prevShouldObserve);
  46119. }
  46120. {
  46121. assertProp(prop, key, value, vm, absent);
  46122. }
  46123. return value
  46124. }
  46125. /**
  46126. * Get the default value of a prop.
  46127. */
  46128. function getPropDefaultValue (vm, prop, key) {
  46129. // no default, return undefined
  46130. if (!hasOwn(prop, 'default')) {
  46131. return undefined
  46132. }
  46133. var def = prop.default;
  46134. // warn against non-factory defaults for Object & Array
  46135. if (isObject(def)) {
  46136. warn(
  46137. 'Invalid default value for prop "' + key + '": ' +
  46138. 'Props with type Object/Array must use a factory function ' +
  46139. 'to return the default value.',
  46140. vm
  46141. );
  46142. }
  46143. // the raw prop value was also undefined from previous render,
  46144. // return previous default value to avoid unnecessary watcher trigger
  46145. if (vm && vm.$options.propsData &&
  46146. vm.$options.propsData[key] === undefined &&
  46147. vm._props[key] !== undefined
  46148. ) {
  46149. return vm._props[key]
  46150. }
  46151. // call factory function for non-Function types
  46152. // a value is Function if its prototype is function even across different execution context
  46153. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46154. ? def.call(vm)
  46155. : def
  46156. }
  46157. /**
  46158. * Assert whether a prop is valid.
  46159. */
  46160. function assertProp (
  46161. prop,
  46162. name,
  46163. value,
  46164. vm,
  46165. absent
  46166. ) {
  46167. if (prop.required && absent) {
  46168. warn(
  46169. 'Missing required prop: "' + name + '"',
  46170. vm
  46171. );
  46172. return
  46173. }
  46174. if (value == null && !prop.required) {
  46175. return
  46176. }
  46177. var type = prop.type;
  46178. var valid = !type || type === true;
  46179. var expectedTypes = [];
  46180. if (type) {
  46181. if (!Array.isArray(type)) {
  46182. type = [type];
  46183. }
  46184. for (var i = 0; i < type.length && !valid; i++) {
  46185. var assertedType = assertType(value, type[i]);
  46186. expectedTypes.push(assertedType.expectedType || '');
  46187. valid = assertedType.valid;
  46188. }
  46189. }
  46190. if (!valid) {
  46191. warn(
  46192. getInvalidTypeMessage(name, value, expectedTypes),
  46193. vm
  46194. );
  46195. return
  46196. }
  46197. var validator = prop.validator;
  46198. if (validator) {
  46199. if (!validator(value)) {
  46200. warn(
  46201. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46202. vm
  46203. );
  46204. }
  46205. }
  46206. }
  46207. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46208. function assertType (value, type) {
  46209. var valid;
  46210. var expectedType = getType(type);
  46211. if (simpleCheckRE.test(expectedType)) {
  46212. var t = typeof value;
  46213. valid = t === expectedType.toLowerCase();
  46214. // for primitive wrapper objects
  46215. if (!valid && t === 'object') {
  46216. valid = value instanceof type;
  46217. }
  46218. } else if (expectedType === 'Object') {
  46219. valid = isPlainObject(value);
  46220. } else if (expectedType === 'Array') {
  46221. valid = Array.isArray(value);
  46222. } else {
  46223. valid = value instanceof type;
  46224. }
  46225. return {
  46226. valid: valid,
  46227. expectedType: expectedType
  46228. }
  46229. }
  46230. /**
  46231. * Use function string name to check built-in types,
  46232. * because a simple equality check will fail when running
  46233. * across different vms / iframes.
  46234. */
  46235. function getType (fn) {
  46236. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46237. return match ? match[1] : ''
  46238. }
  46239. function isSameType (a, b) {
  46240. return getType(a) === getType(b)
  46241. }
  46242. function getTypeIndex (type, expectedTypes) {
  46243. if (!Array.isArray(expectedTypes)) {
  46244. return isSameType(expectedTypes, type) ? 0 : -1
  46245. }
  46246. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46247. if (isSameType(expectedTypes[i], type)) {
  46248. return i
  46249. }
  46250. }
  46251. return -1
  46252. }
  46253. function getInvalidTypeMessage (name, value, expectedTypes) {
  46254. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46255. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46256. var expectedType = expectedTypes[0];
  46257. var receivedType = toRawType(value);
  46258. var expectedValue = styleValue(value, expectedType);
  46259. var receivedValue = styleValue(value, receivedType);
  46260. // check if we need to specify expected value
  46261. if (expectedTypes.length === 1 &&
  46262. isExplicable(expectedType) &&
  46263. !isBoolean(expectedType, receivedType)) {
  46264. message += " with value " + expectedValue;
  46265. }
  46266. message += ", got " + receivedType + " ";
  46267. // check if we need to specify received value
  46268. if (isExplicable(receivedType)) {
  46269. message += "with value " + receivedValue + ".";
  46270. }
  46271. return message
  46272. }
  46273. function styleValue (value, type) {
  46274. if (type === 'String') {
  46275. return ("\"" + value + "\"")
  46276. } else if (type === 'Number') {
  46277. return ("" + (Number(value)))
  46278. } else {
  46279. return ("" + value)
  46280. }
  46281. }
  46282. function isExplicable (value) {
  46283. var explicitTypes = ['string', 'number', 'boolean'];
  46284. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46285. }
  46286. function isBoolean () {
  46287. var args = [], len = arguments.length;
  46288. while ( len-- ) args[ len ] = arguments[ len ];
  46289. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46290. }
  46291. /* */
  46292. function handleError (err, vm, info) {
  46293. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46294. // See: https://github.com/vuejs/vuex/issues/1505
  46295. pushTarget();
  46296. try {
  46297. if (vm) {
  46298. var cur = vm;
  46299. while ((cur = cur.$parent)) {
  46300. var hooks = cur.$options.errorCaptured;
  46301. if (hooks) {
  46302. for (var i = 0; i < hooks.length; i++) {
  46303. try {
  46304. var capture = hooks[i].call(cur, err, vm, info) === false;
  46305. if (capture) { return }
  46306. } catch (e) {
  46307. globalHandleError(e, cur, 'errorCaptured hook');
  46308. }
  46309. }
  46310. }
  46311. }
  46312. }
  46313. globalHandleError(err, vm, info);
  46314. } finally {
  46315. popTarget();
  46316. }
  46317. }
  46318. function invokeWithErrorHandling (
  46319. handler,
  46320. context,
  46321. args,
  46322. vm,
  46323. info
  46324. ) {
  46325. var res;
  46326. try {
  46327. res = args ? handler.apply(context, args) : handler.call(context);
  46328. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46329. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46330. // issue #9511
  46331. // avoid catch triggering multiple times when nested calls
  46332. res._handled = true;
  46333. }
  46334. } catch (e) {
  46335. handleError(e, vm, info);
  46336. }
  46337. return res
  46338. }
  46339. function globalHandleError (err, vm, info) {
  46340. if (config.errorHandler) {
  46341. try {
  46342. return config.errorHandler.call(null, err, vm, info)
  46343. } catch (e) {
  46344. // if the user intentionally throws the original error in the handler,
  46345. // do not log it twice
  46346. if (e !== err) {
  46347. logError(e, null, 'config.errorHandler');
  46348. }
  46349. }
  46350. }
  46351. logError(err, vm, info);
  46352. }
  46353. function logError (err, vm, info) {
  46354. {
  46355. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46356. }
  46357. /* istanbul ignore else */
  46358. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46359. console.error(err);
  46360. } else {
  46361. throw err
  46362. }
  46363. }
  46364. /* */
  46365. var isUsingMicroTask = false;
  46366. var callbacks = [];
  46367. var pending = false;
  46368. function flushCallbacks () {
  46369. pending = false;
  46370. var copies = callbacks.slice(0);
  46371. callbacks.length = 0;
  46372. for (var i = 0; i < copies.length; i++) {
  46373. copies[i]();
  46374. }
  46375. }
  46376. // Here we have async deferring wrappers using microtasks.
  46377. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46378. // However, it has subtle problems when state is changed right before repaint
  46379. // (e.g. #6813, out-in transitions).
  46380. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46381. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46382. // So we now use microtasks everywhere, again.
  46383. // A major drawback of this tradeoff is that there are some scenarios
  46384. // where microtasks have too high a priority and fire in between supposedly
  46385. // sequential events (e.g. #4521, #6690, which have workarounds)
  46386. // or even between bubbling of the same event (#6566).
  46387. var timerFunc;
  46388. // The nextTick behavior leverages the microtask queue, which can be accessed
  46389. // via either native Promise.then or MutationObserver.
  46390. // MutationObserver has wider support, however it is seriously bugged in
  46391. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46392. // completely stops working after triggering a few times... so, if native
  46393. // Promise is available, we will use it:
  46394. /* istanbul ignore next, $flow-disable-line */
  46395. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46396. var p = Promise.resolve();
  46397. timerFunc = function () {
  46398. p.then(flushCallbacks);
  46399. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46400. // it can get stuck in a weird state where callbacks are pushed into the
  46401. // microtask queue but the queue isn't being flushed, until the browser
  46402. // needs to do some other work, e.g. handle a timer. Therefore we can
  46403. // "force" the microtask queue to be flushed by adding an empty timer.
  46404. if (isIOS) { setTimeout(noop); }
  46405. };
  46406. isUsingMicroTask = true;
  46407. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46408. isNative(MutationObserver) ||
  46409. // PhantomJS and iOS 7.x
  46410. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46411. )) {
  46412. // Use MutationObserver where native Promise is not available,
  46413. // e.g. PhantomJS, iOS7, Android 4.4
  46414. // (#6466 MutationObserver is unreliable in IE11)
  46415. var counter = 1;
  46416. var observer = new MutationObserver(flushCallbacks);
  46417. var textNode = document.createTextNode(String(counter));
  46418. observer.observe(textNode, {
  46419. characterData: true
  46420. });
  46421. timerFunc = function () {
  46422. counter = (counter + 1) % 2;
  46423. textNode.data = String(counter);
  46424. };
  46425. isUsingMicroTask = true;
  46426. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46427. // Fallback to setImmediate.
  46428. // Technically it leverages the (macro) task queue,
  46429. // but it is still a better choice than setTimeout.
  46430. timerFunc = function () {
  46431. setImmediate(flushCallbacks);
  46432. };
  46433. } else {
  46434. // Fallback to setTimeout.
  46435. timerFunc = function () {
  46436. setTimeout(flushCallbacks, 0);
  46437. };
  46438. }
  46439. function nextTick (cb, ctx) {
  46440. var _resolve;
  46441. callbacks.push(function () {
  46442. if (cb) {
  46443. try {
  46444. cb.call(ctx);
  46445. } catch (e) {
  46446. handleError(e, ctx, 'nextTick');
  46447. }
  46448. } else if (_resolve) {
  46449. _resolve(ctx);
  46450. }
  46451. });
  46452. if (!pending) {
  46453. pending = true;
  46454. timerFunc();
  46455. }
  46456. // $flow-disable-line
  46457. if (!cb && typeof Promise !== 'undefined') {
  46458. return new Promise(function (resolve) {
  46459. _resolve = resolve;
  46460. })
  46461. }
  46462. }
  46463. /* */
  46464. var mark;
  46465. var measure;
  46466. {
  46467. var perf = inBrowser && window.performance;
  46468. /* istanbul ignore if */
  46469. if (
  46470. perf &&
  46471. perf.mark &&
  46472. perf.measure &&
  46473. perf.clearMarks &&
  46474. perf.clearMeasures
  46475. ) {
  46476. mark = function (tag) { return perf.mark(tag); };
  46477. measure = function (name, startTag, endTag) {
  46478. perf.measure(name, startTag, endTag);
  46479. perf.clearMarks(startTag);
  46480. perf.clearMarks(endTag);
  46481. // perf.clearMeasures(name)
  46482. };
  46483. }
  46484. }
  46485. /* not type checking this file because flow doesn't play well with Proxy */
  46486. var initProxy;
  46487. {
  46488. var allowedGlobals = makeMap(
  46489. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46490. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46491. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46492. 'require' // for Webpack/Browserify
  46493. );
  46494. var warnNonPresent = function (target, key) {
  46495. warn(
  46496. "Property or method \"" + key + "\" is not defined on the instance but " +
  46497. 'referenced during render. Make sure that this property is reactive, ' +
  46498. 'either in the data option, or for class-based components, by ' +
  46499. 'initializing the property. ' +
  46500. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46501. target
  46502. );
  46503. };
  46504. var warnReservedPrefix = function (target, key) {
  46505. warn(
  46506. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46507. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46508. 'prevent conflicts with Vue internals. ' +
  46509. 'See: https://vuejs.org/v2/api/#data',
  46510. target
  46511. );
  46512. };
  46513. var hasProxy =
  46514. typeof Proxy !== 'undefined' && isNative(Proxy);
  46515. if (hasProxy) {
  46516. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46517. config.keyCodes = new Proxy(config.keyCodes, {
  46518. set: function set (target, key, value) {
  46519. if (isBuiltInModifier(key)) {
  46520. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46521. return false
  46522. } else {
  46523. target[key] = value;
  46524. return true
  46525. }
  46526. }
  46527. });
  46528. }
  46529. var hasHandler = {
  46530. has: function has (target, key) {
  46531. var has = key in target;
  46532. var isAllowed = allowedGlobals(key) ||
  46533. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46534. if (!has && !isAllowed) {
  46535. if (key in target.$data) { warnReservedPrefix(target, key); }
  46536. else { warnNonPresent(target, key); }
  46537. }
  46538. return has || !isAllowed
  46539. }
  46540. };
  46541. var getHandler = {
  46542. get: function get (target, key) {
  46543. if (typeof key === 'string' && !(key in target)) {
  46544. if (key in target.$data) { warnReservedPrefix(target, key); }
  46545. else { warnNonPresent(target, key); }
  46546. }
  46547. return target[key]
  46548. }
  46549. };
  46550. initProxy = function initProxy (vm) {
  46551. if (hasProxy) {
  46552. // determine which proxy handler to use
  46553. var options = vm.$options;
  46554. var handlers = options.render && options.render._withStripped
  46555. ? getHandler
  46556. : hasHandler;
  46557. vm._renderProxy = new Proxy(vm, handlers);
  46558. } else {
  46559. vm._renderProxy = vm;
  46560. }
  46561. };
  46562. }
  46563. /* */
  46564. var seenObjects = new _Set();
  46565. /**
  46566. * Recursively traverse an object to evoke all converted
  46567. * getters, so that every nested property inside the object
  46568. * is collected as a "deep" dependency.
  46569. */
  46570. function traverse (val) {
  46571. _traverse(val, seenObjects);
  46572. seenObjects.clear();
  46573. }
  46574. function _traverse (val, seen) {
  46575. var i, keys;
  46576. var isA = Array.isArray(val);
  46577. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46578. return
  46579. }
  46580. if (val.__ob__) {
  46581. var depId = val.__ob__.dep.id;
  46582. if (seen.has(depId)) {
  46583. return
  46584. }
  46585. seen.add(depId);
  46586. }
  46587. if (isA) {
  46588. i = val.length;
  46589. while (i--) { _traverse(val[i], seen); }
  46590. } else {
  46591. keys = Object.keys(val);
  46592. i = keys.length;
  46593. while (i--) { _traverse(val[keys[i]], seen); }
  46594. }
  46595. }
  46596. /* */
  46597. var normalizeEvent = cached(function (name) {
  46598. var passive = name.charAt(0) === '&';
  46599. name = passive ? name.slice(1) : name;
  46600. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46601. name = once$$1 ? name.slice(1) : name;
  46602. var capture = name.charAt(0) === '!';
  46603. name = capture ? name.slice(1) : name;
  46604. return {
  46605. name: name,
  46606. once: once$$1,
  46607. capture: capture,
  46608. passive: passive
  46609. }
  46610. });
  46611. function createFnInvoker (fns, vm) {
  46612. function invoker () {
  46613. var arguments$1 = arguments;
  46614. var fns = invoker.fns;
  46615. if (Array.isArray(fns)) {
  46616. var cloned = fns.slice();
  46617. for (var i = 0; i < cloned.length; i++) {
  46618. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46619. }
  46620. } else {
  46621. // return handler return value for single handlers
  46622. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46623. }
  46624. }
  46625. invoker.fns = fns;
  46626. return invoker
  46627. }
  46628. function updateListeners (
  46629. on,
  46630. oldOn,
  46631. add,
  46632. remove$$1,
  46633. createOnceHandler,
  46634. vm
  46635. ) {
  46636. var name, def$$1, cur, old, event;
  46637. for (name in on) {
  46638. def$$1 = cur = on[name];
  46639. old = oldOn[name];
  46640. event = normalizeEvent(name);
  46641. if (isUndef(cur)) {
  46642. warn(
  46643. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46644. vm
  46645. );
  46646. } else if (isUndef(old)) {
  46647. if (isUndef(cur.fns)) {
  46648. cur = on[name] = createFnInvoker(cur, vm);
  46649. }
  46650. if (isTrue(event.once)) {
  46651. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46652. }
  46653. add(event.name, cur, event.capture, event.passive, event.params);
  46654. } else if (cur !== old) {
  46655. old.fns = cur;
  46656. on[name] = old;
  46657. }
  46658. }
  46659. for (name in oldOn) {
  46660. if (isUndef(on[name])) {
  46661. event = normalizeEvent(name);
  46662. remove$$1(event.name, oldOn[name], event.capture);
  46663. }
  46664. }
  46665. }
  46666. /* */
  46667. function mergeVNodeHook (def, hookKey, hook) {
  46668. if (def instanceof VNode) {
  46669. def = def.data.hook || (def.data.hook = {});
  46670. }
  46671. var invoker;
  46672. var oldHook = def[hookKey];
  46673. function wrappedHook () {
  46674. hook.apply(this, arguments);
  46675. // important: remove merged hook to ensure it's called only once
  46676. // and prevent memory leak
  46677. remove(invoker.fns, wrappedHook);
  46678. }
  46679. if (isUndef(oldHook)) {
  46680. // no existing hook
  46681. invoker = createFnInvoker([wrappedHook]);
  46682. } else {
  46683. /* istanbul ignore if */
  46684. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46685. // already a merged invoker
  46686. invoker = oldHook;
  46687. invoker.fns.push(wrappedHook);
  46688. } else {
  46689. // existing plain hook
  46690. invoker = createFnInvoker([oldHook, wrappedHook]);
  46691. }
  46692. }
  46693. invoker.merged = true;
  46694. def[hookKey] = invoker;
  46695. }
  46696. /* */
  46697. function extractPropsFromVNodeData (
  46698. data,
  46699. Ctor,
  46700. tag
  46701. ) {
  46702. // we are only extracting raw values here.
  46703. // validation and default values are handled in the child
  46704. // component itself.
  46705. var propOptions = Ctor.options.props;
  46706. if (isUndef(propOptions)) {
  46707. return
  46708. }
  46709. var res = {};
  46710. var attrs = data.attrs;
  46711. var props = data.props;
  46712. if (isDef(attrs) || isDef(props)) {
  46713. for (var key in propOptions) {
  46714. var altKey = hyphenate(key);
  46715. {
  46716. var keyInLowerCase = key.toLowerCase();
  46717. if (
  46718. key !== keyInLowerCase &&
  46719. attrs && hasOwn(attrs, keyInLowerCase)
  46720. ) {
  46721. tip(
  46722. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46723. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46724. " \"" + key + "\". " +
  46725. "Note that HTML attributes are case-insensitive and camelCased " +
  46726. "props need to use their kebab-case equivalents when using in-DOM " +
  46727. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46728. );
  46729. }
  46730. }
  46731. checkProp(res, props, key, altKey, true) ||
  46732. checkProp(res, attrs, key, altKey, false);
  46733. }
  46734. }
  46735. return res
  46736. }
  46737. function checkProp (
  46738. res,
  46739. hash,
  46740. key,
  46741. altKey,
  46742. preserve
  46743. ) {
  46744. if (isDef(hash)) {
  46745. if (hasOwn(hash, key)) {
  46746. res[key] = hash[key];
  46747. if (!preserve) {
  46748. delete hash[key];
  46749. }
  46750. return true
  46751. } else if (hasOwn(hash, altKey)) {
  46752. res[key] = hash[altKey];
  46753. if (!preserve) {
  46754. delete hash[altKey];
  46755. }
  46756. return true
  46757. }
  46758. }
  46759. return false
  46760. }
  46761. /* */
  46762. // The template compiler attempts to minimize the need for normalization by
  46763. // statically analyzing the template at compile time.
  46764. //
  46765. // For plain HTML markup, normalization can be completely skipped because the
  46766. // generated render function is guaranteed to return Array<VNode>. There are
  46767. // two cases where extra normalization is needed:
  46768. // 1. When the children contains components - because a functional component
  46769. // may return an Array instead of a single root. In this case, just a simple
  46770. // normalization is needed - if any child is an Array, we flatten the whole
  46771. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46772. // because functional components already normalize their own children.
  46773. function simpleNormalizeChildren (children) {
  46774. for (var i = 0; i < children.length; i++) {
  46775. if (Array.isArray(children[i])) {
  46776. return Array.prototype.concat.apply([], children)
  46777. }
  46778. }
  46779. return children
  46780. }
  46781. // 2. When the children contains constructs that always generated nested Arrays,
  46782. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46783. // with hand-written render functions / JSX. In such cases a full normalization
  46784. // is needed to cater to all possible types of children values.
  46785. function normalizeChildren (children) {
  46786. return isPrimitive(children)
  46787. ? [createTextVNode(children)]
  46788. : Array.isArray(children)
  46789. ? normalizeArrayChildren(children)
  46790. : undefined
  46791. }
  46792. function isTextNode (node) {
  46793. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46794. }
  46795. function normalizeArrayChildren (children, nestedIndex) {
  46796. var res = [];
  46797. var i, c, lastIndex, last;
  46798. for (i = 0; i < children.length; i++) {
  46799. c = children[i];
  46800. if (isUndef(c) || typeof c === 'boolean') { continue }
  46801. lastIndex = res.length - 1;
  46802. last = res[lastIndex];
  46803. // nested
  46804. if (Array.isArray(c)) {
  46805. if (c.length > 0) {
  46806. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46807. // merge adjacent text nodes
  46808. if (isTextNode(c[0]) && isTextNode(last)) {
  46809. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46810. c.shift();
  46811. }
  46812. res.push.apply(res, c);
  46813. }
  46814. } else if (isPrimitive(c)) {
  46815. if (isTextNode(last)) {
  46816. // merge adjacent text nodes
  46817. // this is necessary for SSR hydration because text nodes are
  46818. // essentially merged when rendered to HTML strings
  46819. res[lastIndex] = createTextVNode(last.text + c);
  46820. } else if (c !== '') {
  46821. // convert primitive to vnode
  46822. res.push(createTextVNode(c));
  46823. }
  46824. } else {
  46825. if (isTextNode(c) && isTextNode(last)) {
  46826. // merge adjacent text nodes
  46827. res[lastIndex] = createTextVNode(last.text + c.text);
  46828. } else {
  46829. // default key for nested array children (likely generated by v-for)
  46830. if (isTrue(children._isVList) &&
  46831. isDef(c.tag) &&
  46832. isUndef(c.key) &&
  46833. isDef(nestedIndex)) {
  46834. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46835. }
  46836. res.push(c);
  46837. }
  46838. }
  46839. }
  46840. return res
  46841. }
  46842. /* */
  46843. function initProvide (vm) {
  46844. var provide = vm.$options.provide;
  46845. if (provide) {
  46846. vm._provided = typeof provide === 'function'
  46847. ? provide.call(vm)
  46848. : provide;
  46849. }
  46850. }
  46851. function initInjections (vm) {
  46852. var result = resolveInject(vm.$options.inject, vm);
  46853. if (result) {
  46854. toggleObserving(false);
  46855. Object.keys(result).forEach(function (key) {
  46856. /* istanbul ignore else */
  46857. {
  46858. defineReactive$$1(vm, key, result[key], function () {
  46859. warn(
  46860. "Avoid mutating an injected value directly since the changes will be " +
  46861. "overwritten whenever the provided component re-renders. " +
  46862. "injection being mutated: \"" + key + "\"",
  46863. vm
  46864. );
  46865. });
  46866. }
  46867. });
  46868. toggleObserving(true);
  46869. }
  46870. }
  46871. function resolveInject (inject, vm) {
  46872. if (inject) {
  46873. // inject is :any because flow is not smart enough to figure out cached
  46874. var result = Object.create(null);
  46875. var keys = hasSymbol
  46876. ? Reflect.ownKeys(inject)
  46877. : Object.keys(inject);
  46878. for (var i = 0; i < keys.length; i++) {
  46879. var key = keys[i];
  46880. // #6574 in case the inject object is observed...
  46881. if (key === '__ob__') { continue }
  46882. var provideKey = inject[key].from;
  46883. var source = vm;
  46884. while (source) {
  46885. if (source._provided && hasOwn(source._provided, provideKey)) {
  46886. result[key] = source._provided[provideKey];
  46887. break
  46888. }
  46889. source = source.$parent;
  46890. }
  46891. if (!source) {
  46892. if ('default' in inject[key]) {
  46893. var provideDefault = inject[key].default;
  46894. result[key] = typeof provideDefault === 'function'
  46895. ? provideDefault.call(vm)
  46896. : provideDefault;
  46897. } else {
  46898. warn(("Injection \"" + key + "\" not found"), vm);
  46899. }
  46900. }
  46901. }
  46902. return result
  46903. }
  46904. }
  46905. /* */
  46906. /**
  46907. * Runtime helper for resolving raw children VNodes into a slot object.
  46908. */
  46909. function resolveSlots (
  46910. children,
  46911. context
  46912. ) {
  46913. if (!children || !children.length) {
  46914. return {}
  46915. }
  46916. var slots = {};
  46917. for (var i = 0, l = children.length; i < l; i++) {
  46918. var child = children[i];
  46919. var data = child.data;
  46920. // remove slot attribute if the node is resolved as a Vue slot node
  46921. if (data && data.attrs && data.attrs.slot) {
  46922. delete data.attrs.slot;
  46923. }
  46924. // named slots should only be respected if the vnode was rendered in the
  46925. // same context.
  46926. if ((child.context === context || child.fnContext === context) &&
  46927. data && data.slot != null
  46928. ) {
  46929. var name = data.slot;
  46930. var slot = (slots[name] || (slots[name] = []));
  46931. if (child.tag === 'template') {
  46932. slot.push.apply(slot, child.children || []);
  46933. } else {
  46934. slot.push(child);
  46935. }
  46936. } else {
  46937. (slots.default || (slots.default = [])).push(child);
  46938. }
  46939. }
  46940. // ignore slots that contains only whitespace
  46941. for (var name$1 in slots) {
  46942. if (slots[name$1].every(isWhitespace)) {
  46943. delete slots[name$1];
  46944. }
  46945. }
  46946. return slots
  46947. }
  46948. function isWhitespace (node) {
  46949. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46950. }
  46951. /* */
  46952. function normalizeScopedSlots (
  46953. slots,
  46954. normalSlots,
  46955. prevSlots
  46956. ) {
  46957. var res;
  46958. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46959. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46960. var key = slots && slots.$key;
  46961. if (!slots) {
  46962. res = {};
  46963. } else if (slots._normalized) {
  46964. // fast path 1: child component re-render only, parent did not change
  46965. return slots._normalized
  46966. } else if (
  46967. isStable &&
  46968. prevSlots &&
  46969. prevSlots !== emptyObject &&
  46970. key === prevSlots.$key &&
  46971. !hasNormalSlots &&
  46972. !prevSlots.$hasNormal
  46973. ) {
  46974. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46975. // only need to normalize once
  46976. return prevSlots
  46977. } else {
  46978. res = {};
  46979. for (var key$1 in slots) {
  46980. if (slots[key$1] && key$1[0] !== '$') {
  46981. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46982. }
  46983. }
  46984. }
  46985. // expose normal slots on scopedSlots
  46986. for (var key$2 in normalSlots) {
  46987. if (!(key$2 in res)) {
  46988. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46989. }
  46990. }
  46991. // avoriaz seems to mock a non-extensible $scopedSlots object
  46992. // and when that is passed down this would cause an error
  46993. if (slots && Object.isExtensible(slots)) {
  46994. (slots)._normalized = res;
  46995. }
  46996. def(res, '$stable', isStable);
  46997. def(res, '$key', key);
  46998. def(res, '$hasNormal', hasNormalSlots);
  46999. return res
  47000. }
  47001. function normalizeScopedSlot(normalSlots, key, fn) {
  47002. var normalized = function () {
  47003. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47004. res = res && typeof res === 'object' && !Array.isArray(res)
  47005. ? [res] // single vnode
  47006. : normalizeChildren(res);
  47007. return res && (
  47008. res.length === 0 ||
  47009. (res.length === 1 && res[0].isComment) // #9658
  47010. ) ? undefined
  47011. : res
  47012. };
  47013. // this is a slot using the new v-slot syntax without scope. although it is
  47014. // compiled as a scoped slot, render fn users would expect it to be present
  47015. // on this.$slots because the usage is semantically a normal slot.
  47016. if (fn.proxy) {
  47017. Object.defineProperty(normalSlots, key, {
  47018. get: normalized,
  47019. enumerable: true,
  47020. configurable: true
  47021. });
  47022. }
  47023. return normalized
  47024. }
  47025. function proxyNormalSlot(slots, key) {
  47026. return function () { return slots[key]; }
  47027. }
  47028. /* */
  47029. /**
  47030. * Runtime helper for rendering v-for lists.
  47031. */
  47032. function renderList (
  47033. val,
  47034. render
  47035. ) {
  47036. var ret, i, l, keys, key;
  47037. if (Array.isArray(val) || typeof val === 'string') {
  47038. ret = new Array(val.length);
  47039. for (i = 0, l = val.length; i < l; i++) {
  47040. ret[i] = render(val[i], i);
  47041. }
  47042. } else if (typeof val === 'number') {
  47043. ret = new Array(val);
  47044. for (i = 0; i < val; i++) {
  47045. ret[i] = render(i + 1, i);
  47046. }
  47047. } else if (isObject(val)) {
  47048. if (hasSymbol && val[Symbol.iterator]) {
  47049. ret = [];
  47050. var iterator = val[Symbol.iterator]();
  47051. var result = iterator.next();
  47052. while (!result.done) {
  47053. ret.push(render(result.value, ret.length));
  47054. result = iterator.next();
  47055. }
  47056. } else {
  47057. keys = Object.keys(val);
  47058. ret = new Array(keys.length);
  47059. for (i = 0, l = keys.length; i < l; i++) {
  47060. key = keys[i];
  47061. ret[i] = render(val[key], key, i);
  47062. }
  47063. }
  47064. }
  47065. if (!isDef(ret)) {
  47066. ret = [];
  47067. }
  47068. (ret)._isVList = true;
  47069. return ret
  47070. }
  47071. /* */
  47072. /**
  47073. * Runtime helper for rendering <slot>
  47074. */
  47075. function renderSlot (
  47076. name,
  47077. fallback,
  47078. props,
  47079. bindObject
  47080. ) {
  47081. var scopedSlotFn = this.$scopedSlots[name];
  47082. var nodes;
  47083. if (scopedSlotFn) { // scoped slot
  47084. props = props || {};
  47085. if (bindObject) {
  47086. if (!isObject(bindObject)) {
  47087. warn(
  47088. 'slot v-bind without argument expects an Object',
  47089. this
  47090. );
  47091. }
  47092. props = extend(extend({}, bindObject), props);
  47093. }
  47094. nodes = scopedSlotFn(props) || fallback;
  47095. } else {
  47096. nodes = this.$slots[name] || fallback;
  47097. }
  47098. var target = props && props.slot;
  47099. if (target) {
  47100. return this.$createElement('template', { slot: target }, nodes)
  47101. } else {
  47102. return nodes
  47103. }
  47104. }
  47105. /* */
  47106. /**
  47107. * Runtime helper for resolving filters
  47108. */
  47109. function resolveFilter (id) {
  47110. return resolveAsset(this.$options, 'filters', id, true) || identity
  47111. }
  47112. /* */
  47113. function isKeyNotMatch (expect, actual) {
  47114. if (Array.isArray(expect)) {
  47115. return expect.indexOf(actual) === -1
  47116. } else {
  47117. return expect !== actual
  47118. }
  47119. }
  47120. /**
  47121. * Runtime helper for checking keyCodes from config.
  47122. * exposed as Vue.prototype._k
  47123. * passing in eventKeyName as last argument separately for backwards compat
  47124. */
  47125. function checkKeyCodes (
  47126. eventKeyCode,
  47127. key,
  47128. builtInKeyCode,
  47129. eventKeyName,
  47130. builtInKeyName
  47131. ) {
  47132. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47133. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47134. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47135. } else if (mappedKeyCode) {
  47136. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47137. } else if (eventKeyName) {
  47138. return hyphenate(eventKeyName) !== key
  47139. }
  47140. }
  47141. /* */
  47142. /**
  47143. * Runtime helper for merging v-bind="object" into a VNode's data.
  47144. */
  47145. function bindObjectProps (
  47146. data,
  47147. tag,
  47148. value,
  47149. asProp,
  47150. isSync
  47151. ) {
  47152. if (value) {
  47153. if (!isObject(value)) {
  47154. warn(
  47155. 'v-bind without argument expects an Object or Array value',
  47156. this
  47157. );
  47158. } else {
  47159. if (Array.isArray(value)) {
  47160. value = toObject(value);
  47161. }
  47162. var hash;
  47163. var loop = function ( key ) {
  47164. if (
  47165. key === 'class' ||
  47166. key === 'style' ||
  47167. isReservedAttribute(key)
  47168. ) {
  47169. hash = data;
  47170. } else {
  47171. var type = data.attrs && data.attrs.type;
  47172. hash = asProp || config.mustUseProp(tag, type, key)
  47173. ? data.domProps || (data.domProps = {})
  47174. : data.attrs || (data.attrs = {});
  47175. }
  47176. var camelizedKey = camelize(key);
  47177. var hyphenatedKey = hyphenate(key);
  47178. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47179. hash[key] = value[key];
  47180. if (isSync) {
  47181. var on = data.on || (data.on = {});
  47182. on[("update:" + key)] = function ($event) {
  47183. value[key] = $event;
  47184. };
  47185. }
  47186. }
  47187. };
  47188. for (var key in value) loop( key );
  47189. }
  47190. }
  47191. return data
  47192. }
  47193. /* */
  47194. /**
  47195. * Runtime helper for rendering static trees.
  47196. */
  47197. function renderStatic (
  47198. index,
  47199. isInFor
  47200. ) {
  47201. var cached = this._staticTrees || (this._staticTrees = []);
  47202. var tree = cached[index];
  47203. // if has already-rendered static tree and not inside v-for,
  47204. // we can reuse the same tree.
  47205. if (tree && !isInFor) {
  47206. return tree
  47207. }
  47208. // otherwise, render a fresh tree.
  47209. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47210. this._renderProxy,
  47211. null,
  47212. this // for render fns generated for functional component templates
  47213. );
  47214. markStatic(tree, ("__static__" + index), false);
  47215. return tree
  47216. }
  47217. /**
  47218. * Runtime helper for v-once.
  47219. * Effectively it means marking the node as static with a unique key.
  47220. */
  47221. function markOnce (
  47222. tree,
  47223. index,
  47224. key
  47225. ) {
  47226. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47227. return tree
  47228. }
  47229. function markStatic (
  47230. tree,
  47231. key,
  47232. isOnce
  47233. ) {
  47234. if (Array.isArray(tree)) {
  47235. for (var i = 0; i < tree.length; i++) {
  47236. if (tree[i] && typeof tree[i] !== 'string') {
  47237. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47238. }
  47239. }
  47240. } else {
  47241. markStaticNode(tree, key, isOnce);
  47242. }
  47243. }
  47244. function markStaticNode (node, key, isOnce) {
  47245. node.isStatic = true;
  47246. node.key = key;
  47247. node.isOnce = isOnce;
  47248. }
  47249. /* */
  47250. function bindObjectListeners (data, value) {
  47251. if (value) {
  47252. if (!isPlainObject(value)) {
  47253. warn(
  47254. 'v-on without argument expects an Object value',
  47255. this
  47256. );
  47257. } else {
  47258. var on = data.on = data.on ? extend({}, data.on) : {};
  47259. for (var key in value) {
  47260. var existing = on[key];
  47261. var ours = value[key];
  47262. on[key] = existing ? [].concat(existing, ours) : ours;
  47263. }
  47264. }
  47265. }
  47266. return data
  47267. }
  47268. /* */
  47269. function resolveScopedSlots (
  47270. fns, // see flow/vnode
  47271. res,
  47272. // the following are added in 2.6
  47273. hasDynamicKeys,
  47274. contentHashKey
  47275. ) {
  47276. res = res || { $stable: !hasDynamicKeys };
  47277. for (var i = 0; i < fns.length; i++) {
  47278. var slot = fns[i];
  47279. if (Array.isArray(slot)) {
  47280. resolveScopedSlots(slot, res, hasDynamicKeys);
  47281. } else if (slot) {
  47282. // marker for reverse proxying v-slot without scope on this.$slots
  47283. if (slot.proxy) {
  47284. slot.fn.proxy = true;
  47285. }
  47286. res[slot.key] = slot.fn;
  47287. }
  47288. }
  47289. if (contentHashKey) {
  47290. (res).$key = contentHashKey;
  47291. }
  47292. return res
  47293. }
  47294. /* */
  47295. function bindDynamicKeys (baseObj, values) {
  47296. for (var i = 0; i < values.length; i += 2) {
  47297. var key = values[i];
  47298. if (typeof key === 'string' && key) {
  47299. baseObj[values[i]] = values[i + 1];
  47300. } else if (key !== '' && key !== null) {
  47301. // null is a special value for explicitly removing a binding
  47302. warn(
  47303. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47304. this
  47305. );
  47306. }
  47307. }
  47308. return baseObj
  47309. }
  47310. // helper to dynamically append modifier runtime markers to event names.
  47311. // ensure only append when value is already string, otherwise it will be cast
  47312. // to string and cause the type check to miss.
  47313. function prependModifier (value, symbol) {
  47314. return typeof value === 'string' ? symbol + value : value
  47315. }
  47316. /* */
  47317. function installRenderHelpers (target) {
  47318. target._o = markOnce;
  47319. target._n = toNumber;
  47320. target._s = toString;
  47321. target._l = renderList;
  47322. target._t = renderSlot;
  47323. target._q = looseEqual;
  47324. target._i = looseIndexOf;
  47325. target._m = renderStatic;
  47326. target._f = resolveFilter;
  47327. target._k = checkKeyCodes;
  47328. target._b = bindObjectProps;
  47329. target._v = createTextVNode;
  47330. target._e = createEmptyVNode;
  47331. target._u = resolveScopedSlots;
  47332. target._g = bindObjectListeners;
  47333. target._d = bindDynamicKeys;
  47334. target._p = prependModifier;
  47335. }
  47336. /* */
  47337. function FunctionalRenderContext (
  47338. data,
  47339. props,
  47340. children,
  47341. parent,
  47342. Ctor
  47343. ) {
  47344. var this$1 = this;
  47345. var options = Ctor.options;
  47346. // ensure the createElement function in functional components
  47347. // gets a unique context - this is necessary for correct named slot check
  47348. var contextVm;
  47349. if (hasOwn(parent, '_uid')) {
  47350. contextVm = Object.create(parent);
  47351. // $flow-disable-line
  47352. contextVm._original = parent;
  47353. } else {
  47354. // the context vm passed in is a functional context as well.
  47355. // in this case we want to make sure we are able to get a hold to the
  47356. // real context instance.
  47357. contextVm = parent;
  47358. // $flow-disable-line
  47359. parent = parent._original;
  47360. }
  47361. var isCompiled = isTrue(options._compiled);
  47362. var needNormalization = !isCompiled;
  47363. this.data = data;
  47364. this.props = props;
  47365. this.children = children;
  47366. this.parent = parent;
  47367. this.listeners = data.on || emptyObject;
  47368. this.injections = resolveInject(options.inject, parent);
  47369. this.slots = function () {
  47370. if (!this$1.$slots) {
  47371. normalizeScopedSlots(
  47372. data.scopedSlots,
  47373. this$1.$slots = resolveSlots(children, parent)
  47374. );
  47375. }
  47376. return this$1.$slots
  47377. };
  47378. Object.defineProperty(this, 'scopedSlots', ({
  47379. enumerable: true,
  47380. get: function get () {
  47381. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47382. }
  47383. }));
  47384. // support for compiled functional template
  47385. if (isCompiled) {
  47386. // exposing $options for renderStatic()
  47387. this.$options = options;
  47388. // pre-resolve slots for renderSlot()
  47389. this.$slots = this.slots();
  47390. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47391. }
  47392. if (options._scopeId) {
  47393. this._c = function (a, b, c, d) {
  47394. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47395. if (vnode && !Array.isArray(vnode)) {
  47396. vnode.fnScopeId = options._scopeId;
  47397. vnode.fnContext = parent;
  47398. }
  47399. return vnode
  47400. };
  47401. } else {
  47402. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47403. }
  47404. }
  47405. installRenderHelpers(FunctionalRenderContext.prototype);
  47406. function createFunctionalComponent (
  47407. Ctor,
  47408. propsData,
  47409. data,
  47410. contextVm,
  47411. children
  47412. ) {
  47413. var options = Ctor.options;
  47414. var props = {};
  47415. var propOptions = options.props;
  47416. if (isDef(propOptions)) {
  47417. for (var key in propOptions) {
  47418. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47419. }
  47420. } else {
  47421. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47422. if (isDef(data.props)) { mergeProps(props, data.props); }
  47423. }
  47424. var renderContext = new FunctionalRenderContext(
  47425. data,
  47426. props,
  47427. children,
  47428. contextVm,
  47429. Ctor
  47430. );
  47431. var vnode = options.render.call(null, renderContext._c, renderContext);
  47432. if (vnode instanceof VNode) {
  47433. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47434. } else if (Array.isArray(vnode)) {
  47435. var vnodes = normalizeChildren(vnode) || [];
  47436. var res = new Array(vnodes.length);
  47437. for (var i = 0; i < vnodes.length; i++) {
  47438. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47439. }
  47440. return res
  47441. }
  47442. }
  47443. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47444. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47445. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47446. // that should not be matched to match.
  47447. var clone = cloneVNode(vnode);
  47448. clone.fnContext = contextVm;
  47449. clone.fnOptions = options;
  47450. {
  47451. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47452. }
  47453. if (data.slot) {
  47454. (clone.data || (clone.data = {})).slot = data.slot;
  47455. }
  47456. return clone
  47457. }
  47458. function mergeProps (to, from) {
  47459. for (var key in from) {
  47460. to[camelize(key)] = from[key];
  47461. }
  47462. }
  47463. /* */
  47464. /* */
  47465. /* */
  47466. /* */
  47467. // inline hooks to be invoked on component VNodes during patch
  47468. var componentVNodeHooks = {
  47469. init: function init (vnode, hydrating) {
  47470. if (
  47471. vnode.componentInstance &&
  47472. !vnode.componentInstance._isDestroyed &&
  47473. vnode.data.keepAlive
  47474. ) {
  47475. // kept-alive components, treat as a patch
  47476. var mountedNode = vnode; // work around flow
  47477. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47478. } else {
  47479. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47480. vnode,
  47481. activeInstance
  47482. );
  47483. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47484. }
  47485. },
  47486. prepatch: function prepatch (oldVnode, vnode) {
  47487. var options = vnode.componentOptions;
  47488. var child = vnode.componentInstance = oldVnode.componentInstance;
  47489. updateChildComponent(
  47490. child,
  47491. options.propsData, // updated props
  47492. options.listeners, // updated listeners
  47493. vnode, // new parent vnode
  47494. options.children // new children
  47495. );
  47496. },
  47497. insert: function insert (vnode) {
  47498. var context = vnode.context;
  47499. var componentInstance = vnode.componentInstance;
  47500. if (!componentInstance._isMounted) {
  47501. componentInstance._isMounted = true;
  47502. callHook(componentInstance, 'mounted');
  47503. }
  47504. if (vnode.data.keepAlive) {
  47505. if (context._isMounted) {
  47506. // vue-router#1212
  47507. // During updates, a kept-alive component's child components may
  47508. // change, so directly walking the tree here may call activated hooks
  47509. // on incorrect children. Instead we push them into a queue which will
  47510. // be processed after the whole patch process ended.
  47511. queueActivatedComponent(componentInstance);
  47512. } else {
  47513. activateChildComponent(componentInstance, true /* direct */);
  47514. }
  47515. }
  47516. },
  47517. destroy: function destroy (vnode) {
  47518. var componentInstance = vnode.componentInstance;
  47519. if (!componentInstance._isDestroyed) {
  47520. if (!vnode.data.keepAlive) {
  47521. componentInstance.$destroy();
  47522. } else {
  47523. deactivateChildComponent(componentInstance, true /* direct */);
  47524. }
  47525. }
  47526. }
  47527. };
  47528. var hooksToMerge = Object.keys(componentVNodeHooks);
  47529. function createComponent (
  47530. Ctor,
  47531. data,
  47532. context,
  47533. children,
  47534. tag
  47535. ) {
  47536. if (isUndef(Ctor)) {
  47537. return
  47538. }
  47539. var baseCtor = context.$options._base;
  47540. // plain options object: turn it into a constructor
  47541. if (isObject(Ctor)) {
  47542. Ctor = baseCtor.extend(Ctor);
  47543. }
  47544. // if at this stage it's not a constructor or an async component factory,
  47545. // reject.
  47546. if (typeof Ctor !== 'function') {
  47547. {
  47548. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47549. }
  47550. return
  47551. }
  47552. // async component
  47553. var asyncFactory;
  47554. if (isUndef(Ctor.cid)) {
  47555. asyncFactory = Ctor;
  47556. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47557. if (Ctor === undefined) {
  47558. // return a placeholder node for async component, which is rendered
  47559. // as a comment node but preserves all the raw information for the node.
  47560. // the information will be used for async server-rendering and hydration.
  47561. return createAsyncPlaceholder(
  47562. asyncFactory,
  47563. data,
  47564. context,
  47565. children,
  47566. tag
  47567. )
  47568. }
  47569. }
  47570. data = data || {};
  47571. // resolve constructor options in case global mixins are applied after
  47572. // component constructor creation
  47573. resolveConstructorOptions(Ctor);
  47574. // transform component v-model data into props & events
  47575. if (isDef(data.model)) {
  47576. transformModel(Ctor.options, data);
  47577. }
  47578. // extract props
  47579. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47580. // functional component
  47581. if (isTrue(Ctor.options.functional)) {
  47582. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47583. }
  47584. // extract listeners, since these needs to be treated as
  47585. // child component listeners instead of DOM listeners
  47586. var listeners = data.on;
  47587. // replace with listeners with .native modifier
  47588. // so it gets processed during parent component patch.
  47589. data.on = data.nativeOn;
  47590. if (isTrue(Ctor.options.abstract)) {
  47591. // abstract components do not keep anything
  47592. // other than props & listeners & slot
  47593. // work around flow
  47594. var slot = data.slot;
  47595. data = {};
  47596. if (slot) {
  47597. data.slot = slot;
  47598. }
  47599. }
  47600. // install component management hooks onto the placeholder node
  47601. installComponentHooks(data);
  47602. // return a placeholder vnode
  47603. var name = Ctor.options.name || tag;
  47604. var vnode = new VNode(
  47605. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47606. data, undefined, undefined, undefined, context,
  47607. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47608. asyncFactory
  47609. );
  47610. return vnode
  47611. }
  47612. function createComponentInstanceForVnode (
  47613. vnode, // we know it's MountedComponentVNode but flow doesn't
  47614. parent // activeInstance in lifecycle state
  47615. ) {
  47616. var options = {
  47617. _isComponent: true,
  47618. _parentVnode: vnode,
  47619. parent: parent
  47620. };
  47621. // check inline-template render functions
  47622. var inlineTemplate = vnode.data.inlineTemplate;
  47623. if (isDef(inlineTemplate)) {
  47624. options.render = inlineTemplate.render;
  47625. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47626. }
  47627. return new vnode.componentOptions.Ctor(options)
  47628. }
  47629. function installComponentHooks (data) {
  47630. var hooks = data.hook || (data.hook = {});
  47631. for (var i = 0; i < hooksToMerge.length; i++) {
  47632. var key = hooksToMerge[i];
  47633. var existing = hooks[key];
  47634. var toMerge = componentVNodeHooks[key];
  47635. if (existing !== toMerge && !(existing && existing._merged)) {
  47636. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47637. }
  47638. }
  47639. }
  47640. function mergeHook$1 (f1, f2) {
  47641. var merged = function (a, b) {
  47642. // flow complains about extra args which is why we use any
  47643. f1(a, b);
  47644. f2(a, b);
  47645. };
  47646. merged._merged = true;
  47647. return merged
  47648. }
  47649. // transform component v-model info (value and callback) into
  47650. // prop and event handler respectively.
  47651. function transformModel (options, data) {
  47652. var prop = (options.model && options.model.prop) || 'value';
  47653. var event = (options.model && options.model.event) || 'input'
  47654. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47655. var on = data.on || (data.on = {});
  47656. var existing = on[event];
  47657. var callback = data.model.callback;
  47658. if (isDef(existing)) {
  47659. if (
  47660. Array.isArray(existing)
  47661. ? existing.indexOf(callback) === -1
  47662. : existing !== callback
  47663. ) {
  47664. on[event] = [callback].concat(existing);
  47665. }
  47666. } else {
  47667. on[event] = callback;
  47668. }
  47669. }
  47670. /* */
  47671. var SIMPLE_NORMALIZE = 1;
  47672. var ALWAYS_NORMALIZE = 2;
  47673. // wrapper function for providing a more flexible interface
  47674. // without getting yelled at by flow
  47675. function createElement (
  47676. context,
  47677. tag,
  47678. data,
  47679. children,
  47680. normalizationType,
  47681. alwaysNormalize
  47682. ) {
  47683. if (Array.isArray(data) || isPrimitive(data)) {
  47684. normalizationType = children;
  47685. children = data;
  47686. data = undefined;
  47687. }
  47688. if (isTrue(alwaysNormalize)) {
  47689. normalizationType = ALWAYS_NORMALIZE;
  47690. }
  47691. return _createElement(context, tag, data, children, normalizationType)
  47692. }
  47693. function _createElement (
  47694. context,
  47695. tag,
  47696. data,
  47697. children,
  47698. normalizationType
  47699. ) {
  47700. if (isDef(data) && isDef((data).__ob__)) {
  47701. warn(
  47702. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47703. 'Always create fresh vnode data objects in each render!',
  47704. context
  47705. );
  47706. return createEmptyVNode()
  47707. }
  47708. // object syntax in v-bind
  47709. if (isDef(data) && isDef(data.is)) {
  47710. tag = data.is;
  47711. }
  47712. if (!tag) {
  47713. // in case of component :is set to falsy value
  47714. return createEmptyVNode()
  47715. }
  47716. // warn against non-primitive key
  47717. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47718. ) {
  47719. {
  47720. warn(
  47721. 'Avoid using non-primitive value as key, ' +
  47722. 'use string/number value instead.',
  47723. context
  47724. );
  47725. }
  47726. }
  47727. // support single function children as default scoped slot
  47728. if (Array.isArray(children) &&
  47729. typeof children[0] === 'function'
  47730. ) {
  47731. data = data || {};
  47732. data.scopedSlots = { default: children[0] };
  47733. children.length = 0;
  47734. }
  47735. if (normalizationType === ALWAYS_NORMALIZE) {
  47736. children = normalizeChildren(children);
  47737. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47738. children = simpleNormalizeChildren(children);
  47739. }
  47740. var vnode, ns;
  47741. if (typeof tag === 'string') {
  47742. var Ctor;
  47743. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47744. if (config.isReservedTag(tag)) {
  47745. // platform built-in elements
  47746. if (isDef(data) && isDef(data.nativeOn)) {
  47747. warn(
  47748. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47749. context
  47750. );
  47751. }
  47752. vnode = new VNode(
  47753. config.parsePlatformTagName(tag), data, children,
  47754. undefined, undefined, context
  47755. );
  47756. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47757. // component
  47758. vnode = createComponent(Ctor, data, context, children, tag);
  47759. } else {
  47760. // unknown or unlisted namespaced elements
  47761. // check at runtime because it may get assigned a namespace when its
  47762. // parent normalizes children
  47763. vnode = new VNode(
  47764. tag, data, children,
  47765. undefined, undefined, context
  47766. );
  47767. }
  47768. } else {
  47769. // direct component options / constructor
  47770. vnode = createComponent(tag, data, context, children);
  47771. }
  47772. if (Array.isArray(vnode)) {
  47773. return vnode
  47774. } else if (isDef(vnode)) {
  47775. if (isDef(ns)) { applyNS(vnode, ns); }
  47776. if (isDef(data)) { registerDeepBindings(data); }
  47777. return vnode
  47778. } else {
  47779. return createEmptyVNode()
  47780. }
  47781. }
  47782. function applyNS (vnode, ns, force) {
  47783. vnode.ns = ns;
  47784. if (vnode.tag === 'foreignObject') {
  47785. // use default namespace inside foreignObject
  47786. ns = undefined;
  47787. force = true;
  47788. }
  47789. if (isDef(vnode.children)) {
  47790. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47791. var child = vnode.children[i];
  47792. if (isDef(child.tag) && (
  47793. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47794. applyNS(child, ns, force);
  47795. }
  47796. }
  47797. }
  47798. }
  47799. // ref #5318
  47800. // necessary to ensure parent re-render when deep bindings like :style and
  47801. // :class are used on slot nodes
  47802. function registerDeepBindings (data) {
  47803. if (isObject(data.style)) {
  47804. traverse(data.style);
  47805. }
  47806. if (isObject(data.class)) {
  47807. traverse(data.class);
  47808. }
  47809. }
  47810. /* */
  47811. function initRender (vm) {
  47812. vm._vnode = null; // the root of the child tree
  47813. vm._staticTrees = null; // v-once cached trees
  47814. var options = vm.$options;
  47815. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47816. var renderContext = parentVnode && parentVnode.context;
  47817. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47818. vm.$scopedSlots = emptyObject;
  47819. // bind the createElement fn to this instance
  47820. // so that we get proper render context inside it.
  47821. // args order: tag, data, children, normalizationType, alwaysNormalize
  47822. // internal version is used by render functions compiled from templates
  47823. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47824. // normalization is always applied for the public version, used in
  47825. // user-written render functions.
  47826. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47827. // $attrs & $listeners are exposed for easier HOC creation.
  47828. // they need to be reactive so that HOCs using them are always updated
  47829. var parentData = parentVnode && parentVnode.data;
  47830. /* istanbul ignore else */
  47831. {
  47832. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47833. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47834. }, true);
  47835. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47836. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47837. }, true);
  47838. }
  47839. }
  47840. var currentRenderingInstance = null;
  47841. function renderMixin (Vue) {
  47842. // install runtime convenience helpers
  47843. installRenderHelpers(Vue.prototype);
  47844. Vue.prototype.$nextTick = function (fn) {
  47845. return nextTick(fn, this)
  47846. };
  47847. Vue.prototype._render = function () {
  47848. var vm = this;
  47849. var ref = vm.$options;
  47850. var render = ref.render;
  47851. var _parentVnode = ref._parentVnode;
  47852. if (_parentVnode) {
  47853. vm.$scopedSlots = normalizeScopedSlots(
  47854. _parentVnode.data.scopedSlots,
  47855. vm.$slots,
  47856. vm.$scopedSlots
  47857. );
  47858. }
  47859. // set parent vnode. this allows render functions to have access
  47860. // to the data on the placeholder node.
  47861. vm.$vnode = _parentVnode;
  47862. // render self
  47863. var vnode;
  47864. try {
  47865. // There's no need to maintain a stack because all render fns are called
  47866. // separately from one another. Nested component's render fns are called
  47867. // when parent component is patched.
  47868. currentRenderingInstance = vm;
  47869. vnode = render.call(vm._renderProxy, vm.$createElement);
  47870. } catch (e) {
  47871. handleError(e, vm, "render");
  47872. // return error render result,
  47873. // or previous vnode to prevent render error causing blank component
  47874. /* istanbul ignore else */
  47875. if (vm.$options.renderError) {
  47876. try {
  47877. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47878. } catch (e) {
  47879. handleError(e, vm, "renderError");
  47880. vnode = vm._vnode;
  47881. }
  47882. } else {
  47883. vnode = vm._vnode;
  47884. }
  47885. } finally {
  47886. currentRenderingInstance = null;
  47887. }
  47888. // if the returned array contains only a single node, allow it
  47889. if (Array.isArray(vnode) && vnode.length === 1) {
  47890. vnode = vnode[0];
  47891. }
  47892. // return empty vnode in case the render function errored out
  47893. if (!(vnode instanceof VNode)) {
  47894. if (Array.isArray(vnode)) {
  47895. warn(
  47896. 'Multiple root nodes returned from render function. Render function ' +
  47897. 'should return a single root node.',
  47898. vm
  47899. );
  47900. }
  47901. vnode = createEmptyVNode();
  47902. }
  47903. // set parent
  47904. vnode.parent = _parentVnode;
  47905. return vnode
  47906. };
  47907. }
  47908. /* */
  47909. function ensureCtor (comp, base) {
  47910. if (
  47911. comp.__esModule ||
  47912. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47913. ) {
  47914. comp = comp.default;
  47915. }
  47916. return isObject(comp)
  47917. ? base.extend(comp)
  47918. : comp
  47919. }
  47920. function createAsyncPlaceholder (
  47921. factory,
  47922. data,
  47923. context,
  47924. children,
  47925. tag
  47926. ) {
  47927. var node = createEmptyVNode();
  47928. node.asyncFactory = factory;
  47929. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47930. return node
  47931. }
  47932. function resolveAsyncComponent (
  47933. factory,
  47934. baseCtor
  47935. ) {
  47936. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47937. return factory.errorComp
  47938. }
  47939. if (isDef(factory.resolved)) {
  47940. return factory.resolved
  47941. }
  47942. var owner = currentRenderingInstance;
  47943. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47944. // already pending
  47945. factory.owners.push(owner);
  47946. }
  47947. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47948. return factory.loadingComp
  47949. }
  47950. if (owner && !isDef(factory.owners)) {
  47951. var owners = factory.owners = [owner];
  47952. var sync = true;
  47953. var timerLoading = null;
  47954. var timerTimeout = null
  47955. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47956. var forceRender = function (renderCompleted) {
  47957. for (var i = 0, l = owners.length; i < l; i++) {
  47958. (owners[i]).$forceUpdate();
  47959. }
  47960. if (renderCompleted) {
  47961. owners.length = 0;
  47962. if (timerLoading !== null) {
  47963. clearTimeout(timerLoading);
  47964. timerLoading = null;
  47965. }
  47966. if (timerTimeout !== null) {
  47967. clearTimeout(timerTimeout);
  47968. timerTimeout = null;
  47969. }
  47970. }
  47971. };
  47972. var resolve = once(function (res) {
  47973. // cache resolved
  47974. factory.resolved = ensureCtor(res, baseCtor);
  47975. // invoke callbacks only if this is not a synchronous resolve
  47976. // (async resolves are shimmed as synchronous during SSR)
  47977. if (!sync) {
  47978. forceRender(true);
  47979. } else {
  47980. owners.length = 0;
  47981. }
  47982. });
  47983. var reject = once(function (reason) {
  47984. warn(
  47985. "Failed to resolve async component: " + (String(factory)) +
  47986. (reason ? ("\nReason: " + reason) : '')
  47987. );
  47988. if (isDef(factory.errorComp)) {
  47989. factory.error = true;
  47990. forceRender(true);
  47991. }
  47992. });
  47993. var res = factory(resolve, reject);
  47994. if (isObject(res)) {
  47995. if (isPromise(res)) {
  47996. // () => Promise
  47997. if (isUndef(factory.resolved)) {
  47998. res.then(resolve, reject);
  47999. }
  48000. } else if (isPromise(res.component)) {
  48001. res.component.then(resolve, reject);
  48002. if (isDef(res.error)) {
  48003. factory.errorComp = ensureCtor(res.error, baseCtor);
  48004. }
  48005. if (isDef(res.loading)) {
  48006. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48007. if (res.delay === 0) {
  48008. factory.loading = true;
  48009. } else {
  48010. timerLoading = setTimeout(function () {
  48011. timerLoading = null;
  48012. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48013. factory.loading = true;
  48014. forceRender(false);
  48015. }
  48016. }, res.delay || 200);
  48017. }
  48018. }
  48019. if (isDef(res.timeout)) {
  48020. timerTimeout = setTimeout(function () {
  48021. timerTimeout = null;
  48022. if (isUndef(factory.resolved)) {
  48023. reject(
  48024. "timeout (" + (res.timeout) + "ms)"
  48025. );
  48026. }
  48027. }, res.timeout);
  48028. }
  48029. }
  48030. }
  48031. sync = false;
  48032. // return in case resolved synchronously
  48033. return factory.loading
  48034. ? factory.loadingComp
  48035. : factory.resolved
  48036. }
  48037. }
  48038. /* */
  48039. function isAsyncPlaceholder (node) {
  48040. return node.isComment && node.asyncFactory
  48041. }
  48042. /* */
  48043. function getFirstComponentChild (children) {
  48044. if (Array.isArray(children)) {
  48045. for (var i = 0; i < children.length; i++) {
  48046. var c = children[i];
  48047. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48048. return c
  48049. }
  48050. }
  48051. }
  48052. }
  48053. /* */
  48054. /* */
  48055. function initEvents (vm) {
  48056. vm._events = Object.create(null);
  48057. vm._hasHookEvent = false;
  48058. // init parent attached events
  48059. var listeners = vm.$options._parentListeners;
  48060. if (listeners) {
  48061. updateComponentListeners(vm, listeners);
  48062. }
  48063. }
  48064. var target;
  48065. function add (event, fn) {
  48066. target.$on(event, fn);
  48067. }
  48068. function remove$1 (event, fn) {
  48069. target.$off(event, fn);
  48070. }
  48071. function createOnceHandler (event, fn) {
  48072. var _target = target;
  48073. return function onceHandler () {
  48074. var res = fn.apply(null, arguments);
  48075. if (res !== null) {
  48076. _target.$off(event, onceHandler);
  48077. }
  48078. }
  48079. }
  48080. function updateComponentListeners (
  48081. vm,
  48082. listeners,
  48083. oldListeners
  48084. ) {
  48085. target = vm;
  48086. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48087. target = undefined;
  48088. }
  48089. function eventsMixin (Vue) {
  48090. var hookRE = /^hook:/;
  48091. Vue.prototype.$on = function (event, fn) {
  48092. var vm = this;
  48093. if (Array.isArray(event)) {
  48094. for (var i = 0, l = event.length; i < l; i++) {
  48095. vm.$on(event[i], fn);
  48096. }
  48097. } else {
  48098. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48099. // optimize hook:event cost by using a boolean flag marked at registration
  48100. // instead of a hash lookup
  48101. if (hookRE.test(event)) {
  48102. vm._hasHookEvent = true;
  48103. }
  48104. }
  48105. return vm
  48106. };
  48107. Vue.prototype.$once = function (event, fn) {
  48108. var vm = this;
  48109. function on () {
  48110. vm.$off(event, on);
  48111. fn.apply(vm, arguments);
  48112. }
  48113. on.fn = fn;
  48114. vm.$on(event, on);
  48115. return vm
  48116. };
  48117. Vue.prototype.$off = function (event, fn) {
  48118. var vm = this;
  48119. // all
  48120. if (!arguments.length) {
  48121. vm._events = Object.create(null);
  48122. return vm
  48123. }
  48124. // array of events
  48125. if (Array.isArray(event)) {
  48126. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48127. vm.$off(event[i$1], fn);
  48128. }
  48129. return vm
  48130. }
  48131. // specific event
  48132. var cbs = vm._events[event];
  48133. if (!cbs) {
  48134. return vm
  48135. }
  48136. if (!fn) {
  48137. vm._events[event] = null;
  48138. return vm
  48139. }
  48140. // specific handler
  48141. var cb;
  48142. var i = cbs.length;
  48143. while (i--) {
  48144. cb = cbs[i];
  48145. if (cb === fn || cb.fn === fn) {
  48146. cbs.splice(i, 1);
  48147. break
  48148. }
  48149. }
  48150. return vm
  48151. };
  48152. Vue.prototype.$emit = function (event) {
  48153. var vm = this;
  48154. {
  48155. var lowerCaseEvent = event.toLowerCase();
  48156. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48157. tip(
  48158. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48159. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48160. "Note that HTML attributes are case-insensitive and you cannot use " +
  48161. "v-on to listen to camelCase events when using in-DOM templates. " +
  48162. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48163. );
  48164. }
  48165. }
  48166. var cbs = vm._events[event];
  48167. if (cbs) {
  48168. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48169. var args = toArray(arguments, 1);
  48170. var info = "event handler for \"" + event + "\"";
  48171. for (var i = 0, l = cbs.length; i < l; i++) {
  48172. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48173. }
  48174. }
  48175. return vm
  48176. };
  48177. }
  48178. /* */
  48179. var activeInstance = null;
  48180. var isUpdatingChildComponent = false;
  48181. function setActiveInstance(vm) {
  48182. var prevActiveInstance = activeInstance;
  48183. activeInstance = vm;
  48184. return function () {
  48185. activeInstance = prevActiveInstance;
  48186. }
  48187. }
  48188. function initLifecycle (vm) {
  48189. var options = vm.$options;
  48190. // locate first non-abstract parent
  48191. var parent = options.parent;
  48192. if (parent && !options.abstract) {
  48193. while (parent.$options.abstract && parent.$parent) {
  48194. parent = parent.$parent;
  48195. }
  48196. parent.$children.push(vm);
  48197. }
  48198. vm.$parent = parent;
  48199. vm.$root = parent ? parent.$root : vm;
  48200. vm.$children = [];
  48201. vm.$refs = {};
  48202. vm._watcher = null;
  48203. vm._inactive = null;
  48204. vm._directInactive = false;
  48205. vm._isMounted = false;
  48206. vm._isDestroyed = false;
  48207. vm._isBeingDestroyed = false;
  48208. }
  48209. function lifecycleMixin (Vue) {
  48210. Vue.prototype._update = function (vnode, hydrating) {
  48211. var vm = this;
  48212. var prevEl = vm.$el;
  48213. var prevVnode = vm._vnode;
  48214. var restoreActiveInstance = setActiveInstance(vm);
  48215. vm._vnode = vnode;
  48216. // Vue.prototype.__patch__ is injected in entry points
  48217. // based on the rendering backend used.
  48218. if (!prevVnode) {
  48219. // initial render
  48220. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48221. } else {
  48222. // updates
  48223. vm.$el = vm.__patch__(prevVnode, vnode);
  48224. }
  48225. restoreActiveInstance();
  48226. // update __vue__ reference
  48227. if (prevEl) {
  48228. prevEl.__vue__ = null;
  48229. }
  48230. if (vm.$el) {
  48231. vm.$el.__vue__ = vm;
  48232. }
  48233. // if parent is an HOC, update its $el as well
  48234. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48235. vm.$parent.$el = vm.$el;
  48236. }
  48237. // updated hook is called by the scheduler to ensure that children are
  48238. // updated in a parent's updated hook.
  48239. };
  48240. Vue.prototype.$forceUpdate = function () {
  48241. var vm = this;
  48242. if (vm._watcher) {
  48243. vm._watcher.update();
  48244. }
  48245. };
  48246. Vue.prototype.$destroy = function () {
  48247. var vm = this;
  48248. if (vm._isBeingDestroyed) {
  48249. return
  48250. }
  48251. callHook(vm, 'beforeDestroy');
  48252. vm._isBeingDestroyed = true;
  48253. // remove self from parent
  48254. var parent = vm.$parent;
  48255. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48256. remove(parent.$children, vm);
  48257. }
  48258. // teardown watchers
  48259. if (vm._watcher) {
  48260. vm._watcher.teardown();
  48261. }
  48262. var i = vm._watchers.length;
  48263. while (i--) {
  48264. vm._watchers[i].teardown();
  48265. }
  48266. // remove reference from data ob
  48267. // frozen object may not have observer.
  48268. if (vm._data.__ob__) {
  48269. vm._data.__ob__.vmCount--;
  48270. }
  48271. // call the last hook...
  48272. vm._isDestroyed = true;
  48273. // invoke destroy hooks on current rendered tree
  48274. vm.__patch__(vm._vnode, null);
  48275. // fire destroyed hook
  48276. callHook(vm, 'destroyed');
  48277. // turn off all instance listeners.
  48278. vm.$off();
  48279. // remove __vue__ reference
  48280. if (vm.$el) {
  48281. vm.$el.__vue__ = null;
  48282. }
  48283. // release circular reference (#6759)
  48284. if (vm.$vnode) {
  48285. vm.$vnode.parent = null;
  48286. }
  48287. };
  48288. }
  48289. function mountComponent (
  48290. vm,
  48291. el,
  48292. hydrating
  48293. ) {
  48294. vm.$el = el;
  48295. if (!vm.$options.render) {
  48296. vm.$options.render = createEmptyVNode;
  48297. {
  48298. /* istanbul ignore if */
  48299. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48300. vm.$options.el || el) {
  48301. warn(
  48302. 'You are using the runtime-only build of Vue where the template ' +
  48303. 'compiler is not available. Either pre-compile the templates into ' +
  48304. 'render functions, or use the compiler-included build.',
  48305. vm
  48306. );
  48307. } else {
  48308. warn(
  48309. 'Failed to mount component: template or render function not defined.',
  48310. vm
  48311. );
  48312. }
  48313. }
  48314. }
  48315. callHook(vm, 'beforeMount');
  48316. var updateComponent;
  48317. /* istanbul ignore if */
  48318. if (config.performance && mark) {
  48319. updateComponent = function () {
  48320. var name = vm._name;
  48321. var id = vm._uid;
  48322. var startTag = "vue-perf-start:" + id;
  48323. var endTag = "vue-perf-end:" + id;
  48324. mark(startTag);
  48325. var vnode = vm._render();
  48326. mark(endTag);
  48327. measure(("vue " + name + " render"), startTag, endTag);
  48328. mark(startTag);
  48329. vm._update(vnode, hydrating);
  48330. mark(endTag);
  48331. measure(("vue " + name + " patch"), startTag, endTag);
  48332. };
  48333. } else {
  48334. updateComponent = function () {
  48335. vm._update(vm._render(), hydrating);
  48336. };
  48337. }
  48338. // we set this to vm._watcher inside the watcher's constructor
  48339. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48340. // component's mounted hook), which relies on vm._watcher being already defined
  48341. new Watcher(vm, updateComponent, noop, {
  48342. before: function before () {
  48343. if (vm._isMounted && !vm._isDestroyed) {
  48344. callHook(vm, 'beforeUpdate');
  48345. }
  48346. }
  48347. }, true /* isRenderWatcher */);
  48348. hydrating = false;
  48349. // manually mounted instance, call mounted on self
  48350. // mounted is called for render-created child components in its inserted hook
  48351. if (vm.$vnode == null) {
  48352. vm._isMounted = true;
  48353. callHook(vm, 'mounted');
  48354. }
  48355. return vm
  48356. }
  48357. function updateChildComponent (
  48358. vm,
  48359. propsData,
  48360. listeners,
  48361. parentVnode,
  48362. renderChildren
  48363. ) {
  48364. {
  48365. isUpdatingChildComponent = true;
  48366. }
  48367. // determine whether component has slot children
  48368. // we need to do this before overwriting $options._renderChildren.
  48369. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48370. // dynamic slot names). Static scoped slots compiled from template has the
  48371. // "$stable" marker.
  48372. var newScopedSlots = parentVnode.data.scopedSlots;
  48373. var oldScopedSlots = vm.$scopedSlots;
  48374. var hasDynamicScopedSlot = !!(
  48375. (newScopedSlots && !newScopedSlots.$stable) ||
  48376. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48377. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48378. );
  48379. // Any static slot children from the parent may have changed during parent's
  48380. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48381. // update is necessary to ensure correctness.
  48382. var needsForceUpdate = !!(
  48383. renderChildren || // has new static slots
  48384. vm.$options._renderChildren || // has old static slots
  48385. hasDynamicScopedSlot
  48386. );
  48387. vm.$options._parentVnode = parentVnode;
  48388. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48389. if (vm._vnode) { // update child tree's parent
  48390. vm._vnode.parent = parentVnode;
  48391. }
  48392. vm.$options._renderChildren = renderChildren;
  48393. // update $attrs and $listeners hash
  48394. // these are also reactive so they may trigger child update if the child
  48395. // used them during render
  48396. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48397. vm.$listeners = listeners || emptyObject;
  48398. // update props
  48399. if (propsData && vm.$options.props) {
  48400. toggleObserving(false);
  48401. var props = vm._props;
  48402. var propKeys = vm.$options._propKeys || [];
  48403. for (var i = 0; i < propKeys.length; i++) {
  48404. var key = propKeys[i];
  48405. var propOptions = vm.$options.props; // wtf flow?
  48406. props[key] = validateProp(key, propOptions, propsData, vm);
  48407. }
  48408. toggleObserving(true);
  48409. // keep a copy of raw propsData
  48410. vm.$options.propsData = propsData;
  48411. }
  48412. // update listeners
  48413. listeners = listeners || emptyObject;
  48414. var oldListeners = vm.$options._parentListeners;
  48415. vm.$options._parentListeners = listeners;
  48416. updateComponentListeners(vm, listeners, oldListeners);
  48417. // resolve slots + force update if has children
  48418. if (needsForceUpdate) {
  48419. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48420. vm.$forceUpdate();
  48421. }
  48422. {
  48423. isUpdatingChildComponent = false;
  48424. }
  48425. }
  48426. function isInInactiveTree (vm) {
  48427. while (vm && (vm = vm.$parent)) {
  48428. if (vm._inactive) { return true }
  48429. }
  48430. return false
  48431. }
  48432. function activateChildComponent (vm, direct) {
  48433. if (direct) {
  48434. vm._directInactive = false;
  48435. if (isInInactiveTree(vm)) {
  48436. return
  48437. }
  48438. } else if (vm._directInactive) {
  48439. return
  48440. }
  48441. if (vm._inactive || vm._inactive === null) {
  48442. vm._inactive = false;
  48443. for (var i = 0; i < vm.$children.length; i++) {
  48444. activateChildComponent(vm.$children[i]);
  48445. }
  48446. callHook(vm, 'activated');
  48447. }
  48448. }
  48449. function deactivateChildComponent (vm, direct) {
  48450. if (direct) {
  48451. vm._directInactive = true;
  48452. if (isInInactiveTree(vm)) {
  48453. return
  48454. }
  48455. }
  48456. if (!vm._inactive) {
  48457. vm._inactive = true;
  48458. for (var i = 0; i < vm.$children.length; i++) {
  48459. deactivateChildComponent(vm.$children[i]);
  48460. }
  48461. callHook(vm, 'deactivated');
  48462. }
  48463. }
  48464. function callHook (vm, hook) {
  48465. // #7573 disable dep collection when invoking lifecycle hooks
  48466. pushTarget();
  48467. var handlers = vm.$options[hook];
  48468. var info = hook + " hook";
  48469. if (handlers) {
  48470. for (var i = 0, j = handlers.length; i < j; i++) {
  48471. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48472. }
  48473. }
  48474. if (vm._hasHookEvent) {
  48475. vm.$emit('hook:' + hook);
  48476. }
  48477. popTarget();
  48478. }
  48479. /* */
  48480. var MAX_UPDATE_COUNT = 100;
  48481. var queue = [];
  48482. var activatedChildren = [];
  48483. var has = {};
  48484. var circular = {};
  48485. var waiting = false;
  48486. var flushing = false;
  48487. var index = 0;
  48488. /**
  48489. * Reset the scheduler's state.
  48490. */
  48491. function resetSchedulerState () {
  48492. index = queue.length = activatedChildren.length = 0;
  48493. has = {};
  48494. {
  48495. circular = {};
  48496. }
  48497. waiting = flushing = false;
  48498. }
  48499. // Async edge case #6566 requires saving the timestamp when event listeners are
  48500. // attached. However, calling performance.now() has a perf overhead especially
  48501. // if the page has thousands of event listeners. Instead, we take a timestamp
  48502. // every time the scheduler flushes and use that for all event listeners
  48503. // attached during that flush.
  48504. var currentFlushTimestamp = 0;
  48505. // Async edge case fix requires storing an event listener's attach timestamp.
  48506. var getNow = Date.now;
  48507. // Determine what event timestamp the browser is using. Annoyingly, the
  48508. // timestamp can either be hi-res (relative to page load) or low-res
  48509. // (relative to UNIX epoch), so in order to compare time we have to use the
  48510. // same timestamp type when saving the flush timestamp.
  48511. // All IE versions use low-res event timestamps, and have problematic clock
  48512. // implementations (#9632)
  48513. if (inBrowser && !isIE) {
  48514. var performance = window.performance;
  48515. if (
  48516. performance &&
  48517. typeof performance.now === 'function' &&
  48518. getNow() > document.createEvent('Event').timeStamp
  48519. ) {
  48520. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48521. // smaller than it, it means the event is using a hi-res timestamp,
  48522. // and we need to use the hi-res version for event listener timestamps as
  48523. // well.
  48524. getNow = function () { return performance.now(); };
  48525. }
  48526. }
  48527. /**
  48528. * Flush both queues and run the watchers.
  48529. */
  48530. function flushSchedulerQueue () {
  48531. currentFlushTimestamp = getNow();
  48532. flushing = true;
  48533. var watcher, id;
  48534. // Sort queue before flush.
  48535. // This ensures that:
  48536. // 1. Components are updated from parent to child. (because parent is always
  48537. // created before the child)
  48538. // 2. A component's user watchers are run before its render watcher (because
  48539. // user watchers are created before the render watcher)
  48540. // 3. If a component is destroyed during a parent component's watcher run,
  48541. // its watchers can be skipped.
  48542. queue.sort(function (a, b) { return a.id - b.id; });
  48543. // do not cache length because more watchers might be pushed
  48544. // as we run existing watchers
  48545. for (index = 0; index < queue.length; index++) {
  48546. watcher = queue[index];
  48547. if (watcher.before) {
  48548. watcher.before();
  48549. }
  48550. id = watcher.id;
  48551. has[id] = null;
  48552. watcher.run();
  48553. // in dev build, check and stop circular updates.
  48554. if (has[id] != null) {
  48555. circular[id] = (circular[id] || 0) + 1;
  48556. if (circular[id] > MAX_UPDATE_COUNT) {
  48557. warn(
  48558. 'You may have an infinite update loop ' + (
  48559. watcher.user
  48560. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48561. : "in a component render function."
  48562. ),
  48563. watcher.vm
  48564. );
  48565. break
  48566. }
  48567. }
  48568. }
  48569. // keep copies of post queues before resetting state
  48570. var activatedQueue = activatedChildren.slice();
  48571. var updatedQueue = queue.slice();
  48572. resetSchedulerState();
  48573. // call component updated and activated hooks
  48574. callActivatedHooks(activatedQueue);
  48575. callUpdatedHooks(updatedQueue);
  48576. // devtool hook
  48577. /* istanbul ignore if */
  48578. if (devtools && config.devtools) {
  48579. devtools.emit('flush');
  48580. }
  48581. }
  48582. function callUpdatedHooks (queue) {
  48583. var i = queue.length;
  48584. while (i--) {
  48585. var watcher = queue[i];
  48586. var vm = watcher.vm;
  48587. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48588. callHook(vm, 'updated');
  48589. }
  48590. }
  48591. }
  48592. /**
  48593. * Queue a kept-alive component that was activated during patch.
  48594. * The queue will be processed after the entire tree has been patched.
  48595. */
  48596. function queueActivatedComponent (vm) {
  48597. // setting _inactive to false here so that a render function can
  48598. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48599. vm._inactive = false;
  48600. activatedChildren.push(vm);
  48601. }
  48602. function callActivatedHooks (queue) {
  48603. for (var i = 0; i < queue.length; i++) {
  48604. queue[i]._inactive = true;
  48605. activateChildComponent(queue[i], true /* true */);
  48606. }
  48607. }
  48608. /**
  48609. * Push a watcher into the watcher queue.
  48610. * Jobs with duplicate IDs will be skipped unless it's
  48611. * pushed when the queue is being flushed.
  48612. */
  48613. function queueWatcher (watcher) {
  48614. var id = watcher.id;
  48615. if (has[id] == null) {
  48616. has[id] = true;
  48617. if (!flushing) {
  48618. queue.push(watcher);
  48619. } else {
  48620. // if already flushing, splice the watcher based on its id
  48621. // if already past its id, it will be run next immediately.
  48622. var i = queue.length - 1;
  48623. while (i > index && queue[i].id > watcher.id) {
  48624. i--;
  48625. }
  48626. queue.splice(i + 1, 0, watcher);
  48627. }
  48628. // queue the flush
  48629. if (!waiting) {
  48630. waiting = true;
  48631. if (!config.async) {
  48632. flushSchedulerQueue();
  48633. return
  48634. }
  48635. nextTick(flushSchedulerQueue);
  48636. }
  48637. }
  48638. }
  48639. /* */
  48640. var uid$2 = 0;
  48641. /**
  48642. * A watcher parses an expression, collects dependencies,
  48643. * and fires callback when the expression value changes.
  48644. * This is used for both the $watch() api and directives.
  48645. */
  48646. var Watcher = function Watcher (
  48647. vm,
  48648. expOrFn,
  48649. cb,
  48650. options,
  48651. isRenderWatcher
  48652. ) {
  48653. this.vm = vm;
  48654. if (isRenderWatcher) {
  48655. vm._watcher = this;
  48656. }
  48657. vm._watchers.push(this);
  48658. // options
  48659. if (options) {
  48660. this.deep = !!options.deep;
  48661. this.user = !!options.user;
  48662. this.lazy = !!options.lazy;
  48663. this.sync = !!options.sync;
  48664. this.before = options.before;
  48665. } else {
  48666. this.deep = this.user = this.lazy = this.sync = false;
  48667. }
  48668. this.cb = cb;
  48669. this.id = ++uid$2; // uid for batching
  48670. this.active = true;
  48671. this.dirty = this.lazy; // for lazy watchers
  48672. this.deps = [];
  48673. this.newDeps = [];
  48674. this.depIds = new _Set();
  48675. this.newDepIds = new _Set();
  48676. this.expression = expOrFn.toString();
  48677. // parse expression for getter
  48678. if (typeof expOrFn === 'function') {
  48679. this.getter = expOrFn;
  48680. } else {
  48681. this.getter = parsePath(expOrFn);
  48682. if (!this.getter) {
  48683. this.getter = noop;
  48684. warn(
  48685. "Failed watching path: \"" + expOrFn + "\" " +
  48686. 'Watcher only accepts simple dot-delimited paths. ' +
  48687. 'For full control, use a function instead.',
  48688. vm
  48689. );
  48690. }
  48691. }
  48692. this.value = this.lazy
  48693. ? undefined
  48694. : this.get();
  48695. };
  48696. /**
  48697. * Evaluate the getter, and re-collect dependencies.
  48698. */
  48699. Watcher.prototype.get = function get () {
  48700. pushTarget(this);
  48701. var value;
  48702. var vm = this.vm;
  48703. try {
  48704. value = this.getter.call(vm, vm);
  48705. } catch (e) {
  48706. if (this.user) {
  48707. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48708. } else {
  48709. throw e
  48710. }
  48711. } finally {
  48712. // "touch" every property so they are all tracked as
  48713. // dependencies for deep watching
  48714. if (this.deep) {
  48715. traverse(value);
  48716. }
  48717. popTarget();
  48718. this.cleanupDeps();
  48719. }
  48720. return value
  48721. };
  48722. /**
  48723. * Add a dependency to this directive.
  48724. */
  48725. Watcher.prototype.addDep = function addDep (dep) {
  48726. var id = dep.id;
  48727. if (!this.newDepIds.has(id)) {
  48728. this.newDepIds.add(id);
  48729. this.newDeps.push(dep);
  48730. if (!this.depIds.has(id)) {
  48731. dep.addSub(this);
  48732. }
  48733. }
  48734. };
  48735. /**
  48736. * Clean up for dependency collection.
  48737. */
  48738. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48739. var i = this.deps.length;
  48740. while (i--) {
  48741. var dep = this.deps[i];
  48742. if (!this.newDepIds.has(dep.id)) {
  48743. dep.removeSub(this);
  48744. }
  48745. }
  48746. var tmp = this.depIds;
  48747. this.depIds = this.newDepIds;
  48748. this.newDepIds = tmp;
  48749. this.newDepIds.clear();
  48750. tmp = this.deps;
  48751. this.deps = this.newDeps;
  48752. this.newDeps = tmp;
  48753. this.newDeps.length = 0;
  48754. };
  48755. /**
  48756. * Subscriber interface.
  48757. * Will be called when a dependency changes.
  48758. */
  48759. Watcher.prototype.update = function update () {
  48760. /* istanbul ignore else */
  48761. if (this.lazy) {
  48762. this.dirty = true;
  48763. } else if (this.sync) {
  48764. this.run();
  48765. } else {
  48766. queueWatcher(this);
  48767. }
  48768. };
  48769. /**
  48770. * Scheduler job interface.
  48771. * Will be called by the scheduler.
  48772. */
  48773. Watcher.prototype.run = function run () {
  48774. if (this.active) {
  48775. var value = this.get();
  48776. if (
  48777. value !== this.value ||
  48778. // Deep watchers and watchers on Object/Arrays should fire even
  48779. // when the value is the same, because the value may
  48780. // have mutated.
  48781. isObject(value) ||
  48782. this.deep
  48783. ) {
  48784. // set new value
  48785. var oldValue = this.value;
  48786. this.value = value;
  48787. if (this.user) {
  48788. try {
  48789. this.cb.call(this.vm, value, oldValue);
  48790. } catch (e) {
  48791. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48792. }
  48793. } else {
  48794. this.cb.call(this.vm, value, oldValue);
  48795. }
  48796. }
  48797. }
  48798. };
  48799. /**
  48800. * Evaluate the value of the watcher.
  48801. * This only gets called for lazy watchers.
  48802. */
  48803. Watcher.prototype.evaluate = function evaluate () {
  48804. this.value = this.get();
  48805. this.dirty = false;
  48806. };
  48807. /**
  48808. * Depend on all deps collected by this watcher.
  48809. */
  48810. Watcher.prototype.depend = function depend () {
  48811. var i = this.deps.length;
  48812. while (i--) {
  48813. this.deps[i].depend();
  48814. }
  48815. };
  48816. /**
  48817. * Remove self from all dependencies' subscriber list.
  48818. */
  48819. Watcher.prototype.teardown = function teardown () {
  48820. if (this.active) {
  48821. // remove self from vm's watcher list
  48822. // this is a somewhat expensive operation so we skip it
  48823. // if the vm is being destroyed.
  48824. if (!this.vm._isBeingDestroyed) {
  48825. remove(this.vm._watchers, this);
  48826. }
  48827. var i = this.deps.length;
  48828. while (i--) {
  48829. this.deps[i].removeSub(this);
  48830. }
  48831. this.active = false;
  48832. }
  48833. };
  48834. /* */
  48835. var sharedPropertyDefinition = {
  48836. enumerable: true,
  48837. configurable: true,
  48838. get: noop,
  48839. set: noop
  48840. };
  48841. function proxy (target, sourceKey, key) {
  48842. sharedPropertyDefinition.get = function proxyGetter () {
  48843. return this[sourceKey][key]
  48844. };
  48845. sharedPropertyDefinition.set = function proxySetter (val) {
  48846. this[sourceKey][key] = val;
  48847. };
  48848. Object.defineProperty(target, key, sharedPropertyDefinition);
  48849. }
  48850. function initState (vm) {
  48851. vm._watchers = [];
  48852. var opts = vm.$options;
  48853. if (opts.props) { initProps(vm, opts.props); }
  48854. if (opts.methods) { initMethods(vm, opts.methods); }
  48855. if (opts.data) {
  48856. initData(vm);
  48857. } else {
  48858. observe(vm._data = {}, true /* asRootData */);
  48859. }
  48860. if (opts.computed) { initComputed(vm, opts.computed); }
  48861. if (opts.watch && opts.watch !== nativeWatch) {
  48862. initWatch(vm, opts.watch);
  48863. }
  48864. }
  48865. function initProps (vm, propsOptions) {
  48866. var propsData = vm.$options.propsData || {};
  48867. var props = vm._props = {};
  48868. // cache prop keys so that future props updates can iterate using Array
  48869. // instead of dynamic object key enumeration.
  48870. var keys = vm.$options._propKeys = [];
  48871. var isRoot = !vm.$parent;
  48872. // root instance props should be converted
  48873. if (!isRoot) {
  48874. toggleObserving(false);
  48875. }
  48876. var loop = function ( key ) {
  48877. keys.push(key);
  48878. var value = validateProp(key, propsOptions, propsData, vm);
  48879. /* istanbul ignore else */
  48880. {
  48881. var hyphenatedKey = hyphenate(key);
  48882. if (isReservedAttribute(hyphenatedKey) ||
  48883. config.isReservedAttr(hyphenatedKey)) {
  48884. warn(
  48885. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48886. vm
  48887. );
  48888. }
  48889. defineReactive$$1(props, key, value, function () {
  48890. if (!isRoot && !isUpdatingChildComponent) {
  48891. warn(
  48892. "Avoid mutating a prop directly since the value will be " +
  48893. "overwritten whenever the parent component re-renders. " +
  48894. "Instead, use a data or computed property based on the prop's " +
  48895. "value. Prop being mutated: \"" + key + "\"",
  48896. vm
  48897. );
  48898. }
  48899. });
  48900. }
  48901. // static props are already proxied on the component's prototype
  48902. // during Vue.extend(). We only need to proxy props defined at
  48903. // instantiation here.
  48904. if (!(key in vm)) {
  48905. proxy(vm, "_props", key);
  48906. }
  48907. };
  48908. for (var key in propsOptions) loop( key );
  48909. toggleObserving(true);
  48910. }
  48911. function initData (vm) {
  48912. var data = vm.$options.data;
  48913. data = vm._data = typeof data === 'function'
  48914. ? getData(data, vm)
  48915. : data || {};
  48916. if (!isPlainObject(data)) {
  48917. data = {};
  48918. warn(
  48919. 'data functions should return an object:\n' +
  48920. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48921. vm
  48922. );
  48923. }
  48924. // proxy data on instance
  48925. var keys = Object.keys(data);
  48926. var props = vm.$options.props;
  48927. var methods = vm.$options.methods;
  48928. var i = keys.length;
  48929. while (i--) {
  48930. var key = keys[i];
  48931. {
  48932. if (methods && hasOwn(methods, key)) {
  48933. warn(
  48934. ("Method \"" + key + "\" has already been defined as a data property."),
  48935. vm
  48936. );
  48937. }
  48938. }
  48939. if (props && hasOwn(props, key)) {
  48940. warn(
  48941. "The data property \"" + key + "\" is already declared as a prop. " +
  48942. "Use prop default value instead.",
  48943. vm
  48944. );
  48945. } else if (!isReserved(key)) {
  48946. proxy(vm, "_data", key);
  48947. }
  48948. }
  48949. // observe data
  48950. observe(data, true /* asRootData */);
  48951. }
  48952. function getData (data, vm) {
  48953. // #7573 disable dep collection when invoking data getters
  48954. pushTarget();
  48955. try {
  48956. return data.call(vm, vm)
  48957. } catch (e) {
  48958. handleError(e, vm, "data()");
  48959. return {}
  48960. } finally {
  48961. popTarget();
  48962. }
  48963. }
  48964. var computedWatcherOptions = { lazy: true };
  48965. function initComputed (vm, computed) {
  48966. // $flow-disable-line
  48967. var watchers = vm._computedWatchers = Object.create(null);
  48968. // computed properties are just getters during SSR
  48969. var isSSR = isServerRendering();
  48970. for (var key in computed) {
  48971. var userDef = computed[key];
  48972. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48973. if (getter == null) {
  48974. warn(
  48975. ("Getter is missing for computed property \"" + key + "\"."),
  48976. vm
  48977. );
  48978. }
  48979. if (!isSSR) {
  48980. // create internal watcher for the computed property.
  48981. watchers[key] = new Watcher(
  48982. vm,
  48983. getter || noop,
  48984. noop,
  48985. computedWatcherOptions
  48986. );
  48987. }
  48988. // component-defined computed properties are already defined on the
  48989. // component prototype. We only need to define computed properties defined
  48990. // at instantiation here.
  48991. if (!(key in vm)) {
  48992. defineComputed(vm, key, userDef);
  48993. } else {
  48994. if (key in vm.$data) {
  48995. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48996. } else if (vm.$options.props && key in vm.$options.props) {
  48997. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48998. }
  48999. }
  49000. }
  49001. }
  49002. function defineComputed (
  49003. target,
  49004. key,
  49005. userDef
  49006. ) {
  49007. var shouldCache = !isServerRendering();
  49008. if (typeof userDef === 'function') {
  49009. sharedPropertyDefinition.get = shouldCache
  49010. ? createComputedGetter(key)
  49011. : createGetterInvoker(userDef);
  49012. sharedPropertyDefinition.set = noop;
  49013. } else {
  49014. sharedPropertyDefinition.get = userDef.get
  49015. ? shouldCache && userDef.cache !== false
  49016. ? createComputedGetter(key)
  49017. : createGetterInvoker(userDef.get)
  49018. : noop;
  49019. sharedPropertyDefinition.set = userDef.set || noop;
  49020. }
  49021. if (sharedPropertyDefinition.set === noop) {
  49022. sharedPropertyDefinition.set = function () {
  49023. warn(
  49024. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49025. this
  49026. );
  49027. };
  49028. }
  49029. Object.defineProperty(target, key, sharedPropertyDefinition);
  49030. }
  49031. function createComputedGetter (key) {
  49032. return function computedGetter () {
  49033. var watcher = this._computedWatchers && this._computedWatchers[key];
  49034. if (watcher) {
  49035. if (watcher.dirty) {
  49036. watcher.evaluate();
  49037. }
  49038. if (Dep.target) {
  49039. watcher.depend();
  49040. }
  49041. return watcher.value
  49042. }
  49043. }
  49044. }
  49045. function createGetterInvoker(fn) {
  49046. return function computedGetter () {
  49047. return fn.call(this, this)
  49048. }
  49049. }
  49050. function initMethods (vm, methods) {
  49051. var props = vm.$options.props;
  49052. for (var key in methods) {
  49053. {
  49054. if (typeof methods[key] !== 'function') {
  49055. warn(
  49056. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49057. "Did you reference the function correctly?",
  49058. vm
  49059. );
  49060. }
  49061. if (props && hasOwn(props, key)) {
  49062. warn(
  49063. ("Method \"" + key + "\" has already been defined as a prop."),
  49064. vm
  49065. );
  49066. }
  49067. if ((key in vm) && isReserved(key)) {
  49068. warn(
  49069. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49070. "Avoid defining component methods that start with _ or $."
  49071. );
  49072. }
  49073. }
  49074. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49075. }
  49076. }
  49077. function initWatch (vm, watch) {
  49078. for (var key in watch) {
  49079. var handler = watch[key];
  49080. if (Array.isArray(handler)) {
  49081. for (var i = 0; i < handler.length; i++) {
  49082. createWatcher(vm, key, handler[i]);
  49083. }
  49084. } else {
  49085. createWatcher(vm, key, handler);
  49086. }
  49087. }
  49088. }
  49089. function createWatcher (
  49090. vm,
  49091. expOrFn,
  49092. handler,
  49093. options
  49094. ) {
  49095. if (isPlainObject(handler)) {
  49096. options = handler;
  49097. handler = handler.handler;
  49098. }
  49099. if (typeof handler === 'string') {
  49100. handler = vm[handler];
  49101. }
  49102. return vm.$watch(expOrFn, handler, options)
  49103. }
  49104. function stateMixin (Vue) {
  49105. // flow somehow has problems with directly declared definition object
  49106. // when using Object.defineProperty, so we have to procedurally build up
  49107. // the object here.
  49108. var dataDef = {};
  49109. dataDef.get = function () { return this._data };
  49110. var propsDef = {};
  49111. propsDef.get = function () { return this._props };
  49112. {
  49113. dataDef.set = function () {
  49114. warn(
  49115. 'Avoid replacing instance root $data. ' +
  49116. 'Use nested data properties instead.',
  49117. this
  49118. );
  49119. };
  49120. propsDef.set = function () {
  49121. warn("$props is readonly.", this);
  49122. };
  49123. }
  49124. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49125. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49126. Vue.prototype.$set = set;
  49127. Vue.prototype.$delete = del;
  49128. Vue.prototype.$watch = function (
  49129. expOrFn,
  49130. cb,
  49131. options
  49132. ) {
  49133. var vm = this;
  49134. if (isPlainObject(cb)) {
  49135. return createWatcher(vm, expOrFn, cb, options)
  49136. }
  49137. options = options || {};
  49138. options.user = true;
  49139. var watcher = new Watcher(vm, expOrFn, cb, options);
  49140. if (options.immediate) {
  49141. try {
  49142. cb.call(vm, watcher.value);
  49143. } catch (error) {
  49144. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49145. }
  49146. }
  49147. return function unwatchFn () {
  49148. watcher.teardown();
  49149. }
  49150. };
  49151. }
  49152. /* */
  49153. var uid$3 = 0;
  49154. function initMixin (Vue) {
  49155. Vue.prototype._init = function (options) {
  49156. var vm = this;
  49157. // a uid
  49158. vm._uid = uid$3++;
  49159. var startTag, endTag;
  49160. /* istanbul ignore if */
  49161. if (config.performance && mark) {
  49162. startTag = "vue-perf-start:" + (vm._uid);
  49163. endTag = "vue-perf-end:" + (vm._uid);
  49164. mark(startTag);
  49165. }
  49166. // a flag to avoid this being observed
  49167. vm._isVue = true;
  49168. // merge options
  49169. if (options && options._isComponent) {
  49170. // optimize internal component instantiation
  49171. // since dynamic options merging is pretty slow, and none of the
  49172. // internal component options needs special treatment.
  49173. initInternalComponent(vm, options);
  49174. } else {
  49175. vm.$options = mergeOptions(
  49176. resolveConstructorOptions(vm.constructor),
  49177. options || {},
  49178. vm
  49179. );
  49180. }
  49181. /* istanbul ignore else */
  49182. {
  49183. initProxy(vm);
  49184. }
  49185. // expose real self
  49186. vm._self = vm;
  49187. initLifecycle(vm);
  49188. initEvents(vm);
  49189. initRender(vm);
  49190. callHook(vm, 'beforeCreate');
  49191. initInjections(vm); // resolve injections before data/props
  49192. initState(vm);
  49193. initProvide(vm); // resolve provide after data/props
  49194. callHook(vm, 'created');
  49195. /* istanbul ignore if */
  49196. if (config.performance && mark) {
  49197. vm._name = formatComponentName(vm, false);
  49198. mark(endTag);
  49199. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49200. }
  49201. if (vm.$options.el) {
  49202. vm.$mount(vm.$options.el);
  49203. }
  49204. };
  49205. }
  49206. function initInternalComponent (vm, options) {
  49207. var opts = vm.$options = Object.create(vm.constructor.options);
  49208. // doing this because it's faster than dynamic enumeration.
  49209. var parentVnode = options._parentVnode;
  49210. opts.parent = options.parent;
  49211. opts._parentVnode = parentVnode;
  49212. var vnodeComponentOptions = parentVnode.componentOptions;
  49213. opts.propsData = vnodeComponentOptions.propsData;
  49214. opts._parentListeners = vnodeComponentOptions.listeners;
  49215. opts._renderChildren = vnodeComponentOptions.children;
  49216. opts._componentTag = vnodeComponentOptions.tag;
  49217. if (options.render) {
  49218. opts.render = options.render;
  49219. opts.staticRenderFns = options.staticRenderFns;
  49220. }
  49221. }
  49222. function resolveConstructorOptions (Ctor) {
  49223. var options = Ctor.options;
  49224. if (Ctor.super) {
  49225. var superOptions = resolveConstructorOptions(Ctor.super);
  49226. var cachedSuperOptions = Ctor.superOptions;
  49227. if (superOptions !== cachedSuperOptions) {
  49228. // super option changed,
  49229. // need to resolve new options.
  49230. Ctor.superOptions = superOptions;
  49231. // check if there are any late-modified/attached options (#4976)
  49232. var modifiedOptions = resolveModifiedOptions(Ctor);
  49233. // update base extend options
  49234. if (modifiedOptions) {
  49235. extend(Ctor.extendOptions, modifiedOptions);
  49236. }
  49237. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49238. if (options.name) {
  49239. options.components[options.name] = Ctor;
  49240. }
  49241. }
  49242. }
  49243. return options
  49244. }
  49245. function resolveModifiedOptions (Ctor) {
  49246. var modified;
  49247. var latest = Ctor.options;
  49248. var sealed = Ctor.sealedOptions;
  49249. for (var key in latest) {
  49250. if (latest[key] !== sealed[key]) {
  49251. if (!modified) { modified = {}; }
  49252. modified[key] = latest[key];
  49253. }
  49254. }
  49255. return modified
  49256. }
  49257. function Vue (options) {
  49258. if (!(this instanceof Vue)
  49259. ) {
  49260. warn('Vue is a constructor and should be called with the `new` keyword');
  49261. }
  49262. this._init(options);
  49263. }
  49264. initMixin(Vue);
  49265. stateMixin(Vue);
  49266. eventsMixin(Vue);
  49267. lifecycleMixin(Vue);
  49268. renderMixin(Vue);
  49269. /* */
  49270. function initUse (Vue) {
  49271. Vue.use = function (plugin) {
  49272. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49273. if (installedPlugins.indexOf(plugin) > -1) {
  49274. return this
  49275. }
  49276. // additional parameters
  49277. var args = toArray(arguments, 1);
  49278. args.unshift(this);
  49279. if (typeof plugin.install === 'function') {
  49280. plugin.install.apply(plugin, args);
  49281. } else if (typeof plugin === 'function') {
  49282. plugin.apply(null, args);
  49283. }
  49284. installedPlugins.push(plugin);
  49285. return this
  49286. };
  49287. }
  49288. /* */
  49289. function initMixin$1 (Vue) {
  49290. Vue.mixin = function (mixin) {
  49291. this.options = mergeOptions(this.options, mixin);
  49292. return this
  49293. };
  49294. }
  49295. /* */
  49296. function initExtend (Vue) {
  49297. /**
  49298. * Each instance constructor, including Vue, has a unique
  49299. * cid. This enables us to create wrapped "child
  49300. * constructors" for prototypal inheritance and cache them.
  49301. */
  49302. Vue.cid = 0;
  49303. var cid = 1;
  49304. /**
  49305. * Class inheritance
  49306. */
  49307. Vue.extend = function (extendOptions) {
  49308. extendOptions = extendOptions || {};
  49309. var Super = this;
  49310. var SuperId = Super.cid;
  49311. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49312. if (cachedCtors[SuperId]) {
  49313. return cachedCtors[SuperId]
  49314. }
  49315. var name = extendOptions.name || Super.options.name;
  49316. if (name) {
  49317. validateComponentName(name);
  49318. }
  49319. var Sub = function VueComponent (options) {
  49320. this._init(options);
  49321. };
  49322. Sub.prototype = Object.create(Super.prototype);
  49323. Sub.prototype.constructor = Sub;
  49324. Sub.cid = cid++;
  49325. Sub.options = mergeOptions(
  49326. Super.options,
  49327. extendOptions
  49328. );
  49329. Sub['super'] = Super;
  49330. // For props and computed properties, we define the proxy getters on
  49331. // the Vue instances at extension time, on the extended prototype. This
  49332. // avoids Object.defineProperty calls for each instance created.
  49333. if (Sub.options.props) {
  49334. initProps$1(Sub);
  49335. }
  49336. if (Sub.options.computed) {
  49337. initComputed$1(Sub);
  49338. }
  49339. // allow further extension/mixin/plugin usage
  49340. Sub.extend = Super.extend;
  49341. Sub.mixin = Super.mixin;
  49342. Sub.use = Super.use;
  49343. // create asset registers, so extended classes
  49344. // can have their private assets too.
  49345. ASSET_TYPES.forEach(function (type) {
  49346. Sub[type] = Super[type];
  49347. });
  49348. // enable recursive self-lookup
  49349. if (name) {
  49350. Sub.options.components[name] = Sub;
  49351. }
  49352. // keep a reference to the super options at extension time.
  49353. // later at instantiation we can check if Super's options have
  49354. // been updated.
  49355. Sub.superOptions = Super.options;
  49356. Sub.extendOptions = extendOptions;
  49357. Sub.sealedOptions = extend({}, Sub.options);
  49358. // cache constructor
  49359. cachedCtors[SuperId] = Sub;
  49360. return Sub
  49361. };
  49362. }
  49363. function initProps$1 (Comp) {
  49364. var props = Comp.options.props;
  49365. for (var key in props) {
  49366. proxy(Comp.prototype, "_props", key);
  49367. }
  49368. }
  49369. function initComputed$1 (Comp) {
  49370. var computed = Comp.options.computed;
  49371. for (var key in computed) {
  49372. defineComputed(Comp.prototype, key, computed[key]);
  49373. }
  49374. }
  49375. /* */
  49376. function initAssetRegisters (Vue) {
  49377. /**
  49378. * Create asset registration methods.
  49379. */
  49380. ASSET_TYPES.forEach(function (type) {
  49381. Vue[type] = function (
  49382. id,
  49383. definition
  49384. ) {
  49385. if (!definition) {
  49386. return this.options[type + 's'][id]
  49387. } else {
  49388. /* istanbul ignore if */
  49389. if (type === 'component') {
  49390. validateComponentName(id);
  49391. }
  49392. if (type === 'component' && isPlainObject(definition)) {
  49393. definition.name = definition.name || id;
  49394. definition = this.options._base.extend(definition);
  49395. }
  49396. if (type === 'directive' && typeof definition === 'function') {
  49397. definition = { bind: definition, update: definition };
  49398. }
  49399. this.options[type + 's'][id] = definition;
  49400. return definition
  49401. }
  49402. };
  49403. });
  49404. }
  49405. /* */
  49406. function getComponentName (opts) {
  49407. return opts && (opts.Ctor.options.name || opts.tag)
  49408. }
  49409. function matches (pattern, name) {
  49410. if (Array.isArray(pattern)) {
  49411. return pattern.indexOf(name) > -1
  49412. } else if (typeof pattern === 'string') {
  49413. return pattern.split(',').indexOf(name) > -1
  49414. } else if (isRegExp(pattern)) {
  49415. return pattern.test(name)
  49416. }
  49417. /* istanbul ignore next */
  49418. return false
  49419. }
  49420. function pruneCache (keepAliveInstance, filter) {
  49421. var cache = keepAliveInstance.cache;
  49422. var keys = keepAliveInstance.keys;
  49423. var _vnode = keepAliveInstance._vnode;
  49424. for (var key in cache) {
  49425. var cachedNode = cache[key];
  49426. if (cachedNode) {
  49427. var name = getComponentName(cachedNode.componentOptions);
  49428. if (name && !filter(name)) {
  49429. pruneCacheEntry(cache, key, keys, _vnode);
  49430. }
  49431. }
  49432. }
  49433. }
  49434. function pruneCacheEntry (
  49435. cache,
  49436. key,
  49437. keys,
  49438. current
  49439. ) {
  49440. var cached$$1 = cache[key];
  49441. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49442. cached$$1.componentInstance.$destroy();
  49443. }
  49444. cache[key] = null;
  49445. remove(keys, key);
  49446. }
  49447. var patternTypes = [String, RegExp, Array];
  49448. var KeepAlive = {
  49449. name: 'keep-alive',
  49450. abstract: true,
  49451. props: {
  49452. include: patternTypes,
  49453. exclude: patternTypes,
  49454. max: [String, Number]
  49455. },
  49456. created: function created () {
  49457. this.cache = Object.create(null);
  49458. this.keys = [];
  49459. },
  49460. destroyed: function destroyed () {
  49461. for (var key in this.cache) {
  49462. pruneCacheEntry(this.cache, key, this.keys);
  49463. }
  49464. },
  49465. mounted: function mounted () {
  49466. var this$1 = this;
  49467. this.$watch('include', function (val) {
  49468. pruneCache(this$1, function (name) { return matches(val, name); });
  49469. });
  49470. this.$watch('exclude', function (val) {
  49471. pruneCache(this$1, function (name) { return !matches(val, name); });
  49472. });
  49473. },
  49474. render: function render () {
  49475. var slot = this.$slots.default;
  49476. var vnode = getFirstComponentChild(slot);
  49477. var componentOptions = vnode && vnode.componentOptions;
  49478. if (componentOptions) {
  49479. // check pattern
  49480. var name = getComponentName(componentOptions);
  49481. var ref = this;
  49482. var include = ref.include;
  49483. var exclude = ref.exclude;
  49484. if (
  49485. // not included
  49486. (include && (!name || !matches(include, name))) ||
  49487. // excluded
  49488. (exclude && name && matches(exclude, name))
  49489. ) {
  49490. return vnode
  49491. }
  49492. var ref$1 = this;
  49493. var cache = ref$1.cache;
  49494. var keys = ref$1.keys;
  49495. var key = vnode.key == null
  49496. // same constructor may get registered as different local components
  49497. // so cid alone is not enough (#3269)
  49498. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49499. : vnode.key;
  49500. if (cache[key]) {
  49501. vnode.componentInstance = cache[key].componentInstance;
  49502. // make current key freshest
  49503. remove(keys, key);
  49504. keys.push(key);
  49505. } else {
  49506. cache[key] = vnode;
  49507. keys.push(key);
  49508. // prune oldest entry
  49509. if (this.max && keys.length > parseInt(this.max)) {
  49510. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49511. }
  49512. }
  49513. vnode.data.keepAlive = true;
  49514. }
  49515. return vnode || (slot && slot[0])
  49516. }
  49517. };
  49518. var builtInComponents = {
  49519. KeepAlive: KeepAlive
  49520. };
  49521. /* */
  49522. function initGlobalAPI (Vue) {
  49523. // config
  49524. var configDef = {};
  49525. configDef.get = function () { return config; };
  49526. {
  49527. configDef.set = function () {
  49528. warn(
  49529. 'Do not replace the Vue.config object, set individual fields instead.'
  49530. );
  49531. };
  49532. }
  49533. Object.defineProperty(Vue, 'config', configDef);
  49534. // exposed util methods.
  49535. // NOTE: these are not considered part of the public API - avoid relying on
  49536. // them unless you are aware of the risk.
  49537. Vue.util = {
  49538. warn: warn,
  49539. extend: extend,
  49540. mergeOptions: mergeOptions,
  49541. defineReactive: defineReactive$$1
  49542. };
  49543. Vue.set = set;
  49544. Vue.delete = del;
  49545. Vue.nextTick = nextTick;
  49546. // 2.6 explicit observable API
  49547. Vue.observable = function (obj) {
  49548. observe(obj);
  49549. return obj
  49550. };
  49551. Vue.options = Object.create(null);
  49552. ASSET_TYPES.forEach(function (type) {
  49553. Vue.options[type + 's'] = Object.create(null);
  49554. });
  49555. // this is used to identify the "base" constructor to extend all plain-object
  49556. // components with in Weex's multi-instance scenarios.
  49557. Vue.options._base = Vue;
  49558. extend(Vue.options.components, builtInComponents);
  49559. initUse(Vue);
  49560. initMixin$1(Vue);
  49561. initExtend(Vue);
  49562. initAssetRegisters(Vue);
  49563. }
  49564. initGlobalAPI(Vue);
  49565. Object.defineProperty(Vue.prototype, '$isServer', {
  49566. get: isServerRendering
  49567. });
  49568. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49569. get: function get () {
  49570. /* istanbul ignore next */
  49571. return this.$vnode && this.$vnode.ssrContext
  49572. }
  49573. });
  49574. // expose FunctionalRenderContext for ssr runtime helper installation
  49575. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49576. value: FunctionalRenderContext
  49577. });
  49578. Vue.version = '2.6.11';
  49579. /* */
  49580. // these are reserved for web because they are directly compiled away
  49581. // during template compilation
  49582. var isReservedAttr = makeMap('style,class');
  49583. // attributes that should be using props for binding
  49584. var acceptValue = makeMap('input,textarea,option,select,progress');
  49585. var mustUseProp = function (tag, type, attr) {
  49586. return (
  49587. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49588. (attr === 'selected' && tag === 'option') ||
  49589. (attr === 'checked' && tag === 'input') ||
  49590. (attr === 'muted' && tag === 'video')
  49591. )
  49592. };
  49593. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49594. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49595. var convertEnumeratedValue = function (key, value) {
  49596. return isFalsyAttrValue(value) || value === 'false'
  49597. ? 'false'
  49598. // allow arbitrary string value for contenteditable
  49599. : key === 'contenteditable' && isValidContentEditableValue(value)
  49600. ? value
  49601. : 'true'
  49602. };
  49603. var isBooleanAttr = makeMap(
  49604. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49605. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49606. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49607. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49608. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49609. 'truespeed,typemustmatch,visible'
  49610. );
  49611. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49612. var isXlink = function (name) {
  49613. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49614. };
  49615. var getXlinkProp = function (name) {
  49616. return isXlink(name) ? name.slice(6, name.length) : ''
  49617. };
  49618. var isFalsyAttrValue = function (val) {
  49619. return val == null || val === false
  49620. };
  49621. /* */
  49622. function genClassForVnode (vnode) {
  49623. var data = vnode.data;
  49624. var parentNode = vnode;
  49625. var childNode = vnode;
  49626. while (isDef(childNode.componentInstance)) {
  49627. childNode = childNode.componentInstance._vnode;
  49628. if (childNode && childNode.data) {
  49629. data = mergeClassData(childNode.data, data);
  49630. }
  49631. }
  49632. while (isDef(parentNode = parentNode.parent)) {
  49633. if (parentNode && parentNode.data) {
  49634. data = mergeClassData(data, parentNode.data);
  49635. }
  49636. }
  49637. return renderClass(data.staticClass, data.class)
  49638. }
  49639. function mergeClassData (child, parent) {
  49640. return {
  49641. staticClass: concat(child.staticClass, parent.staticClass),
  49642. class: isDef(child.class)
  49643. ? [child.class, parent.class]
  49644. : parent.class
  49645. }
  49646. }
  49647. function renderClass (
  49648. staticClass,
  49649. dynamicClass
  49650. ) {
  49651. if (isDef(staticClass) || isDef(dynamicClass)) {
  49652. return concat(staticClass, stringifyClass(dynamicClass))
  49653. }
  49654. /* istanbul ignore next */
  49655. return ''
  49656. }
  49657. function concat (a, b) {
  49658. return a ? b ? (a + ' ' + b) : a : (b || '')
  49659. }
  49660. function stringifyClass (value) {
  49661. if (Array.isArray(value)) {
  49662. return stringifyArray(value)
  49663. }
  49664. if (isObject(value)) {
  49665. return stringifyObject(value)
  49666. }
  49667. if (typeof value === 'string') {
  49668. return value
  49669. }
  49670. /* istanbul ignore next */
  49671. return ''
  49672. }
  49673. function stringifyArray (value) {
  49674. var res = '';
  49675. var stringified;
  49676. for (var i = 0, l = value.length; i < l; i++) {
  49677. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49678. if (res) { res += ' '; }
  49679. res += stringified;
  49680. }
  49681. }
  49682. return res
  49683. }
  49684. function stringifyObject (value) {
  49685. var res = '';
  49686. for (var key in value) {
  49687. if (value[key]) {
  49688. if (res) { res += ' '; }
  49689. res += key;
  49690. }
  49691. }
  49692. return res
  49693. }
  49694. /* */
  49695. var namespaceMap = {
  49696. svg: 'http://www.w3.org/2000/svg',
  49697. math: 'http://www.w3.org/1998/Math/MathML'
  49698. };
  49699. var isHTMLTag = makeMap(
  49700. 'html,body,base,head,link,meta,style,title,' +
  49701. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49702. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49703. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49704. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49705. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49706. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49707. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49708. 'output,progress,select,textarea,' +
  49709. 'details,dialog,menu,menuitem,summary,' +
  49710. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49711. );
  49712. // this map is intentionally selective, only covering SVG elements that may
  49713. // contain child elements.
  49714. var isSVG = makeMap(
  49715. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49716. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49717. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49718. true
  49719. );
  49720. var isPreTag = function (tag) { return tag === 'pre'; };
  49721. var isReservedTag = function (tag) {
  49722. return isHTMLTag(tag) || isSVG(tag)
  49723. };
  49724. function getTagNamespace (tag) {
  49725. if (isSVG(tag)) {
  49726. return 'svg'
  49727. }
  49728. // basic support for MathML
  49729. // note it doesn't support other MathML elements being component roots
  49730. if (tag === 'math') {
  49731. return 'math'
  49732. }
  49733. }
  49734. var unknownElementCache = Object.create(null);
  49735. function isUnknownElement (tag) {
  49736. /* istanbul ignore if */
  49737. if (!inBrowser) {
  49738. return true
  49739. }
  49740. if (isReservedTag(tag)) {
  49741. return false
  49742. }
  49743. tag = tag.toLowerCase();
  49744. /* istanbul ignore if */
  49745. if (unknownElementCache[tag] != null) {
  49746. return unknownElementCache[tag]
  49747. }
  49748. var el = document.createElement(tag);
  49749. if (tag.indexOf('-') > -1) {
  49750. // http://stackoverflow.com/a/28210364/1070244
  49751. return (unknownElementCache[tag] = (
  49752. el.constructor === window.HTMLUnknownElement ||
  49753. el.constructor === window.HTMLElement
  49754. ))
  49755. } else {
  49756. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49757. }
  49758. }
  49759. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49760. /* */
  49761. /**
  49762. * Query an element selector if it's not an element already.
  49763. */
  49764. function query (el) {
  49765. if (typeof el === 'string') {
  49766. var selected = document.querySelector(el);
  49767. if (!selected) {
  49768. warn(
  49769. 'Cannot find element: ' + el
  49770. );
  49771. return document.createElement('div')
  49772. }
  49773. return selected
  49774. } else {
  49775. return el
  49776. }
  49777. }
  49778. /* */
  49779. function createElement$1 (tagName, vnode) {
  49780. var elm = document.createElement(tagName);
  49781. if (tagName !== 'select') {
  49782. return elm
  49783. }
  49784. // false or null will remove the attribute but undefined will not
  49785. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49786. elm.setAttribute('multiple', 'multiple');
  49787. }
  49788. return elm
  49789. }
  49790. function createElementNS (namespace, tagName) {
  49791. return document.createElementNS(namespaceMap[namespace], tagName)
  49792. }
  49793. function createTextNode (text) {
  49794. return document.createTextNode(text)
  49795. }
  49796. function createComment (text) {
  49797. return document.createComment(text)
  49798. }
  49799. function insertBefore (parentNode, newNode, referenceNode) {
  49800. parentNode.insertBefore(newNode, referenceNode);
  49801. }
  49802. function removeChild (node, child) {
  49803. node.removeChild(child);
  49804. }
  49805. function appendChild (node, child) {
  49806. node.appendChild(child);
  49807. }
  49808. function parentNode (node) {
  49809. return node.parentNode
  49810. }
  49811. function nextSibling (node) {
  49812. return node.nextSibling
  49813. }
  49814. function tagName (node) {
  49815. return node.tagName
  49816. }
  49817. function setTextContent (node, text) {
  49818. node.textContent = text;
  49819. }
  49820. function setStyleScope (node, scopeId) {
  49821. node.setAttribute(scopeId, '');
  49822. }
  49823. var nodeOps = /*#__PURE__*/Object.freeze({
  49824. createElement: createElement$1,
  49825. createElementNS: createElementNS,
  49826. createTextNode: createTextNode,
  49827. createComment: createComment,
  49828. insertBefore: insertBefore,
  49829. removeChild: removeChild,
  49830. appendChild: appendChild,
  49831. parentNode: parentNode,
  49832. nextSibling: nextSibling,
  49833. tagName: tagName,
  49834. setTextContent: setTextContent,
  49835. setStyleScope: setStyleScope
  49836. });
  49837. /* */
  49838. var ref = {
  49839. create: function create (_, vnode) {
  49840. registerRef(vnode);
  49841. },
  49842. update: function update (oldVnode, vnode) {
  49843. if (oldVnode.data.ref !== vnode.data.ref) {
  49844. registerRef(oldVnode, true);
  49845. registerRef(vnode);
  49846. }
  49847. },
  49848. destroy: function destroy (vnode) {
  49849. registerRef(vnode, true);
  49850. }
  49851. };
  49852. function registerRef (vnode, isRemoval) {
  49853. var key = vnode.data.ref;
  49854. if (!isDef(key)) { return }
  49855. var vm = vnode.context;
  49856. var ref = vnode.componentInstance || vnode.elm;
  49857. var refs = vm.$refs;
  49858. if (isRemoval) {
  49859. if (Array.isArray(refs[key])) {
  49860. remove(refs[key], ref);
  49861. } else if (refs[key] === ref) {
  49862. refs[key] = undefined;
  49863. }
  49864. } else {
  49865. if (vnode.data.refInFor) {
  49866. if (!Array.isArray(refs[key])) {
  49867. refs[key] = [ref];
  49868. } else if (refs[key].indexOf(ref) < 0) {
  49869. // $flow-disable-line
  49870. refs[key].push(ref);
  49871. }
  49872. } else {
  49873. refs[key] = ref;
  49874. }
  49875. }
  49876. }
  49877. /**
  49878. * Virtual DOM patching algorithm based on Snabbdom by
  49879. * Simon Friis Vindum (@paldepind)
  49880. * Licensed under the MIT License
  49881. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49882. *
  49883. * modified by Evan You (@yyx990803)
  49884. *
  49885. * Not type-checking this because this file is perf-critical and the cost
  49886. * of making flow understand it is not worth it.
  49887. */
  49888. var emptyNode = new VNode('', {}, []);
  49889. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49890. function sameVnode (a, b) {
  49891. return (
  49892. a.key === b.key && (
  49893. (
  49894. a.tag === b.tag &&
  49895. a.isComment === b.isComment &&
  49896. isDef(a.data) === isDef(b.data) &&
  49897. sameInputType(a, b)
  49898. ) || (
  49899. isTrue(a.isAsyncPlaceholder) &&
  49900. a.asyncFactory === b.asyncFactory &&
  49901. isUndef(b.asyncFactory.error)
  49902. )
  49903. )
  49904. )
  49905. }
  49906. function sameInputType (a, b) {
  49907. if (a.tag !== 'input') { return true }
  49908. var i;
  49909. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49910. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49911. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49912. }
  49913. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49914. var i, key;
  49915. var map = {};
  49916. for (i = beginIdx; i <= endIdx; ++i) {
  49917. key = children[i].key;
  49918. if (isDef(key)) { map[key] = i; }
  49919. }
  49920. return map
  49921. }
  49922. function createPatchFunction (backend) {
  49923. var i, j;
  49924. var cbs = {};
  49925. var modules = backend.modules;
  49926. var nodeOps = backend.nodeOps;
  49927. for (i = 0; i < hooks.length; ++i) {
  49928. cbs[hooks[i]] = [];
  49929. for (j = 0; j < modules.length; ++j) {
  49930. if (isDef(modules[j][hooks[i]])) {
  49931. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49932. }
  49933. }
  49934. }
  49935. function emptyNodeAt (elm) {
  49936. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49937. }
  49938. function createRmCb (childElm, listeners) {
  49939. function remove$$1 () {
  49940. if (--remove$$1.listeners === 0) {
  49941. removeNode(childElm);
  49942. }
  49943. }
  49944. remove$$1.listeners = listeners;
  49945. return remove$$1
  49946. }
  49947. function removeNode (el) {
  49948. var parent = nodeOps.parentNode(el);
  49949. // element may have already been removed due to v-html / v-text
  49950. if (isDef(parent)) {
  49951. nodeOps.removeChild(parent, el);
  49952. }
  49953. }
  49954. function isUnknownElement$$1 (vnode, inVPre) {
  49955. return (
  49956. !inVPre &&
  49957. !vnode.ns &&
  49958. !(
  49959. config.ignoredElements.length &&
  49960. config.ignoredElements.some(function (ignore) {
  49961. return isRegExp(ignore)
  49962. ? ignore.test(vnode.tag)
  49963. : ignore === vnode.tag
  49964. })
  49965. ) &&
  49966. config.isUnknownElement(vnode.tag)
  49967. )
  49968. }
  49969. var creatingElmInVPre = 0;
  49970. function createElm (
  49971. vnode,
  49972. insertedVnodeQueue,
  49973. parentElm,
  49974. refElm,
  49975. nested,
  49976. ownerArray,
  49977. index
  49978. ) {
  49979. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49980. // This vnode was used in a previous render!
  49981. // now it's used as a new node, overwriting its elm would cause
  49982. // potential patch errors down the road when it's used as an insertion
  49983. // reference node. Instead, we clone the node on-demand before creating
  49984. // associated DOM element for it.
  49985. vnode = ownerArray[index] = cloneVNode(vnode);
  49986. }
  49987. vnode.isRootInsert = !nested; // for transition enter check
  49988. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49989. return
  49990. }
  49991. var data = vnode.data;
  49992. var children = vnode.children;
  49993. var tag = vnode.tag;
  49994. if (isDef(tag)) {
  49995. {
  49996. if (data && data.pre) {
  49997. creatingElmInVPre++;
  49998. }
  49999. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50000. warn(
  50001. 'Unknown custom element: <' + tag + '> - did you ' +
  50002. 'register the component correctly? For recursive components, ' +
  50003. 'make sure to provide the "name" option.',
  50004. vnode.context
  50005. );
  50006. }
  50007. }
  50008. vnode.elm = vnode.ns
  50009. ? nodeOps.createElementNS(vnode.ns, tag)
  50010. : nodeOps.createElement(tag, vnode);
  50011. setScope(vnode);
  50012. /* istanbul ignore if */
  50013. {
  50014. createChildren(vnode, children, insertedVnodeQueue);
  50015. if (isDef(data)) {
  50016. invokeCreateHooks(vnode, insertedVnodeQueue);
  50017. }
  50018. insert(parentElm, vnode.elm, refElm);
  50019. }
  50020. if (data && data.pre) {
  50021. creatingElmInVPre--;
  50022. }
  50023. } else if (isTrue(vnode.isComment)) {
  50024. vnode.elm = nodeOps.createComment(vnode.text);
  50025. insert(parentElm, vnode.elm, refElm);
  50026. } else {
  50027. vnode.elm = nodeOps.createTextNode(vnode.text);
  50028. insert(parentElm, vnode.elm, refElm);
  50029. }
  50030. }
  50031. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50032. var i = vnode.data;
  50033. if (isDef(i)) {
  50034. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50035. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50036. i(vnode, false /* hydrating */);
  50037. }
  50038. // after calling the init hook, if the vnode is a child component
  50039. // it should've created a child instance and mounted it. the child
  50040. // component also has set the placeholder vnode's elm.
  50041. // in that case we can just return the element and be done.
  50042. if (isDef(vnode.componentInstance)) {
  50043. initComponent(vnode, insertedVnodeQueue);
  50044. insert(parentElm, vnode.elm, refElm);
  50045. if (isTrue(isReactivated)) {
  50046. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50047. }
  50048. return true
  50049. }
  50050. }
  50051. }
  50052. function initComponent (vnode, insertedVnodeQueue) {
  50053. if (isDef(vnode.data.pendingInsert)) {
  50054. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50055. vnode.data.pendingInsert = null;
  50056. }
  50057. vnode.elm = vnode.componentInstance.$el;
  50058. if (isPatchable(vnode)) {
  50059. invokeCreateHooks(vnode, insertedVnodeQueue);
  50060. setScope(vnode);
  50061. } else {
  50062. // empty component root.
  50063. // skip all element-related modules except for ref (#3455)
  50064. registerRef(vnode);
  50065. // make sure to invoke the insert hook
  50066. insertedVnodeQueue.push(vnode);
  50067. }
  50068. }
  50069. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50070. var i;
  50071. // hack for #4339: a reactivated component with inner transition
  50072. // does not trigger because the inner node's created hooks are not called
  50073. // again. It's not ideal to involve module-specific logic in here but
  50074. // there doesn't seem to be a better way to do it.
  50075. var innerNode = vnode;
  50076. while (innerNode.componentInstance) {
  50077. innerNode = innerNode.componentInstance._vnode;
  50078. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50079. for (i = 0; i < cbs.activate.length; ++i) {
  50080. cbs.activate[i](emptyNode, innerNode);
  50081. }
  50082. insertedVnodeQueue.push(innerNode);
  50083. break
  50084. }
  50085. }
  50086. // unlike a newly created component,
  50087. // a reactivated keep-alive component doesn't insert itself
  50088. insert(parentElm, vnode.elm, refElm);
  50089. }
  50090. function insert (parent, elm, ref$$1) {
  50091. if (isDef(parent)) {
  50092. if (isDef(ref$$1)) {
  50093. if (nodeOps.parentNode(ref$$1) === parent) {
  50094. nodeOps.insertBefore(parent, elm, ref$$1);
  50095. }
  50096. } else {
  50097. nodeOps.appendChild(parent, elm);
  50098. }
  50099. }
  50100. }
  50101. function createChildren (vnode, children, insertedVnodeQueue) {
  50102. if (Array.isArray(children)) {
  50103. {
  50104. checkDuplicateKeys(children);
  50105. }
  50106. for (var i = 0; i < children.length; ++i) {
  50107. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50108. }
  50109. } else if (isPrimitive(vnode.text)) {
  50110. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50111. }
  50112. }
  50113. function isPatchable (vnode) {
  50114. while (vnode.componentInstance) {
  50115. vnode = vnode.componentInstance._vnode;
  50116. }
  50117. return isDef(vnode.tag)
  50118. }
  50119. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50120. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50121. cbs.create[i$1](emptyNode, vnode);
  50122. }
  50123. i = vnode.data.hook; // Reuse variable
  50124. if (isDef(i)) {
  50125. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50126. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50127. }
  50128. }
  50129. // set scope id attribute for scoped CSS.
  50130. // this is implemented as a special case to avoid the overhead
  50131. // of going through the normal attribute patching process.
  50132. function setScope (vnode) {
  50133. var i;
  50134. if (isDef(i = vnode.fnScopeId)) {
  50135. nodeOps.setStyleScope(vnode.elm, i);
  50136. } else {
  50137. var ancestor = vnode;
  50138. while (ancestor) {
  50139. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50140. nodeOps.setStyleScope(vnode.elm, i);
  50141. }
  50142. ancestor = ancestor.parent;
  50143. }
  50144. }
  50145. // for slot content they should also get the scopeId from the host instance.
  50146. if (isDef(i = activeInstance) &&
  50147. i !== vnode.context &&
  50148. i !== vnode.fnContext &&
  50149. isDef(i = i.$options._scopeId)
  50150. ) {
  50151. nodeOps.setStyleScope(vnode.elm, i);
  50152. }
  50153. }
  50154. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50155. for (; startIdx <= endIdx; ++startIdx) {
  50156. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50157. }
  50158. }
  50159. function invokeDestroyHook (vnode) {
  50160. var i, j;
  50161. var data = vnode.data;
  50162. if (isDef(data)) {
  50163. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50164. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50165. }
  50166. if (isDef(i = vnode.children)) {
  50167. for (j = 0; j < vnode.children.length; ++j) {
  50168. invokeDestroyHook(vnode.children[j]);
  50169. }
  50170. }
  50171. }
  50172. function removeVnodes (vnodes, startIdx, endIdx) {
  50173. for (; startIdx <= endIdx; ++startIdx) {
  50174. var ch = vnodes[startIdx];
  50175. if (isDef(ch)) {
  50176. if (isDef(ch.tag)) {
  50177. removeAndInvokeRemoveHook(ch);
  50178. invokeDestroyHook(ch);
  50179. } else { // Text node
  50180. removeNode(ch.elm);
  50181. }
  50182. }
  50183. }
  50184. }
  50185. function removeAndInvokeRemoveHook (vnode, rm) {
  50186. if (isDef(rm) || isDef(vnode.data)) {
  50187. var i;
  50188. var listeners = cbs.remove.length + 1;
  50189. if (isDef(rm)) {
  50190. // we have a recursively passed down rm callback
  50191. // increase the listeners count
  50192. rm.listeners += listeners;
  50193. } else {
  50194. // directly removing
  50195. rm = createRmCb(vnode.elm, listeners);
  50196. }
  50197. // recursively invoke hooks on child component root node
  50198. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50199. removeAndInvokeRemoveHook(i, rm);
  50200. }
  50201. for (i = 0; i < cbs.remove.length; ++i) {
  50202. cbs.remove[i](vnode, rm);
  50203. }
  50204. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50205. i(vnode, rm);
  50206. } else {
  50207. rm();
  50208. }
  50209. } else {
  50210. removeNode(vnode.elm);
  50211. }
  50212. }
  50213. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50214. var oldStartIdx = 0;
  50215. var newStartIdx = 0;
  50216. var oldEndIdx = oldCh.length - 1;
  50217. var oldStartVnode = oldCh[0];
  50218. var oldEndVnode = oldCh[oldEndIdx];
  50219. var newEndIdx = newCh.length - 1;
  50220. var newStartVnode = newCh[0];
  50221. var newEndVnode = newCh[newEndIdx];
  50222. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50223. // removeOnly is a special flag used only by <transition-group>
  50224. // to ensure removed elements stay in correct relative positions
  50225. // during leaving transitions
  50226. var canMove = !removeOnly;
  50227. {
  50228. checkDuplicateKeys(newCh);
  50229. }
  50230. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50231. if (isUndef(oldStartVnode)) {
  50232. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50233. } else if (isUndef(oldEndVnode)) {
  50234. oldEndVnode = oldCh[--oldEndIdx];
  50235. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50236. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50237. oldStartVnode = oldCh[++oldStartIdx];
  50238. newStartVnode = newCh[++newStartIdx];
  50239. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50240. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50241. oldEndVnode = oldCh[--oldEndIdx];
  50242. newEndVnode = newCh[--newEndIdx];
  50243. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50244. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50245. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50246. oldStartVnode = oldCh[++oldStartIdx];
  50247. newEndVnode = newCh[--newEndIdx];
  50248. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50249. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50250. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50251. oldEndVnode = oldCh[--oldEndIdx];
  50252. newStartVnode = newCh[++newStartIdx];
  50253. } else {
  50254. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50255. idxInOld = isDef(newStartVnode.key)
  50256. ? oldKeyToIdx[newStartVnode.key]
  50257. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50258. if (isUndef(idxInOld)) { // New element
  50259. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50260. } else {
  50261. vnodeToMove = oldCh[idxInOld];
  50262. if (sameVnode(vnodeToMove, newStartVnode)) {
  50263. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50264. oldCh[idxInOld] = undefined;
  50265. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50266. } else {
  50267. // same key but different element. treat as new element
  50268. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50269. }
  50270. }
  50271. newStartVnode = newCh[++newStartIdx];
  50272. }
  50273. }
  50274. if (oldStartIdx > oldEndIdx) {
  50275. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50276. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50277. } else if (newStartIdx > newEndIdx) {
  50278. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50279. }
  50280. }
  50281. function checkDuplicateKeys (children) {
  50282. var seenKeys = {};
  50283. for (var i = 0; i < children.length; i++) {
  50284. var vnode = children[i];
  50285. var key = vnode.key;
  50286. if (isDef(key)) {
  50287. if (seenKeys[key]) {
  50288. warn(
  50289. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50290. vnode.context
  50291. );
  50292. } else {
  50293. seenKeys[key] = true;
  50294. }
  50295. }
  50296. }
  50297. }
  50298. function findIdxInOld (node, oldCh, start, end) {
  50299. for (var i = start; i < end; i++) {
  50300. var c = oldCh[i];
  50301. if (isDef(c) && sameVnode(node, c)) { return i }
  50302. }
  50303. }
  50304. function patchVnode (
  50305. oldVnode,
  50306. vnode,
  50307. insertedVnodeQueue,
  50308. ownerArray,
  50309. index,
  50310. removeOnly
  50311. ) {
  50312. if (oldVnode === vnode) {
  50313. return
  50314. }
  50315. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50316. // clone reused vnode
  50317. vnode = ownerArray[index] = cloneVNode(vnode);
  50318. }
  50319. var elm = vnode.elm = oldVnode.elm;
  50320. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50321. if (isDef(vnode.asyncFactory.resolved)) {
  50322. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50323. } else {
  50324. vnode.isAsyncPlaceholder = true;
  50325. }
  50326. return
  50327. }
  50328. // reuse element for static trees.
  50329. // note we only do this if the vnode is cloned -
  50330. // if the new node is not cloned it means the render functions have been
  50331. // reset by the hot-reload-api and we need to do a proper re-render.
  50332. if (isTrue(vnode.isStatic) &&
  50333. isTrue(oldVnode.isStatic) &&
  50334. vnode.key === oldVnode.key &&
  50335. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50336. ) {
  50337. vnode.componentInstance = oldVnode.componentInstance;
  50338. return
  50339. }
  50340. var i;
  50341. var data = vnode.data;
  50342. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50343. i(oldVnode, vnode);
  50344. }
  50345. var oldCh = oldVnode.children;
  50346. var ch = vnode.children;
  50347. if (isDef(data) && isPatchable(vnode)) {
  50348. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50349. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50350. }
  50351. if (isUndef(vnode.text)) {
  50352. if (isDef(oldCh) && isDef(ch)) {
  50353. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50354. } else if (isDef(ch)) {
  50355. {
  50356. checkDuplicateKeys(ch);
  50357. }
  50358. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50359. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50360. } else if (isDef(oldCh)) {
  50361. removeVnodes(oldCh, 0, oldCh.length - 1);
  50362. } else if (isDef(oldVnode.text)) {
  50363. nodeOps.setTextContent(elm, '');
  50364. }
  50365. } else if (oldVnode.text !== vnode.text) {
  50366. nodeOps.setTextContent(elm, vnode.text);
  50367. }
  50368. if (isDef(data)) {
  50369. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50370. }
  50371. }
  50372. function invokeInsertHook (vnode, queue, initial) {
  50373. // delay insert hooks for component root nodes, invoke them after the
  50374. // element is really inserted
  50375. if (isTrue(initial) && isDef(vnode.parent)) {
  50376. vnode.parent.data.pendingInsert = queue;
  50377. } else {
  50378. for (var i = 0; i < queue.length; ++i) {
  50379. queue[i].data.hook.insert(queue[i]);
  50380. }
  50381. }
  50382. }
  50383. var hydrationBailed = false;
  50384. // list of modules that can skip create hook during hydration because they
  50385. // are already rendered on the client or has no need for initialization
  50386. // Note: style is excluded because it relies on initial clone for future
  50387. // deep updates (#7063).
  50388. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50389. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50390. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50391. var i;
  50392. var tag = vnode.tag;
  50393. var data = vnode.data;
  50394. var children = vnode.children;
  50395. inVPre = inVPre || (data && data.pre);
  50396. vnode.elm = elm;
  50397. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50398. vnode.isAsyncPlaceholder = true;
  50399. return true
  50400. }
  50401. // assert node match
  50402. {
  50403. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50404. return false
  50405. }
  50406. }
  50407. if (isDef(data)) {
  50408. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50409. if (isDef(i = vnode.componentInstance)) {
  50410. // child component. it should have hydrated its own tree.
  50411. initComponent(vnode, insertedVnodeQueue);
  50412. return true
  50413. }
  50414. }
  50415. if (isDef(tag)) {
  50416. if (isDef(children)) {
  50417. // empty element, allow client to pick up and populate children
  50418. if (!elm.hasChildNodes()) {
  50419. createChildren(vnode, children, insertedVnodeQueue);
  50420. } else {
  50421. // v-html and domProps: innerHTML
  50422. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50423. if (i !== elm.innerHTML) {
  50424. /* istanbul ignore if */
  50425. if (typeof console !== 'undefined' &&
  50426. !hydrationBailed
  50427. ) {
  50428. hydrationBailed = true;
  50429. console.warn('Parent: ', elm);
  50430. console.warn('server innerHTML: ', i);
  50431. console.warn('client innerHTML: ', elm.innerHTML);
  50432. }
  50433. return false
  50434. }
  50435. } else {
  50436. // iterate and compare children lists
  50437. var childrenMatch = true;
  50438. var childNode = elm.firstChild;
  50439. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50440. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50441. childrenMatch = false;
  50442. break
  50443. }
  50444. childNode = childNode.nextSibling;
  50445. }
  50446. // if childNode is not null, it means the actual childNodes list is
  50447. // longer than the virtual children list.
  50448. if (!childrenMatch || childNode) {
  50449. /* istanbul ignore if */
  50450. if (typeof console !== 'undefined' &&
  50451. !hydrationBailed
  50452. ) {
  50453. hydrationBailed = true;
  50454. console.warn('Parent: ', elm);
  50455. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50456. }
  50457. return false
  50458. }
  50459. }
  50460. }
  50461. }
  50462. if (isDef(data)) {
  50463. var fullInvoke = false;
  50464. for (var key in data) {
  50465. if (!isRenderedModule(key)) {
  50466. fullInvoke = true;
  50467. invokeCreateHooks(vnode, insertedVnodeQueue);
  50468. break
  50469. }
  50470. }
  50471. if (!fullInvoke && data['class']) {
  50472. // ensure collecting deps for deep class bindings for future updates
  50473. traverse(data['class']);
  50474. }
  50475. }
  50476. } else if (elm.data !== vnode.text) {
  50477. elm.data = vnode.text;
  50478. }
  50479. return true
  50480. }
  50481. function assertNodeMatch (node, vnode, inVPre) {
  50482. if (isDef(vnode.tag)) {
  50483. return vnode.tag.indexOf('vue-component') === 0 || (
  50484. !isUnknownElement$$1(vnode, inVPre) &&
  50485. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50486. )
  50487. } else {
  50488. return node.nodeType === (vnode.isComment ? 8 : 3)
  50489. }
  50490. }
  50491. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50492. if (isUndef(vnode)) {
  50493. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50494. return
  50495. }
  50496. var isInitialPatch = false;
  50497. var insertedVnodeQueue = [];
  50498. if (isUndef(oldVnode)) {
  50499. // empty mount (likely as component), create new root element
  50500. isInitialPatch = true;
  50501. createElm(vnode, insertedVnodeQueue);
  50502. } else {
  50503. var isRealElement = isDef(oldVnode.nodeType);
  50504. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50505. // patch existing root node
  50506. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50507. } else {
  50508. if (isRealElement) {
  50509. // mounting to a real element
  50510. // check if this is server-rendered content and if we can perform
  50511. // a successful hydration.
  50512. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50513. oldVnode.removeAttribute(SSR_ATTR);
  50514. hydrating = true;
  50515. }
  50516. if (isTrue(hydrating)) {
  50517. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50518. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50519. return oldVnode
  50520. } else {
  50521. warn(
  50522. 'The client-side rendered virtual DOM tree is not matching ' +
  50523. 'server-rendered content. This is likely caused by incorrect ' +
  50524. 'HTML markup, for example nesting block-level elements inside ' +
  50525. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50526. 'full client-side render.'
  50527. );
  50528. }
  50529. }
  50530. // either not server-rendered, or hydration failed.
  50531. // create an empty node and replace it
  50532. oldVnode = emptyNodeAt(oldVnode);
  50533. }
  50534. // replacing existing element
  50535. var oldElm = oldVnode.elm;
  50536. var parentElm = nodeOps.parentNode(oldElm);
  50537. // create new node
  50538. createElm(
  50539. vnode,
  50540. insertedVnodeQueue,
  50541. // extremely rare edge case: do not insert if old element is in a
  50542. // leaving transition. Only happens when combining transition +
  50543. // keep-alive + HOCs. (#4590)
  50544. oldElm._leaveCb ? null : parentElm,
  50545. nodeOps.nextSibling(oldElm)
  50546. );
  50547. // update parent placeholder node element, recursively
  50548. if (isDef(vnode.parent)) {
  50549. var ancestor = vnode.parent;
  50550. var patchable = isPatchable(vnode);
  50551. while (ancestor) {
  50552. for (var i = 0; i < cbs.destroy.length; ++i) {
  50553. cbs.destroy[i](ancestor);
  50554. }
  50555. ancestor.elm = vnode.elm;
  50556. if (patchable) {
  50557. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50558. cbs.create[i$1](emptyNode, ancestor);
  50559. }
  50560. // #6513
  50561. // invoke insert hooks that may have been merged by create hooks.
  50562. // e.g. for directives that uses the "inserted" hook.
  50563. var insert = ancestor.data.hook.insert;
  50564. if (insert.merged) {
  50565. // start at index 1 to avoid re-invoking component mounted hook
  50566. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50567. insert.fns[i$2]();
  50568. }
  50569. }
  50570. } else {
  50571. registerRef(ancestor);
  50572. }
  50573. ancestor = ancestor.parent;
  50574. }
  50575. }
  50576. // destroy old node
  50577. if (isDef(parentElm)) {
  50578. removeVnodes([oldVnode], 0, 0);
  50579. } else if (isDef(oldVnode.tag)) {
  50580. invokeDestroyHook(oldVnode);
  50581. }
  50582. }
  50583. }
  50584. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50585. return vnode.elm
  50586. }
  50587. }
  50588. /* */
  50589. var directives = {
  50590. create: updateDirectives,
  50591. update: updateDirectives,
  50592. destroy: function unbindDirectives (vnode) {
  50593. updateDirectives(vnode, emptyNode);
  50594. }
  50595. };
  50596. function updateDirectives (oldVnode, vnode) {
  50597. if (oldVnode.data.directives || vnode.data.directives) {
  50598. _update(oldVnode, vnode);
  50599. }
  50600. }
  50601. function _update (oldVnode, vnode) {
  50602. var isCreate = oldVnode === emptyNode;
  50603. var isDestroy = vnode === emptyNode;
  50604. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50605. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50606. var dirsWithInsert = [];
  50607. var dirsWithPostpatch = [];
  50608. var key, oldDir, dir;
  50609. for (key in newDirs) {
  50610. oldDir = oldDirs[key];
  50611. dir = newDirs[key];
  50612. if (!oldDir) {
  50613. // new directive, bind
  50614. callHook$1(dir, 'bind', vnode, oldVnode);
  50615. if (dir.def && dir.def.inserted) {
  50616. dirsWithInsert.push(dir);
  50617. }
  50618. } else {
  50619. // existing directive, update
  50620. dir.oldValue = oldDir.value;
  50621. dir.oldArg = oldDir.arg;
  50622. callHook$1(dir, 'update', vnode, oldVnode);
  50623. if (dir.def && dir.def.componentUpdated) {
  50624. dirsWithPostpatch.push(dir);
  50625. }
  50626. }
  50627. }
  50628. if (dirsWithInsert.length) {
  50629. var callInsert = function () {
  50630. for (var i = 0; i < dirsWithInsert.length; i++) {
  50631. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50632. }
  50633. };
  50634. if (isCreate) {
  50635. mergeVNodeHook(vnode, 'insert', callInsert);
  50636. } else {
  50637. callInsert();
  50638. }
  50639. }
  50640. if (dirsWithPostpatch.length) {
  50641. mergeVNodeHook(vnode, 'postpatch', function () {
  50642. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50643. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50644. }
  50645. });
  50646. }
  50647. if (!isCreate) {
  50648. for (key in oldDirs) {
  50649. if (!newDirs[key]) {
  50650. // no longer present, unbind
  50651. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50652. }
  50653. }
  50654. }
  50655. }
  50656. var emptyModifiers = Object.create(null);
  50657. function normalizeDirectives$1 (
  50658. dirs,
  50659. vm
  50660. ) {
  50661. var res = Object.create(null);
  50662. if (!dirs) {
  50663. // $flow-disable-line
  50664. return res
  50665. }
  50666. var i, dir;
  50667. for (i = 0; i < dirs.length; i++) {
  50668. dir = dirs[i];
  50669. if (!dir.modifiers) {
  50670. // $flow-disable-line
  50671. dir.modifiers = emptyModifiers;
  50672. }
  50673. res[getRawDirName(dir)] = dir;
  50674. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50675. }
  50676. // $flow-disable-line
  50677. return res
  50678. }
  50679. function getRawDirName (dir) {
  50680. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50681. }
  50682. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50683. var fn = dir.def && dir.def[hook];
  50684. if (fn) {
  50685. try {
  50686. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50687. } catch (e) {
  50688. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50689. }
  50690. }
  50691. }
  50692. var baseModules = [
  50693. ref,
  50694. directives
  50695. ];
  50696. /* */
  50697. function updateAttrs (oldVnode, vnode) {
  50698. var opts = vnode.componentOptions;
  50699. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50700. return
  50701. }
  50702. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50703. return
  50704. }
  50705. var key, cur, old;
  50706. var elm = vnode.elm;
  50707. var oldAttrs = oldVnode.data.attrs || {};
  50708. var attrs = vnode.data.attrs || {};
  50709. // clone observed objects, as the user probably wants to mutate it
  50710. if (isDef(attrs.__ob__)) {
  50711. attrs = vnode.data.attrs = extend({}, attrs);
  50712. }
  50713. for (key in attrs) {
  50714. cur = attrs[key];
  50715. old = oldAttrs[key];
  50716. if (old !== cur) {
  50717. setAttr(elm, key, cur);
  50718. }
  50719. }
  50720. // #4391: in IE9, setting type can reset value for input[type=radio]
  50721. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50722. /* istanbul ignore if */
  50723. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50724. setAttr(elm, 'value', attrs.value);
  50725. }
  50726. for (key in oldAttrs) {
  50727. if (isUndef(attrs[key])) {
  50728. if (isXlink(key)) {
  50729. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50730. } else if (!isEnumeratedAttr(key)) {
  50731. elm.removeAttribute(key);
  50732. }
  50733. }
  50734. }
  50735. }
  50736. function setAttr (el, key, value) {
  50737. if (el.tagName.indexOf('-') > -1) {
  50738. baseSetAttr(el, key, value);
  50739. } else if (isBooleanAttr(key)) {
  50740. // set attribute for blank value
  50741. // e.g. <option disabled>Select one</option>
  50742. if (isFalsyAttrValue(value)) {
  50743. el.removeAttribute(key);
  50744. } else {
  50745. // technically allowfullscreen is a boolean attribute for <iframe>,
  50746. // but Flash expects a value of "true" when used on <embed> tag
  50747. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50748. ? 'true'
  50749. : key;
  50750. el.setAttribute(key, value);
  50751. }
  50752. } else if (isEnumeratedAttr(key)) {
  50753. el.setAttribute(key, convertEnumeratedValue(key, value));
  50754. } else if (isXlink(key)) {
  50755. if (isFalsyAttrValue(value)) {
  50756. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50757. } else {
  50758. el.setAttributeNS(xlinkNS, key, value);
  50759. }
  50760. } else {
  50761. baseSetAttr(el, key, value);
  50762. }
  50763. }
  50764. function baseSetAttr (el, key, value) {
  50765. if (isFalsyAttrValue(value)) {
  50766. el.removeAttribute(key);
  50767. } else {
  50768. // #7138: IE10 & 11 fires input event when setting placeholder on
  50769. // <textarea>... block the first input event and remove the blocker
  50770. // immediately.
  50771. /* istanbul ignore if */
  50772. if (
  50773. isIE && !isIE9 &&
  50774. el.tagName === 'TEXTAREA' &&
  50775. key === 'placeholder' && value !== '' && !el.__ieph
  50776. ) {
  50777. var blocker = function (e) {
  50778. e.stopImmediatePropagation();
  50779. el.removeEventListener('input', blocker);
  50780. };
  50781. el.addEventListener('input', blocker);
  50782. // $flow-disable-line
  50783. el.__ieph = true; /* IE placeholder patched */
  50784. }
  50785. el.setAttribute(key, value);
  50786. }
  50787. }
  50788. var attrs = {
  50789. create: updateAttrs,
  50790. update: updateAttrs
  50791. };
  50792. /* */
  50793. function updateClass (oldVnode, vnode) {
  50794. var el = vnode.elm;
  50795. var data = vnode.data;
  50796. var oldData = oldVnode.data;
  50797. if (
  50798. isUndef(data.staticClass) &&
  50799. isUndef(data.class) && (
  50800. isUndef(oldData) || (
  50801. isUndef(oldData.staticClass) &&
  50802. isUndef(oldData.class)
  50803. )
  50804. )
  50805. ) {
  50806. return
  50807. }
  50808. var cls = genClassForVnode(vnode);
  50809. // handle transition classes
  50810. var transitionClass = el._transitionClasses;
  50811. if (isDef(transitionClass)) {
  50812. cls = concat(cls, stringifyClass(transitionClass));
  50813. }
  50814. // set the class
  50815. if (cls !== el._prevClass) {
  50816. el.setAttribute('class', cls);
  50817. el._prevClass = cls;
  50818. }
  50819. }
  50820. var klass = {
  50821. create: updateClass,
  50822. update: updateClass
  50823. };
  50824. /* */
  50825. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50826. function parseFilters (exp) {
  50827. var inSingle = false;
  50828. var inDouble = false;
  50829. var inTemplateString = false;
  50830. var inRegex = false;
  50831. var curly = 0;
  50832. var square = 0;
  50833. var paren = 0;
  50834. var lastFilterIndex = 0;
  50835. var c, prev, i, expression, filters;
  50836. for (i = 0; i < exp.length; i++) {
  50837. prev = c;
  50838. c = exp.charCodeAt(i);
  50839. if (inSingle) {
  50840. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50841. } else if (inDouble) {
  50842. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50843. } else if (inTemplateString) {
  50844. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50845. } else if (inRegex) {
  50846. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50847. } else if (
  50848. c === 0x7C && // pipe
  50849. exp.charCodeAt(i + 1) !== 0x7C &&
  50850. exp.charCodeAt(i - 1) !== 0x7C &&
  50851. !curly && !square && !paren
  50852. ) {
  50853. if (expression === undefined) {
  50854. // first filter, end of expression
  50855. lastFilterIndex = i + 1;
  50856. expression = exp.slice(0, i).trim();
  50857. } else {
  50858. pushFilter();
  50859. }
  50860. } else {
  50861. switch (c) {
  50862. case 0x22: inDouble = true; break // "
  50863. case 0x27: inSingle = true; break // '
  50864. case 0x60: inTemplateString = true; break // `
  50865. case 0x28: paren++; break // (
  50866. case 0x29: paren--; break // )
  50867. case 0x5B: square++; break // [
  50868. case 0x5D: square--; break // ]
  50869. case 0x7B: curly++; break // {
  50870. case 0x7D: curly--; break // }
  50871. }
  50872. if (c === 0x2f) { // /
  50873. var j = i - 1;
  50874. var p = (void 0);
  50875. // find first non-whitespace prev char
  50876. for (; j >= 0; j--) {
  50877. p = exp.charAt(j);
  50878. if (p !== ' ') { break }
  50879. }
  50880. if (!p || !validDivisionCharRE.test(p)) {
  50881. inRegex = true;
  50882. }
  50883. }
  50884. }
  50885. }
  50886. if (expression === undefined) {
  50887. expression = exp.slice(0, i).trim();
  50888. } else if (lastFilterIndex !== 0) {
  50889. pushFilter();
  50890. }
  50891. function pushFilter () {
  50892. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50893. lastFilterIndex = i + 1;
  50894. }
  50895. if (filters) {
  50896. for (i = 0; i < filters.length; i++) {
  50897. expression = wrapFilter(expression, filters[i]);
  50898. }
  50899. }
  50900. return expression
  50901. }
  50902. function wrapFilter (exp, filter) {
  50903. var i = filter.indexOf('(');
  50904. if (i < 0) {
  50905. // _f: resolveFilter
  50906. return ("_f(\"" + filter + "\")(" + exp + ")")
  50907. } else {
  50908. var name = filter.slice(0, i);
  50909. var args = filter.slice(i + 1);
  50910. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50911. }
  50912. }
  50913. /* */
  50914. /* eslint-disable no-unused-vars */
  50915. function baseWarn (msg, range) {
  50916. console.error(("[Vue compiler]: " + msg));
  50917. }
  50918. /* eslint-enable no-unused-vars */
  50919. function pluckModuleFunction (
  50920. modules,
  50921. key
  50922. ) {
  50923. return modules
  50924. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50925. : []
  50926. }
  50927. function addProp (el, name, value, range, dynamic) {
  50928. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50929. el.plain = false;
  50930. }
  50931. function addAttr (el, name, value, range, dynamic) {
  50932. var attrs = dynamic
  50933. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50934. : (el.attrs || (el.attrs = []));
  50935. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50936. el.plain = false;
  50937. }
  50938. // add a raw attr (use this in preTransforms)
  50939. function addRawAttr (el, name, value, range) {
  50940. el.attrsMap[name] = value;
  50941. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50942. }
  50943. function addDirective (
  50944. el,
  50945. name,
  50946. rawName,
  50947. value,
  50948. arg,
  50949. isDynamicArg,
  50950. modifiers,
  50951. range
  50952. ) {
  50953. (el.directives || (el.directives = [])).push(rangeSetItem({
  50954. name: name,
  50955. rawName: rawName,
  50956. value: value,
  50957. arg: arg,
  50958. isDynamicArg: isDynamicArg,
  50959. modifiers: modifiers
  50960. }, range));
  50961. el.plain = false;
  50962. }
  50963. function prependModifierMarker (symbol, name, dynamic) {
  50964. return dynamic
  50965. ? ("_p(" + name + ",\"" + symbol + "\")")
  50966. : symbol + name // mark the event as captured
  50967. }
  50968. function addHandler (
  50969. el,
  50970. name,
  50971. value,
  50972. modifiers,
  50973. important,
  50974. warn,
  50975. range,
  50976. dynamic
  50977. ) {
  50978. modifiers = modifiers || emptyObject;
  50979. // warn prevent and passive modifier
  50980. /* istanbul ignore if */
  50981. if (
  50982. warn &&
  50983. modifiers.prevent && modifiers.passive
  50984. ) {
  50985. warn(
  50986. 'passive and prevent can\'t be used together. ' +
  50987. 'Passive handler can\'t prevent default event.',
  50988. range
  50989. );
  50990. }
  50991. // normalize click.right and click.middle since they don't actually fire
  50992. // this is technically browser-specific, but at least for now browsers are
  50993. // the only target envs that have right/middle clicks.
  50994. if (modifiers.right) {
  50995. if (dynamic) {
  50996. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50997. } else if (name === 'click') {
  50998. name = 'contextmenu';
  50999. delete modifiers.right;
  51000. }
  51001. } else if (modifiers.middle) {
  51002. if (dynamic) {
  51003. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51004. } else if (name === 'click') {
  51005. name = 'mouseup';
  51006. }
  51007. }
  51008. // check capture modifier
  51009. if (modifiers.capture) {
  51010. delete modifiers.capture;
  51011. name = prependModifierMarker('!', name, dynamic);
  51012. }
  51013. if (modifiers.once) {
  51014. delete modifiers.once;
  51015. name = prependModifierMarker('~', name, dynamic);
  51016. }
  51017. /* istanbul ignore if */
  51018. if (modifiers.passive) {
  51019. delete modifiers.passive;
  51020. name = prependModifierMarker('&', name, dynamic);
  51021. }
  51022. var events;
  51023. if (modifiers.native) {
  51024. delete modifiers.native;
  51025. events = el.nativeEvents || (el.nativeEvents = {});
  51026. } else {
  51027. events = el.events || (el.events = {});
  51028. }
  51029. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51030. if (modifiers !== emptyObject) {
  51031. newHandler.modifiers = modifiers;
  51032. }
  51033. var handlers = events[name];
  51034. /* istanbul ignore if */
  51035. if (Array.isArray(handlers)) {
  51036. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51037. } else if (handlers) {
  51038. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51039. } else {
  51040. events[name] = newHandler;
  51041. }
  51042. el.plain = false;
  51043. }
  51044. function getRawBindingAttr (
  51045. el,
  51046. name
  51047. ) {
  51048. return el.rawAttrsMap[':' + name] ||
  51049. el.rawAttrsMap['v-bind:' + name] ||
  51050. el.rawAttrsMap[name]
  51051. }
  51052. function getBindingAttr (
  51053. el,
  51054. name,
  51055. getStatic
  51056. ) {
  51057. var dynamicValue =
  51058. getAndRemoveAttr(el, ':' + name) ||
  51059. getAndRemoveAttr(el, 'v-bind:' + name);
  51060. if (dynamicValue != null) {
  51061. return parseFilters(dynamicValue)
  51062. } else if (getStatic !== false) {
  51063. var staticValue = getAndRemoveAttr(el, name);
  51064. if (staticValue != null) {
  51065. return JSON.stringify(staticValue)
  51066. }
  51067. }
  51068. }
  51069. // note: this only removes the attr from the Array (attrsList) so that it
  51070. // doesn't get processed by processAttrs.
  51071. // By default it does NOT remove it from the map (attrsMap) because the map is
  51072. // needed during codegen.
  51073. function getAndRemoveAttr (
  51074. el,
  51075. name,
  51076. removeFromMap
  51077. ) {
  51078. var val;
  51079. if ((val = el.attrsMap[name]) != null) {
  51080. var list = el.attrsList;
  51081. for (var i = 0, l = list.length; i < l; i++) {
  51082. if (list[i].name === name) {
  51083. list.splice(i, 1);
  51084. break
  51085. }
  51086. }
  51087. }
  51088. if (removeFromMap) {
  51089. delete el.attrsMap[name];
  51090. }
  51091. return val
  51092. }
  51093. function getAndRemoveAttrByRegex (
  51094. el,
  51095. name
  51096. ) {
  51097. var list = el.attrsList;
  51098. for (var i = 0, l = list.length; i < l; i++) {
  51099. var attr = list[i];
  51100. if (name.test(attr.name)) {
  51101. list.splice(i, 1);
  51102. return attr
  51103. }
  51104. }
  51105. }
  51106. function rangeSetItem (
  51107. item,
  51108. range
  51109. ) {
  51110. if (range) {
  51111. if (range.start != null) {
  51112. item.start = range.start;
  51113. }
  51114. if (range.end != null) {
  51115. item.end = range.end;
  51116. }
  51117. }
  51118. return item
  51119. }
  51120. /* */
  51121. /**
  51122. * Cross-platform code generation for component v-model
  51123. */
  51124. function genComponentModel (
  51125. el,
  51126. value,
  51127. modifiers
  51128. ) {
  51129. var ref = modifiers || {};
  51130. var number = ref.number;
  51131. var trim = ref.trim;
  51132. var baseValueExpression = '$$v';
  51133. var valueExpression = baseValueExpression;
  51134. if (trim) {
  51135. valueExpression =
  51136. "(typeof " + baseValueExpression + " === 'string'" +
  51137. "? " + baseValueExpression + ".trim()" +
  51138. ": " + baseValueExpression + ")";
  51139. }
  51140. if (number) {
  51141. valueExpression = "_n(" + valueExpression + ")";
  51142. }
  51143. var assignment = genAssignmentCode(value, valueExpression);
  51144. el.model = {
  51145. value: ("(" + value + ")"),
  51146. expression: JSON.stringify(value),
  51147. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51148. };
  51149. }
  51150. /**
  51151. * Cross-platform codegen helper for generating v-model value assignment code.
  51152. */
  51153. function genAssignmentCode (
  51154. value,
  51155. assignment
  51156. ) {
  51157. var res = parseModel(value);
  51158. if (res.key === null) {
  51159. return (value + "=" + assignment)
  51160. } else {
  51161. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51162. }
  51163. }
  51164. /**
  51165. * Parse a v-model expression into a base path and a final key segment.
  51166. * Handles both dot-path and possible square brackets.
  51167. *
  51168. * Possible cases:
  51169. *
  51170. * - test
  51171. * - test[key]
  51172. * - test[test1[key]]
  51173. * - test["a"][key]
  51174. * - xxx.test[a[a].test1[key]]
  51175. * - test.xxx.a["asa"][test1[key]]
  51176. *
  51177. */
  51178. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51179. function parseModel (val) {
  51180. // Fix https://github.com/vuejs/vue/pull/7730
  51181. // allow v-model="obj.val " (trailing whitespace)
  51182. val = val.trim();
  51183. len = val.length;
  51184. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51185. index$1 = val.lastIndexOf('.');
  51186. if (index$1 > -1) {
  51187. return {
  51188. exp: val.slice(0, index$1),
  51189. key: '"' + val.slice(index$1 + 1) + '"'
  51190. }
  51191. } else {
  51192. return {
  51193. exp: val,
  51194. key: null
  51195. }
  51196. }
  51197. }
  51198. str = val;
  51199. index$1 = expressionPos = expressionEndPos = 0;
  51200. while (!eof()) {
  51201. chr = next();
  51202. /* istanbul ignore if */
  51203. if (isStringStart(chr)) {
  51204. parseString(chr);
  51205. } else if (chr === 0x5B) {
  51206. parseBracket(chr);
  51207. }
  51208. }
  51209. return {
  51210. exp: val.slice(0, expressionPos),
  51211. key: val.slice(expressionPos + 1, expressionEndPos)
  51212. }
  51213. }
  51214. function next () {
  51215. return str.charCodeAt(++index$1)
  51216. }
  51217. function eof () {
  51218. return index$1 >= len
  51219. }
  51220. function isStringStart (chr) {
  51221. return chr === 0x22 || chr === 0x27
  51222. }
  51223. function parseBracket (chr) {
  51224. var inBracket = 1;
  51225. expressionPos = index$1;
  51226. while (!eof()) {
  51227. chr = next();
  51228. if (isStringStart(chr)) {
  51229. parseString(chr);
  51230. continue
  51231. }
  51232. if (chr === 0x5B) { inBracket++; }
  51233. if (chr === 0x5D) { inBracket--; }
  51234. if (inBracket === 0) {
  51235. expressionEndPos = index$1;
  51236. break
  51237. }
  51238. }
  51239. }
  51240. function parseString (chr) {
  51241. var stringQuote = chr;
  51242. while (!eof()) {
  51243. chr = next();
  51244. if (chr === stringQuote) {
  51245. break
  51246. }
  51247. }
  51248. }
  51249. /* */
  51250. var warn$1;
  51251. // in some cases, the event used has to be determined at runtime
  51252. // so we used some reserved tokens during compile.
  51253. var RANGE_TOKEN = '__r';
  51254. var CHECKBOX_RADIO_TOKEN = '__c';
  51255. function model (
  51256. el,
  51257. dir,
  51258. _warn
  51259. ) {
  51260. warn$1 = _warn;
  51261. var value = dir.value;
  51262. var modifiers = dir.modifiers;
  51263. var tag = el.tag;
  51264. var type = el.attrsMap.type;
  51265. {
  51266. // inputs with type="file" are read only and setting the input's
  51267. // value will throw an error.
  51268. if (tag === 'input' && type === 'file') {
  51269. warn$1(
  51270. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51271. "File inputs are read only. Use a v-on:change listener instead.",
  51272. el.rawAttrsMap['v-model']
  51273. );
  51274. }
  51275. }
  51276. if (el.component) {
  51277. genComponentModel(el, value, modifiers);
  51278. // component v-model doesn't need extra runtime
  51279. return false
  51280. } else if (tag === 'select') {
  51281. genSelect(el, value, modifiers);
  51282. } else if (tag === 'input' && type === 'checkbox') {
  51283. genCheckboxModel(el, value, modifiers);
  51284. } else if (tag === 'input' && type === 'radio') {
  51285. genRadioModel(el, value, modifiers);
  51286. } else if (tag === 'input' || tag === 'textarea') {
  51287. genDefaultModel(el, value, modifiers);
  51288. } else if (!config.isReservedTag(tag)) {
  51289. genComponentModel(el, value, modifiers);
  51290. // component v-model doesn't need extra runtime
  51291. return false
  51292. } else {
  51293. warn$1(
  51294. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51295. "v-model is not supported on this element type. " +
  51296. 'If you are working with contenteditable, it\'s recommended to ' +
  51297. 'wrap a library dedicated for that purpose inside a custom component.',
  51298. el.rawAttrsMap['v-model']
  51299. );
  51300. }
  51301. // ensure runtime directive metadata
  51302. return true
  51303. }
  51304. function genCheckboxModel (
  51305. el,
  51306. value,
  51307. modifiers
  51308. ) {
  51309. var number = modifiers && modifiers.number;
  51310. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51311. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51312. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51313. addProp(el, 'checked',
  51314. "Array.isArray(" + value + ")" +
  51315. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51316. trueValueBinding === 'true'
  51317. ? (":(" + value + ")")
  51318. : (":_q(" + value + "," + trueValueBinding + ")")
  51319. )
  51320. );
  51321. addHandler(el, 'change',
  51322. "var $$a=" + value + "," +
  51323. '$$el=$event.target,' +
  51324. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51325. 'if(Array.isArray($$a)){' +
  51326. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51327. '$$i=_i($$a,$$v);' +
  51328. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51329. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51330. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51331. null, true
  51332. );
  51333. }
  51334. function genRadioModel (
  51335. el,
  51336. value,
  51337. modifiers
  51338. ) {
  51339. var number = modifiers && modifiers.number;
  51340. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51341. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51342. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51343. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51344. }
  51345. function genSelect (
  51346. el,
  51347. value,
  51348. modifiers
  51349. ) {
  51350. var number = modifiers && modifiers.number;
  51351. var selectedVal = "Array.prototype.filter" +
  51352. ".call($event.target.options,function(o){return o.selected})" +
  51353. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51354. "return " + (number ? '_n(val)' : 'val') + "})";
  51355. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51356. var code = "var $$selectedVal = " + selectedVal + ";";
  51357. code = code + " " + (genAssignmentCode(value, assignment));
  51358. addHandler(el, 'change', code, null, true);
  51359. }
  51360. function genDefaultModel (
  51361. el,
  51362. value,
  51363. modifiers
  51364. ) {
  51365. var type = el.attrsMap.type;
  51366. // warn if v-bind:value conflicts with v-model
  51367. // except for inputs with v-bind:type
  51368. {
  51369. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51370. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51371. if (value$1 && !typeBinding) {
  51372. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51373. warn$1(
  51374. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51375. 'because the latter already expands to a value binding internally',
  51376. el.rawAttrsMap[binding]
  51377. );
  51378. }
  51379. }
  51380. var ref = modifiers || {};
  51381. var lazy = ref.lazy;
  51382. var number = ref.number;
  51383. var trim = ref.trim;
  51384. var needCompositionGuard = !lazy && type !== 'range';
  51385. var event = lazy
  51386. ? 'change'
  51387. : type === 'range'
  51388. ? RANGE_TOKEN
  51389. : 'input';
  51390. var valueExpression = '$event.target.value';
  51391. if (trim) {
  51392. valueExpression = "$event.target.value.trim()";
  51393. }
  51394. if (number) {
  51395. valueExpression = "_n(" + valueExpression + ")";
  51396. }
  51397. var code = genAssignmentCode(value, valueExpression);
  51398. if (needCompositionGuard) {
  51399. code = "if($event.target.composing)return;" + code;
  51400. }
  51401. addProp(el, 'value', ("(" + value + ")"));
  51402. addHandler(el, event, code, null, true);
  51403. if (trim || number) {
  51404. addHandler(el, 'blur', '$forceUpdate()');
  51405. }
  51406. }
  51407. /* */
  51408. // normalize v-model event tokens that can only be determined at runtime.
  51409. // it's important to place the event as the first in the array because
  51410. // the whole point is ensuring the v-model callback gets called before
  51411. // user-attached handlers.
  51412. function normalizeEvents (on) {
  51413. /* istanbul ignore if */
  51414. if (isDef(on[RANGE_TOKEN])) {
  51415. // IE input[type=range] only supports `change` event
  51416. var event = isIE ? 'change' : 'input';
  51417. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51418. delete on[RANGE_TOKEN];
  51419. }
  51420. // This was originally intended to fix #4521 but no longer necessary
  51421. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51422. /* istanbul ignore if */
  51423. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51424. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51425. delete on[CHECKBOX_RADIO_TOKEN];
  51426. }
  51427. }
  51428. var target$1;
  51429. function createOnceHandler$1 (event, handler, capture) {
  51430. var _target = target$1; // save current target element in closure
  51431. return function onceHandler () {
  51432. var res = handler.apply(null, arguments);
  51433. if (res !== null) {
  51434. remove$2(event, onceHandler, capture, _target);
  51435. }
  51436. }
  51437. }
  51438. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51439. // implementation and does not fire microtasks in between event propagation, so
  51440. // safe to exclude.
  51441. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51442. function add$1 (
  51443. name,
  51444. handler,
  51445. capture,
  51446. passive
  51447. ) {
  51448. // async edge case #6566: inner click event triggers patch, event handler
  51449. // attached to outer element during patch, and triggered again. This
  51450. // happens because browsers fire microtask ticks between event propagation.
  51451. // the solution is simple: we save the timestamp when a handler is attached,
  51452. // and the handler would only fire if the event passed to it was fired
  51453. // AFTER it was attached.
  51454. if (useMicrotaskFix) {
  51455. var attachedTimestamp = currentFlushTimestamp;
  51456. var original = handler;
  51457. handler = original._wrapper = function (e) {
  51458. if (
  51459. // no bubbling, should always fire.
  51460. // this is just a safety net in case event.timeStamp is unreliable in
  51461. // certain weird environments...
  51462. e.target === e.currentTarget ||
  51463. // event is fired after handler attachment
  51464. e.timeStamp >= attachedTimestamp ||
  51465. // bail for environments that have buggy event.timeStamp implementations
  51466. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51467. // #9681 QtWebEngine event.timeStamp is negative value
  51468. e.timeStamp <= 0 ||
  51469. // #9448 bail if event is fired in another document in a multi-page
  51470. // electron/nw.js app, since event.timeStamp will be using a different
  51471. // starting reference
  51472. e.target.ownerDocument !== document
  51473. ) {
  51474. return original.apply(this, arguments)
  51475. }
  51476. };
  51477. }
  51478. target$1.addEventListener(
  51479. name,
  51480. handler,
  51481. supportsPassive
  51482. ? { capture: capture, passive: passive }
  51483. : capture
  51484. );
  51485. }
  51486. function remove$2 (
  51487. name,
  51488. handler,
  51489. capture,
  51490. _target
  51491. ) {
  51492. (_target || target$1).removeEventListener(
  51493. name,
  51494. handler._wrapper || handler,
  51495. capture
  51496. );
  51497. }
  51498. function updateDOMListeners (oldVnode, vnode) {
  51499. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51500. return
  51501. }
  51502. var on = vnode.data.on || {};
  51503. var oldOn = oldVnode.data.on || {};
  51504. target$1 = vnode.elm;
  51505. normalizeEvents(on);
  51506. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51507. target$1 = undefined;
  51508. }
  51509. var events = {
  51510. create: updateDOMListeners,
  51511. update: updateDOMListeners
  51512. };
  51513. /* */
  51514. var svgContainer;
  51515. function updateDOMProps (oldVnode, vnode) {
  51516. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51517. return
  51518. }
  51519. var key, cur;
  51520. var elm = vnode.elm;
  51521. var oldProps = oldVnode.data.domProps || {};
  51522. var props = vnode.data.domProps || {};
  51523. // clone observed objects, as the user probably wants to mutate it
  51524. if (isDef(props.__ob__)) {
  51525. props = vnode.data.domProps = extend({}, props);
  51526. }
  51527. for (key in oldProps) {
  51528. if (!(key in props)) {
  51529. elm[key] = '';
  51530. }
  51531. }
  51532. for (key in props) {
  51533. cur = props[key];
  51534. // ignore children if the node has textContent or innerHTML,
  51535. // as these will throw away existing DOM nodes and cause removal errors
  51536. // on subsequent patches (#3360)
  51537. if (key === 'textContent' || key === 'innerHTML') {
  51538. if (vnode.children) { vnode.children.length = 0; }
  51539. if (cur === oldProps[key]) { continue }
  51540. // #6601 work around Chrome version <= 55 bug where single textNode
  51541. // replaced by innerHTML/textContent retains its parentNode property
  51542. if (elm.childNodes.length === 1) {
  51543. elm.removeChild(elm.childNodes[0]);
  51544. }
  51545. }
  51546. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51547. // store value as _value as well since
  51548. // non-string values will be stringified
  51549. elm._value = cur;
  51550. // avoid resetting cursor position when value is the same
  51551. var strCur = isUndef(cur) ? '' : String(cur);
  51552. if (shouldUpdateValue(elm, strCur)) {
  51553. elm.value = strCur;
  51554. }
  51555. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51556. // IE doesn't support innerHTML for SVG elements
  51557. svgContainer = svgContainer || document.createElement('div');
  51558. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51559. var svg = svgContainer.firstChild;
  51560. while (elm.firstChild) {
  51561. elm.removeChild(elm.firstChild);
  51562. }
  51563. while (svg.firstChild) {
  51564. elm.appendChild(svg.firstChild);
  51565. }
  51566. } else if (
  51567. // skip the update if old and new VDOM state is the same.
  51568. // `value` is handled separately because the DOM value may be temporarily
  51569. // out of sync with VDOM state due to focus, composition and modifiers.
  51570. // This #4521 by skipping the unnecesarry `checked` update.
  51571. cur !== oldProps[key]
  51572. ) {
  51573. // some property updates can throw
  51574. // e.g. `value` on <progress> w/ non-finite value
  51575. try {
  51576. elm[key] = cur;
  51577. } catch (e) {}
  51578. }
  51579. }
  51580. }
  51581. // check platforms/web/util/attrs.js acceptValue
  51582. function shouldUpdateValue (elm, checkVal) {
  51583. return (!elm.composing && (
  51584. elm.tagName === 'OPTION' ||
  51585. isNotInFocusAndDirty(elm, checkVal) ||
  51586. isDirtyWithModifiers(elm, checkVal)
  51587. ))
  51588. }
  51589. function isNotInFocusAndDirty (elm, checkVal) {
  51590. // return true when textbox (.number and .trim) loses focus and its value is
  51591. // not equal to the updated value
  51592. var notInFocus = true;
  51593. // #6157
  51594. // work around IE bug when accessing document.activeElement in an iframe
  51595. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51596. return notInFocus && elm.value !== checkVal
  51597. }
  51598. function isDirtyWithModifiers (elm, newVal) {
  51599. var value = elm.value;
  51600. var modifiers = elm._vModifiers; // injected by v-model runtime
  51601. if (isDef(modifiers)) {
  51602. if (modifiers.number) {
  51603. return toNumber(value) !== toNumber(newVal)
  51604. }
  51605. if (modifiers.trim) {
  51606. return value.trim() !== newVal.trim()
  51607. }
  51608. }
  51609. return value !== newVal
  51610. }
  51611. var domProps = {
  51612. create: updateDOMProps,
  51613. update: updateDOMProps
  51614. };
  51615. /* */
  51616. var parseStyleText = cached(function (cssText) {
  51617. var res = {};
  51618. var listDelimiter = /;(?![^(]*\))/g;
  51619. var propertyDelimiter = /:(.+)/;
  51620. cssText.split(listDelimiter).forEach(function (item) {
  51621. if (item) {
  51622. var tmp = item.split(propertyDelimiter);
  51623. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51624. }
  51625. });
  51626. return res
  51627. });
  51628. // merge static and dynamic style data on the same vnode
  51629. function normalizeStyleData (data) {
  51630. var style = normalizeStyleBinding(data.style);
  51631. // static style is pre-processed into an object during compilation
  51632. // and is always a fresh object, so it's safe to merge into it
  51633. return data.staticStyle
  51634. ? extend(data.staticStyle, style)
  51635. : style
  51636. }
  51637. // normalize possible array / string values into Object
  51638. function normalizeStyleBinding (bindingStyle) {
  51639. if (Array.isArray(bindingStyle)) {
  51640. return toObject(bindingStyle)
  51641. }
  51642. if (typeof bindingStyle === 'string') {
  51643. return parseStyleText(bindingStyle)
  51644. }
  51645. return bindingStyle
  51646. }
  51647. /**
  51648. * parent component style should be after child's
  51649. * so that parent component's style could override it
  51650. */
  51651. function getStyle (vnode, checkChild) {
  51652. var res = {};
  51653. var styleData;
  51654. if (checkChild) {
  51655. var childNode = vnode;
  51656. while (childNode.componentInstance) {
  51657. childNode = childNode.componentInstance._vnode;
  51658. if (
  51659. childNode && childNode.data &&
  51660. (styleData = normalizeStyleData(childNode.data))
  51661. ) {
  51662. extend(res, styleData);
  51663. }
  51664. }
  51665. }
  51666. if ((styleData = normalizeStyleData(vnode.data))) {
  51667. extend(res, styleData);
  51668. }
  51669. var parentNode = vnode;
  51670. while ((parentNode = parentNode.parent)) {
  51671. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51672. extend(res, styleData);
  51673. }
  51674. }
  51675. return res
  51676. }
  51677. /* */
  51678. var cssVarRE = /^--/;
  51679. var importantRE = /\s*!important$/;
  51680. var setProp = function (el, name, val) {
  51681. /* istanbul ignore if */
  51682. if (cssVarRE.test(name)) {
  51683. el.style.setProperty(name, val);
  51684. } else if (importantRE.test(val)) {
  51685. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51686. } else {
  51687. var normalizedName = normalize(name);
  51688. if (Array.isArray(val)) {
  51689. // Support values array created by autoprefixer, e.g.
  51690. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51691. // Set them one by one, and the browser will only set those it can recognize
  51692. for (var i = 0, len = val.length; i < len; i++) {
  51693. el.style[normalizedName] = val[i];
  51694. }
  51695. } else {
  51696. el.style[normalizedName] = val;
  51697. }
  51698. }
  51699. };
  51700. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51701. var emptyStyle;
  51702. var normalize = cached(function (prop) {
  51703. emptyStyle = emptyStyle || document.createElement('div').style;
  51704. prop = camelize(prop);
  51705. if (prop !== 'filter' && (prop in emptyStyle)) {
  51706. return prop
  51707. }
  51708. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51709. for (var i = 0; i < vendorNames.length; i++) {
  51710. var name = vendorNames[i] + capName;
  51711. if (name in emptyStyle) {
  51712. return name
  51713. }
  51714. }
  51715. });
  51716. function updateStyle (oldVnode, vnode) {
  51717. var data = vnode.data;
  51718. var oldData = oldVnode.data;
  51719. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51720. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51721. ) {
  51722. return
  51723. }
  51724. var cur, name;
  51725. var el = vnode.elm;
  51726. var oldStaticStyle = oldData.staticStyle;
  51727. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51728. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51729. var oldStyle = oldStaticStyle || oldStyleBinding;
  51730. var style = normalizeStyleBinding(vnode.data.style) || {};
  51731. // store normalized style under a different key for next diff
  51732. // make sure to clone it if it's reactive, since the user likely wants
  51733. // to mutate it.
  51734. vnode.data.normalizedStyle = isDef(style.__ob__)
  51735. ? extend({}, style)
  51736. : style;
  51737. var newStyle = getStyle(vnode, true);
  51738. for (name in oldStyle) {
  51739. if (isUndef(newStyle[name])) {
  51740. setProp(el, name, '');
  51741. }
  51742. }
  51743. for (name in newStyle) {
  51744. cur = newStyle[name];
  51745. if (cur !== oldStyle[name]) {
  51746. // ie9 setting to null has no effect, must use empty string
  51747. setProp(el, name, cur == null ? '' : cur);
  51748. }
  51749. }
  51750. }
  51751. var style = {
  51752. create: updateStyle,
  51753. update: updateStyle
  51754. };
  51755. /* */
  51756. var whitespaceRE = /\s+/;
  51757. /**
  51758. * Add class with compatibility for SVG since classList is not supported on
  51759. * SVG elements in IE
  51760. */
  51761. function addClass (el, cls) {
  51762. /* istanbul ignore if */
  51763. if (!cls || !(cls = cls.trim())) {
  51764. return
  51765. }
  51766. /* istanbul ignore else */
  51767. if (el.classList) {
  51768. if (cls.indexOf(' ') > -1) {
  51769. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51770. } else {
  51771. el.classList.add(cls);
  51772. }
  51773. } else {
  51774. var cur = " " + (el.getAttribute('class') || '') + " ";
  51775. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51776. el.setAttribute('class', (cur + cls).trim());
  51777. }
  51778. }
  51779. }
  51780. /**
  51781. * Remove class with compatibility for SVG since classList is not supported on
  51782. * SVG elements in IE
  51783. */
  51784. function removeClass (el, cls) {
  51785. /* istanbul ignore if */
  51786. if (!cls || !(cls = cls.trim())) {
  51787. return
  51788. }
  51789. /* istanbul ignore else */
  51790. if (el.classList) {
  51791. if (cls.indexOf(' ') > -1) {
  51792. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51793. } else {
  51794. el.classList.remove(cls);
  51795. }
  51796. if (!el.classList.length) {
  51797. el.removeAttribute('class');
  51798. }
  51799. } else {
  51800. var cur = " " + (el.getAttribute('class') || '') + " ";
  51801. var tar = ' ' + cls + ' ';
  51802. while (cur.indexOf(tar) >= 0) {
  51803. cur = cur.replace(tar, ' ');
  51804. }
  51805. cur = cur.trim();
  51806. if (cur) {
  51807. el.setAttribute('class', cur);
  51808. } else {
  51809. el.removeAttribute('class');
  51810. }
  51811. }
  51812. }
  51813. /* */
  51814. function resolveTransition (def$$1) {
  51815. if (!def$$1) {
  51816. return
  51817. }
  51818. /* istanbul ignore else */
  51819. if (typeof def$$1 === 'object') {
  51820. var res = {};
  51821. if (def$$1.css !== false) {
  51822. extend(res, autoCssTransition(def$$1.name || 'v'));
  51823. }
  51824. extend(res, def$$1);
  51825. return res
  51826. } else if (typeof def$$1 === 'string') {
  51827. return autoCssTransition(def$$1)
  51828. }
  51829. }
  51830. var autoCssTransition = cached(function (name) {
  51831. return {
  51832. enterClass: (name + "-enter"),
  51833. enterToClass: (name + "-enter-to"),
  51834. enterActiveClass: (name + "-enter-active"),
  51835. leaveClass: (name + "-leave"),
  51836. leaveToClass: (name + "-leave-to"),
  51837. leaveActiveClass: (name + "-leave-active")
  51838. }
  51839. });
  51840. var hasTransition = inBrowser && !isIE9;
  51841. var TRANSITION = 'transition';
  51842. var ANIMATION = 'animation';
  51843. // Transition property/event sniffing
  51844. var transitionProp = 'transition';
  51845. var transitionEndEvent = 'transitionend';
  51846. var animationProp = 'animation';
  51847. var animationEndEvent = 'animationend';
  51848. if (hasTransition) {
  51849. /* istanbul ignore if */
  51850. if (window.ontransitionend === undefined &&
  51851. window.onwebkittransitionend !== undefined
  51852. ) {
  51853. transitionProp = 'WebkitTransition';
  51854. transitionEndEvent = 'webkitTransitionEnd';
  51855. }
  51856. if (window.onanimationend === undefined &&
  51857. window.onwebkitanimationend !== undefined
  51858. ) {
  51859. animationProp = 'WebkitAnimation';
  51860. animationEndEvent = 'webkitAnimationEnd';
  51861. }
  51862. }
  51863. // binding to window is necessary to make hot reload work in IE in strict mode
  51864. var raf = inBrowser
  51865. ? window.requestAnimationFrame
  51866. ? window.requestAnimationFrame.bind(window)
  51867. : setTimeout
  51868. : /* istanbul ignore next */ function (fn) { return fn(); };
  51869. function nextFrame (fn) {
  51870. raf(function () {
  51871. raf(fn);
  51872. });
  51873. }
  51874. function addTransitionClass (el, cls) {
  51875. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51876. if (transitionClasses.indexOf(cls) < 0) {
  51877. transitionClasses.push(cls);
  51878. addClass(el, cls);
  51879. }
  51880. }
  51881. function removeTransitionClass (el, cls) {
  51882. if (el._transitionClasses) {
  51883. remove(el._transitionClasses, cls);
  51884. }
  51885. removeClass(el, cls);
  51886. }
  51887. function whenTransitionEnds (
  51888. el,
  51889. expectedType,
  51890. cb
  51891. ) {
  51892. var ref = getTransitionInfo(el, expectedType);
  51893. var type = ref.type;
  51894. var timeout = ref.timeout;
  51895. var propCount = ref.propCount;
  51896. if (!type) { return cb() }
  51897. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51898. var ended = 0;
  51899. var end = function () {
  51900. el.removeEventListener(event, onEnd);
  51901. cb();
  51902. };
  51903. var onEnd = function (e) {
  51904. if (e.target === el) {
  51905. if (++ended >= propCount) {
  51906. end();
  51907. }
  51908. }
  51909. };
  51910. setTimeout(function () {
  51911. if (ended < propCount) {
  51912. end();
  51913. }
  51914. }, timeout + 1);
  51915. el.addEventListener(event, onEnd);
  51916. }
  51917. var transformRE = /\b(transform|all)(,|$)/;
  51918. function getTransitionInfo (el, expectedType) {
  51919. var styles = window.getComputedStyle(el);
  51920. // JSDOM may return undefined for transition properties
  51921. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51922. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51923. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51924. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51925. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51926. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51927. var type;
  51928. var timeout = 0;
  51929. var propCount = 0;
  51930. /* istanbul ignore if */
  51931. if (expectedType === TRANSITION) {
  51932. if (transitionTimeout > 0) {
  51933. type = TRANSITION;
  51934. timeout = transitionTimeout;
  51935. propCount = transitionDurations.length;
  51936. }
  51937. } else if (expectedType === ANIMATION) {
  51938. if (animationTimeout > 0) {
  51939. type = ANIMATION;
  51940. timeout = animationTimeout;
  51941. propCount = animationDurations.length;
  51942. }
  51943. } else {
  51944. timeout = Math.max(transitionTimeout, animationTimeout);
  51945. type = timeout > 0
  51946. ? transitionTimeout > animationTimeout
  51947. ? TRANSITION
  51948. : ANIMATION
  51949. : null;
  51950. propCount = type
  51951. ? type === TRANSITION
  51952. ? transitionDurations.length
  51953. : animationDurations.length
  51954. : 0;
  51955. }
  51956. var hasTransform =
  51957. type === TRANSITION &&
  51958. transformRE.test(styles[transitionProp + 'Property']);
  51959. return {
  51960. type: type,
  51961. timeout: timeout,
  51962. propCount: propCount,
  51963. hasTransform: hasTransform
  51964. }
  51965. }
  51966. function getTimeout (delays, durations) {
  51967. /* istanbul ignore next */
  51968. while (delays.length < durations.length) {
  51969. delays = delays.concat(delays);
  51970. }
  51971. return Math.max.apply(null, durations.map(function (d, i) {
  51972. return toMs(d) + toMs(delays[i])
  51973. }))
  51974. }
  51975. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51976. // in a locale-dependent way, using a comma instead of a dot.
  51977. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51978. // as a floor function) causing unexpected behaviors
  51979. function toMs (s) {
  51980. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51981. }
  51982. /* */
  51983. function enter (vnode, toggleDisplay) {
  51984. var el = vnode.elm;
  51985. // call leave callback now
  51986. if (isDef(el._leaveCb)) {
  51987. el._leaveCb.cancelled = true;
  51988. el._leaveCb();
  51989. }
  51990. var data = resolveTransition(vnode.data.transition);
  51991. if (isUndef(data)) {
  51992. return
  51993. }
  51994. /* istanbul ignore if */
  51995. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51996. return
  51997. }
  51998. var css = data.css;
  51999. var type = data.type;
  52000. var enterClass = data.enterClass;
  52001. var enterToClass = data.enterToClass;
  52002. var enterActiveClass = data.enterActiveClass;
  52003. var appearClass = data.appearClass;
  52004. var appearToClass = data.appearToClass;
  52005. var appearActiveClass = data.appearActiveClass;
  52006. var beforeEnter = data.beforeEnter;
  52007. var enter = data.enter;
  52008. var afterEnter = data.afterEnter;
  52009. var enterCancelled = data.enterCancelled;
  52010. var beforeAppear = data.beforeAppear;
  52011. var appear = data.appear;
  52012. var afterAppear = data.afterAppear;
  52013. var appearCancelled = data.appearCancelled;
  52014. var duration = data.duration;
  52015. // activeInstance will always be the <transition> component managing this
  52016. // transition. One edge case to check is when the <transition> is placed
  52017. // as the root node of a child component. In that case we need to check
  52018. // <transition>'s parent for appear check.
  52019. var context = activeInstance;
  52020. var transitionNode = activeInstance.$vnode;
  52021. while (transitionNode && transitionNode.parent) {
  52022. context = transitionNode.context;
  52023. transitionNode = transitionNode.parent;
  52024. }
  52025. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52026. if (isAppear && !appear && appear !== '') {
  52027. return
  52028. }
  52029. var startClass = isAppear && appearClass
  52030. ? appearClass
  52031. : enterClass;
  52032. var activeClass = isAppear && appearActiveClass
  52033. ? appearActiveClass
  52034. : enterActiveClass;
  52035. var toClass = isAppear && appearToClass
  52036. ? appearToClass
  52037. : enterToClass;
  52038. var beforeEnterHook = isAppear
  52039. ? (beforeAppear || beforeEnter)
  52040. : beforeEnter;
  52041. var enterHook = isAppear
  52042. ? (typeof appear === 'function' ? appear : enter)
  52043. : enter;
  52044. var afterEnterHook = isAppear
  52045. ? (afterAppear || afterEnter)
  52046. : afterEnter;
  52047. var enterCancelledHook = isAppear
  52048. ? (appearCancelled || enterCancelled)
  52049. : enterCancelled;
  52050. var explicitEnterDuration = toNumber(
  52051. isObject(duration)
  52052. ? duration.enter
  52053. : duration
  52054. );
  52055. if (explicitEnterDuration != null) {
  52056. checkDuration(explicitEnterDuration, 'enter', vnode);
  52057. }
  52058. var expectsCSS = css !== false && !isIE9;
  52059. var userWantsControl = getHookArgumentsLength(enterHook);
  52060. var cb = el._enterCb = once(function () {
  52061. if (expectsCSS) {
  52062. removeTransitionClass(el, toClass);
  52063. removeTransitionClass(el, activeClass);
  52064. }
  52065. if (cb.cancelled) {
  52066. if (expectsCSS) {
  52067. removeTransitionClass(el, startClass);
  52068. }
  52069. enterCancelledHook && enterCancelledHook(el);
  52070. } else {
  52071. afterEnterHook && afterEnterHook(el);
  52072. }
  52073. el._enterCb = null;
  52074. });
  52075. if (!vnode.data.show) {
  52076. // remove pending leave element on enter by injecting an insert hook
  52077. mergeVNodeHook(vnode, 'insert', function () {
  52078. var parent = el.parentNode;
  52079. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52080. if (pendingNode &&
  52081. pendingNode.tag === vnode.tag &&
  52082. pendingNode.elm._leaveCb
  52083. ) {
  52084. pendingNode.elm._leaveCb();
  52085. }
  52086. enterHook && enterHook(el, cb);
  52087. });
  52088. }
  52089. // start enter transition
  52090. beforeEnterHook && beforeEnterHook(el);
  52091. if (expectsCSS) {
  52092. addTransitionClass(el, startClass);
  52093. addTransitionClass(el, activeClass);
  52094. nextFrame(function () {
  52095. removeTransitionClass(el, startClass);
  52096. if (!cb.cancelled) {
  52097. addTransitionClass(el, toClass);
  52098. if (!userWantsControl) {
  52099. if (isValidDuration(explicitEnterDuration)) {
  52100. setTimeout(cb, explicitEnterDuration);
  52101. } else {
  52102. whenTransitionEnds(el, type, cb);
  52103. }
  52104. }
  52105. }
  52106. });
  52107. }
  52108. if (vnode.data.show) {
  52109. toggleDisplay && toggleDisplay();
  52110. enterHook && enterHook(el, cb);
  52111. }
  52112. if (!expectsCSS && !userWantsControl) {
  52113. cb();
  52114. }
  52115. }
  52116. function leave (vnode, rm) {
  52117. var el = vnode.elm;
  52118. // call enter callback now
  52119. if (isDef(el._enterCb)) {
  52120. el._enterCb.cancelled = true;
  52121. el._enterCb();
  52122. }
  52123. var data = resolveTransition(vnode.data.transition);
  52124. if (isUndef(data) || el.nodeType !== 1) {
  52125. return rm()
  52126. }
  52127. /* istanbul ignore if */
  52128. if (isDef(el._leaveCb)) {
  52129. return
  52130. }
  52131. var css = data.css;
  52132. var type = data.type;
  52133. var leaveClass = data.leaveClass;
  52134. var leaveToClass = data.leaveToClass;
  52135. var leaveActiveClass = data.leaveActiveClass;
  52136. var beforeLeave = data.beforeLeave;
  52137. var leave = data.leave;
  52138. var afterLeave = data.afterLeave;
  52139. var leaveCancelled = data.leaveCancelled;
  52140. var delayLeave = data.delayLeave;
  52141. var duration = data.duration;
  52142. var expectsCSS = css !== false && !isIE9;
  52143. var userWantsControl = getHookArgumentsLength(leave);
  52144. var explicitLeaveDuration = toNumber(
  52145. isObject(duration)
  52146. ? duration.leave
  52147. : duration
  52148. );
  52149. if (isDef(explicitLeaveDuration)) {
  52150. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52151. }
  52152. var cb = el._leaveCb = once(function () {
  52153. if (el.parentNode && el.parentNode._pending) {
  52154. el.parentNode._pending[vnode.key] = null;
  52155. }
  52156. if (expectsCSS) {
  52157. removeTransitionClass(el, leaveToClass);
  52158. removeTransitionClass(el, leaveActiveClass);
  52159. }
  52160. if (cb.cancelled) {
  52161. if (expectsCSS) {
  52162. removeTransitionClass(el, leaveClass);
  52163. }
  52164. leaveCancelled && leaveCancelled(el);
  52165. } else {
  52166. rm();
  52167. afterLeave && afterLeave(el);
  52168. }
  52169. el._leaveCb = null;
  52170. });
  52171. if (delayLeave) {
  52172. delayLeave(performLeave);
  52173. } else {
  52174. performLeave();
  52175. }
  52176. function performLeave () {
  52177. // the delayed leave may have already been cancelled
  52178. if (cb.cancelled) {
  52179. return
  52180. }
  52181. // record leaving element
  52182. if (!vnode.data.show && el.parentNode) {
  52183. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52184. }
  52185. beforeLeave && beforeLeave(el);
  52186. if (expectsCSS) {
  52187. addTransitionClass(el, leaveClass);
  52188. addTransitionClass(el, leaveActiveClass);
  52189. nextFrame(function () {
  52190. removeTransitionClass(el, leaveClass);
  52191. if (!cb.cancelled) {
  52192. addTransitionClass(el, leaveToClass);
  52193. if (!userWantsControl) {
  52194. if (isValidDuration(explicitLeaveDuration)) {
  52195. setTimeout(cb, explicitLeaveDuration);
  52196. } else {
  52197. whenTransitionEnds(el, type, cb);
  52198. }
  52199. }
  52200. }
  52201. });
  52202. }
  52203. leave && leave(el, cb);
  52204. if (!expectsCSS && !userWantsControl) {
  52205. cb();
  52206. }
  52207. }
  52208. }
  52209. // only used in dev mode
  52210. function checkDuration (val, name, vnode) {
  52211. if (typeof val !== 'number') {
  52212. warn(
  52213. "<transition> explicit " + name + " duration is not a valid number - " +
  52214. "got " + (JSON.stringify(val)) + ".",
  52215. vnode.context
  52216. );
  52217. } else if (isNaN(val)) {
  52218. warn(
  52219. "<transition> explicit " + name + " duration is NaN - " +
  52220. 'the duration expression might be incorrect.',
  52221. vnode.context
  52222. );
  52223. }
  52224. }
  52225. function isValidDuration (val) {
  52226. return typeof val === 'number' && !isNaN(val)
  52227. }
  52228. /**
  52229. * Normalize a transition hook's argument length. The hook may be:
  52230. * - a merged hook (invoker) with the original in .fns
  52231. * - a wrapped component method (check ._length)
  52232. * - a plain function (.length)
  52233. */
  52234. function getHookArgumentsLength (fn) {
  52235. if (isUndef(fn)) {
  52236. return false
  52237. }
  52238. var invokerFns = fn.fns;
  52239. if (isDef(invokerFns)) {
  52240. // invoker
  52241. return getHookArgumentsLength(
  52242. Array.isArray(invokerFns)
  52243. ? invokerFns[0]
  52244. : invokerFns
  52245. )
  52246. } else {
  52247. return (fn._length || fn.length) > 1
  52248. }
  52249. }
  52250. function _enter (_, vnode) {
  52251. if (vnode.data.show !== true) {
  52252. enter(vnode);
  52253. }
  52254. }
  52255. var transition = inBrowser ? {
  52256. create: _enter,
  52257. activate: _enter,
  52258. remove: function remove$$1 (vnode, rm) {
  52259. /* istanbul ignore else */
  52260. if (vnode.data.show !== true) {
  52261. leave(vnode, rm);
  52262. } else {
  52263. rm();
  52264. }
  52265. }
  52266. } : {};
  52267. var platformModules = [
  52268. attrs,
  52269. klass,
  52270. events,
  52271. domProps,
  52272. style,
  52273. transition
  52274. ];
  52275. /* */
  52276. // the directive module should be applied last, after all
  52277. // built-in modules have been applied.
  52278. var modules = platformModules.concat(baseModules);
  52279. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52280. /**
  52281. * Not type checking this file because flow doesn't like attaching
  52282. * properties to Elements.
  52283. */
  52284. /* istanbul ignore if */
  52285. if (isIE9) {
  52286. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52287. document.addEventListener('selectionchange', function () {
  52288. var el = document.activeElement;
  52289. if (el && el.vmodel) {
  52290. trigger(el, 'input');
  52291. }
  52292. });
  52293. }
  52294. var directive = {
  52295. inserted: function inserted (el, binding, vnode, oldVnode) {
  52296. if (vnode.tag === 'select') {
  52297. // #6903
  52298. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52299. mergeVNodeHook(vnode, 'postpatch', function () {
  52300. directive.componentUpdated(el, binding, vnode);
  52301. });
  52302. } else {
  52303. setSelected(el, binding, vnode.context);
  52304. }
  52305. el._vOptions = [].map.call(el.options, getValue);
  52306. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52307. el._vModifiers = binding.modifiers;
  52308. if (!binding.modifiers.lazy) {
  52309. el.addEventListener('compositionstart', onCompositionStart);
  52310. el.addEventListener('compositionend', onCompositionEnd);
  52311. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52312. // switching focus before confirming composition choice
  52313. // this also fixes the issue where some browsers e.g. iOS Chrome
  52314. // fires "change" instead of "input" on autocomplete.
  52315. el.addEventListener('change', onCompositionEnd);
  52316. /* istanbul ignore if */
  52317. if (isIE9) {
  52318. el.vmodel = true;
  52319. }
  52320. }
  52321. }
  52322. },
  52323. componentUpdated: function componentUpdated (el, binding, vnode) {
  52324. if (vnode.tag === 'select') {
  52325. setSelected(el, binding, vnode.context);
  52326. // in case the options rendered by v-for have changed,
  52327. // it's possible that the value is out-of-sync with the rendered options.
  52328. // detect such cases and filter out values that no longer has a matching
  52329. // option in the DOM.
  52330. var prevOptions = el._vOptions;
  52331. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52332. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52333. // trigger change event if
  52334. // no matching option found for at least one value
  52335. var needReset = el.multiple
  52336. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52337. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52338. if (needReset) {
  52339. trigger(el, 'change');
  52340. }
  52341. }
  52342. }
  52343. }
  52344. };
  52345. function setSelected (el, binding, vm) {
  52346. actuallySetSelected(el, binding, vm);
  52347. /* istanbul ignore if */
  52348. if (isIE || isEdge) {
  52349. setTimeout(function () {
  52350. actuallySetSelected(el, binding, vm);
  52351. }, 0);
  52352. }
  52353. }
  52354. function actuallySetSelected (el, binding, vm) {
  52355. var value = binding.value;
  52356. var isMultiple = el.multiple;
  52357. if (isMultiple && !Array.isArray(value)) {
  52358. warn(
  52359. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52360. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52361. vm
  52362. );
  52363. return
  52364. }
  52365. var selected, option;
  52366. for (var i = 0, l = el.options.length; i < l; i++) {
  52367. option = el.options[i];
  52368. if (isMultiple) {
  52369. selected = looseIndexOf(value, getValue(option)) > -1;
  52370. if (option.selected !== selected) {
  52371. option.selected = selected;
  52372. }
  52373. } else {
  52374. if (looseEqual(getValue(option), value)) {
  52375. if (el.selectedIndex !== i) {
  52376. el.selectedIndex = i;
  52377. }
  52378. return
  52379. }
  52380. }
  52381. }
  52382. if (!isMultiple) {
  52383. el.selectedIndex = -1;
  52384. }
  52385. }
  52386. function hasNoMatchingOption (value, options) {
  52387. return options.every(function (o) { return !looseEqual(o, value); })
  52388. }
  52389. function getValue (option) {
  52390. return '_value' in option
  52391. ? option._value
  52392. : option.value
  52393. }
  52394. function onCompositionStart (e) {
  52395. e.target.composing = true;
  52396. }
  52397. function onCompositionEnd (e) {
  52398. // prevent triggering an input event for no reason
  52399. if (!e.target.composing) { return }
  52400. e.target.composing = false;
  52401. trigger(e.target, 'input');
  52402. }
  52403. function trigger (el, type) {
  52404. var e = document.createEvent('HTMLEvents');
  52405. e.initEvent(type, true, true);
  52406. el.dispatchEvent(e);
  52407. }
  52408. /* */
  52409. // recursively search for possible transition defined inside the component root
  52410. function locateNode (vnode) {
  52411. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52412. ? locateNode(vnode.componentInstance._vnode)
  52413. : vnode
  52414. }
  52415. var show = {
  52416. bind: function bind (el, ref, vnode) {
  52417. var value = ref.value;
  52418. vnode = locateNode(vnode);
  52419. var transition$$1 = vnode.data && vnode.data.transition;
  52420. var originalDisplay = el.__vOriginalDisplay =
  52421. el.style.display === 'none' ? '' : el.style.display;
  52422. if (value && transition$$1) {
  52423. vnode.data.show = true;
  52424. enter(vnode, function () {
  52425. el.style.display = originalDisplay;
  52426. });
  52427. } else {
  52428. el.style.display = value ? originalDisplay : 'none';
  52429. }
  52430. },
  52431. update: function update (el, ref, vnode) {
  52432. var value = ref.value;
  52433. var oldValue = ref.oldValue;
  52434. /* istanbul ignore if */
  52435. if (!value === !oldValue) { return }
  52436. vnode = locateNode(vnode);
  52437. var transition$$1 = vnode.data && vnode.data.transition;
  52438. if (transition$$1) {
  52439. vnode.data.show = true;
  52440. if (value) {
  52441. enter(vnode, function () {
  52442. el.style.display = el.__vOriginalDisplay;
  52443. });
  52444. } else {
  52445. leave(vnode, function () {
  52446. el.style.display = 'none';
  52447. });
  52448. }
  52449. } else {
  52450. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52451. }
  52452. },
  52453. unbind: function unbind (
  52454. el,
  52455. binding,
  52456. vnode,
  52457. oldVnode,
  52458. isDestroy
  52459. ) {
  52460. if (!isDestroy) {
  52461. el.style.display = el.__vOriginalDisplay;
  52462. }
  52463. }
  52464. };
  52465. var platformDirectives = {
  52466. model: directive,
  52467. show: show
  52468. };
  52469. /* */
  52470. var transitionProps = {
  52471. name: String,
  52472. appear: Boolean,
  52473. css: Boolean,
  52474. mode: String,
  52475. type: String,
  52476. enterClass: String,
  52477. leaveClass: String,
  52478. enterToClass: String,
  52479. leaveToClass: String,
  52480. enterActiveClass: String,
  52481. leaveActiveClass: String,
  52482. appearClass: String,
  52483. appearActiveClass: String,
  52484. appearToClass: String,
  52485. duration: [Number, String, Object]
  52486. };
  52487. // in case the child is also an abstract component, e.g. <keep-alive>
  52488. // we want to recursively retrieve the real component to be rendered
  52489. function getRealChild (vnode) {
  52490. var compOptions = vnode && vnode.componentOptions;
  52491. if (compOptions && compOptions.Ctor.options.abstract) {
  52492. return getRealChild(getFirstComponentChild(compOptions.children))
  52493. } else {
  52494. return vnode
  52495. }
  52496. }
  52497. function extractTransitionData (comp) {
  52498. var data = {};
  52499. var options = comp.$options;
  52500. // props
  52501. for (var key in options.propsData) {
  52502. data[key] = comp[key];
  52503. }
  52504. // events.
  52505. // extract listeners and pass them directly to the transition methods
  52506. var listeners = options._parentListeners;
  52507. for (var key$1 in listeners) {
  52508. data[camelize(key$1)] = listeners[key$1];
  52509. }
  52510. return data
  52511. }
  52512. function placeholder (h, rawChild) {
  52513. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52514. return h('keep-alive', {
  52515. props: rawChild.componentOptions.propsData
  52516. })
  52517. }
  52518. }
  52519. function hasParentTransition (vnode) {
  52520. while ((vnode = vnode.parent)) {
  52521. if (vnode.data.transition) {
  52522. return true
  52523. }
  52524. }
  52525. }
  52526. function isSameChild (child, oldChild) {
  52527. return oldChild.key === child.key && oldChild.tag === child.tag
  52528. }
  52529. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52530. var isVShowDirective = function (d) { return d.name === 'show'; };
  52531. var Transition = {
  52532. name: 'transition',
  52533. props: transitionProps,
  52534. abstract: true,
  52535. render: function render (h) {
  52536. var this$1 = this;
  52537. var children = this.$slots.default;
  52538. if (!children) {
  52539. return
  52540. }
  52541. // filter out text nodes (possible whitespaces)
  52542. children = children.filter(isNotTextNode);
  52543. /* istanbul ignore if */
  52544. if (!children.length) {
  52545. return
  52546. }
  52547. // warn multiple elements
  52548. if (children.length > 1) {
  52549. warn(
  52550. '<transition> can only be used on a single element. Use ' +
  52551. '<transition-group> for lists.',
  52552. this.$parent
  52553. );
  52554. }
  52555. var mode = this.mode;
  52556. // warn invalid mode
  52557. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52558. ) {
  52559. warn(
  52560. 'invalid <transition> mode: ' + mode,
  52561. this.$parent
  52562. );
  52563. }
  52564. var rawChild = children[0];
  52565. // if this is a component root node and the component's
  52566. // parent container node also has transition, skip.
  52567. if (hasParentTransition(this.$vnode)) {
  52568. return rawChild
  52569. }
  52570. // apply transition data to child
  52571. // use getRealChild() to ignore abstract components e.g. keep-alive
  52572. var child = getRealChild(rawChild);
  52573. /* istanbul ignore if */
  52574. if (!child) {
  52575. return rawChild
  52576. }
  52577. if (this._leaving) {
  52578. return placeholder(h, rawChild)
  52579. }
  52580. // ensure a key that is unique to the vnode type and to this transition
  52581. // component instance. This key will be used to remove pending leaving nodes
  52582. // during entering.
  52583. var id = "__transition-" + (this._uid) + "-";
  52584. child.key = child.key == null
  52585. ? child.isComment
  52586. ? id + 'comment'
  52587. : id + child.tag
  52588. : isPrimitive(child.key)
  52589. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52590. : child.key;
  52591. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52592. var oldRawChild = this._vnode;
  52593. var oldChild = getRealChild(oldRawChild);
  52594. // mark v-show
  52595. // so that the transition module can hand over the control to the directive
  52596. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52597. child.data.show = true;
  52598. }
  52599. if (
  52600. oldChild &&
  52601. oldChild.data &&
  52602. !isSameChild(child, oldChild) &&
  52603. !isAsyncPlaceholder(oldChild) &&
  52604. // #6687 component root is a comment node
  52605. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52606. ) {
  52607. // replace old child transition data with fresh one
  52608. // important for dynamic transitions!
  52609. var oldData = oldChild.data.transition = extend({}, data);
  52610. // handle transition mode
  52611. if (mode === 'out-in') {
  52612. // return placeholder node and queue update when leave finishes
  52613. this._leaving = true;
  52614. mergeVNodeHook(oldData, 'afterLeave', function () {
  52615. this$1._leaving = false;
  52616. this$1.$forceUpdate();
  52617. });
  52618. return placeholder(h, rawChild)
  52619. } else if (mode === 'in-out') {
  52620. if (isAsyncPlaceholder(child)) {
  52621. return oldRawChild
  52622. }
  52623. var delayedLeave;
  52624. var performLeave = function () { delayedLeave(); };
  52625. mergeVNodeHook(data, 'afterEnter', performLeave);
  52626. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52627. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52628. }
  52629. }
  52630. return rawChild
  52631. }
  52632. };
  52633. /* */
  52634. var props = extend({
  52635. tag: String,
  52636. moveClass: String
  52637. }, transitionProps);
  52638. delete props.mode;
  52639. var TransitionGroup = {
  52640. props: props,
  52641. beforeMount: function beforeMount () {
  52642. var this$1 = this;
  52643. var update = this._update;
  52644. this._update = function (vnode, hydrating) {
  52645. var restoreActiveInstance = setActiveInstance(this$1);
  52646. // force removing pass
  52647. this$1.__patch__(
  52648. this$1._vnode,
  52649. this$1.kept,
  52650. false, // hydrating
  52651. true // removeOnly (!important, avoids unnecessary moves)
  52652. );
  52653. this$1._vnode = this$1.kept;
  52654. restoreActiveInstance();
  52655. update.call(this$1, vnode, hydrating);
  52656. };
  52657. },
  52658. render: function render (h) {
  52659. var tag = this.tag || this.$vnode.data.tag || 'span';
  52660. var map = Object.create(null);
  52661. var prevChildren = this.prevChildren = this.children;
  52662. var rawChildren = this.$slots.default || [];
  52663. var children = this.children = [];
  52664. var transitionData = extractTransitionData(this);
  52665. for (var i = 0; i < rawChildren.length; i++) {
  52666. var c = rawChildren[i];
  52667. if (c.tag) {
  52668. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52669. children.push(c);
  52670. map[c.key] = c
  52671. ;(c.data || (c.data = {})).transition = transitionData;
  52672. } else {
  52673. var opts = c.componentOptions;
  52674. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52675. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52676. }
  52677. }
  52678. }
  52679. if (prevChildren) {
  52680. var kept = [];
  52681. var removed = [];
  52682. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52683. var c$1 = prevChildren[i$1];
  52684. c$1.data.transition = transitionData;
  52685. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52686. if (map[c$1.key]) {
  52687. kept.push(c$1);
  52688. } else {
  52689. removed.push(c$1);
  52690. }
  52691. }
  52692. this.kept = h(tag, null, kept);
  52693. this.removed = removed;
  52694. }
  52695. return h(tag, null, children)
  52696. },
  52697. updated: function updated () {
  52698. var children = this.prevChildren;
  52699. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52700. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52701. return
  52702. }
  52703. // we divide the work into three loops to avoid mixing DOM reads and writes
  52704. // in each iteration - which helps prevent layout thrashing.
  52705. children.forEach(callPendingCbs);
  52706. children.forEach(recordPosition);
  52707. children.forEach(applyTranslation);
  52708. // force reflow to put everything in position
  52709. // assign to this to avoid being removed in tree-shaking
  52710. // $flow-disable-line
  52711. this._reflow = document.body.offsetHeight;
  52712. children.forEach(function (c) {
  52713. if (c.data.moved) {
  52714. var el = c.elm;
  52715. var s = el.style;
  52716. addTransitionClass(el, moveClass);
  52717. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52718. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52719. if (e && e.target !== el) {
  52720. return
  52721. }
  52722. if (!e || /transform$/.test(e.propertyName)) {
  52723. el.removeEventListener(transitionEndEvent, cb);
  52724. el._moveCb = null;
  52725. removeTransitionClass(el, moveClass);
  52726. }
  52727. });
  52728. }
  52729. });
  52730. },
  52731. methods: {
  52732. hasMove: function hasMove (el, moveClass) {
  52733. /* istanbul ignore if */
  52734. if (!hasTransition) {
  52735. return false
  52736. }
  52737. /* istanbul ignore if */
  52738. if (this._hasMove) {
  52739. return this._hasMove
  52740. }
  52741. // Detect whether an element with the move class applied has
  52742. // CSS transitions. Since the element may be inside an entering
  52743. // transition at this very moment, we make a clone of it and remove
  52744. // all other transition classes applied to ensure only the move class
  52745. // is applied.
  52746. var clone = el.cloneNode();
  52747. if (el._transitionClasses) {
  52748. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52749. }
  52750. addClass(clone, moveClass);
  52751. clone.style.display = 'none';
  52752. this.$el.appendChild(clone);
  52753. var info = getTransitionInfo(clone);
  52754. this.$el.removeChild(clone);
  52755. return (this._hasMove = info.hasTransform)
  52756. }
  52757. }
  52758. };
  52759. function callPendingCbs (c) {
  52760. /* istanbul ignore if */
  52761. if (c.elm._moveCb) {
  52762. c.elm._moveCb();
  52763. }
  52764. /* istanbul ignore if */
  52765. if (c.elm._enterCb) {
  52766. c.elm._enterCb();
  52767. }
  52768. }
  52769. function recordPosition (c) {
  52770. c.data.newPos = c.elm.getBoundingClientRect();
  52771. }
  52772. function applyTranslation (c) {
  52773. var oldPos = c.data.pos;
  52774. var newPos = c.data.newPos;
  52775. var dx = oldPos.left - newPos.left;
  52776. var dy = oldPos.top - newPos.top;
  52777. if (dx || dy) {
  52778. c.data.moved = true;
  52779. var s = c.elm.style;
  52780. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52781. s.transitionDuration = '0s';
  52782. }
  52783. }
  52784. var platformComponents = {
  52785. Transition: Transition,
  52786. TransitionGroup: TransitionGroup
  52787. };
  52788. /* */
  52789. // install platform specific utils
  52790. Vue.config.mustUseProp = mustUseProp;
  52791. Vue.config.isReservedTag = isReservedTag;
  52792. Vue.config.isReservedAttr = isReservedAttr;
  52793. Vue.config.getTagNamespace = getTagNamespace;
  52794. Vue.config.isUnknownElement = isUnknownElement;
  52795. // install platform runtime directives & components
  52796. extend(Vue.options.directives, platformDirectives);
  52797. extend(Vue.options.components, platformComponents);
  52798. // install platform patch function
  52799. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52800. // public mount method
  52801. Vue.prototype.$mount = function (
  52802. el,
  52803. hydrating
  52804. ) {
  52805. el = el && inBrowser ? query(el) : undefined;
  52806. return mountComponent(this, el, hydrating)
  52807. };
  52808. // devtools global hook
  52809. /* istanbul ignore next */
  52810. if (inBrowser) {
  52811. setTimeout(function () {
  52812. if (config.devtools) {
  52813. if (devtools) {
  52814. devtools.emit('init', Vue);
  52815. } else {
  52816. console[console.info ? 'info' : 'log'](
  52817. 'Download the Vue Devtools extension for a better development experience:\n' +
  52818. 'https://github.com/vuejs/vue-devtools'
  52819. );
  52820. }
  52821. }
  52822. if (config.productionTip !== false &&
  52823. typeof console !== 'undefined'
  52824. ) {
  52825. console[console.info ? 'info' : 'log'](
  52826. "You are running Vue in development mode.\n" +
  52827. "Make sure to turn on production mode when deploying for production.\n" +
  52828. "See more tips at https://vuejs.org/guide/deployment.html"
  52829. );
  52830. }
  52831. }, 0);
  52832. }
  52833. /* */
  52834. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52835. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52836. var buildRegex = cached(function (delimiters) {
  52837. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52838. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52839. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52840. });
  52841. function parseText (
  52842. text,
  52843. delimiters
  52844. ) {
  52845. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52846. if (!tagRE.test(text)) {
  52847. return
  52848. }
  52849. var tokens = [];
  52850. var rawTokens = [];
  52851. var lastIndex = tagRE.lastIndex = 0;
  52852. var match, index, tokenValue;
  52853. while ((match = tagRE.exec(text))) {
  52854. index = match.index;
  52855. // push text token
  52856. if (index > lastIndex) {
  52857. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52858. tokens.push(JSON.stringify(tokenValue));
  52859. }
  52860. // tag token
  52861. var exp = parseFilters(match[1].trim());
  52862. tokens.push(("_s(" + exp + ")"));
  52863. rawTokens.push({ '@binding': exp });
  52864. lastIndex = index + match[0].length;
  52865. }
  52866. if (lastIndex < text.length) {
  52867. rawTokens.push(tokenValue = text.slice(lastIndex));
  52868. tokens.push(JSON.stringify(tokenValue));
  52869. }
  52870. return {
  52871. expression: tokens.join('+'),
  52872. tokens: rawTokens
  52873. }
  52874. }
  52875. /* */
  52876. function transformNode (el, options) {
  52877. var warn = options.warn || baseWarn;
  52878. var staticClass = getAndRemoveAttr(el, 'class');
  52879. if (staticClass) {
  52880. var res = parseText(staticClass, options.delimiters);
  52881. if (res) {
  52882. warn(
  52883. "class=\"" + staticClass + "\": " +
  52884. 'Interpolation inside attributes has been removed. ' +
  52885. 'Use v-bind or the colon shorthand instead. For example, ' +
  52886. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52887. el.rawAttrsMap['class']
  52888. );
  52889. }
  52890. }
  52891. if (staticClass) {
  52892. el.staticClass = JSON.stringify(staticClass);
  52893. }
  52894. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52895. if (classBinding) {
  52896. el.classBinding = classBinding;
  52897. }
  52898. }
  52899. function genData (el) {
  52900. var data = '';
  52901. if (el.staticClass) {
  52902. data += "staticClass:" + (el.staticClass) + ",";
  52903. }
  52904. if (el.classBinding) {
  52905. data += "class:" + (el.classBinding) + ",";
  52906. }
  52907. return data
  52908. }
  52909. var klass$1 = {
  52910. staticKeys: ['staticClass'],
  52911. transformNode: transformNode,
  52912. genData: genData
  52913. };
  52914. /* */
  52915. function transformNode$1 (el, options) {
  52916. var warn = options.warn || baseWarn;
  52917. var staticStyle = getAndRemoveAttr(el, 'style');
  52918. if (staticStyle) {
  52919. /* istanbul ignore if */
  52920. {
  52921. var res = parseText(staticStyle, options.delimiters);
  52922. if (res) {
  52923. warn(
  52924. "style=\"" + staticStyle + "\": " +
  52925. 'Interpolation inside attributes has been removed. ' +
  52926. 'Use v-bind or the colon shorthand instead. For example, ' +
  52927. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52928. el.rawAttrsMap['style']
  52929. );
  52930. }
  52931. }
  52932. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52933. }
  52934. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52935. if (styleBinding) {
  52936. el.styleBinding = styleBinding;
  52937. }
  52938. }
  52939. function genData$1 (el) {
  52940. var data = '';
  52941. if (el.staticStyle) {
  52942. data += "staticStyle:" + (el.staticStyle) + ",";
  52943. }
  52944. if (el.styleBinding) {
  52945. data += "style:(" + (el.styleBinding) + "),";
  52946. }
  52947. return data
  52948. }
  52949. var style$1 = {
  52950. staticKeys: ['staticStyle'],
  52951. transformNode: transformNode$1,
  52952. genData: genData$1
  52953. };
  52954. /* */
  52955. var decoder;
  52956. var he = {
  52957. decode: function decode (html) {
  52958. decoder = decoder || document.createElement('div');
  52959. decoder.innerHTML = html;
  52960. return decoder.textContent
  52961. }
  52962. };
  52963. /* */
  52964. var isUnaryTag = makeMap(
  52965. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52966. 'link,meta,param,source,track,wbr'
  52967. );
  52968. // Elements that you can, intentionally, leave open
  52969. // (and which close themselves)
  52970. var canBeLeftOpenTag = makeMap(
  52971. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52972. );
  52973. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52974. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52975. var isNonPhrasingTag = makeMap(
  52976. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52977. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52978. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52979. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52980. 'title,tr,track'
  52981. );
  52982. /**
  52983. * Not type-checking this file because it's mostly vendor code.
  52984. */
  52985. // Regular Expressions for parsing tags and attributes
  52986. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52987. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52988. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52989. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52990. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52991. var startTagClose = /^\s*(\/?)>/;
  52992. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52993. var doctype = /^<!DOCTYPE [^>]+>/i;
  52994. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52995. var comment = /^<!\--/;
  52996. var conditionalComment = /^<!\[/;
  52997. // Special Elements (can contain anything)
  52998. var isPlainTextElement = makeMap('script,style,textarea', true);
  52999. var reCache = {};
  53000. var decodingMap = {
  53001. '&lt;': '<',
  53002. '&gt;': '>',
  53003. '&quot;': '"',
  53004. '&amp;': '&',
  53005. '&#10;': '\n',
  53006. '&#9;': '\t',
  53007. '&#39;': "'"
  53008. };
  53009. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53010. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53011. // #5992
  53012. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53013. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53014. function decodeAttr (value, shouldDecodeNewlines) {
  53015. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53016. return value.replace(re, function (match) { return decodingMap[match]; })
  53017. }
  53018. function parseHTML (html, options) {
  53019. var stack = [];
  53020. var expectHTML = options.expectHTML;
  53021. var isUnaryTag$$1 = options.isUnaryTag || no;
  53022. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53023. var index = 0;
  53024. var last, lastTag;
  53025. while (html) {
  53026. last = html;
  53027. // Make sure we're not in a plaintext content element like script/style
  53028. if (!lastTag || !isPlainTextElement(lastTag)) {
  53029. var textEnd = html.indexOf('<');
  53030. if (textEnd === 0) {
  53031. // Comment:
  53032. if (comment.test(html)) {
  53033. var commentEnd = html.indexOf('-->');
  53034. if (commentEnd >= 0) {
  53035. if (options.shouldKeepComment) {
  53036. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53037. }
  53038. advance(commentEnd + 3);
  53039. continue
  53040. }
  53041. }
  53042. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53043. if (conditionalComment.test(html)) {
  53044. var conditionalEnd = html.indexOf(']>');
  53045. if (conditionalEnd >= 0) {
  53046. advance(conditionalEnd + 2);
  53047. continue
  53048. }
  53049. }
  53050. // Doctype:
  53051. var doctypeMatch = html.match(doctype);
  53052. if (doctypeMatch) {
  53053. advance(doctypeMatch[0].length);
  53054. continue
  53055. }
  53056. // End tag:
  53057. var endTagMatch = html.match(endTag);
  53058. if (endTagMatch) {
  53059. var curIndex = index;
  53060. advance(endTagMatch[0].length);
  53061. parseEndTag(endTagMatch[1], curIndex, index);
  53062. continue
  53063. }
  53064. // Start tag:
  53065. var startTagMatch = parseStartTag();
  53066. if (startTagMatch) {
  53067. handleStartTag(startTagMatch);
  53068. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53069. advance(1);
  53070. }
  53071. continue
  53072. }
  53073. }
  53074. var text = (void 0), rest = (void 0), next = (void 0);
  53075. if (textEnd >= 0) {
  53076. rest = html.slice(textEnd);
  53077. while (
  53078. !endTag.test(rest) &&
  53079. !startTagOpen.test(rest) &&
  53080. !comment.test(rest) &&
  53081. !conditionalComment.test(rest)
  53082. ) {
  53083. // < in plain text, be forgiving and treat it as text
  53084. next = rest.indexOf('<', 1);
  53085. if (next < 0) { break }
  53086. textEnd += next;
  53087. rest = html.slice(textEnd);
  53088. }
  53089. text = html.substring(0, textEnd);
  53090. }
  53091. if (textEnd < 0) {
  53092. text = html;
  53093. }
  53094. if (text) {
  53095. advance(text.length);
  53096. }
  53097. if (options.chars && text) {
  53098. options.chars(text, index - text.length, index);
  53099. }
  53100. } else {
  53101. var endTagLength = 0;
  53102. var stackedTag = lastTag.toLowerCase();
  53103. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53104. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53105. endTagLength = endTag.length;
  53106. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53107. text = text
  53108. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53109. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53110. }
  53111. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53112. text = text.slice(1);
  53113. }
  53114. if (options.chars) {
  53115. options.chars(text);
  53116. }
  53117. return ''
  53118. });
  53119. index += html.length - rest$1.length;
  53120. html = rest$1;
  53121. parseEndTag(stackedTag, index - endTagLength, index);
  53122. }
  53123. if (html === last) {
  53124. options.chars && options.chars(html);
  53125. if (!stack.length && options.warn) {
  53126. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53127. }
  53128. break
  53129. }
  53130. }
  53131. // Clean up any remaining tags
  53132. parseEndTag();
  53133. function advance (n) {
  53134. index += n;
  53135. html = html.substring(n);
  53136. }
  53137. function parseStartTag () {
  53138. var start = html.match(startTagOpen);
  53139. if (start) {
  53140. var match = {
  53141. tagName: start[1],
  53142. attrs: [],
  53143. start: index
  53144. };
  53145. advance(start[0].length);
  53146. var end, attr;
  53147. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53148. attr.start = index;
  53149. advance(attr[0].length);
  53150. attr.end = index;
  53151. match.attrs.push(attr);
  53152. }
  53153. if (end) {
  53154. match.unarySlash = end[1];
  53155. advance(end[0].length);
  53156. match.end = index;
  53157. return match
  53158. }
  53159. }
  53160. }
  53161. function handleStartTag (match) {
  53162. var tagName = match.tagName;
  53163. var unarySlash = match.unarySlash;
  53164. if (expectHTML) {
  53165. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53166. parseEndTag(lastTag);
  53167. }
  53168. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53169. parseEndTag(tagName);
  53170. }
  53171. }
  53172. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53173. var l = match.attrs.length;
  53174. var attrs = new Array(l);
  53175. for (var i = 0; i < l; i++) {
  53176. var args = match.attrs[i];
  53177. var value = args[3] || args[4] || args[5] || '';
  53178. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53179. ? options.shouldDecodeNewlinesForHref
  53180. : options.shouldDecodeNewlines;
  53181. attrs[i] = {
  53182. name: args[1],
  53183. value: decodeAttr(value, shouldDecodeNewlines)
  53184. };
  53185. if (options.outputSourceRange) {
  53186. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53187. attrs[i].end = args.end;
  53188. }
  53189. }
  53190. if (!unary) {
  53191. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53192. lastTag = tagName;
  53193. }
  53194. if (options.start) {
  53195. options.start(tagName, attrs, unary, match.start, match.end);
  53196. }
  53197. }
  53198. function parseEndTag (tagName, start, end) {
  53199. var pos, lowerCasedTagName;
  53200. if (start == null) { start = index; }
  53201. if (end == null) { end = index; }
  53202. // Find the closest opened tag of the same type
  53203. if (tagName) {
  53204. lowerCasedTagName = tagName.toLowerCase();
  53205. for (pos = stack.length - 1; pos >= 0; pos--) {
  53206. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53207. break
  53208. }
  53209. }
  53210. } else {
  53211. // If no tag name is provided, clean shop
  53212. pos = 0;
  53213. }
  53214. if (pos >= 0) {
  53215. // Close all the open elements, up the stack
  53216. for (var i = stack.length - 1; i >= pos; i--) {
  53217. if (i > pos || !tagName &&
  53218. options.warn
  53219. ) {
  53220. options.warn(
  53221. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53222. { start: stack[i].start, end: stack[i].end }
  53223. );
  53224. }
  53225. if (options.end) {
  53226. options.end(stack[i].tag, start, end);
  53227. }
  53228. }
  53229. // Remove the open elements from the stack
  53230. stack.length = pos;
  53231. lastTag = pos && stack[pos - 1].tag;
  53232. } else if (lowerCasedTagName === 'br') {
  53233. if (options.start) {
  53234. options.start(tagName, [], true, start, end);
  53235. }
  53236. } else if (lowerCasedTagName === 'p') {
  53237. if (options.start) {
  53238. options.start(tagName, [], false, start, end);
  53239. }
  53240. if (options.end) {
  53241. options.end(tagName, start, end);
  53242. }
  53243. }
  53244. }
  53245. }
  53246. /* */
  53247. var onRE = /^@|^v-on:/;
  53248. var dirRE = /^v-|^@|^:|^#/;
  53249. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53250. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53251. var stripParensRE = /^\(|\)$/g;
  53252. var dynamicArgRE = /^\[.*\]$/;
  53253. var argRE = /:(.*)$/;
  53254. var bindRE = /^:|^\.|^v-bind:/;
  53255. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53256. var slotRE = /^v-slot(:|$)|^#/;
  53257. var lineBreakRE = /[\r\n]/;
  53258. var whitespaceRE$1 = /\s+/g;
  53259. var invalidAttributeRE = /[\s"'<>\/=]/;
  53260. var decodeHTMLCached = cached(he.decode);
  53261. var emptySlotScopeToken = "_empty_";
  53262. // configurable state
  53263. var warn$2;
  53264. var delimiters;
  53265. var transforms;
  53266. var preTransforms;
  53267. var postTransforms;
  53268. var platformIsPreTag;
  53269. var platformMustUseProp;
  53270. var platformGetTagNamespace;
  53271. var maybeComponent;
  53272. function createASTElement (
  53273. tag,
  53274. attrs,
  53275. parent
  53276. ) {
  53277. return {
  53278. type: 1,
  53279. tag: tag,
  53280. attrsList: attrs,
  53281. attrsMap: makeAttrsMap(attrs),
  53282. rawAttrsMap: {},
  53283. parent: parent,
  53284. children: []
  53285. }
  53286. }
  53287. /**
  53288. * Convert HTML string to AST.
  53289. */
  53290. function parse (
  53291. template,
  53292. options
  53293. ) {
  53294. warn$2 = options.warn || baseWarn;
  53295. platformIsPreTag = options.isPreTag || no;
  53296. platformMustUseProp = options.mustUseProp || no;
  53297. platformGetTagNamespace = options.getTagNamespace || no;
  53298. var isReservedTag = options.isReservedTag || no;
  53299. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53300. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53301. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53302. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53303. delimiters = options.delimiters;
  53304. var stack = [];
  53305. var preserveWhitespace = options.preserveWhitespace !== false;
  53306. var whitespaceOption = options.whitespace;
  53307. var root;
  53308. var currentParent;
  53309. var inVPre = false;
  53310. var inPre = false;
  53311. var warned = false;
  53312. function warnOnce (msg, range) {
  53313. if (!warned) {
  53314. warned = true;
  53315. warn$2(msg, range);
  53316. }
  53317. }
  53318. function closeElement (element) {
  53319. trimEndingWhitespace(element);
  53320. if (!inVPre && !element.processed) {
  53321. element = processElement(element, options);
  53322. }
  53323. // tree management
  53324. if (!stack.length && element !== root) {
  53325. // allow root elements with v-if, v-else-if and v-else
  53326. if (root.if && (element.elseif || element.else)) {
  53327. {
  53328. checkRootConstraints(element);
  53329. }
  53330. addIfCondition(root, {
  53331. exp: element.elseif,
  53332. block: element
  53333. });
  53334. } else {
  53335. warnOnce(
  53336. "Component template should contain exactly one root element. " +
  53337. "If you are using v-if on multiple elements, " +
  53338. "use v-else-if to chain them instead.",
  53339. { start: element.start }
  53340. );
  53341. }
  53342. }
  53343. if (currentParent && !element.forbidden) {
  53344. if (element.elseif || element.else) {
  53345. processIfConditions(element, currentParent);
  53346. } else {
  53347. if (element.slotScope) {
  53348. // scoped slot
  53349. // keep it in the children list so that v-else(-if) conditions can
  53350. // find it as the prev node.
  53351. var name = element.slotTarget || '"default"'
  53352. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53353. }
  53354. currentParent.children.push(element);
  53355. element.parent = currentParent;
  53356. }
  53357. }
  53358. // final children cleanup
  53359. // filter out scoped slots
  53360. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53361. // remove trailing whitespace node again
  53362. trimEndingWhitespace(element);
  53363. // check pre state
  53364. if (element.pre) {
  53365. inVPre = false;
  53366. }
  53367. if (platformIsPreTag(element.tag)) {
  53368. inPre = false;
  53369. }
  53370. // apply post-transforms
  53371. for (var i = 0; i < postTransforms.length; i++) {
  53372. postTransforms[i](element, options);
  53373. }
  53374. }
  53375. function trimEndingWhitespace (el) {
  53376. // remove trailing whitespace node
  53377. if (!inPre) {
  53378. var lastNode;
  53379. while (
  53380. (lastNode = el.children[el.children.length - 1]) &&
  53381. lastNode.type === 3 &&
  53382. lastNode.text === ' '
  53383. ) {
  53384. el.children.pop();
  53385. }
  53386. }
  53387. }
  53388. function checkRootConstraints (el) {
  53389. if (el.tag === 'slot' || el.tag === 'template') {
  53390. warnOnce(
  53391. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53392. 'contain multiple nodes.',
  53393. { start: el.start }
  53394. );
  53395. }
  53396. if (el.attrsMap.hasOwnProperty('v-for')) {
  53397. warnOnce(
  53398. 'Cannot use v-for on stateful component root element because ' +
  53399. 'it renders multiple elements.',
  53400. el.rawAttrsMap['v-for']
  53401. );
  53402. }
  53403. }
  53404. parseHTML(template, {
  53405. warn: warn$2,
  53406. expectHTML: options.expectHTML,
  53407. isUnaryTag: options.isUnaryTag,
  53408. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53409. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53410. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53411. shouldKeepComment: options.comments,
  53412. outputSourceRange: options.outputSourceRange,
  53413. start: function start (tag, attrs, unary, start$1, end) {
  53414. // check namespace.
  53415. // inherit parent ns if there is one
  53416. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53417. // handle IE svg bug
  53418. /* istanbul ignore if */
  53419. if (isIE && ns === 'svg') {
  53420. attrs = guardIESVGBug(attrs);
  53421. }
  53422. var element = createASTElement(tag, attrs, currentParent);
  53423. if (ns) {
  53424. element.ns = ns;
  53425. }
  53426. {
  53427. if (options.outputSourceRange) {
  53428. element.start = start$1;
  53429. element.end = end;
  53430. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53431. cumulated[attr.name] = attr;
  53432. return cumulated
  53433. }, {});
  53434. }
  53435. attrs.forEach(function (attr) {
  53436. if (invalidAttributeRE.test(attr.name)) {
  53437. warn$2(
  53438. "Invalid dynamic argument expression: attribute names cannot contain " +
  53439. "spaces, quotes, <, >, / or =.",
  53440. {
  53441. start: attr.start + attr.name.indexOf("["),
  53442. end: attr.start + attr.name.length
  53443. }
  53444. );
  53445. }
  53446. });
  53447. }
  53448. if (isForbiddenTag(element) && !isServerRendering()) {
  53449. element.forbidden = true;
  53450. warn$2(
  53451. 'Templates should only be responsible for mapping the state to the ' +
  53452. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53453. "<" + tag + ">" + ', as they will not be parsed.',
  53454. { start: element.start }
  53455. );
  53456. }
  53457. // apply pre-transforms
  53458. for (var i = 0; i < preTransforms.length; i++) {
  53459. element = preTransforms[i](element, options) || element;
  53460. }
  53461. if (!inVPre) {
  53462. processPre(element);
  53463. if (element.pre) {
  53464. inVPre = true;
  53465. }
  53466. }
  53467. if (platformIsPreTag(element.tag)) {
  53468. inPre = true;
  53469. }
  53470. if (inVPre) {
  53471. processRawAttrs(element);
  53472. } else if (!element.processed) {
  53473. // structural directives
  53474. processFor(element);
  53475. processIf(element);
  53476. processOnce(element);
  53477. }
  53478. if (!root) {
  53479. root = element;
  53480. {
  53481. checkRootConstraints(root);
  53482. }
  53483. }
  53484. if (!unary) {
  53485. currentParent = element;
  53486. stack.push(element);
  53487. } else {
  53488. closeElement(element);
  53489. }
  53490. },
  53491. end: function end (tag, start, end$1) {
  53492. var element = stack[stack.length - 1];
  53493. // pop stack
  53494. stack.length -= 1;
  53495. currentParent = stack[stack.length - 1];
  53496. if (options.outputSourceRange) {
  53497. element.end = end$1;
  53498. }
  53499. closeElement(element);
  53500. },
  53501. chars: function chars (text, start, end) {
  53502. if (!currentParent) {
  53503. {
  53504. if (text === template) {
  53505. warnOnce(
  53506. 'Component template requires a root element, rather than just text.',
  53507. { start: start }
  53508. );
  53509. } else if ((text = text.trim())) {
  53510. warnOnce(
  53511. ("text \"" + text + "\" outside root element will be ignored."),
  53512. { start: start }
  53513. );
  53514. }
  53515. }
  53516. return
  53517. }
  53518. // IE textarea placeholder bug
  53519. /* istanbul ignore if */
  53520. if (isIE &&
  53521. currentParent.tag === 'textarea' &&
  53522. currentParent.attrsMap.placeholder === text
  53523. ) {
  53524. return
  53525. }
  53526. var children = currentParent.children;
  53527. if (inPre || text.trim()) {
  53528. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53529. } else if (!children.length) {
  53530. // remove the whitespace-only node right after an opening tag
  53531. text = '';
  53532. } else if (whitespaceOption) {
  53533. if (whitespaceOption === 'condense') {
  53534. // in condense mode, remove the whitespace node if it contains
  53535. // line break, otherwise condense to a single space
  53536. text = lineBreakRE.test(text) ? '' : ' ';
  53537. } else {
  53538. text = ' ';
  53539. }
  53540. } else {
  53541. text = preserveWhitespace ? ' ' : '';
  53542. }
  53543. if (text) {
  53544. if (!inPre && whitespaceOption === 'condense') {
  53545. // condense consecutive whitespaces into single space
  53546. text = text.replace(whitespaceRE$1, ' ');
  53547. }
  53548. var res;
  53549. var child;
  53550. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53551. child = {
  53552. type: 2,
  53553. expression: res.expression,
  53554. tokens: res.tokens,
  53555. text: text
  53556. };
  53557. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53558. child = {
  53559. type: 3,
  53560. text: text
  53561. };
  53562. }
  53563. if (child) {
  53564. if (options.outputSourceRange) {
  53565. child.start = start;
  53566. child.end = end;
  53567. }
  53568. children.push(child);
  53569. }
  53570. }
  53571. },
  53572. comment: function comment (text, start, end) {
  53573. // adding anyting as a sibling to the root node is forbidden
  53574. // comments should still be allowed, but ignored
  53575. if (currentParent) {
  53576. var child = {
  53577. type: 3,
  53578. text: text,
  53579. isComment: true
  53580. };
  53581. if (options.outputSourceRange) {
  53582. child.start = start;
  53583. child.end = end;
  53584. }
  53585. currentParent.children.push(child);
  53586. }
  53587. }
  53588. });
  53589. return root
  53590. }
  53591. function processPre (el) {
  53592. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53593. el.pre = true;
  53594. }
  53595. }
  53596. function processRawAttrs (el) {
  53597. var list = el.attrsList;
  53598. var len = list.length;
  53599. if (len) {
  53600. var attrs = el.attrs = new Array(len);
  53601. for (var i = 0; i < len; i++) {
  53602. attrs[i] = {
  53603. name: list[i].name,
  53604. value: JSON.stringify(list[i].value)
  53605. };
  53606. if (list[i].start != null) {
  53607. attrs[i].start = list[i].start;
  53608. attrs[i].end = list[i].end;
  53609. }
  53610. }
  53611. } else if (!el.pre) {
  53612. // non root node in pre blocks with no attributes
  53613. el.plain = true;
  53614. }
  53615. }
  53616. function processElement (
  53617. element,
  53618. options
  53619. ) {
  53620. processKey(element);
  53621. // determine whether this is a plain element after
  53622. // removing structural attributes
  53623. element.plain = (
  53624. !element.key &&
  53625. !element.scopedSlots &&
  53626. !element.attrsList.length
  53627. );
  53628. processRef(element);
  53629. processSlotContent(element);
  53630. processSlotOutlet(element);
  53631. processComponent(element);
  53632. for (var i = 0; i < transforms.length; i++) {
  53633. element = transforms[i](element, options) || element;
  53634. }
  53635. processAttrs(element);
  53636. return element
  53637. }
  53638. function processKey (el) {
  53639. var exp = getBindingAttr(el, 'key');
  53640. if (exp) {
  53641. {
  53642. if (el.tag === 'template') {
  53643. warn$2(
  53644. "<template> cannot be keyed. Place the key on real elements instead.",
  53645. getRawBindingAttr(el, 'key')
  53646. );
  53647. }
  53648. if (el.for) {
  53649. var iterator = el.iterator2 || el.iterator1;
  53650. var parent = el.parent;
  53651. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53652. warn$2(
  53653. "Do not use v-for index as key on <transition-group> children, " +
  53654. "this is the same as not using keys.",
  53655. getRawBindingAttr(el, 'key'),
  53656. true /* tip */
  53657. );
  53658. }
  53659. }
  53660. }
  53661. el.key = exp;
  53662. }
  53663. }
  53664. function processRef (el) {
  53665. var ref = getBindingAttr(el, 'ref');
  53666. if (ref) {
  53667. el.ref = ref;
  53668. el.refInFor = checkInFor(el);
  53669. }
  53670. }
  53671. function processFor (el) {
  53672. var exp;
  53673. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53674. var res = parseFor(exp);
  53675. if (res) {
  53676. extend(el, res);
  53677. } else {
  53678. warn$2(
  53679. ("Invalid v-for expression: " + exp),
  53680. el.rawAttrsMap['v-for']
  53681. );
  53682. }
  53683. }
  53684. }
  53685. function parseFor (exp) {
  53686. var inMatch = exp.match(forAliasRE);
  53687. if (!inMatch) { return }
  53688. var res = {};
  53689. res.for = inMatch[2].trim();
  53690. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53691. var iteratorMatch = alias.match(forIteratorRE);
  53692. if (iteratorMatch) {
  53693. res.alias = alias.replace(forIteratorRE, '').trim();
  53694. res.iterator1 = iteratorMatch[1].trim();
  53695. if (iteratorMatch[2]) {
  53696. res.iterator2 = iteratorMatch[2].trim();
  53697. }
  53698. } else {
  53699. res.alias = alias;
  53700. }
  53701. return res
  53702. }
  53703. function processIf (el) {
  53704. var exp = getAndRemoveAttr(el, 'v-if');
  53705. if (exp) {
  53706. el.if = exp;
  53707. addIfCondition(el, {
  53708. exp: exp,
  53709. block: el
  53710. });
  53711. } else {
  53712. if (getAndRemoveAttr(el, 'v-else') != null) {
  53713. el.else = true;
  53714. }
  53715. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53716. if (elseif) {
  53717. el.elseif = elseif;
  53718. }
  53719. }
  53720. }
  53721. function processIfConditions (el, parent) {
  53722. var prev = findPrevElement(parent.children);
  53723. if (prev && prev.if) {
  53724. addIfCondition(prev, {
  53725. exp: el.elseif,
  53726. block: el
  53727. });
  53728. } else {
  53729. warn$2(
  53730. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53731. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53732. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53733. );
  53734. }
  53735. }
  53736. function findPrevElement (children) {
  53737. var i = children.length;
  53738. while (i--) {
  53739. if (children[i].type === 1) {
  53740. return children[i]
  53741. } else {
  53742. if (children[i].text !== ' ') {
  53743. warn$2(
  53744. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53745. "will be ignored.",
  53746. children[i]
  53747. );
  53748. }
  53749. children.pop();
  53750. }
  53751. }
  53752. }
  53753. function addIfCondition (el, condition) {
  53754. if (!el.ifConditions) {
  53755. el.ifConditions = [];
  53756. }
  53757. el.ifConditions.push(condition);
  53758. }
  53759. function processOnce (el) {
  53760. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53761. if (once$$1 != null) {
  53762. el.once = true;
  53763. }
  53764. }
  53765. // handle content being passed to a component as slot,
  53766. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53767. function processSlotContent (el) {
  53768. var slotScope;
  53769. if (el.tag === 'template') {
  53770. slotScope = getAndRemoveAttr(el, 'scope');
  53771. /* istanbul ignore if */
  53772. if (slotScope) {
  53773. warn$2(
  53774. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53775. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53776. "can also be used on plain elements in addition to <template> to " +
  53777. "denote scoped slots.",
  53778. el.rawAttrsMap['scope'],
  53779. true
  53780. );
  53781. }
  53782. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53783. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53784. /* istanbul ignore if */
  53785. if (el.attrsMap['v-for']) {
  53786. warn$2(
  53787. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53788. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53789. "scoped slot to make it clearer.",
  53790. el.rawAttrsMap['slot-scope'],
  53791. true
  53792. );
  53793. }
  53794. el.slotScope = slotScope;
  53795. }
  53796. // slot="xxx"
  53797. var slotTarget = getBindingAttr(el, 'slot');
  53798. if (slotTarget) {
  53799. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53800. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53801. // preserve slot as an attribute for native shadow DOM compat
  53802. // only for non-scoped slots.
  53803. if (el.tag !== 'template' && !el.slotScope) {
  53804. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53805. }
  53806. }
  53807. // 2.6 v-slot syntax
  53808. {
  53809. if (el.tag === 'template') {
  53810. // v-slot on <template>
  53811. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53812. if (slotBinding) {
  53813. {
  53814. if (el.slotTarget || el.slotScope) {
  53815. warn$2(
  53816. "Unexpected mixed usage of different slot syntaxes.",
  53817. el
  53818. );
  53819. }
  53820. if (el.parent && !maybeComponent(el.parent)) {
  53821. warn$2(
  53822. "<template v-slot> can only appear at the root level inside " +
  53823. "the receiving component",
  53824. el
  53825. );
  53826. }
  53827. }
  53828. var ref = getSlotName(slotBinding);
  53829. var name = ref.name;
  53830. var dynamic = ref.dynamic;
  53831. el.slotTarget = name;
  53832. el.slotTargetDynamic = dynamic;
  53833. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53834. }
  53835. } else {
  53836. // v-slot on component, denotes default slot
  53837. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53838. if (slotBinding$1) {
  53839. {
  53840. if (!maybeComponent(el)) {
  53841. warn$2(
  53842. "v-slot can only be used on components or <template>.",
  53843. slotBinding$1
  53844. );
  53845. }
  53846. if (el.slotScope || el.slotTarget) {
  53847. warn$2(
  53848. "Unexpected mixed usage of different slot syntaxes.",
  53849. el
  53850. );
  53851. }
  53852. if (el.scopedSlots) {
  53853. warn$2(
  53854. "To avoid scope ambiguity, the default slot should also use " +
  53855. "<template> syntax when there are other named slots.",
  53856. slotBinding$1
  53857. );
  53858. }
  53859. }
  53860. // add the component's children to its default slot
  53861. var slots = el.scopedSlots || (el.scopedSlots = {});
  53862. var ref$1 = getSlotName(slotBinding$1);
  53863. var name$1 = ref$1.name;
  53864. var dynamic$1 = ref$1.dynamic;
  53865. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53866. slotContainer.slotTarget = name$1;
  53867. slotContainer.slotTargetDynamic = dynamic$1;
  53868. slotContainer.children = el.children.filter(function (c) {
  53869. if (!c.slotScope) {
  53870. c.parent = slotContainer;
  53871. return true
  53872. }
  53873. });
  53874. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53875. // remove children as they are returned from scopedSlots now
  53876. el.children = [];
  53877. // mark el non-plain so data gets generated
  53878. el.plain = false;
  53879. }
  53880. }
  53881. }
  53882. }
  53883. function getSlotName (binding) {
  53884. var name = binding.name.replace(slotRE, '');
  53885. if (!name) {
  53886. if (binding.name[0] !== '#') {
  53887. name = 'default';
  53888. } else {
  53889. warn$2(
  53890. "v-slot shorthand syntax requires a slot name.",
  53891. binding
  53892. );
  53893. }
  53894. }
  53895. return dynamicArgRE.test(name)
  53896. // dynamic [name]
  53897. ? { name: name.slice(1, -1), dynamic: true }
  53898. // static name
  53899. : { name: ("\"" + name + "\""), dynamic: false }
  53900. }
  53901. // handle <slot/> outlets
  53902. function processSlotOutlet (el) {
  53903. if (el.tag === 'slot') {
  53904. el.slotName = getBindingAttr(el, 'name');
  53905. if (el.key) {
  53906. warn$2(
  53907. "`key` does not work on <slot> because slots are abstract outlets " +
  53908. "and can possibly expand into multiple elements. " +
  53909. "Use the key on a wrapping element instead.",
  53910. getRawBindingAttr(el, 'key')
  53911. );
  53912. }
  53913. }
  53914. }
  53915. function processComponent (el) {
  53916. var binding;
  53917. if ((binding = getBindingAttr(el, 'is'))) {
  53918. el.component = binding;
  53919. }
  53920. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53921. el.inlineTemplate = true;
  53922. }
  53923. }
  53924. function processAttrs (el) {
  53925. var list = el.attrsList;
  53926. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53927. for (i = 0, l = list.length; i < l; i++) {
  53928. name = rawName = list[i].name;
  53929. value = list[i].value;
  53930. if (dirRE.test(name)) {
  53931. // mark element as dynamic
  53932. el.hasBindings = true;
  53933. // modifiers
  53934. modifiers = parseModifiers(name.replace(dirRE, ''));
  53935. // support .foo shorthand syntax for the .prop modifier
  53936. if (modifiers) {
  53937. name = name.replace(modifierRE, '');
  53938. }
  53939. if (bindRE.test(name)) { // v-bind
  53940. name = name.replace(bindRE, '');
  53941. value = parseFilters(value);
  53942. isDynamic = dynamicArgRE.test(name);
  53943. if (isDynamic) {
  53944. name = name.slice(1, -1);
  53945. }
  53946. if (
  53947. value.trim().length === 0
  53948. ) {
  53949. warn$2(
  53950. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53951. );
  53952. }
  53953. if (modifiers) {
  53954. if (modifiers.prop && !isDynamic) {
  53955. name = camelize(name);
  53956. if (name === 'innerHtml') { name = 'innerHTML'; }
  53957. }
  53958. if (modifiers.camel && !isDynamic) {
  53959. name = camelize(name);
  53960. }
  53961. if (modifiers.sync) {
  53962. syncGen = genAssignmentCode(value, "$event");
  53963. if (!isDynamic) {
  53964. addHandler(
  53965. el,
  53966. ("update:" + (camelize(name))),
  53967. syncGen,
  53968. null,
  53969. false,
  53970. warn$2,
  53971. list[i]
  53972. );
  53973. if (hyphenate(name) !== camelize(name)) {
  53974. addHandler(
  53975. el,
  53976. ("update:" + (hyphenate(name))),
  53977. syncGen,
  53978. null,
  53979. false,
  53980. warn$2,
  53981. list[i]
  53982. );
  53983. }
  53984. } else {
  53985. // handler w/ dynamic event name
  53986. addHandler(
  53987. el,
  53988. ("\"update:\"+(" + name + ")"),
  53989. syncGen,
  53990. null,
  53991. false,
  53992. warn$2,
  53993. list[i],
  53994. true // dynamic
  53995. );
  53996. }
  53997. }
  53998. }
  53999. if ((modifiers && modifiers.prop) || (
  54000. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54001. )) {
  54002. addProp(el, name, value, list[i], isDynamic);
  54003. } else {
  54004. addAttr(el, name, value, list[i], isDynamic);
  54005. }
  54006. } else if (onRE.test(name)) { // v-on
  54007. name = name.replace(onRE, '');
  54008. isDynamic = dynamicArgRE.test(name);
  54009. if (isDynamic) {
  54010. name = name.slice(1, -1);
  54011. }
  54012. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54013. } else { // normal directives
  54014. name = name.replace(dirRE, '');
  54015. // parse arg
  54016. var argMatch = name.match(argRE);
  54017. var arg = argMatch && argMatch[1];
  54018. isDynamic = false;
  54019. if (arg) {
  54020. name = name.slice(0, -(arg.length + 1));
  54021. if (dynamicArgRE.test(arg)) {
  54022. arg = arg.slice(1, -1);
  54023. isDynamic = true;
  54024. }
  54025. }
  54026. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54027. if (name === 'model') {
  54028. checkForAliasModel(el, value);
  54029. }
  54030. }
  54031. } else {
  54032. // literal attribute
  54033. {
  54034. var res = parseText(value, delimiters);
  54035. if (res) {
  54036. warn$2(
  54037. name + "=\"" + value + "\": " +
  54038. 'Interpolation inside attributes has been removed. ' +
  54039. 'Use v-bind or the colon shorthand instead. For example, ' +
  54040. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54041. list[i]
  54042. );
  54043. }
  54044. }
  54045. addAttr(el, name, JSON.stringify(value), list[i]);
  54046. // #6887 firefox doesn't update muted state if set via attribute
  54047. // even immediately after element creation
  54048. if (!el.component &&
  54049. name === 'muted' &&
  54050. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54051. addProp(el, name, 'true', list[i]);
  54052. }
  54053. }
  54054. }
  54055. }
  54056. function checkInFor (el) {
  54057. var parent = el;
  54058. while (parent) {
  54059. if (parent.for !== undefined) {
  54060. return true
  54061. }
  54062. parent = parent.parent;
  54063. }
  54064. return false
  54065. }
  54066. function parseModifiers (name) {
  54067. var match = name.match(modifierRE);
  54068. if (match) {
  54069. var ret = {};
  54070. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54071. return ret
  54072. }
  54073. }
  54074. function makeAttrsMap (attrs) {
  54075. var map = {};
  54076. for (var i = 0, l = attrs.length; i < l; i++) {
  54077. if (
  54078. map[attrs[i].name] && !isIE && !isEdge
  54079. ) {
  54080. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54081. }
  54082. map[attrs[i].name] = attrs[i].value;
  54083. }
  54084. return map
  54085. }
  54086. // for script (e.g. type="x/template") or style, do not decode content
  54087. function isTextTag (el) {
  54088. return el.tag === 'script' || el.tag === 'style'
  54089. }
  54090. function isForbiddenTag (el) {
  54091. return (
  54092. el.tag === 'style' ||
  54093. (el.tag === 'script' && (
  54094. !el.attrsMap.type ||
  54095. el.attrsMap.type === 'text/javascript'
  54096. ))
  54097. )
  54098. }
  54099. var ieNSBug = /^xmlns:NS\d+/;
  54100. var ieNSPrefix = /^NS\d+:/;
  54101. /* istanbul ignore next */
  54102. function guardIESVGBug (attrs) {
  54103. var res = [];
  54104. for (var i = 0; i < attrs.length; i++) {
  54105. var attr = attrs[i];
  54106. if (!ieNSBug.test(attr.name)) {
  54107. attr.name = attr.name.replace(ieNSPrefix, '');
  54108. res.push(attr);
  54109. }
  54110. }
  54111. return res
  54112. }
  54113. function checkForAliasModel (el, value) {
  54114. var _el = el;
  54115. while (_el) {
  54116. if (_el.for && _el.alias === value) {
  54117. warn$2(
  54118. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54119. "You are binding v-model directly to a v-for iteration alias. " +
  54120. "This will not be able to modify the v-for source array because " +
  54121. "writing to the alias is like modifying a function local variable. " +
  54122. "Consider using an array of objects and use v-model on an object property instead.",
  54123. el.rawAttrsMap['v-model']
  54124. );
  54125. }
  54126. _el = _el.parent;
  54127. }
  54128. }
  54129. /* */
  54130. function preTransformNode (el, options) {
  54131. if (el.tag === 'input') {
  54132. var map = el.attrsMap;
  54133. if (!map['v-model']) {
  54134. return
  54135. }
  54136. var typeBinding;
  54137. if (map[':type'] || map['v-bind:type']) {
  54138. typeBinding = getBindingAttr(el, 'type');
  54139. }
  54140. if (!map.type && !typeBinding && map['v-bind']) {
  54141. typeBinding = "(" + (map['v-bind']) + ").type";
  54142. }
  54143. if (typeBinding) {
  54144. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54145. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54146. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54147. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54148. // 1. checkbox
  54149. var branch0 = cloneASTElement(el);
  54150. // process for on the main node
  54151. processFor(branch0);
  54152. addRawAttr(branch0, 'type', 'checkbox');
  54153. processElement(branch0, options);
  54154. branch0.processed = true; // prevent it from double-processed
  54155. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54156. addIfCondition(branch0, {
  54157. exp: branch0.if,
  54158. block: branch0
  54159. });
  54160. // 2. add radio else-if condition
  54161. var branch1 = cloneASTElement(el);
  54162. getAndRemoveAttr(branch1, 'v-for', true);
  54163. addRawAttr(branch1, 'type', 'radio');
  54164. processElement(branch1, options);
  54165. addIfCondition(branch0, {
  54166. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54167. block: branch1
  54168. });
  54169. // 3. other
  54170. var branch2 = cloneASTElement(el);
  54171. getAndRemoveAttr(branch2, 'v-for', true);
  54172. addRawAttr(branch2, ':type', typeBinding);
  54173. processElement(branch2, options);
  54174. addIfCondition(branch0, {
  54175. exp: ifCondition,
  54176. block: branch2
  54177. });
  54178. if (hasElse) {
  54179. branch0.else = true;
  54180. } else if (elseIfCondition) {
  54181. branch0.elseif = elseIfCondition;
  54182. }
  54183. return branch0
  54184. }
  54185. }
  54186. }
  54187. function cloneASTElement (el) {
  54188. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54189. }
  54190. var model$1 = {
  54191. preTransformNode: preTransformNode
  54192. };
  54193. var modules$1 = [
  54194. klass$1,
  54195. style$1,
  54196. model$1
  54197. ];
  54198. /* */
  54199. function text (el, dir) {
  54200. if (dir.value) {
  54201. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54202. }
  54203. }
  54204. /* */
  54205. function html (el, dir) {
  54206. if (dir.value) {
  54207. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54208. }
  54209. }
  54210. var directives$1 = {
  54211. model: model,
  54212. text: text,
  54213. html: html
  54214. };
  54215. /* */
  54216. var baseOptions = {
  54217. expectHTML: true,
  54218. modules: modules$1,
  54219. directives: directives$1,
  54220. isPreTag: isPreTag,
  54221. isUnaryTag: isUnaryTag,
  54222. mustUseProp: mustUseProp,
  54223. canBeLeftOpenTag: canBeLeftOpenTag,
  54224. isReservedTag: isReservedTag,
  54225. getTagNamespace: getTagNamespace,
  54226. staticKeys: genStaticKeys(modules$1)
  54227. };
  54228. /* */
  54229. var isStaticKey;
  54230. var isPlatformReservedTag;
  54231. var genStaticKeysCached = cached(genStaticKeys$1);
  54232. /**
  54233. * Goal of the optimizer: walk the generated template AST tree
  54234. * and detect sub-trees that are purely static, i.e. parts of
  54235. * the DOM that never needs to change.
  54236. *
  54237. * Once we detect these sub-trees, we can:
  54238. *
  54239. * 1. Hoist them into constants, so that we no longer need to
  54240. * create fresh nodes for them on each re-render;
  54241. * 2. Completely skip them in the patching process.
  54242. */
  54243. function optimize (root, options) {
  54244. if (!root) { return }
  54245. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54246. isPlatformReservedTag = options.isReservedTag || no;
  54247. // first pass: mark all non-static nodes.
  54248. markStatic$1(root);
  54249. // second pass: mark static roots.
  54250. markStaticRoots(root, false);
  54251. }
  54252. function genStaticKeys$1 (keys) {
  54253. return makeMap(
  54254. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54255. (keys ? ',' + keys : '')
  54256. )
  54257. }
  54258. function markStatic$1 (node) {
  54259. node.static = isStatic(node);
  54260. if (node.type === 1) {
  54261. // do not make component slot content static. this avoids
  54262. // 1. components not able to mutate slot nodes
  54263. // 2. static slot content fails for hot-reloading
  54264. if (
  54265. !isPlatformReservedTag(node.tag) &&
  54266. node.tag !== 'slot' &&
  54267. node.attrsMap['inline-template'] == null
  54268. ) {
  54269. return
  54270. }
  54271. for (var i = 0, l = node.children.length; i < l; i++) {
  54272. var child = node.children[i];
  54273. markStatic$1(child);
  54274. if (!child.static) {
  54275. node.static = false;
  54276. }
  54277. }
  54278. if (node.ifConditions) {
  54279. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54280. var block = node.ifConditions[i$1].block;
  54281. markStatic$1(block);
  54282. if (!block.static) {
  54283. node.static = false;
  54284. }
  54285. }
  54286. }
  54287. }
  54288. }
  54289. function markStaticRoots (node, isInFor) {
  54290. if (node.type === 1) {
  54291. if (node.static || node.once) {
  54292. node.staticInFor = isInFor;
  54293. }
  54294. // For a node to qualify as a static root, it should have children that
  54295. // are not just static text. Otherwise the cost of hoisting out will
  54296. // outweigh the benefits and it's better off to just always render it fresh.
  54297. if (node.static && node.children.length && !(
  54298. node.children.length === 1 &&
  54299. node.children[0].type === 3
  54300. )) {
  54301. node.staticRoot = true;
  54302. return
  54303. } else {
  54304. node.staticRoot = false;
  54305. }
  54306. if (node.children) {
  54307. for (var i = 0, l = node.children.length; i < l; i++) {
  54308. markStaticRoots(node.children[i], isInFor || !!node.for);
  54309. }
  54310. }
  54311. if (node.ifConditions) {
  54312. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54313. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54314. }
  54315. }
  54316. }
  54317. }
  54318. function isStatic (node) {
  54319. if (node.type === 2) { // expression
  54320. return false
  54321. }
  54322. if (node.type === 3) { // text
  54323. return true
  54324. }
  54325. return !!(node.pre || (
  54326. !node.hasBindings && // no dynamic bindings
  54327. !node.if && !node.for && // not v-if or v-for or v-else
  54328. !isBuiltInTag(node.tag) && // not a built-in
  54329. isPlatformReservedTag(node.tag) && // not a component
  54330. !isDirectChildOfTemplateFor(node) &&
  54331. Object.keys(node).every(isStaticKey)
  54332. ))
  54333. }
  54334. function isDirectChildOfTemplateFor (node) {
  54335. while (node.parent) {
  54336. node = node.parent;
  54337. if (node.tag !== 'template') {
  54338. return false
  54339. }
  54340. if (node.for) {
  54341. return true
  54342. }
  54343. }
  54344. return false
  54345. }
  54346. /* */
  54347. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54348. var fnInvokeRE = /\([^)]*?\);*$/;
  54349. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54350. // KeyboardEvent.keyCode aliases
  54351. var keyCodes = {
  54352. esc: 27,
  54353. tab: 9,
  54354. enter: 13,
  54355. space: 32,
  54356. up: 38,
  54357. left: 37,
  54358. right: 39,
  54359. down: 40,
  54360. 'delete': [8, 46]
  54361. };
  54362. // KeyboardEvent.key aliases
  54363. var keyNames = {
  54364. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54365. esc: ['Esc', 'Escape'],
  54366. tab: 'Tab',
  54367. enter: 'Enter',
  54368. // #9112: IE11 uses `Spacebar` for Space key name.
  54369. space: [' ', 'Spacebar'],
  54370. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54371. up: ['Up', 'ArrowUp'],
  54372. left: ['Left', 'ArrowLeft'],
  54373. right: ['Right', 'ArrowRight'],
  54374. down: ['Down', 'ArrowDown'],
  54375. // #9112: IE11 uses `Del` for Delete key name.
  54376. 'delete': ['Backspace', 'Delete', 'Del']
  54377. };
  54378. // #4868: modifiers that prevent the execution of the listener
  54379. // need to explicitly return null so that we can determine whether to remove
  54380. // the listener for .once
  54381. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54382. var modifierCode = {
  54383. stop: '$event.stopPropagation();',
  54384. prevent: '$event.preventDefault();',
  54385. self: genGuard("$event.target !== $event.currentTarget"),
  54386. ctrl: genGuard("!$event.ctrlKey"),
  54387. shift: genGuard("!$event.shiftKey"),
  54388. alt: genGuard("!$event.altKey"),
  54389. meta: genGuard("!$event.metaKey"),
  54390. left: genGuard("'button' in $event && $event.button !== 0"),
  54391. middle: genGuard("'button' in $event && $event.button !== 1"),
  54392. right: genGuard("'button' in $event && $event.button !== 2")
  54393. };
  54394. function genHandlers (
  54395. events,
  54396. isNative
  54397. ) {
  54398. var prefix = isNative ? 'nativeOn:' : 'on:';
  54399. var staticHandlers = "";
  54400. var dynamicHandlers = "";
  54401. for (var name in events) {
  54402. var handlerCode = genHandler(events[name]);
  54403. if (events[name] && events[name].dynamic) {
  54404. dynamicHandlers += name + "," + handlerCode + ",";
  54405. } else {
  54406. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54407. }
  54408. }
  54409. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54410. if (dynamicHandlers) {
  54411. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54412. } else {
  54413. return prefix + staticHandlers
  54414. }
  54415. }
  54416. function genHandler (handler) {
  54417. if (!handler) {
  54418. return 'function(){}'
  54419. }
  54420. if (Array.isArray(handler)) {
  54421. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54422. }
  54423. var isMethodPath = simplePathRE.test(handler.value);
  54424. var isFunctionExpression = fnExpRE.test(handler.value);
  54425. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54426. if (!handler.modifiers) {
  54427. if (isMethodPath || isFunctionExpression) {
  54428. return handler.value
  54429. }
  54430. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54431. } else {
  54432. var code = '';
  54433. var genModifierCode = '';
  54434. var keys = [];
  54435. for (var key in handler.modifiers) {
  54436. if (modifierCode[key]) {
  54437. genModifierCode += modifierCode[key];
  54438. // left/right
  54439. if (keyCodes[key]) {
  54440. keys.push(key);
  54441. }
  54442. } else if (key === 'exact') {
  54443. var modifiers = (handler.modifiers);
  54444. genModifierCode += genGuard(
  54445. ['ctrl', 'shift', 'alt', 'meta']
  54446. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54447. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54448. .join('||')
  54449. );
  54450. } else {
  54451. keys.push(key);
  54452. }
  54453. }
  54454. if (keys.length) {
  54455. code += genKeyFilter(keys);
  54456. }
  54457. // Make sure modifiers like prevent and stop get executed after key filtering
  54458. if (genModifierCode) {
  54459. code += genModifierCode;
  54460. }
  54461. var handlerCode = isMethodPath
  54462. ? ("return " + (handler.value) + "($event)")
  54463. : isFunctionExpression
  54464. ? ("return (" + (handler.value) + ")($event)")
  54465. : isFunctionInvocation
  54466. ? ("return " + (handler.value))
  54467. : handler.value;
  54468. return ("function($event){" + code + handlerCode + "}")
  54469. }
  54470. }
  54471. function genKeyFilter (keys) {
  54472. return (
  54473. // make sure the key filters only apply to KeyboardEvents
  54474. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54475. // key events that do not have keyCode property...
  54476. "if(!$event.type.indexOf('key')&&" +
  54477. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54478. )
  54479. }
  54480. function genFilterCode (key) {
  54481. var keyVal = parseInt(key, 10);
  54482. if (keyVal) {
  54483. return ("$event.keyCode!==" + keyVal)
  54484. }
  54485. var keyCode = keyCodes[key];
  54486. var keyName = keyNames[key];
  54487. return (
  54488. "_k($event.keyCode," +
  54489. (JSON.stringify(key)) + "," +
  54490. (JSON.stringify(keyCode)) + "," +
  54491. "$event.key," +
  54492. "" + (JSON.stringify(keyName)) +
  54493. ")"
  54494. )
  54495. }
  54496. /* */
  54497. function on (el, dir) {
  54498. if (dir.modifiers) {
  54499. warn("v-on without argument does not support modifiers.");
  54500. }
  54501. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54502. }
  54503. /* */
  54504. function bind$1 (el, dir) {
  54505. el.wrapData = function (code) {
  54506. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54507. };
  54508. }
  54509. /* */
  54510. var baseDirectives = {
  54511. on: on,
  54512. bind: bind$1,
  54513. cloak: noop
  54514. };
  54515. /* */
  54516. var CodegenState = function CodegenState (options) {
  54517. this.options = options;
  54518. this.warn = options.warn || baseWarn;
  54519. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54520. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54521. this.directives = extend(extend({}, baseDirectives), options.directives);
  54522. var isReservedTag = options.isReservedTag || no;
  54523. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54524. this.onceId = 0;
  54525. this.staticRenderFns = [];
  54526. this.pre = false;
  54527. };
  54528. function generate (
  54529. ast,
  54530. options
  54531. ) {
  54532. var state = new CodegenState(options);
  54533. var code = ast ? genElement(ast, state) : '_c("div")';
  54534. return {
  54535. render: ("with(this){return " + code + "}"),
  54536. staticRenderFns: state.staticRenderFns
  54537. }
  54538. }
  54539. function genElement (el, state) {
  54540. if (el.parent) {
  54541. el.pre = el.pre || el.parent.pre;
  54542. }
  54543. if (el.staticRoot && !el.staticProcessed) {
  54544. return genStatic(el, state)
  54545. } else if (el.once && !el.onceProcessed) {
  54546. return genOnce(el, state)
  54547. } else if (el.for && !el.forProcessed) {
  54548. return genFor(el, state)
  54549. } else if (el.if && !el.ifProcessed) {
  54550. return genIf(el, state)
  54551. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54552. return genChildren(el, state) || 'void 0'
  54553. } else if (el.tag === 'slot') {
  54554. return genSlot(el, state)
  54555. } else {
  54556. // component or element
  54557. var code;
  54558. if (el.component) {
  54559. code = genComponent(el.component, el, state);
  54560. } else {
  54561. var data;
  54562. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54563. data = genData$2(el, state);
  54564. }
  54565. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54566. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54567. }
  54568. // module transforms
  54569. for (var i = 0; i < state.transforms.length; i++) {
  54570. code = state.transforms[i](el, code);
  54571. }
  54572. return code
  54573. }
  54574. }
  54575. // hoist static sub-trees out
  54576. function genStatic (el, state) {
  54577. el.staticProcessed = true;
  54578. // Some elements (templates) need to behave differently inside of a v-pre
  54579. // node. All pre nodes are static roots, so we can use this as a location to
  54580. // wrap a state change and reset it upon exiting the pre node.
  54581. var originalPreState = state.pre;
  54582. if (el.pre) {
  54583. state.pre = el.pre;
  54584. }
  54585. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54586. state.pre = originalPreState;
  54587. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54588. }
  54589. // v-once
  54590. function genOnce (el, state) {
  54591. el.onceProcessed = true;
  54592. if (el.if && !el.ifProcessed) {
  54593. return genIf(el, state)
  54594. } else if (el.staticInFor) {
  54595. var key = '';
  54596. var parent = el.parent;
  54597. while (parent) {
  54598. if (parent.for) {
  54599. key = parent.key;
  54600. break
  54601. }
  54602. parent = parent.parent;
  54603. }
  54604. if (!key) {
  54605. state.warn(
  54606. "v-once can only be used inside v-for that is keyed. ",
  54607. el.rawAttrsMap['v-once']
  54608. );
  54609. return genElement(el, state)
  54610. }
  54611. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54612. } else {
  54613. return genStatic(el, state)
  54614. }
  54615. }
  54616. function genIf (
  54617. el,
  54618. state,
  54619. altGen,
  54620. altEmpty
  54621. ) {
  54622. el.ifProcessed = true; // avoid recursion
  54623. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54624. }
  54625. function genIfConditions (
  54626. conditions,
  54627. state,
  54628. altGen,
  54629. altEmpty
  54630. ) {
  54631. if (!conditions.length) {
  54632. return altEmpty || '_e()'
  54633. }
  54634. var condition = conditions.shift();
  54635. if (condition.exp) {
  54636. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54637. } else {
  54638. return ("" + (genTernaryExp(condition.block)))
  54639. }
  54640. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54641. function genTernaryExp (el) {
  54642. return altGen
  54643. ? altGen(el, state)
  54644. : el.once
  54645. ? genOnce(el, state)
  54646. : genElement(el, state)
  54647. }
  54648. }
  54649. function genFor (
  54650. el,
  54651. state,
  54652. altGen,
  54653. altHelper
  54654. ) {
  54655. var exp = el.for;
  54656. var alias = el.alias;
  54657. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54658. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54659. if (state.maybeComponent(el) &&
  54660. el.tag !== 'slot' &&
  54661. el.tag !== 'template' &&
  54662. !el.key
  54663. ) {
  54664. state.warn(
  54665. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54666. "v-for should have explicit keys. " +
  54667. "See https://vuejs.org/guide/list.html#key for more info.",
  54668. el.rawAttrsMap['v-for'],
  54669. true /* tip */
  54670. );
  54671. }
  54672. el.forProcessed = true; // avoid recursion
  54673. return (altHelper || '_l') + "((" + exp + ")," +
  54674. "function(" + alias + iterator1 + iterator2 + "){" +
  54675. "return " + ((altGen || genElement)(el, state)) +
  54676. '})'
  54677. }
  54678. function genData$2 (el, state) {
  54679. var data = '{';
  54680. // directives first.
  54681. // directives may mutate the el's other properties before they are generated.
  54682. var dirs = genDirectives(el, state);
  54683. if (dirs) { data += dirs + ','; }
  54684. // key
  54685. if (el.key) {
  54686. data += "key:" + (el.key) + ",";
  54687. }
  54688. // ref
  54689. if (el.ref) {
  54690. data += "ref:" + (el.ref) + ",";
  54691. }
  54692. if (el.refInFor) {
  54693. data += "refInFor:true,";
  54694. }
  54695. // pre
  54696. if (el.pre) {
  54697. data += "pre:true,";
  54698. }
  54699. // record original tag name for components using "is" attribute
  54700. if (el.component) {
  54701. data += "tag:\"" + (el.tag) + "\",";
  54702. }
  54703. // module data generation functions
  54704. for (var i = 0; i < state.dataGenFns.length; i++) {
  54705. data += state.dataGenFns[i](el);
  54706. }
  54707. // attributes
  54708. if (el.attrs) {
  54709. data += "attrs:" + (genProps(el.attrs)) + ",";
  54710. }
  54711. // DOM props
  54712. if (el.props) {
  54713. data += "domProps:" + (genProps(el.props)) + ",";
  54714. }
  54715. // event handlers
  54716. if (el.events) {
  54717. data += (genHandlers(el.events, false)) + ",";
  54718. }
  54719. if (el.nativeEvents) {
  54720. data += (genHandlers(el.nativeEvents, true)) + ",";
  54721. }
  54722. // slot target
  54723. // only for non-scoped slots
  54724. if (el.slotTarget && !el.slotScope) {
  54725. data += "slot:" + (el.slotTarget) + ",";
  54726. }
  54727. // scoped slots
  54728. if (el.scopedSlots) {
  54729. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54730. }
  54731. // component v-model
  54732. if (el.model) {
  54733. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54734. }
  54735. // inline-template
  54736. if (el.inlineTemplate) {
  54737. var inlineTemplate = genInlineTemplate(el, state);
  54738. if (inlineTemplate) {
  54739. data += inlineTemplate + ",";
  54740. }
  54741. }
  54742. data = data.replace(/,$/, '') + '}';
  54743. // v-bind dynamic argument wrap
  54744. // v-bind with dynamic arguments must be applied using the same v-bind object
  54745. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54746. if (el.dynamicAttrs) {
  54747. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54748. }
  54749. // v-bind data wrap
  54750. if (el.wrapData) {
  54751. data = el.wrapData(data);
  54752. }
  54753. // v-on data wrap
  54754. if (el.wrapListeners) {
  54755. data = el.wrapListeners(data);
  54756. }
  54757. return data
  54758. }
  54759. function genDirectives (el, state) {
  54760. var dirs = el.directives;
  54761. if (!dirs) { return }
  54762. var res = 'directives:[';
  54763. var hasRuntime = false;
  54764. var i, l, dir, needRuntime;
  54765. for (i = 0, l = dirs.length; i < l; i++) {
  54766. dir = dirs[i];
  54767. needRuntime = true;
  54768. var gen = state.directives[dir.name];
  54769. if (gen) {
  54770. // compile-time directive that manipulates AST.
  54771. // returns true if it also needs a runtime counterpart.
  54772. needRuntime = !!gen(el, dir, state.warn);
  54773. }
  54774. if (needRuntime) {
  54775. hasRuntime = true;
  54776. 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))) : '') + "},";
  54777. }
  54778. }
  54779. if (hasRuntime) {
  54780. return res.slice(0, -1) + ']'
  54781. }
  54782. }
  54783. function genInlineTemplate (el, state) {
  54784. var ast = el.children[0];
  54785. if (el.children.length !== 1 || ast.type !== 1) {
  54786. state.warn(
  54787. 'Inline-template components must have exactly one child element.',
  54788. { start: el.start }
  54789. );
  54790. }
  54791. if (ast && ast.type === 1) {
  54792. var inlineRenderFns = generate(ast, state.options);
  54793. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54794. }
  54795. }
  54796. function genScopedSlots (
  54797. el,
  54798. slots,
  54799. state
  54800. ) {
  54801. // by default scoped slots are considered "stable", this allows child
  54802. // components with only scoped slots to skip forced updates from parent.
  54803. // but in some cases we have to bail-out of this optimization
  54804. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54805. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54806. var slot = slots[key];
  54807. return (
  54808. slot.slotTargetDynamic ||
  54809. slot.if ||
  54810. slot.for ||
  54811. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54812. )
  54813. });
  54814. // #9534: if a component with scoped slots is inside a conditional branch,
  54815. // it's possible for the same component to be reused but with different
  54816. // compiled slot content. To avoid that, we generate a unique key based on
  54817. // the generated code of all the slot contents.
  54818. var needsKey = !!el.if;
  54819. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54820. // disconnected due to the intermediate scope variable)
  54821. // #9438, #9506
  54822. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54823. // and skip force updating ones that do not actually use scope variables.
  54824. if (!needsForceUpdate) {
  54825. var parent = el.parent;
  54826. while (parent) {
  54827. if (
  54828. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54829. parent.for
  54830. ) {
  54831. needsForceUpdate = true;
  54832. break
  54833. }
  54834. if (parent.if) {
  54835. needsKey = true;
  54836. }
  54837. parent = parent.parent;
  54838. }
  54839. }
  54840. var generatedSlots = Object.keys(slots)
  54841. .map(function (key) { return genScopedSlot(slots[key], state); })
  54842. .join(',');
  54843. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54844. }
  54845. function hash(str) {
  54846. var hash = 5381;
  54847. var i = str.length;
  54848. while(i) {
  54849. hash = (hash * 33) ^ str.charCodeAt(--i);
  54850. }
  54851. return hash >>> 0
  54852. }
  54853. function containsSlotChild (el) {
  54854. if (el.type === 1) {
  54855. if (el.tag === 'slot') {
  54856. return true
  54857. }
  54858. return el.children.some(containsSlotChild)
  54859. }
  54860. return false
  54861. }
  54862. function genScopedSlot (
  54863. el,
  54864. state
  54865. ) {
  54866. var isLegacySyntax = el.attrsMap['slot-scope'];
  54867. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54868. return genIf(el, state, genScopedSlot, "null")
  54869. }
  54870. if (el.for && !el.forProcessed) {
  54871. return genFor(el, state, genScopedSlot)
  54872. }
  54873. var slotScope = el.slotScope === emptySlotScopeToken
  54874. ? ""
  54875. : String(el.slotScope);
  54876. var fn = "function(" + slotScope + "){" +
  54877. "return " + (el.tag === 'template'
  54878. ? el.if && isLegacySyntax
  54879. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54880. : genChildren(el, state) || 'undefined'
  54881. : genElement(el, state)) + "}";
  54882. // reverse proxy v-slot without scope on this.$slots
  54883. var reverseProxy = slotScope ? "" : ",proxy:true";
  54884. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54885. }
  54886. function genChildren (
  54887. el,
  54888. state,
  54889. checkSkip,
  54890. altGenElement,
  54891. altGenNode
  54892. ) {
  54893. var children = el.children;
  54894. if (children.length) {
  54895. var el$1 = children[0];
  54896. // optimize single v-for
  54897. if (children.length === 1 &&
  54898. el$1.for &&
  54899. el$1.tag !== 'template' &&
  54900. el$1.tag !== 'slot'
  54901. ) {
  54902. var normalizationType = checkSkip
  54903. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54904. : "";
  54905. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54906. }
  54907. var normalizationType$1 = checkSkip
  54908. ? getNormalizationType(children, state.maybeComponent)
  54909. : 0;
  54910. var gen = altGenNode || genNode;
  54911. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54912. }
  54913. }
  54914. // determine the normalization needed for the children array.
  54915. // 0: no normalization needed
  54916. // 1: simple normalization needed (possible 1-level deep nested array)
  54917. // 2: full normalization needed
  54918. function getNormalizationType (
  54919. children,
  54920. maybeComponent
  54921. ) {
  54922. var res = 0;
  54923. for (var i = 0; i < children.length; i++) {
  54924. var el = children[i];
  54925. if (el.type !== 1) {
  54926. continue
  54927. }
  54928. if (needsNormalization(el) ||
  54929. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54930. res = 2;
  54931. break
  54932. }
  54933. if (maybeComponent(el) ||
  54934. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54935. res = 1;
  54936. }
  54937. }
  54938. return res
  54939. }
  54940. function needsNormalization (el) {
  54941. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54942. }
  54943. function genNode (node, state) {
  54944. if (node.type === 1) {
  54945. return genElement(node, state)
  54946. } else if (node.type === 3 && node.isComment) {
  54947. return genComment(node)
  54948. } else {
  54949. return genText(node)
  54950. }
  54951. }
  54952. function genText (text) {
  54953. return ("_v(" + (text.type === 2
  54954. ? text.expression // no need for () because already wrapped in _s()
  54955. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54956. }
  54957. function genComment (comment) {
  54958. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54959. }
  54960. function genSlot (el, state) {
  54961. var slotName = el.slotName || '"default"';
  54962. var children = genChildren(el, state);
  54963. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54964. var attrs = el.attrs || el.dynamicAttrs
  54965. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54966. // slot props are camelized
  54967. name: camelize(attr.name),
  54968. value: attr.value,
  54969. dynamic: attr.dynamic
  54970. }); }))
  54971. : null;
  54972. var bind$$1 = el.attrsMap['v-bind'];
  54973. if ((attrs || bind$$1) && !children) {
  54974. res += ",null";
  54975. }
  54976. if (attrs) {
  54977. res += "," + attrs;
  54978. }
  54979. if (bind$$1) {
  54980. res += (attrs ? '' : ',null') + "," + bind$$1;
  54981. }
  54982. return res + ')'
  54983. }
  54984. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54985. function genComponent (
  54986. componentName,
  54987. el,
  54988. state
  54989. ) {
  54990. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54991. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54992. }
  54993. function genProps (props) {
  54994. var staticProps = "";
  54995. var dynamicProps = "";
  54996. for (var i = 0; i < props.length; i++) {
  54997. var prop = props[i];
  54998. var value = transformSpecialNewlines(prop.value);
  54999. if (prop.dynamic) {
  55000. dynamicProps += (prop.name) + "," + value + ",";
  55001. } else {
  55002. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55003. }
  55004. }
  55005. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55006. if (dynamicProps) {
  55007. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55008. } else {
  55009. return staticProps
  55010. }
  55011. }
  55012. // #3895, #4268
  55013. function transformSpecialNewlines (text) {
  55014. return text
  55015. .replace(/\u2028/g, '\\u2028')
  55016. .replace(/\u2029/g, '\\u2029')
  55017. }
  55018. /* */
  55019. // these keywords should not appear inside expressions, but operators like
  55020. // typeof, instanceof and in are allowed
  55021. var prohibitedKeywordRE = new RegExp('\\b' + (
  55022. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55023. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55024. 'extends,finally,continue,debugger,function,arguments'
  55025. ).split(',').join('\\b|\\b') + '\\b');
  55026. // these unary operators should not be used as property/method names
  55027. var unaryOperatorsRE = new RegExp('\\b' + (
  55028. 'delete,typeof,void'
  55029. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55030. // strip strings in expressions
  55031. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55032. // detect problematic expressions in a template
  55033. function detectErrors (ast, warn) {
  55034. if (ast) {
  55035. checkNode(ast, warn);
  55036. }
  55037. }
  55038. function checkNode (node, warn) {
  55039. if (node.type === 1) {
  55040. for (var name in node.attrsMap) {
  55041. if (dirRE.test(name)) {
  55042. var value = node.attrsMap[name];
  55043. if (value) {
  55044. var range = node.rawAttrsMap[name];
  55045. if (name === 'v-for') {
  55046. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55047. } else if (name === 'v-slot' || name[0] === '#') {
  55048. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55049. } else if (onRE.test(name)) {
  55050. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55051. } else {
  55052. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55053. }
  55054. }
  55055. }
  55056. }
  55057. if (node.children) {
  55058. for (var i = 0; i < node.children.length; i++) {
  55059. checkNode(node.children[i], warn);
  55060. }
  55061. }
  55062. } else if (node.type === 2) {
  55063. checkExpression(node.expression, node.text, warn, node);
  55064. }
  55065. }
  55066. function checkEvent (exp, text, warn, range) {
  55067. var stripped = exp.replace(stripStringRE, '');
  55068. var keywordMatch = stripped.match(unaryOperatorsRE);
  55069. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55070. warn(
  55071. "avoid using JavaScript unary operator as property name: " +
  55072. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55073. range
  55074. );
  55075. }
  55076. checkExpression(exp, text, warn, range);
  55077. }
  55078. function checkFor (node, text, warn, range) {
  55079. checkExpression(node.for || '', text, warn, range);
  55080. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55081. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55082. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55083. }
  55084. function checkIdentifier (
  55085. ident,
  55086. type,
  55087. text,
  55088. warn,
  55089. range
  55090. ) {
  55091. if (typeof ident === 'string') {
  55092. try {
  55093. new Function(("var " + ident + "=_"));
  55094. } catch (e) {
  55095. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55096. }
  55097. }
  55098. }
  55099. function checkExpression (exp, text, warn, range) {
  55100. try {
  55101. new Function(("return " + exp));
  55102. } catch (e) {
  55103. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55104. if (keywordMatch) {
  55105. warn(
  55106. "avoid using JavaScript keyword as property name: " +
  55107. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55108. range
  55109. );
  55110. } else {
  55111. warn(
  55112. "invalid expression: " + (e.message) + " in\n\n" +
  55113. " " + exp + "\n\n" +
  55114. " Raw expression: " + (text.trim()) + "\n",
  55115. range
  55116. );
  55117. }
  55118. }
  55119. }
  55120. function checkFunctionParameterExpression (exp, text, warn, range) {
  55121. try {
  55122. new Function(exp, '');
  55123. } catch (e) {
  55124. warn(
  55125. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55126. " " + exp + "\n\n" +
  55127. " Raw expression: " + (text.trim()) + "\n",
  55128. range
  55129. );
  55130. }
  55131. }
  55132. /* */
  55133. var range = 2;
  55134. function generateCodeFrame (
  55135. source,
  55136. start,
  55137. end
  55138. ) {
  55139. if ( start === void 0 ) start = 0;
  55140. if ( end === void 0 ) end = source.length;
  55141. var lines = source.split(/\r?\n/);
  55142. var count = 0;
  55143. var res = [];
  55144. for (var i = 0; i < lines.length; i++) {
  55145. count += lines[i].length + 1;
  55146. if (count >= start) {
  55147. for (var j = i - range; j <= i + range || end > count; j++) {
  55148. if (j < 0 || j >= lines.length) { continue }
  55149. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55150. var lineLength = lines[j].length;
  55151. if (j === i) {
  55152. // push underline
  55153. var pad = start - (count - lineLength) + 1;
  55154. var length = end > count ? lineLength - pad : end - start;
  55155. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55156. } else if (j > i) {
  55157. if (end > count) {
  55158. var length$1 = Math.min(end - count, lineLength);
  55159. res.push(" | " + repeat$1("^", length$1));
  55160. }
  55161. count += lineLength + 1;
  55162. }
  55163. }
  55164. break
  55165. }
  55166. }
  55167. return res.join('\n')
  55168. }
  55169. function repeat$1 (str, n) {
  55170. var result = '';
  55171. if (n > 0) {
  55172. while (true) { // eslint-disable-line
  55173. if (n & 1) { result += str; }
  55174. n >>>= 1;
  55175. if (n <= 0) { break }
  55176. str += str;
  55177. }
  55178. }
  55179. return result
  55180. }
  55181. /* */
  55182. function createFunction (code, errors) {
  55183. try {
  55184. return new Function(code)
  55185. } catch (err) {
  55186. errors.push({ err: err, code: code });
  55187. return noop
  55188. }
  55189. }
  55190. function createCompileToFunctionFn (compile) {
  55191. var cache = Object.create(null);
  55192. return function compileToFunctions (
  55193. template,
  55194. options,
  55195. vm
  55196. ) {
  55197. options = extend({}, options);
  55198. var warn$$1 = options.warn || warn;
  55199. delete options.warn;
  55200. /* istanbul ignore if */
  55201. {
  55202. // detect possible CSP restriction
  55203. try {
  55204. new Function('return 1');
  55205. } catch (e) {
  55206. if (e.toString().match(/unsafe-eval|CSP/)) {
  55207. warn$$1(
  55208. 'It seems you are using the standalone build of Vue.js in an ' +
  55209. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55210. 'The template compiler cannot work in this environment. Consider ' +
  55211. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55212. 'templates into render functions.'
  55213. );
  55214. }
  55215. }
  55216. }
  55217. // check cache
  55218. var key = options.delimiters
  55219. ? String(options.delimiters) + template
  55220. : template;
  55221. if (cache[key]) {
  55222. return cache[key]
  55223. }
  55224. // compile
  55225. var compiled = compile(template, options);
  55226. // check compilation errors/tips
  55227. {
  55228. if (compiled.errors && compiled.errors.length) {
  55229. if (options.outputSourceRange) {
  55230. compiled.errors.forEach(function (e) {
  55231. warn$$1(
  55232. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55233. generateCodeFrame(template, e.start, e.end),
  55234. vm
  55235. );
  55236. });
  55237. } else {
  55238. warn$$1(
  55239. "Error compiling template:\n\n" + template + "\n\n" +
  55240. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55241. vm
  55242. );
  55243. }
  55244. }
  55245. if (compiled.tips && compiled.tips.length) {
  55246. if (options.outputSourceRange) {
  55247. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55248. } else {
  55249. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55250. }
  55251. }
  55252. }
  55253. // turn code into functions
  55254. var res = {};
  55255. var fnGenErrors = [];
  55256. res.render = createFunction(compiled.render, fnGenErrors);
  55257. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55258. return createFunction(code, fnGenErrors)
  55259. });
  55260. // check function generation errors.
  55261. // this should only happen if there is a bug in the compiler itself.
  55262. // mostly for codegen development use
  55263. /* istanbul ignore if */
  55264. {
  55265. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55266. warn$$1(
  55267. "Failed to generate render function:\n\n" +
  55268. fnGenErrors.map(function (ref) {
  55269. var err = ref.err;
  55270. var code = ref.code;
  55271. return ((err.toString()) + " in\n\n" + code + "\n");
  55272. }).join('\n'),
  55273. vm
  55274. );
  55275. }
  55276. }
  55277. return (cache[key] = res)
  55278. }
  55279. }
  55280. /* */
  55281. function createCompilerCreator (baseCompile) {
  55282. return function createCompiler (baseOptions) {
  55283. function compile (
  55284. template,
  55285. options
  55286. ) {
  55287. var finalOptions = Object.create(baseOptions);
  55288. var errors = [];
  55289. var tips = [];
  55290. var warn = function (msg, range, tip) {
  55291. (tip ? tips : errors).push(msg);
  55292. };
  55293. if (options) {
  55294. if (options.outputSourceRange) {
  55295. // $flow-disable-line
  55296. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55297. warn = function (msg, range, tip) {
  55298. var data = { msg: msg };
  55299. if (range) {
  55300. if (range.start != null) {
  55301. data.start = range.start + leadingSpaceLength;
  55302. }
  55303. if (range.end != null) {
  55304. data.end = range.end + leadingSpaceLength;
  55305. }
  55306. }
  55307. (tip ? tips : errors).push(data);
  55308. };
  55309. }
  55310. // merge custom modules
  55311. if (options.modules) {
  55312. finalOptions.modules =
  55313. (baseOptions.modules || []).concat(options.modules);
  55314. }
  55315. // merge custom directives
  55316. if (options.directives) {
  55317. finalOptions.directives = extend(
  55318. Object.create(baseOptions.directives || null),
  55319. options.directives
  55320. );
  55321. }
  55322. // copy other options
  55323. for (var key in options) {
  55324. if (key !== 'modules' && key !== 'directives') {
  55325. finalOptions[key] = options[key];
  55326. }
  55327. }
  55328. }
  55329. finalOptions.warn = warn;
  55330. var compiled = baseCompile(template.trim(), finalOptions);
  55331. {
  55332. detectErrors(compiled.ast, warn);
  55333. }
  55334. compiled.errors = errors;
  55335. compiled.tips = tips;
  55336. return compiled
  55337. }
  55338. return {
  55339. compile: compile,
  55340. compileToFunctions: createCompileToFunctionFn(compile)
  55341. }
  55342. }
  55343. }
  55344. /* */
  55345. // `createCompilerCreator` allows creating compilers that use alternative
  55346. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55347. // Here we just export a default compiler using the default parts.
  55348. var createCompiler = createCompilerCreator(function baseCompile (
  55349. template,
  55350. options
  55351. ) {
  55352. var ast = parse(template.trim(), options);
  55353. if (options.optimize !== false) {
  55354. optimize(ast, options);
  55355. }
  55356. var code = generate(ast, options);
  55357. return {
  55358. ast: ast,
  55359. render: code.render,
  55360. staticRenderFns: code.staticRenderFns
  55361. }
  55362. });
  55363. /* */
  55364. var ref$1 = createCompiler(baseOptions);
  55365. var compile = ref$1.compile;
  55366. var compileToFunctions = ref$1.compileToFunctions;
  55367. /* */
  55368. // check whether current browser encodes a char inside attribute values
  55369. var div;
  55370. function getShouldDecode (href) {
  55371. div = div || document.createElement('div');
  55372. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55373. return div.innerHTML.indexOf('&#10;') > 0
  55374. }
  55375. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55376. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55377. // #6828: chrome encodes content in a[href]
  55378. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55379. /* */
  55380. var idToTemplate = cached(function (id) {
  55381. var el = query(id);
  55382. return el && el.innerHTML
  55383. });
  55384. var mount = Vue.prototype.$mount;
  55385. Vue.prototype.$mount = function (
  55386. el,
  55387. hydrating
  55388. ) {
  55389. el = el && query(el);
  55390. /* istanbul ignore if */
  55391. if (el === document.body || el === document.documentElement) {
  55392. warn(
  55393. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55394. );
  55395. return this
  55396. }
  55397. var options = this.$options;
  55398. // resolve template/el and convert to render function
  55399. if (!options.render) {
  55400. var template = options.template;
  55401. if (template) {
  55402. if (typeof template === 'string') {
  55403. if (template.charAt(0) === '#') {
  55404. template = idToTemplate(template);
  55405. /* istanbul ignore if */
  55406. if (!template) {
  55407. warn(
  55408. ("Template element not found or is empty: " + (options.template)),
  55409. this
  55410. );
  55411. }
  55412. }
  55413. } else if (template.nodeType) {
  55414. template = template.innerHTML;
  55415. } else {
  55416. {
  55417. warn('invalid template option:' + template, this);
  55418. }
  55419. return this
  55420. }
  55421. } else if (el) {
  55422. template = getOuterHTML(el);
  55423. }
  55424. if (template) {
  55425. /* istanbul ignore if */
  55426. if (config.performance && mark) {
  55427. mark('compile');
  55428. }
  55429. var ref = compileToFunctions(template, {
  55430. outputSourceRange: "development" !== 'production',
  55431. shouldDecodeNewlines: shouldDecodeNewlines,
  55432. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55433. delimiters: options.delimiters,
  55434. comments: options.comments
  55435. }, this);
  55436. var render = ref.render;
  55437. var staticRenderFns = ref.staticRenderFns;
  55438. options.render = render;
  55439. options.staticRenderFns = staticRenderFns;
  55440. /* istanbul ignore if */
  55441. if (config.performance && mark) {
  55442. mark('compile end');
  55443. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55444. }
  55445. }
  55446. }
  55447. return mount.call(this, el, hydrating)
  55448. };
  55449. /**
  55450. * Get outerHTML of elements, taking care
  55451. * of SVG elements in IE as well.
  55452. */
  55453. function getOuterHTML (el) {
  55454. if (el.outerHTML) {
  55455. return el.outerHTML
  55456. } else {
  55457. var container = document.createElement('div');
  55458. container.appendChild(el.cloneNode(true));
  55459. return container.innerHTML
  55460. }
  55461. }
  55462. Vue.compile = compileToFunctions;
  55463. module.exports = Vue;
  55464. /* 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))
  55465. /***/ }),
  55466. /***/ "./node_modules/vue/dist/vue.common.js":
  55467. /*!*********************************************!*\
  55468. !*** ./node_modules/vue/dist/vue.common.js ***!
  55469. \*********************************************/
  55470. /*! no static exports found */
  55471. /***/ (function(module, exports, __webpack_require__) {
  55472. if (false) {} else {
  55473. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55474. }
  55475. /***/ }),
  55476. /***/ "./node_modules/webpack/buildin/global.js":
  55477. /*!***********************************!*\
  55478. !*** (webpack)/buildin/global.js ***!
  55479. \***********************************/
  55480. /*! no static exports found */
  55481. /***/ (function(module, exports) {
  55482. var g;
  55483. // This works in non-strict mode
  55484. g = (function() {
  55485. return this;
  55486. })();
  55487. try {
  55488. // This works if eval is allowed (see CSP)
  55489. g = g || new Function("return this")();
  55490. } catch (e) {
  55491. // This works if the window reference is available
  55492. if (typeof window === "object") g = window;
  55493. }
  55494. // g can still be undefined, but nothing to do about it...
  55495. // We return undefined, instead of nothing here, so it's
  55496. // easier to handle this case. if(!global) { ...}
  55497. module.exports = g;
  55498. /***/ }),
  55499. /***/ "./node_modules/webpack/buildin/module.js":
  55500. /*!***********************************!*\
  55501. !*** (webpack)/buildin/module.js ***!
  55502. \***********************************/
  55503. /*! no static exports found */
  55504. /***/ (function(module, exports) {
  55505. module.exports = function(module) {
  55506. if (!module.webpackPolyfill) {
  55507. module.deprecate = function() {};
  55508. module.paths = [];
  55509. // module.parent = undefined by default
  55510. if (!module.children) module.children = [];
  55511. Object.defineProperty(module, "loaded", {
  55512. enumerable: true,
  55513. get: function() {
  55514. return module.l;
  55515. }
  55516. });
  55517. Object.defineProperty(module, "id", {
  55518. enumerable: true,
  55519. get: function() {
  55520. return module.i;
  55521. }
  55522. });
  55523. module.webpackPolyfill = 1;
  55524. }
  55525. return module;
  55526. };
  55527. /***/ }),
  55528. /***/ "./resources/js/app.js":
  55529. /*!*****************************!*\
  55530. !*** ./resources/js/app.js ***!
  55531. \*****************************/
  55532. /*! no static exports found */
  55533. /***/ (function(module, exports, __webpack_require__) {
  55534. /**
  55535. * First we will load all of this project's JavaScript dependencies which
  55536. * includes Vue and other libraries. It is a great starting point when
  55537. * building robust, powerful web applications using Vue and Laravel.
  55538. */
  55539. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55540. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55541. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55542. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55543. /**
  55544. * The following block of code may be used to automatically register your
  55545. * Vue components. It will recursively scan this directory for the Vue
  55546. * components and automatically register them with their "basename".
  55547. *
  55548. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55549. */
  55550. // const files = require.context('./', true, /\.vue$/i)
  55551. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55552. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55553. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55554. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55555. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55556. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55557. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55558. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55559. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55560. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55561. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55562. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55563. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55564. /**
  55565. * Next, we will create a fresh Vue application instance and attach it to
  55566. * the page. Then, you may begin adding components to this application
  55567. * or customize the JavaScript scaffolding to fit your unique needs.
  55568. */
  55569. var app = new Vue({
  55570. el: '#app'
  55571. });
  55572. $(function () {
  55573. $('[data-toggle="tooltip"]').tooltip();
  55574. });
  55575. var clipboard = new Clipboard('.btn-clip');
  55576. clipboard.on('success', function (e) {
  55577. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55578. position: "right",
  55579. className: 'success'
  55580. });
  55581. e.clearSelection();
  55582. });
  55583. /***/ }),
  55584. /***/ "./resources/js/bootstrap.js":
  55585. /*!***********************************!*\
  55586. !*** ./resources/js/bootstrap.js ***!
  55587. \***********************************/
  55588. /*! no exports provided */
  55589. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55590. "use strict";
  55591. __webpack_require__.r(__webpack_exports__);
  55592. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55593. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55594. /**
  55595. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55596. * for JavaScript based Bootstrap features such as modals and tabs. This
  55597. * code may be modified to fit the specific needs of your application.
  55598. */
  55599. try {
  55600. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55601. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55602. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55603. } catch (e) {}
  55604. /**
  55605. * We'll load the axios HTTP library which allows us to easily issue requests
  55606. * to our Laravel back-end. This library automatically handles sending the
  55607. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55608. */
  55609. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55610. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55611. /**
  55612. * Echo exposes an expressive API for subscribing to channels and listening
  55613. * for events that are broadcast by Laravel. Echo and event broadcasting
  55614. * allows your team to easily build robust real-time web applications.
  55615. */
  55616. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55617. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55618. broadcaster: 'pusher',
  55619. key: "upccrt",
  55620. authEndpoint: '/broadcasting/auth',
  55621. wsHost: window.location.hostname,
  55622. wsPort: 6001,
  55623. disableStats: true
  55624. });
  55625. /***/ }),
  55626. /***/ "./resources/js/components/ExampleComponent.vue":
  55627. /*!******************************************************!*\
  55628. !*** ./resources/js/components/ExampleComponent.vue ***!
  55629. \******************************************************/
  55630. /*! exports provided: default */
  55631. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55632. "use strict";
  55633. __webpack_require__.r(__webpack_exports__);
  55634. /* 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&");
  55635. /* 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&");
  55636. /* 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");
  55637. /* normalize component */
  55638. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55639. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55640. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55641. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55642. false,
  55643. null,
  55644. null,
  55645. null
  55646. )
  55647. /* hot reload */
  55648. if (false) { var api; }
  55649. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55650. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55651. /***/ }),
  55652. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55653. /*!*******************************************************************************!*\
  55654. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55655. \*******************************************************************************/
  55656. /*! exports provided: default */
  55657. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55658. "use strict";
  55659. __webpack_require__.r(__webpack_exports__);
  55660. /* 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&");
  55661. /* 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"]);
  55662. /***/ }),
  55663. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55664. /*!*************************************************************************************!*\
  55665. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55666. \*************************************************************************************/
  55667. /*! exports provided: render, staticRenderFns */
  55668. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55669. "use strict";
  55670. __webpack_require__.r(__webpack_exports__);
  55671. /* 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&");
  55672. /* 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"]; });
  55673. /* 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"]; });
  55674. /***/ }),
  55675. /***/ "./resources/js/components/assetinfo.vue":
  55676. /*!***********************************************!*\
  55677. !*** ./resources/js/components/assetinfo.vue ***!
  55678. \***********************************************/
  55679. /*! exports provided: default */
  55680. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55681. "use strict";
  55682. __webpack_require__.r(__webpack_exports__);
  55683. /* 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&");
  55684. /* 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&");
  55685. /* 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");
  55686. /* normalize component */
  55687. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55688. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55689. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55690. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55691. false,
  55692. null,
  55693. null,
  55694. null
  55695. )
  55696. /* hot reload */
  55697. if (false) { var api; }
  55698. component.options.__file = "resources/js/components/assetinfo.vue"
  55699. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55700. /***/ }),
  55701. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55702. /*!************************************************************************!*\
  55703. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55704. \************************************************************************/
  55705. /*! exports provided: default */
  55706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55707. "use strict";
  55708. __webpack_require__.r(__webpack_exports__);
  55709. /* 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&");
  55710. /* 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"]);
  55711. /***/ }),
  55712. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55713. /*!******************************************************************************!*\
  55714. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55715. \******************************************************************************/
  55716. /*! exports provided: render, staticRenderFns */
  55717. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55718. "use strict";
  55719. __webpack_require__.r(__webpack_exports__);
  55720. /* 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&");
  55721. /* 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"]; });
  55722. /* 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"]; });
  55723. /***/ }),
  55724. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55725. /*!******************************************************************!*\
  55726. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55727. \******************************************************************/
  55728. /*! exports provided: default */
  55729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55730. "use strict";
  55731. __webpack_require__.r(__webpack_exports__);
  55732. /* 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&");
  55733. /* 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&");
  55734. /* 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");
  55735. /* normalize component */
  55736. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55737. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55738. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55739. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55740. false,
  55741. null,
  55742. null,
  55743. null
  55744. )
  55745. /* hot reload */
  55746. if (false) { var api; }
  55747. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55748. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55749. /***/ }),
  55750. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55751. /*!*******************************************************************************************!*\
  55752. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55753. \*******************************************************************************************/
  55754. /*! exports provided: default */
  55755. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55756. "use strict";
  55757. __webpack_require__.r(__webpack_exports__);
  55758. /* 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&");
  55759. /* 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"]);
  55760. /***/ }),
  55761. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55762. /*!*************************************************************************************************!*\
  55763. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55764. \*************************************************************************************************/
  55765. /*! exports provided: render, staticRenderFns */
  55766. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55767. "use strict";
  55768. __webpack_require__.r(__webpack_exports__);
  55769. /* 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&");
  55770. /* 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"]; });
  55771. /* 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"]; });
  55772. /***/ }),
  55773. /***/ "./resources/js/components/credential-form-modal.vue":
  55774. /*!***********************************************************!*\
  55775. !*** ./resources/js/components/credential-form-modal.vue ***!
  55776. \***********************************************************/
  55777. /*! exports provided: default */
  55778. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55779. "use strict";
  55780. __webpack_require__.r(__webpack_exports__);
  55781. /* 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&");
  55782. /* 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&");
  55783. /* 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");
  55784. /* normalize component */
  55785. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55786. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55787. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55788. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55789. false,
  55790. null,
  55791. null,
  55792. null
  55793. )
  55794. /* hot reload */
  55795. if (false) { var api; }
  55796. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55797. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55798. /***/ }),
  55799. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55800. /*!************************************************************************************!*\
  55801. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55802. \************************************************************************************/
  55803. /*! exports provided: default */
  55804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55805. "use strict";
  55806. __webpack_require__.r(__webpack_exports__);
  55807. /* 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&");
  55808. /* 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"]);
  55809. /***/ }),
  55810. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55811. /*!******************************************************************************************!*\
  55812. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55813. \******************************************************************************************/
  55814. /*! exports provided: render, staticRenderFns */
  55815. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55816. "use strict";
  55817. __webpack_require__.r(__webpack_exports__);
  55818. /* 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&");
  55819. /* 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"]; });
  55820. /* 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"]; });
  55821. /***/ }),
  55822. /***/ "./resources/js/components/credential-list.vue":
  55823. /*!*****************************************************!*\
  55824. !*** ./resources/js/components/credential-list.vue ***!
  55825. \*****************************************************/
  55826. /*! exports provided: default */
  55827. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55828. "use strict";
  55829. __webpack_require__.r(__webpack_exports__);
  55830. /* 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&");
  55831. /* 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&");
  55832. /* 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");
  55833. /* normalize component */
  55834. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55835. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55836. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55837. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55838. false,
  55839. null,
  55840. null,
  55841. null
  55842. )
  55843. /* hot reload */
  55844. if (false) { var api; }
  55845. component.options.__file = "resources/js/components/credential-list.vue"
  55846. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55847. /***/ }),
  55848. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55849. /*!******************************************************************************!*\
  55850. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55851. \******************************************************************************/
  55852. /*! exports provided: default */
  55853. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55854. "use strict";
  55855. __webpack_require__.r(__webpack_exports__);
  55856. /* 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&");
  55857. /* 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"]);
  55858. /***/ }),
  55859. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55860. /*!************************************************************************************!*\
  55861. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55862. \************************************************************************************/
  55863. /*! exports provided: render, staticRenderFns */
  55864. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55865. "use strict";
  55866. __webpack_require__.r(__webpack_exports__);
  55867. /* 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&");
  55868. /* 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"]; });
  55869. /* 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"]; });
  55870. /***/ }),
  55871. /***/ "./resources/js/components/credential.vue":
  55872. /*!************************************************!*\
  55873. !*** ./resources/js/components/credential.vue ***!
  55874. \************************************************/
  55875. /*! exports provided: default */
  55876. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55877. "use strict";
  55878. __webpack_require__.r(__webpack_exports__);
  55879. /* 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&");
  55880. /* 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&");
  55881. /* 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");
  55882. /* normalize component */
  55883. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55884. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55885. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55886. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55887. false,
  55888. null,
  55889. null,
  55890. null
  55891. )
  55892. /* hot reload */
  55893. if (false) { var api; }
  55894. component.options.__file = "resources/js/components/credential.vue"
  55895. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55896. /***/ }),
  55897. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55898. /*!*************************************************************************!*\
  55899. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55900. \*************************************************************************/
  55901. /*! exports provided: default */
  55902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55903. "use strict";
  55904. __webpack_require__.r(__webpack_exports__);
  55905. /* 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&");
  55906. /* 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"]);
  55907. /***/ }),
  55908. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55909. /*!*******************************************************************************!*\
  55910. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55911. \*******************************************************************************/
  55912. /*! exports provided: render, staticRenderFns */
  55913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55914. "use strict";
  55915. __webpack_require__.r(__webpack_exports__);
  55916. /* 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&");
  55917. /* 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"]; });
  55918. /* 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"]; });
  55919. /***/ }),
  55920. /***/ "./resources/js/components/errorlist.vue":
  55921. /*!***********************************************!*\
  55922. !*** ./resources/js/components/errorlist.vue ***!
  55923. \***********************************************/
  55924. /*! exports provided: default */
  55925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55926. "use strict";
  55927. __webpack_require__.r(__webpack_exports__);
  55928. /* 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&");
  55929. /* 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&");
  55930. /* 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");
  55931. /* normalize component */
  55932. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55933. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55934. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55935. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55936. false,
  55937. null,
  55938. null,
  55939. null
  55940. )
  55941. /* hot reload */
  55942. if (false) { var api; }
  55943. component.options.__file = "resources/js/components/errorlist.vue"
  55944. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55945. /***/ }),
  55946. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55947. /*!************************************************************************!*\
  55948. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55949. \************************************************************************/
  55950. /*! exports provided: default */
  55951. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55952. "use strict";
  55953. __webpack_require__.r(__webpack_exports__);
  55954. /* 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&");
  55955. /* 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"]);
  55956. /***/ }),
  55957. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55958. /*!******************************************************************************!*\
  55959. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55960. \******************************************************************************/
  55961. /*! exports provided: render, staticRenderFns */
  55962. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55963. "use strict";
  55964. __webpack_require__.r(__webpack_exports__);
  55965. /* 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&");
  55966. /* 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"]; });
  55967. /* 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"]; });
  55968. /***/ }),
  55969. /***/ "./resources/js/components/modal.vue":
  55970. /*!*******************************************!*\
  55971. !*** ./resources/js/components/modal.vue ***!
  55972. \*******************************************/
  55973. /*! exports provided: default */
  55974. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55975. "use strict";
  55976. __webpack_require__.r(__webpack_exports__);
  55977. /* 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&");
  55978. /* 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");
  55979. var script = {}
  55980. /* normalize component */
  55981. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55982. script,
  55983. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55984. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55985. false,
  55986. null,
  55987. null,
  55988. null
  55989. )
  55990. /* hot reload */
  55991. if (false) { var api; }
  55992. component.options.__file = "resources/js/components/modal.vue"
  55993. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55994. /***/ }),
  55995. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55996. /*!**************************************************************************!*\
  55997. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55998. \**************************************************************************/
  55999. /*! exports provided: render, staticRenderFns */
  56000. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56001. "use strict";
  56002. __webpack_require__.r(__webpack_exports__);
  56003. /* 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&");
  56004. /* 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"]; });
  56005. /* 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"]; });
  56006. /***/ }),
  56007. /***/ "./resources/js/components/note-form-modal.vue":
  56008. /*!*****************************************************!*\
  56009. !*** ./resources/js/components/note-form-modal.vue ***!
  56010. \*****************************************************/
  56011. /*! exports provided: default */
  56012. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56013. "use strict";
  56014. __webpack_require__.r(__webpack_exports__);
  56015. /* 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&");
  56016. /* 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&");
  56017. /* 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");
  56018. /* normalize component */
  56019. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56020. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56021. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56022. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56023. false,
  56024. null,
  56025. null,
  56026. null
  56027. )
  56028. /* hot reload */
  56029. if (false) { var api; }
  56030. component.options.__file = "resources/js/components/note-form-modal.vue"
  56031. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56032. /***/ }),
  56033. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56034. /*!******************************************************************************!*\
  56035. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56036. \******************************************************************************/
  56037. /*! exports provided: default */
  56038. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56039. "use strict";
  56040. __webpack_require__.r(__webpack_exports__);
  56041. /* 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&");
  56042. /* 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"]);
  56043. /***/ }),
  56044. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56045. /*!************************************************************************************!*\
  56046. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56047. \************************************************************************************/
  56048. /*! exports provided: render, staticRenderFns */
  56049. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56050. "use strict";
  56051. __webpack_require__.r(__webpack_exports__);
  56052. /* 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&");
  56053. /* 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"]; });
  56054. /* 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"]; });
  56055. /***/ }),
  56056. /***/ "./resources/js/components/notes.vue":
  56057. /*!*******************************************!*\
  56058. !*** ./resources/js/components/notes.vue ***!
  56059. \*******************************************/
  56060. /*! exports provided: default */
  56061. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56062. "use strict";
  56063. __webpack_require__.r(__webpack_exports__);
  56064. /* 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&");
  56065. /* 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&");
  56066. /* 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");
  56067. /* normalize component */
  56068. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56069. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56070. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56071. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56072. false,
  56073. null,
  56074. null,
  56075. null
  56076. )
  56077. /* hot reload */
  56078. if (false) { var api; }
  56079. component.options.__file = "resources/js/components/notes.vue"
  56080. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56081. /***/ }),
  56082. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56083. /*!********************************************************************!*\
  56084. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56085. \********************************************************************/
  56086. /*! exports provided: default */
  56087. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56088. "use strict";
  56089. __webpack_require__.r(__webpack_exports__);
  56090. /* 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&");
  56091. /* 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"]);
  56092. /***/ }),
  56093. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56094. /*!**************************************************************************!*\
  56095. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56096. \**************************************************************************/
  56097. /*! exports provided: render, staticRenderFns */
  56098. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56099. "use strict";
  56100. __webpack_require__.r(__webpack_exports__);
  56101. /* 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&");
  56102. /* 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"]; });
  56103. /* 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"]; });
  56104. /***/ }),
  56105. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56106. /*!*******************************************************!*\
  56107. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56108. \*******************************************************/
  56109. /*! exports provided: default */
  56110. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56111. "use strict";
  56112. __webpack_require__.r(__webpack_exports__);
  56113. /* 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&");
  56114. /* 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&");
  56115. /* 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");
  56116. /* normalize component */
  56117. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56118. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56119. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56120. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56121. false,
  56122. null,
  56123. null,
  56124. null
  56125. )
  56126. /* hot reload */
  56127. if (false) { var api; }
  56128. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56129. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56130. /***/ }),
  56131. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56132. /*!********************************************************************************!*\
  56133. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56134. \********************************************************************************/
  56135. /*! exports provided: default */
  56136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56137. "use strict";
  56138. __webpack_require__.r(__webpack_exports__);
  56139. /* 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&");
  56140. /* 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"]);
  56141. /***/ }),
  56142. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56143. /*!**************************************************************************************!*\
  56144. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56145. \**************************************************************************************/
  56146. /*! exports provided: render, staticRenderFns */
  56147. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56148. "use strict";
  56149. __webpack_require__.r(__webpack_exports__);
  56150. /* 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&");
  56151. /* 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"]; });
  56152. /* 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"]; });
  56153. /***/ }),
  56154. /***/ "./resources/js/components/woinfo.vue":
  56155. /*!********************************************!*\
  56156. !*** ./resources/js/components/woinfo.vue ***!
  56157. \********************************************/
  56158. /*! exports provided: default */
  56159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56160. "use strict";
  56161. __webpack_require__.r(__webpack_exports__);
  56162. /* 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&");
  56163. /* 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&");
  56164. /* 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");
  56165. /* normalize component */
  56166. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56167. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56168. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56169. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56170. false,
  56171. null,
  56172. null,
  56173. null
  56174. )
  56175. /* hot reload */
  56176. if (false) { var api; }
  56177. component.options.__file = "resources/js/components/woinfo.vue"
  56178. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56179. /***/ }),
  56180. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56181. /*!*********************************************************************!*\
  56182. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56183. \*********************************************************************/
  56184. /*! exports provided: default */
  56185. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56186. "use strict";
  56187. __webpack_require__.r(__webpack_exports__);
  56188. /* 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&");
  56189. /* 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"]);
  56190. /***/ }),
  56191. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56192. /*!***************************************************************************!*\
  56193. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56194. \***************************************************************************/
  56195. /*! exports provided: render, staticRenderFns */
  56196. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56197. "use strict";
  56198. __webpack_require__.r(__webpack_exports__);
  56199. /* 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&");
  56200. /* 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"]; });
  56201. /* 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"]; });
  56202. /***/ }),
  56203. /***/ "./resources/js/mixins/dateMixin.js":
  56204. /*!******************************************!*\
  56205. !*** ./resources/js/mixins/dateMixin.js ***!
  56206. \******************************************/
  56207. /*! exports provided: default */
  56208. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56209. "use strict";
  56210. __webpack_require__.r(__webpack_exports__);
  56211. /* harmony default export */ __webpack_exports__["default"] = ({
  56212. methods: {
  56213. treatAsUTC: function treatAsUTC(date) {
  56214. var result = new Date(date);
  56215. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56216. return result;
  56217. },
  56218. daysSinceToday: function daysSinceToday(date) {
  56219. var currentDate = new Date();
  56220. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56221. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56222. },
  56223. getHRDate: function getHRDate(dateString) {
  56224. var date = new Date(dateString);
  56225. return date.toLocaleString('default', {
  56226. month: 'short',
  56227. day: 'numeric',
  56228. year: 'numeric',
  56229. hour: 'numeric',
  56230. minute: 'numeric'
  56231. });
  56232. },
  56233. isZero: function isZero(dateString) {
  56234. return dateString === '0000-00-00 00:00:00';
  56235. }
  56236. }
  56237. });
  56238. /***/ }),
  56239. /***/ "./resources/js/notify.min.js":
  56240. /*!************************************!*\
  56241. !*** ./resources/js/notify.min.js ***!
  56242. \************************************/
  56243. /*! no static exports found */
  56244. /***/ (function(module, exports, __webpack_require__) {
  56245. 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); }
  56246. (function (e) {
  56247. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56248. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56249. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56250. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56251. })(function (e) {
  56252. function A(t, n, i) {
  56253. typeof i == "string" && (i = {
  56254. className: i
  56255. }), 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);
  56256. }
  56257. var t = [].indexOf || function (e) {
  56258. for (var t = 0, n = this.length; t < n; t++) {
  56259. if (t in this && this[t] === e) return t;
  56260. }
  56261. return -1;
  56262. },
  56263. n = "notify",
  56264. r = n + "js",
  56265. i = n + "!blank",
  56266. s = {
  56267. t: "top",
  56268. m: "middle",
  56269. b: "bottom",
  56270. l: "left",
  56271. c: "center",
  56272. r: "right"
  56273. },
  56274. o = ["l", "c", "r"],
  56275. u = ["t", "m", "b"],
  56276. a = ["t", "b", "l", "r"],
  56277. f = {
  56278. t: "b",
  56279. m: null,
  56280. b: "t",
  56281. l: "r",
  56282. c: null,
  56283. r: "l"
  56284. },
  56285. l = function l(t) {
  56286. var n;
  56287. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56288. var r;
  56289. r = t.toLowerCase().charAt(0);
  56290. if (s[r]) return n.push(r);
  56291. }), n;
  56292. },
  56293. c = {},
  56294. h = {
  56295. name: "core",
  56296. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56297. 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}"
  56298. },
  56299. p = {
  56300. "border-radius": ["-webkit-", "-moz-"]
  56301. },
  56302. d = function d(e) {
  56303. return c[e];
  56304. },
  56305. v = function v(e) {
  56306. if (!e) throw "Missing Style name";
  56307. c[e] && delete c[e];
  56308. },
  56309. m = function m(t, i) {
  56310. if (!t) throw "Missing Style name";
  56311. if (!i) throw "Missing Style definition";
  56312. if (!i.html) throw "Missing Style HTML";
  56313. var s = c[t];
  56314. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56315. var o = "";
  56316. i.classes && e.each(i.classes, function (t, n) {
  56317. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56318. return p[t] && e.each(p[t], function (e, r) {
  56319. return o += " " + r + t + ": " + n + ";\n";
  56320. }), o += " " + t + ": " + n + ";\n";
  56321. }), o += "}\n";
  56322. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56323. var u = {},
  56324. a = e(i.html);
  56325. y("html", a, u), y("text", a, u), i.fields = u;
  56326. },
  56327. g = function g(t) {
  56328. var n, r, i;
  56329. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56330. try {
  56331. r.html(t);
  56332. } catch (s) {
  56333. r[0].styleSheet.cssText = t;
  56334. }
  56335. return r;
  56336. },
  56337. y = function y(t, n, r) {
  56338. var s;
  56339. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56340. var n;
  56341. n = e(this).attr(s), n || (n = i), r[n] = t;
  56342. });
  56343. },
  56344. b = function b(e, t) {
  56345. return e.is(t) ? e : e.find(t);
  56346. },
  56347. w = {
  56348. clickToHide: !0,
  56349. autoHide: !0,
  56350. autoHideDelay: 5e3,
  56351. arrowShow: !0,
  56352. arrowSize: 5,
  56353. breakNewLines: !0,
  56354. elementPosition: "bottom",
  56355. globalPosition: "top right",
  56356. style: "bootstrap",
  56357. className: "error",
  56358. showAnimation: "slideDown",
  56359. showDuration: 400,
  56360. hideAnimation: "slideUp",
  56361. hideDuration: 200,
  56362. gap: 5
  56363. },
  56364. E = function E(t, n) {
  56365. var r;
  56366. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56367. },
  56368. S = function S(t) {
  56369. return e.extend(w, t);
  56370. },
  56371. x = function x(t) {
  56372. return e("<" + t + "></" + t + ">");
  56373. },
  56374. T = {},
  56375. N = function N(t) {
  56376. var n;
  56377. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56378. return e(r).attr("name") === t.attr("name");
  56379. }), t = n.first()), t;
  56380. },
  56381. C = function C(e, t, n) {
  56382. var r, i;
  56383. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56384. if (isNaN(n)) return;
  56385. 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;
  56386. },
  56387. k = function k(e, t, n) {
  56388. if (e === "l" || e === "t") return 0;
  56389. if (e === "c" || e === "m") return n / 2 - t / 2;
  56390. if (e === "r" || e === "b") return n - t;
  56391. throw "Invalid alignment";
  56392. },
  56393. L = function L(e) {
  56394. return L.e = L.e || x("div"), L.e.text(e).html();
  56395. };
  56396. A.prototype.loadHTML = function () {
  56397. var t;
  56398. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56399. }, A.prototype.show = function (e, t) {
  56400. var n, r, i, s, o;
  56401. r = function (n) {
  56402. return function () {
  56403. !e && !n.elem && n.destroy();
  56404. if (t) return t();
  56405. };
  56406. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56407. 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 {
  56408. if (!!o || !!e) return r();
  56409. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56410. }
  56411. return n.push(r), i[s].apply(i, n);
  56412. }, A.prototype.setGlobalPosition = function () {
  56413. var t = this.getPosition(),
  56414. n = t[0],
  56415. i = t[1],
  56416. o = s[n],
  56417. u = s[i],
  56418. a = n + "|" + i,
  56419. f = T[a];
  56420. if (!f || !document.body.contains(f[0])) {
  56421. f = T[a] = x("div");
  56422. var l = {};
  56423. 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);
  56424. }
  56425. return f.prepend(this.wrapper);
  56426. }, A.prototype.setElementPosition = function () {
  56427. 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;
  56428. 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"];
  56429. for (w = 0, S = B.length; w < S; w++) {
  56430. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56431. }
  56432. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56433. if (!this.options.arrowShow) this.arrow.hide();else {
  56434. 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";
  56435. for (E = 0, x = a.length; E < x; E++) {
  56436. D = a[E], P = s[D];
  56437. if (D === L) continue;
  56438. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56439. }
  56440. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56441. }
  56442. 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);
  56443. if (r) return this.arrow.removeAttr("style").css(r);
  56444. }, A.prototype.getPosition = function () {
  56445. var e, n, r, i, s, f, c, h;
  56446. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56447. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56448. 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";
  56449. return e.length === 2 && (e[2] = e[1]), e;
  56450. }, A.prototype.getStyle = function (e) {
  56451. var t;
  56452. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56453. if (!t) throw "Missing style: " + e;
  56454. return t;
  56455. }, A.prototype.updateClasses = function () {
  56456. var t, n;
  56457. 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) {
  56458. return r + "-" + n.name + "-" + e;
  56459. }).join(" "), this.userContainer.attr("class", t);
  56460. }, A.prototype.run = function (t, n) {
  56461. var r, s, o, u, a;
  56462. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56463. if (this.container && !t) {
  56464. this.show(!1);
  56465. return;
  56466. }
  56467. if (!this.container && !t) return;
  56468. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56469. for (o in s) {
  56470. r = s[o], u = this.userFields[o];
  56471. if (!u) continue;
  56472. 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);
  56473. }
  56474. 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));
  56475. }, A.prototype.destroy = function () {
  56476. this.wrapper.data(r, null), this.wrapper.remove();
  56477. }, e[n] = function (t, r, i) {
  56478. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56479. }, e.fn[n] = function (t, n) {
  56480. return e(this).each(function () {
  56481. var i = N(e(this)).data(r);
  56482. i && i.destroy();
  56483. var s = new A(e(this), t, n);
  56484. }), this;
  56485. }, e.extend(e[n], {
  56486. defaults: S,
  56487. addStyle: m,
  56488. removeStyle: v,
  56489. pluginOptions: w,
  56490. getStyle: d,
  56491. insertCSS: g
  56492. }), m("bootstrap", {
  56493. html: "<div>\n<span data-notify-text></span>\n</div>",
  56494. classes: {
  56495. base: {
  56496. "font-weight": "bold",
  56497. padding: "8px 15px 8px 14px",
  56498. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56499. "background-color": "#fcf8e3",
  56500. border: "1px solid #fbeed5",
  56501. "border-radius": "4px",
  56502. "white-space": "nowrap",
  56503. "padding-left": "25px",
  56504. "background-repeat": "no-repeat",
  56505. "background-position": "3px 7px"
  56506. },
  56507. error: {
  56508. color: "#B94A48",
  56509. "background-color": "#F2DEDE",
  56510. "border-color": "#EED3D7",
  56511. "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=)"
  56512. },
  56513. success: {
  56514. color: "#468847",
  56515. "background-color": "#DFF0D8",
  56516. "border-color": "#D6E9C6",
  56517. "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==)"
  56518. },
  56519. info: {
  56520. color: "#3A87AD",
  56521. "background-color": "#D9EDF7",
  56522. "border-color": "#BCE8F1",
  56523. "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=)"
  56524. },
  56525. warn: {
  56526. color: "#C09853",
  56527. "background-color": "#FCF8E3",
  56528. "border-color": "#FBEED5",
  56529. "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)"
  56530. }
  56531. }
  56532. }), e(function () {
  56533. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56534. e(this).trigger("notify-hide");
  56535. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56536. var n = e(this).data(r);
  56537. n && n.show(!1);
  56538. });
  56539. });
  56540. });
  56541. /***/ }),
  56542. /***/ "./resources/sass/app.scss":
  56543. /*!*********************************!*\
  56544. !*** ./resources/sass/app.scss ***!
  56545. \*********************************/
  56546. /*! no static exports found */
  56547. /***/ (function(module, exports) {
  56548. // removed by extract-text-webpack-plugin
  56549. /***/ }),
  56550. /***/ 0:
  56551. /*!*************************************************************!*\
  56552. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56553. \*************************************************************/
  56554. /*! no static exports found */
  56555. /***/ (function(module, exports, __webpack_require__) {
  56556. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56557. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56558. /***/ })
  56559. /******/ });