app.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = e.data;
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. },
  1992. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. }).listen('CredentialAdded', function (e) {
  2008. _this.credentials.unshift(e.credential);
  2009. });
  2010. }
  2011. if (this.groupid) {
  2012. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2013. var deletedCred = e.credential;
  2014. var index = _this.credentials.findIndex(function (credential) {
  2015. return credential.groupid === deletedCred['groupid'];
  2016. });
  2017. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2018. _this.deleteCred(index);
  2019. }).listen('CredentialAdded', function (e) {
  2020. _this.credentials.unshift(e.credential);
  2021. });
  2022. }
  2023. }
  2024. });
  2025. /***/ }),
  2026. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2027. /*!*********************************************************************************************************************************************************************!*\
  2028. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  2029. \*********************************************************************************************************************************************************************/
  2030. /*! exports provided: default */
  2031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2032. "use strict";
  2033. __webpack_require__.r(__webpack_exports__);
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. /* harmony default export */ __webpack_exports__["default"] = ({
  2078. props: ['credential', 'descriptions'],
  2079. data: function data() {
  2080. return {
  2081. data: this.credential,
  2082. creddescList: this.descriptions
  2083. };
  2084. },
  2085. mounted: function mounted() {
  2086. var _this = this;
  2087. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2088. _this.data = e.credential;
  2089. });
  2090. },
  2091. methods: {
  2092. deleteCredential: function deleteCredential() {
  2093. var _this2 = this;
  2094. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2095. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2096. })["catch"](function (error) {
  2097. console.error(error);
  2098. });
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2104. /*!********************************************************************************************************************************************************************!*\
  2105. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2106. \********************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. /* harmony default export */ __webpack_exports__["default"] = ({
  2117. props: ['errors'],
  2118. data: function data() {
  2119. return {
  2120. errorList: this.errors
  2121. };
  2122. },
  2123. watch: {
  2124. errors: function errors(newErrors) {
  2125. this.errorList = newErrors;
  2126. }
  2127. }
  2128. });
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  2131. /*!**************************************************************************************************************************************************************************!*\
  2132. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  2133. \**************************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. /* harmony default export */ __webpack_exports__["default"] = ({
  2156. props: {
  2157. populateWith: {
  2158. type: Object,
  2159. require: true
  2160. },
  2161. modalId: {
  2162. type: String,
  2163. require: true
  2164. },
  2165. noteType: {
  2166. type: Number
  2167. },
  2168. noteUser: {
  2169. type: String
  2170. },
  2171. woid: {
  2172. type: Number
  2173. }
  2174. },
  2175. data: function data() {
  2176. return {
  2177. note: JSON.parse(JSON.stringify(this.populateWith))
  2178. };
  2179. },
  2180. methods: {
  2181. updateNote: function updateNote(note) {
  2182. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2183. hideModal();
  2184. });
  2185. },
  2186. hideModal: function hideModal() {
  2187. $('#' + this.modalId).modal('hide');
  2188. }
  2189. }
  2190. });
  2191. /***/ }),
  2192. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2193. /*!****************************************************************************************************************************************************************!*\
  2194. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  2195. \****************************************************************************************************************************************************************/
  2196. /*! exports provided: default */
  2197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2198. "use strict";
  2199. __webpack_require__.r(__webpack_exports__);
  2200. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. /* harmony default export */ __webpack_exports__["default"] = ({
  2240. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2241. props: {
  2242. initialnotes: {
  2243. type: Array,
  2244. "default": []
  2245. },
  2246. authusername: {
  2247. type: String,
  2248. required: true
  2249. },
  2250. noteType: {
  2251. type: Number,
  2252. required: true
  2253. },
  2254. woid: {
  2255. type: Number,
  2256. required: true
  2257. }
  2258. },
  2259. data: function data() {
  2260. return {
  2261. notes: this.initialnotes,
  2262. newNote: {
  2263. notetype: this.noteType,
  2264. thenote: '',
  2265. noteuser: this.authusername,
  2266. woid: this.woid
  2267. }
  2268. };
  2269. },
  2270. computed: {
  2271. noteOrders: function noteOrders() {
  2272. return this.getNoteOrders(this.notes);
  2273. }
  2274. },
  2275. mounted: function mounted() {
  2276. var _this = this;
  2277. Echo.channel('wonotes.' + this.noteType + '.' + this.woid).listen('WorkOrderNoteAdded', function (e) {
  2278. _this.notes.push(e.note);
  2279. }).listen('WorkOrderNoteEdited', function (e) {
  2280. var index = _this.notes.findIndex(function (note) {
  2281. return note.noteid === e.note.noteid;
  2282. });
  2283. _this.notes[index] = e.note;
  2284. }).listen('WorkOrderNoteDeleted', function (e) {
  2285. var index = _this.notes.findIndex(function (note) {
  2286. return note.noteid === e.noteid;
  2287. });
  2288. _this.notes.splice(index, 1);
  2289. });
  2290. },
  2291. methods: {
  2292. createNote: function createNote() {
  2293. var _this2 = this;
  2294. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2295. $('#note' + _this2.noteType + 'add').collapse('hide');
  2296. _this2.newNote.thenote = '';
  2297. });
  2298. },
  2299. getNoteOrders: function getNoteOrders(notes) {
  2300. var noteOrders = [];
  2301. notes.forEach(function (note, index) {
  2302. if (index === 0) {
  2303. noteOrders[index] = 'order-first';
  2304. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2305. if (noteOrders[index - 1] === 'order-first') {
  2306. noteOrders[index] = 'order-last';
  2307. } else {
  2308. noteOrders[index] = 'order-first';
  2309. }
  2310. } else {
  2311. noteOrders[index] = noteOrders[index - 1];
  2312. }
  2313. });
  2314. return noteOrders;
  2315. }
  2316. }
  2317. });
  2318. /***/ }),
  2319. /***/ "./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&":
  2320. /*!****************************************************************************************************************************************************************************!*\
  2321. !*** ./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& ***!
  2322. \****************************************************************************************************************************************************************************/
  2323. /*! exports provided: default */
  2324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2325. "use strict";
  2326. __webpack_require__.r(__webpack_exports__);
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. //
  2335. //
  2336. //
  2337. //
  2338. //
  2339. //
  2340. //
  2341. //
  2342. //
  2343. //
  2344. //
  2345. //
  2346. //
  2347. //
  2348. //
  2349. //
  2350. //
  2351. //
  2352. //
  2353. //
  2354. //
  2355. //
  2356. //
  2357. //
  2358. //
  2359. //
  2360. /* harmony default export */ __webpack_exports__["default"] = ({
  2361. props: ['populateWith', 'storeList', 'modalId'],
  2362. data: function data() {
  2363. return {
  2364. // Copies object from prop, so it doesn't mutate the object
  2365. // from the parent component. Parent component will be updated via
  2366. // Websocket if updateWorkOrder is successful.
  2367. data: JSON.parse(JSON.stringify(this.populateWith)),
  2368. id: this.modalId,
  2369. store: {},
  2370. errors: []
  2371. };
  2372. },
  2373. mounted: function mounted() {
  2374. this.store = {
  2375. 'id': this.data.storeid,
  2376. 'name': this.storeList[this.data.storeid]
  2377. };
  2378. },
  2379. methods: {
  2380. updateWorkOrder: function updateWorkOrder() {
  2381. var _this = this;
  2382. this.data.storeid = this.store.id;
  2383. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2384. $('#workordereditModal').modal('hide');
  2385. })["catch"](function (error) {
  2386. _this.errors = JSON.parse(error.response.request.response).errors;
  2387. });
  2388. }
  2389. }
  2390. });
  2391. /***/ }),
  2392. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2393. /*!*****************************************************************************************************************************************************************!*\
  2394. !*** ./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& ***!
  2395. \*****************************************************************************************************************************************************************/
  2396. /*! exports provided: default */
  2397. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2398. "use strict";
  2399. __webpack_require__.r(__webpack_exports__);
  2400. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. //
  2421. /* harmony default export */ __webpack_exports__["default"] = ({
  2422. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2423. props: ['workOrder', 'stores'],
  2424. data: function data() {
  2425. return {
  2426. data: JSON.parse(this.workOrder)
  2427. };
  2428. },
  2429. computed: {
  2430. storeList: function storeList() {
  2431. var list = {};
  2432. JSON.parse(this.stores).map(function (val) {
  2433. list[val.storeid] = val.storesname;
  2434. });
  2435. return list;
  2436. }
  2437. },
  2438. mounted: function mounted() {
  2439. var _this = this;
  2440. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2441. _this.data = e.data;
  2442. });
  2443. }
  2444. });
  2445. /***/ }),
  2446. /***/ "./node_modules/base64-js/index.js":
  2447. /*!*****************************************!*\
  2448. !*** ./node_modules/base64-js/index.js ***!
  2449. \*****************************************/
  2450. /*! no static exports found */
  2451. /***/ (function(module, exports, __webpack_require__) {
  2452. "use strict";
  2453. exports.byteLength = byteLength
  2454. exports.toByteArray = toByteArray
  2455. exports.fromByteArray = fromByteArray
  2456. var lookup = []
  2457. var revLookup = []
  2458. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2459. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2460. for (var i = 0, len = code.length; i < len; ++i) {
  2461. lookup[i] = code[i]
  2462. revLookup[code.charCodeAt(i)] = i
  2463. }
  2464. // Support decoding URL-safe base64 strings, as Node.js does.
  2465. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2466. revLookup['-'.charCodeAt(0)] = 62
  2467. revLookup['_'.charCodeAt(0)] = 63
  2468. function getLens (b64) {
  2469. var len = b64.length
  2470. if (len % 4 > 0) {
  2471. throw new Error('Invalid string. Length must be a multiple of 4')
  2472. }
  2473. // Trim off extra bytes after placeholder bytes are found
  2474. // See: https://github.com/beatgammit/base64-js/issues/42
  2475. var validLen = b64.indexOf('=')
  2476. if (validLen === -1) validLen = len
  2477. var placeHoldersLen = validLen === len
  2478. ? 0
  2479. : 4 - (validLen % 4)
  2480. return [validLen, placeHoldersLen]
  2481. }
  2482. // base64 is 4/3 + up to two characters of the original data
  2483. function byteLength (b64) {
  2484. var lens = getLens(b64)
  2485. var validLen = lens[0]
  2486. var placeHoldersLen = lens[1]
  2487. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2488. }
  2489. function _byteLength (b64, validLen, placeHoldersLen) {
  2490. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2491. }
  2492. function toByteArray (b64) {
  2493. var tmp
  2494. var lens = getLens(b64)
  2495. var validLen = lens[0]
  2496. var placeHoldersLen = lens[1]
  2497. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2498. var curByte = 0
  2499. // if there are placeholders, only get up to the last complete 4 chars
  2500. var len = placeHoldersLen > 0
  2501. ? validLen - 4
  2502. : validLen
  2503. var i
  2504. for (i = 0; i < len; i += 4) {
  2505. tmp =
  2506. (revLookup[b64.charCodeAt(i)] << 18) |
  2507. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2508. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2509. revLookup[b64.charCodeAt(i + 3)]
  2510. arr[curByte++] = (tmp >> 16) & 0xFF
  2511. arr[curByte++] = (tmp >> 8) & 0xFF
  2512. arr[curByte++] = tmp & 0xFF
  2513. }
  2514. if (placeHoldersLen === 2) {
  2515. tmp =
  2516. (revLookup[b64.charCodeAt(i)] << 2) |
  2517. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2518. arr[curByte++] = tmp & 0xFF
  2519. }
  2520. if (placeHoldersLen === 1) {
  2521. tmp =
  2522. (revLookup[b64.charCodeAt(i)] << 10) |
  2523. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2524. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2525. arr[curByte++] = (tmp >> 8) & 0xFF
  2526. arr[curByte++] = tmp & 0xFF
  2527. }
  2528. return arr
  2529. }
  2530. function tripletToBase64 (num) {
  2531. return lookup[num >> 18 & 0x3F] +
  2532. lookup[num >> 12 & 0x3F] +
  2533. lookup[num >> 6 & 0x3F] +
  2534. lookup[num & 0x3F]
  2535. }
  2536. function encodeChunk (uint8, start, end) {
  2537. var tmp
  2538. var output = []
  2539. for (var i = start; i < end; i += 3) {
  2540. tmp =
  2541. ((uint8[i] << 16) & 0xFF0000) +
  2542. ((uint8[i + 1] << 8) & 0xFF00) +
  2543. (uint8[i + 2] & 0xFF)
  2544. output.push(tripletToBase64(tmp))
  2545. }
  2546. return output.join('')
  2547. }
  2548. function fromByteArray (uint8) {
  2549. var tmp
  2550. var len = uint8.length
  2551. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2552. var parts = []
  2553. var maxChunkLength = 16383 // must be multiple of 3
  2554. // go through the array every three bytes, we'll deal with trailing stuff later
  2555. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2556. parts.push(encodeChunk(
  2557. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2558. ))
  2559. }
  2560. // pad the end with zeros, but make sure to not forget the extra bytes
  2561. if (extraBytes === 1) {
  2562. tmp = uint8[len - 1]
  2563. parts.push(
  2564. lookup[tmp >> 2] +
  2565. lookup[(tmp << 4) & 0x3F] +
  2566. '=='
  2567. )
  2568. } else if (extraBytes === 2) {
  2569. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2570. parts.push(
  2571. lookup[tmp >> 10] +
  2572. lookup[(tmp >> 4) & 0x3F] +
  2573. lookup[(tmp << 2) & 0x3F] +
  2574. '='
  2575. )
  2576. }
  2577. return parts.join('')
  2578. }
  2579. /***/ }),
  2580. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2581. /*!*****************************************************!*\
  2582. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2583. \*****************************************************/
  2584. /*! no static exports found */
  2585. /***/ (function(module, exports, __webpack_require__) {
  2586. /*!
  2587. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2588. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2589. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2590. */
  2591. (function (global, factory) {
  2592. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2593. undefined;
  2594. }(this, (function (exports, $, Popper) { 'use strict';
  2595. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2596. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2597. function _defineProperties(target, props) {
  2598. for (var i = 0; i < props.length; i++) {
  2599. var descriptor = props[i];
  2600. descriptor.enumerable = descriptor.enumerable || false;
  2601. descriptor.configurable = true;
  2602. if ("value" in descriptor) descriptor.writable = true;
  2603. Object.defineProperty(target, descriptor.key, descriptor);
  2604. }
  2605. }
  2606. function _createClass(Constructor, protoProps, staticProps) {
  2607. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2608. if (staticProps) _defineProperties(Constructor, staticProps);
  2609. return Constructor;
  2610. }
  2611. function _defineProperty(obj, key, value) {
  2612. if (key in obj) {
  2613. Object.defineProperty(obj, key, {
  2614. value: value,
  2615. enumerable: true,
  2616. configurable: true,
  2617. writable: true
  2618. });
  2619. } else {
  2620. obj[key] = value;
  2621. }
  2622. return obj;
  2623. }
  2624. function ownKeys(object, enumerableOnly) {
  2625. var keys = Object.keys(object);
  2626. if (Object.getOwnPropertySymbols) {
  2627. var symbols = Object.getOwnPropertySymbols(object);
  2628. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2629. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2630. });
  2631. keys.push.apply(keys, symbols);
  2632. }
  2633. return keys;
  2634. }
  2635. function _objectSpread2(target) {
  2636. for (var i = 1; i < arguments.length; i++) {
  2637. var source = arguments[i] != null ? arguments[i] : {};
  2638. if (i % 2) {
  2639. ownKeys(Object(source), true).forEach(function (key) {
  2640. _defineProperty(target, key, source[key]);
  2641. });
  2642. } else if (Object.getOwnPropertyDescriptors) {
  2643. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2644. } else {
  2645. ownKeys(Object(source)).forEach(function (key) {
  2646. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2647. });
  2648. }
  2649. }
  2650. return target;
  2651. }
  2652. function _inheritsLoose(subClass, superClass) {
  2653. subClass.prototype = Object.create(superClass.prototype);
  2654. subClass.prototype.constructor = subClass;
  2655. subClass.__proto__ = superClass;
  2656. }
  2657. /**
  2658. * --------------------------------------------------------------------------
  2659. * Bootstrap (v4.4.1): util.js
  2660. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2661. * --------------------------------------------------------------------------
  2662. */
  2663. /**
  2664. * ------------------------------------------------------------------------
  2665. * Private TransitionEnd Helpers
  2666. * ------------------------------------------------------------------------
  2667. */
  2668. var TRANSITION_END = 'transitionend';
  2669. var MAX_UID = 1000000;
  2670. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2671. function toType(obj) {
  2672. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2673. }
  2674. function getSpecialTransitionEndEvent() {
  2675. return {
  2676. bindType: TRANSITION_END,
  2677. delegateType: TRANSITION_END,
  2678. handle: function handle(event) {
  2679. if ($(event.target).is(this)) {
  2680. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2681. }
  2682. return undefined; // eslint-disable-line no-undefined
  2683. }
  2684. };
  2685. }
  2686. function transitionEndEmulator(duration) {
  2687. var _this = this;
  2688. var called = false;
  2689. $(this).one(Util.TRANSITION_END, function () {
  2690. called = true;
  2691. });
  2692. setTimeout(function () {
  2693. if (!called) {
  2694. Util.triggerTransitionEnd(_this);
  2695. }
  2696. }, duration);
  2697. return this;
  2698. }
  2699. function setTransitionEndSupport() {
  2700. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2701. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2702. }
  2703. /**
  2704. * --------------------------------------------------------------------------
  2705. * Public Util Api
  2706. * --------------------------------------------------------------------------
  2707. */
  2708. var Util = {
  2709. TRANSITION_END: 'bsTransitionEnd',
  2710. getUID: function getUID(prefix) {
  2711. do {
  2712. // eslint-disable-next-line no-bitwise
  2713. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2714. } while (document.getElementById(prefix));
  2715. return prefix;
  2716. },
  2717. getSelectorFromElement: function getSelectorFromElement(element) {
  2718. var selector = element.getAttribute('data-target');
  2719. if (!selector || selector === '#') {
  2720. var hrefAttr = element.getAttribute('href');
  2721. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2722. }
  2723. try {
  2724. return document.querySelector(selector) ? selector : null;
  2725. } catch (err) {
  2726. return null;
  2727. }
  2728. },
  2729. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2730. if (!element) {
  2731. return 0;
  2732. } // Get transition-duration of the element
  2733. var transitionDuration = $(element).css('transition-duration');
  2734. var transitionDelay = $(element).css('transition-delay');
  2735. var floatTransitionDuration = parseFloat(transitionDuration);
  2736. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2737. if (!floatTransitionDuration && !floatTransitionDelay) {
  2738. return 0;
  2739. } // If multiple durations are defined, take the first
  2740. transitionDuration = transitionDuration.split(',')[0];
  2741. transitionDelay = transitionDelay.split(',')[0];
  2742. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2743. },
  2744. reflow: function reflow(element) {
  2745. return element.offsetHeight;
  2746. },
  2747. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2748. $(element).trigger(TRANSITION_END);
  2749. },
  2750. // TODO: Remove in v5
  2751. supportsTransitionEnd: function supportsTransitionEnd() {
  2752. return Boolean(TRANSITION_END);
  2753. },
  2754. isElement: function isElement(obj) {
  2755. return (obj[0] || obj).nodeType;
  2756. },
  2757. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2758. for (var property in configTypes) {
  2759. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2760. var expectedTypes = configTypes[property];
  2761. var value = config[property];
  2762. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2763. if (!new RegExp(expectedTypes).test(valueType)) {
  2764. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2765. }
  2766. }
  2767. }
  2768. },
  2769. findShadowRoot: function findShadowRoot(element) {
  2770. if (!document.documentElement.attachShadow) {
  2771. return null;
  2772. } // Can find the shadow root otherwise it'll return the document
  2773. if (typeof element.getRootNode === 'function') {
  2774. var root = element.getRootNode();
  2775. return root instanceof ShadowRoot ? root : null;
  2776. }
  2777. if (element instanceof ShadowRoot) {
  2778. return element;
  2779. } // when we don't find a shadow root
  2780. if (!element.parentNode) {
  2781. return null;
  2782. }
  2783. return Util.findShadowRoot(element.parentNode);
  2784. },
  2785. jQueryDetection: function jQueryDetection() {
  2786. if (typeof $ === 'undefined') {
  2787. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2788. }
  2789. var version = $.fn.jquery.split(' ')[0].split('.');
  2790. var minMajor = 1;
  2791. var ltMajor = 2;
  2792. var minMinor = 9;
  2793. var minPatch = 1;
  2794. var maxMajor = 4;
  2795. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2796. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2797. }
  2798. }
  2799. };
  2800. Util.jQueryDetection();
  2801. setTransitionEndSupport();
  2802. /**
  2803. * ------------------------------------------------------------------------
  2804. * Constants
  2805. * ------------------------------------------------------------------------
  2806. */
  2807. var NAME = 'alert';
  2808. var VERSION = '4.4.1';
  2809. var DATA_KEY = 'bs.alert';
  2810. var EVENT_KEY = "." + DATA_KEY;
  2811. var DATA_API_KEY = '.data-api';
  2812. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2813. var Selector = {
  2814. DISMISS: '[data-dismiss="alert"]'
  2815. };
  2816. var Event = {
  2817. CLOSE: "close" + EVENT_KEY,
  2818. CLOSED: "closed" + EVENT_KEY,
  2819. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2820. };
  2821. var ClassName = {
  2822. ALERT: 'alert',
  2823. FADE: 'fade',
  2824. SHOW: 'show'
  2825. };
  2826. /**
  2827. * ------------------------------------------------------------------------
  2828. * Class Definition
  2829. * ------------------------------------------------------------------------
  2830. */
  2831. var Alert =
  2832. /*#__PURE__*/
  2833. function () {
  2834. function Alert(element) {
  2835. this._element = element;
  2836. } // Getters
  2837. var _proto = Alert.prototype;
  2838. // Public
  2839. _proto.close = function close(element) {
  2840. var rootElement = this._element;
  2841. if (element) {
  2842. rootElement = this._getRootElement(element);
  2843. }
  2844. var customEvent = this._triggerCloseEvent(rootElement);
  2845. if (customEvent.isDefaultPrevented()) {
  2846. return;
  2847. }
  2848. this._removeElement(rootElement);
  2849. };
  2850. _proto.dispose = function dispose() {
  2851. $.removeData(this._element, DATA_KEY);
  2852. this._element = null;
  2853. } // Private
  2854. ;
  2855. _proto._getRootElement = function _getRootElement(element) {
  2856. var selector = Util.getSelectorFromElement(element);
  2857. var parent = false;
  2858. if (selector) {
  2859. parent = document.querySelector(selector);
  2860. }
  2861. if (!parent) {
  2862. parent = $(element).closest("." + ClassName.ALERT)[0];
  2863. }
  2864. return parent;
  2865. };
  2866. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2867. var closeEvent = $.Event(Event.CLOSE);
  2868. $(element).trigger(closeEvent);
  2869. return closeEvent;
  2870. };
  2871. _proto._removeElement = function _removeElement(element) {
  2872. var _this = this;
  2873. $(element).removeClass(ClassName.SHOW);
  2874. if (!$(element).hasClass(ClassName.FADE)) {
  2875. this._destroyElement(element);
  2876. return;
  2877. }
  2878. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2879. $(element).one(Util.TRANSITION_END, function (event) {
  2880. return _this._destroyElement(element, event);
  2881. }).emulateTransitionEnd(transitionDuration);
  2882. };
  2883. _proto._destroyElement = function _destroyElement(element) {
  2884. $(element).detach().trigger(Event.CLOSED).remove();
  2885. } // Static
  2886. ;
  2887. Alert._jQueryInterface = function _jQueryInterface(config) {
  2888. return this.each(function () {
  2889. var $element = $(this);
  2890. var data = $element.data(DATA_KEY);
  2891. if (!data) {
  2892. data = new Alert(this);
  2893. $element.data(DATA_KEY, data);
  2894. }
  2895. if (config === 'close') {
  2896. data[config](this);
  2897. }
  2898. });
  2899. };
  2900. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2901. return function (event) {
  2902. if (event) {
  2903. event.preventDefault();
  2904. }
  2905. alertInstance.close(this);
  2906. };
  2907. };
  2908. _createClass(Alert, null, [{
  2909. key: "VERSION",
  2910. get: function get() {
  2911. return VERSION;
  2912. }
  2913. }]);
  2914. return Alert;
  2915. }();
  2916. /**
  2917. * ------------------------------------------------------------------------
  2918. * Data Api implementation
  2919. * ------------------------------------------------------------------------
  2920. */
  2921. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2922. /**
  2923. * ------------------------------------------------------------------------
  2924. * jQuery
  2925. * ------------------------------------------------------------------------
  2926. */
  2927. $.fn[NAME] = Alert._jQueryInterface;
  2928. $.fn[NAME].Constructor = Alert;
  2929. $.fn[NAME].noConflict = function () {
  2930. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2931. return Alert._jQueryInterface;
  2932. };
  2933. /**
  2934. * ------------------------------------------------------------------------
  2935. * Constants
  2936. * ------------------------------------------------------------------------
  2937. */
  2938. var NAME$1 = 'button';
  2939. var VERSION$1 = '4.4.1';
  2940. var DATA_KEY$1 = 'bs.button';
  2941. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2942. var DATA_API_KEY$1 = '.data-api';
  2943. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2944. var ClassName$1 = {
  2945. ACTIVE: 'active',
  2946. BUTTON: 'btn',
  2947. FOCUS: 'focus'
  2948. };
  2949. var Selector$1 = {
  2950. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2951. DATA_TOGGLES: '[data-toggle="buttons"]',
  2952. DATA_TOGGLE: '[data-toggle="button"]',
  2953. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2954. INPUT: 'input:not([type="hidden"])',
  2955. ACTIVE: '.active',
  2956. BUTTON: '.btn'
  2957. };
  2958. var Event$1 = {
  2959. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2960. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2961. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2962. };
  2963. /**
  2964. * ------------------------------------------------------------------------
  2965. * Class Definition
  2966. * ------------------------------------------------------------------------
  2967. */
  2968. var Button =
  2969. /*#__PURE__*/
  2970. function () {
  2971. function Button(element) {
  2972. this._element = element;
  2973. } // Getters
  2974. var _proto = Button.prototype;
  2975. // Public
  2976. _proto.toggle = function toggle() {
  2977. var triggerChangeEvent = true;
  2978. var addAriaPressed = true;
  2979. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2980. if (rootElement) {
  2981. var input = this._element.querySelector(Selector$1.INPUT);
  2982. if (input) {
  2983. if (input.type === 'radio') {
  2984. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2985. triggerChangeEvent = false;
  2986. } else {
  2987. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2988. if (activeElement) {
  2989. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2990. }
  2991. }
  2992. } else if (input.type === 'checkbox') {
  2993. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2994. triggerChangeEvent = false;
  2995. }
  2996. } else {
  2997. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2998. triggerChangeEvent = false;
  2999. }
  3000. if (triggerChangeEvent) {
  3001. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3002. $(input).trigger('change');
  3003. }
  3004. input.focus();
  3005. addAriaPressed = false;
  3006. }
  3007. }
  3008. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3009. if (addAriaPressed) {
  3010. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3011. }
  3012. if (triggerChangeEvent) {
  3013. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3014. }
  3015. }
  3016. };
  3017. _proto.dispose = function dispose() {
  3018. $.removeData(this._element, DATA_KEY$1);
  3019. this._element = null;
  3020. } // Static
  3021. ;
  3022. Button._jQueryInterface = function _jQueryInterface(config) {
  3023. return this.each(function () {
  3024. var data = $(this).data(DATA_KEY$1);
  3025. if (!data) {
  3026. data = new Button(this);
  3027. $(this).data(DATA_KEY$1, data);
  3028. }
  3029. if (config === 'toggle') {
  3030. data[config]();
  3031. }
  3032. });
  3033. };
  3034. _createClass(Button, null, [{
  3035. key: "VERSION",
  3036. get: function get() {
  3037. return VERSION$1;
  3038. }
  3039. }]);
  3040. return Button;
  3041. }();
  3042. /**
  3043. * ------------------------------------------------------------------------
  3044. * Data Api implementation
  3045. * ------------------------------------------------------------------------
  3046. */
  3047. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3048. var button = event.target;
  3049. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3050. button = $(button).closest(Selector$1.BUTTON)[0];
  3051. }
  3052. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3053. event.preventDefault(); // work around Firefox bug #1540995
  3054. } else {
  3055. var inputBtn = button.querySelector(Selector$1.INPUT);
  3056. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3057. event.preventDefault(); // work around Firefox bug #1540995
  3058. return;
  3059. }
  3060. Button._jQueryInterface.call($(button), 'toggle');
  3061. }
  3062. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3063. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3064. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3065. });
  3066. $(window).on(Event$1.LOAD_DATA_API, function () {
  3067. // ensure correct active class is set to match the controls' actual values/states
  3068. // find all checkboxes/readio buttons inside data-toggle groups
  3069. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3070. for (var i = 0, len = buttons.length; i < len; i++) {
  3071. var button = buttons[i];
  3072. var input = button.querySelector(Selector$1.INPUT);
  3073. if (input.checked || input.hasAttribute('checked')) {
  3074. button.classList.add(ClassName$1.ACTIVE);
  3075. } else {
  3076. button.classList.remove(ClassName$1.ACTIVE);
  3077. }
  3078. } // find all button toggles
  3079. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3080. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3081. var _button = buttons[_i];
  3082. if (_button.getAttribute('aria-pressed') === 'true') {
  3083. _button.classList.add(ClassName$1.ACTIVE);
  3084. } else {
  3085. _button.classList.remove(ClassName$1.ACTIVE);
  3086. }
  3087. }
  3088. });
  3089. /**
  3090. * ------------------------------------------------------------------------
  3091. * jQuery
  3092. * ------------------------------------------------------------------------
  3093. */
  3094. $.fn[NAME$1] = Button._jQueryInterface;
  3095. $.fn[NAME$1].Constructor = Button;
  3096. $.fn[NAME$1].noConflict = function () {
  3097. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3098. return Button._jQueryInterface;
  3099. };
  3100. /**
  3101. * ------------------------------------------------------------------------
  3102. * Constants
  3103. * ------------------------------------------------------------------------
  3104. */
  3105. var NAME$2 = 'carousel';
  3106. var VERSION$2 = '4.4.1';
  3107. var DATA_KEY$2 = 'bs.carousel';
  3108. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3109. var DATA_API_KEY$2 = '.data-api';
  3110. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3111. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3112. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3113. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3114. var SWIPE_THRESHOLD = 40;
  3115. var Default = {
  3116. interval: 5000,
  3117. keyboard: true,
  3118. slide: false,
  3119. pause: 'hover',
  3120. wrap: true,
  3121. touch: true
  3122. };
  3123. var DefaultType = {
  3124. interval: '(number|boolean)',
  3125. keyboard: 'boolean',
  3126. slide: '(boolean|string)',
  3127. pause: '(string|boolean)',
  3128. wrap: 'boolean',
  3129. touch: 'boolean'
  3130. };
  3131. var Direction = {
  3132. NEXT: 'next',
  3133. PREV: 'prev',
  3134. LEFT: 'left',
  3135. RIGHT: 'right'
  3136. };
  3137. var Event$2 = {
  3138. SLIDE: "slide" + EVENT_KEY$2,
  3139. SLID: "slid" + EVENT_KEY$2,
  3140. KEYDOWN: "keydown" + EVENT_KEY$2,
  3141. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3142. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3143. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3144. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3145. TOUCHEND: "touchend" + EVENT_KEY$2,
  3146. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3147. POINTERUP: "pointerup" + EVENT_KEY$2,
  3148. DRAG_START: "dragstart" + EVENT_KEY$2,
  3149. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3150. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3151. };
  3152. var ClassName$2 = {
  3153. CAROUSEL: 'carousel',
  3154. ACTIVE: 'active',
  3155. SLIDE: 'slide',
  3156. RIGHT: 'carousel-item-right',
  3157. LEFT: 'carousel-item-left',
  3158. NEXT: 'carousel-item-next',
  3159. PREV: 'carousel-item-prev',
  3160. ITEM: 'carousel-item',
  3161. POINTER_EVENT: 'pointer-event'
  3162. };
  3163. var Selector$2 = {
  3164. ACTIVE: '.active',
  3165. ACTIVE_ITEM: '.active.carousel-item',
  3166. ITEM: '.carousel-item',
  3167. ITEM_IMG: '.carousel-item img',
  3168. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3169. INDICATORS: '.carousel-indicators',
  3170. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3171. DATA_RIDE: '[data-ride="carousel"]'
  3172. };
  3173. var PointerType = {
  3174. TOUCH: 'touch',
  3175. PEN: 'pen'
  3176. };
  3177. /**
  3178. * ------------------------------------------------------------------------
  3179. * Class Definition
  3180. * ------------------------------------------------------------------------
  3181. */
  3182. var Carousel =
  3183. /*#__PURE__*/
  3184. function () {
  3185. function Carousel(element, config) {
  3186. this._items = null;
  3187. this._interval = null;
  3188. this._activeElement = null;
  3189. this._isPaused = false;
  3190. this._isSliding = false;
  3191. this.touchTimeout = null;
  3192. this.touchStartX = 0;
  3193. this.touchDeltaX = 0;
  3194. this._config = this._getConfig(config);
  3195. this._element = element;
  3196. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3197. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3198. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3199. this._addEventListeners();
  3200. } // Getters
  3201. var _proto = Carousel.prototype;
  3202. // Public
  3203. _proto.next = function next() {
  3204. if (!this._isSliding) {
  3205. this._slide(Direction.NEXT);
  3206. }
  3207. };
  3208. _proto.nextWhenVisible = function nextWhenVisible() {
  3209. // Don't call next when the page isn't visible
  3210. // or the carousel or its parent isn't visible
  3211. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3212. this.next();
  3213. }
  3214. };
  3215. _proto.prev = function prev() {
  3216. if (!this._isSliding) {
  3217. this._slide(Direction.PREV);
  3218. }
  3219. };
  3220. _proto.pause = function pause(event) {
  3221. if (!event) {
  3222. this._isPaused = true;
  3223. }
  3224. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3225. Util.triggerTransitionEnd(this._element);
  3226. this.cycle(true);
  3227. }
  3228. clearInterval(this._interval);
  3229. this._interval = null;
  3230. };
  3231. _proto.cycle = function cycle(event) {
  3232. if (!event) {
  3233. this._isPaused = false;
  3234. }
  3235. if (this._interval) {
  3236. clearInterval(this._interval);
  3237. this._interval = null;
  3238. }
  3239. if (this._config.interval && !this._isPaused) {
  3240. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3241. }
  3242. };
  3243. _proto.to = function to(index) {
  3244. var _this = this;
  3245. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3246. var activeIndex = this._getItemIndex(this._activeElement);
  3247. if (index > this._items.length - 1 || index < 0) {
  3248. return;
  3249. }
  3250. if (this._isSliding) {
  3251. $(this._element).one(Event$2.SLID, function () {
  3252. return _this.to(index);
  3253. });
  3254. return;
  3255. }
  3256. if (activeIndex === index) {
  3257. this.pause();
  3258. this.cycle();
  3259. return;
  3260. }
  3261. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3262. this._slide(direction, this._items[index]);
  3263. };
  3264. _proto.dispose = function dispose() {
  3265. $(this._element).off(EVENT_KEY$2);
  3266. $.removeData(this._element, DATA_KEY$2);
  3267. this._items = null;
  3268. this._config = null;
  3269. this._element = null;
  3270. this._interval = null;
  3271. this._isPaused = null;
  3272. this._isSliding = null;
  3273. this._activeElement = null;
  3274. this._indicatorsElement = null;
  3275. } // Private
  3276. ;
  3277. _proto._getConfig = function _getConfig(config) {
  3278. config = _objectSpread2({}, Default, {}, config);
  3279. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3280. return config;
  3281. };
  3282. _proto._handleSwipe = function _handleSwipe() {
  3283. var absDeltax = Math.abs(this.touchDeltaX);
  3284. if (absDeltax <= SWIPE_THRESHOLD) {
  3285. return;
  3286. }
  3287. var direction = absDeltax / this.touchDeltaX;
  3288. this.touchDeltaX = 0; // swipe left
  3289. if (direction > 0) {
  3290. this.prev();
  3291. } // swipe right
  3292. if (direction < 0) {
  3293. this.next();
  3294. }
  3295. };
  3296. _proto._addEventListeners = function _addEventListeners() {
  3297. var _this2 = this;
  3298. if (this._config.keyboard) {
  3299. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3300. return _this2._keydown(event);
  3301. });
  3302. }
  3303. if (this._config.pause === 'hover') {
  3304. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3305. return _this2.pause(event);
  3306. }).on(Event$2.MOUSELEAVE, function (event) {
  3307. return _this2.cycle(event);
  3308. });
  3309. }
  3310. if (this._config.touch) {
  3311. this._addTouchEventListeners();
  3312. }
  3313. };
  3314. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3315. var _this3 = this;
  3316. if (!this._touchSupported) {
  3317. return;
  3318. }
  3319. var start = function start(event) {
  3320. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3321. _this3.touchStartX = event.originalEvent.clientX;
  3322. } else if (!_this3._pointerEvent) {
  3323. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3324. }
  3325. };
  3326. var move = function move(event) {
  3327. // ensure swiping with one touch and not pinching
  3328. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3329. _this3.touchDeltaX = 0;
  3330. } else {
  3331. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3332. }
  3333. };
  3334. var end = function end(event) {
  3335. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3336. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3337. }
  3338. _this3._handleSwipe();
  3339. if (_this3._config.pause === 'hover') {
  3340. // If it's a touch-enabled device, mouseenter/leave are fired as
  3341. // part of the mouse compatibility events on first tap - the carousel
  3342. // would stop cycling until user tapped out of it;
  3343. // here, we listen for touchend, explicitly pause the carousel
  3344. // (as if it's the second time we tap on it, mouseenter compat event
  3345. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3346. // events to fire) we explicitly restart cycling
  3347. _this3.pause();
  3348. if (_this3.touchTimeout) {
  3349. clearTimeout(_this3.touchTimeout);
  3350. }
  3351. _this3.touchTimeout = setTimeout(function (event) {
  3352. return _this3.cycle(event);
  3353. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3354. }
  3355. };
  3356. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3357. return e.preventDefault();
  3358. });
  3359. if (this._pointerEvent) {
  3360. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3361. return start(event);
  3362. });
  3363. $(this._element).on(Event$2.POINTERUP, function (event) {
  3364. return end(event);
  3365. });
  3366. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3367. } else {
  3368. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3369. return start(event);
  3370. });
  3371. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3372. return move(event);
  3373. });
  3374. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3375. return end(event);
  3376. });
  3377. }
  3378. };
  3379. _proto._keydown = function _keydown(event) {
  3380. if (/input|textarea/i.test(event.target.tagName)) {
  3381. return;
  3382. }
  3383. switch (event.which) {
  3384. case ARROW_LEFT_KEYCODE:
  3385. event.preventDefault();
  3386. this.prev();
  3387. break;
  3388. case ARROW_RIGHT_KEYCODE:
  3389. event.preventDefault();
  3390. this.next();
  3391. break;
  3392. }
  3393. };
  3394. _proto._getItemIndex = function _getItemIndex(element) {
  3395. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3396. return this._items.indexOf(element);
  3397. };
  3398. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3399. var isNextDirection = direction === Direction.NEXT;
  3400. var isPrevDirection = direction === Direction.PREV;
  3401. var activeIndex = this._getItemIndex(activeElement);
  3402. var lastItemIndex = this._items.length - 1;
  3403. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3404. if (isGoingToWrap && !this._config.wrap) {
  3405. return activeElement;
  3406. }
  3407. var delta = direction === Direction.PREV ? -1 : 1;
  3408. var itemIndex = (activeIndex + delta) % this._items.length;
  3409. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3410. };
  3411. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3412. var targetIndex = this._getItemIndex(relatedTarget);
  3413. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3414. var slideEvent = $.Event(Event$2.SLIDE, {
  3415. relatedTarget: relatedTarget,
  3416. direction: eventDirectionName,
  3417. from: fromIndex,
  3418. to: targetIndex
  3419. });
  3420. $(this._element).trigger(slideEvent);
  3421. return slideEvent;
  3422. };
  3423. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3424. if (this._indicatorsElement) {
  3425. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3426. $(indicators).removeClass(ClassName$2.ACTIVE);
  3427. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3428. if (nextIndicator) {
  3429. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3430. }
  3431. }
  3432. };
  3433. _proto._slide = function _slide(direction, element) {
  3434. var _this4 = this;
  3435. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3436. var activeElementIndex = this._getItemIndex(activeElement);
  3437. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3438. var nextElementIndex = this._getItemIndex(nextElement);
  3439. var isCycling = Boolean(this._interval);
  3440. var directionalClassName;
  3441. var orderClassName;
  3442. var eventDirectionName;
  3443. if (direction === Direction.NEXT) {
  3444. directionalClassName = ClassName$2.LEFT;
  3445. orderClassName = ClassName$2.NEXT;
  3446. eventDirectionName = Direction.LEFT;
  3447. } else {
  3448. directionalClassName = ClassName$2.RIGHT;
  3449. orderClassName = ClassName$2.PREV;
  3450. eventDirectionName = Direction.RIGHT;
  3451. }
  3452. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3453. this._isSliding = false;
  3454. return;
  3455. }
  3456. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3457. if (slideEvent.isDefaultPrevented()) {
  3458. return;
  3459. }
  3460. if (!activeElement || !nextElement) {
  3461. // Some weirdness is happening, so we bail
  3462. return;
  3463. }
  3464. this._isSliding = true;
  3465. if (isCycling) {
  3466. this.pause();
  3467. }
  3468. this._setActiveIndicatorElement(nextElement);
  3469. var slidEvent = $.Event(Event$2.SLID, {
  3470. relatedTarget: nextElement,
  3471. direction: eventDirectionName,
  3472. from: activeElementIndex,
  3473. to: nextElementIndex
  3474. });
  3475. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3476. $(nextElement).addClass(orderClassName);
  3477. Util.reflow(nextElement);
  3478. $(activeElement).addClass(directionalClassName);
  3479. $(nextElement).addClass(directionalClassName);
  3480. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3481. if (nextElementInterval) {
  3482. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3483. this._config.interval = nextElementInterval;
  3484. } else {
  3485. this._config.interval = this._config.defaultInterval || this._config.interval;
  3486. }
  3487. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3488. $(activeElement).one(Util.TRANSITION_END, function () {
  3489. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3490. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3491. _this4._isSliding = false;
  3492. setTimeout(function () {
  3493. return $(_this4._element).trigger(slidEvent);
  3494. }, 0);
  3495. }).emulateTransitionEnd(transitionDuration);
  3496. } else {
  3497. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3498. $(nextElement).addClass(ClassName$2.ACTIVE);
  3499. this._isSliding = false;
  3500. $(this._element).trigger(slidEvent);
  3501. }
  3502. if (isCycling) {
  3503. this.cycle();
  3504. }
  3505. } // Static
  3506. ;
  3507. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3508. return this.each(function () {
  3509. var data = $(this).data(DATA_KEY$2);
  3510. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3511. if (typeof config === 'object') {
  3512. _config = _objectSpread2({}, _config, {}, config);
  3513. }
  3514. var action = typeof config === 'string' ? config : _config.slide;
  3515. if (!data) {
  3516. data = new Carousel(this, _config);
  3517. $(this).data(DATA_KEY$2, data);
  3518. }
  3519. if (typeof config === 'number') {
  3520. data.to(config);
  3521. } else if (typeof action === 'string') {
  3522. if (typeof data[action] === 'undefined') {
  3523. throw new TypeError("No method named \"" + action + "\"");
  3524. }
  3525. data[action]();
  3526. } else if (_config.interval && _config.ride) {
  3527. data.pause();
  3528. data.cycle();
  3529. }
  3530. });
  3531. };
  3532. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3533. var selector = Util.getSelectorFromElement(this);
  3534. if (!selector) {
  3535. return;
  3536. }
  3537. var target = $(selector)[0];
  3538. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3539. return;
  3540. }
  3541. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3542. var slideIndex = this.getAttribute('data-slide-to');
  3543. if (slideIndex) {
  3544. config.interval = false;
  3545. }
  3546. Carousel._jQueryInterface.call($(target), config);
  3547. if (slideIndex) {
  3548. $(target).data(DATA_KEY$2).to(slideIndex);
  3549. }
  3550. event.preventDefault();
  3551. };
  3552. _createClass(Carousel, null, [{
  3553. key: "VERSION",
  3554. get: function get() {
  3555. return VERSION$2;
  3556. }
  3557. }, {
  3558. key: "Default",
  3559. get: function get() {
  3560. return Default;
  3561. }
  3562. }]);
  3563. return Carousel;
  3564. }();
  3565. /**
  3566. * ------------------------------------------------------------------------
  3567. * Data Api implementation
  3568. * ------------------------------------------------------------------------
  3569. */
  3570. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3571. $(window).on(Event$2.LOAD_DATA_API, function () {
  3572. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3573. for (var i = 0, len = carousels.length; i < len; i++) {
  3574. var $carousel = $(carousels[i]);
  3575. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3576. }
  3577. });
  3578. /**
  3579. * ------------------------------------------------------------------------
  3580. * jQuery
  3581. * ------------------------------------------------------------------------
  3582. */
  3583. $.fn[NAME$2] = Carousel._jQueryInterface;
  3584. $.fn[NAME$2].Constructor = Carousel;
  3585. $.fn[NAME$2].noConflict = function () {
  3586. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3587. return Carousel._jQueryInterface;
  3588. };
  3589. /**
  3590. * ------------------------------------------------------------------------
  3591. * Constants
  3592. * ------------------------------------------------------------------------
  3593. */
  3594. var NAME$3 = 'collapse';
  3595. var VERSION$3 = '4.4.1';
  3596. var DATA_KEY$3 = 'bs.collapse';
  3597. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3598. var DATA_API_KEY$3 = '.data-api';
  3599. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3600. var Default$1 = {
  3601. toggle: true,
  3602. parent: ''
  3603. };
  3604. var DefaultType$1 = {
  3605. toggle: 'boolean',
  3606. parent: '(string|element)'
  3607. };
  3608. var Event$3 = {
  3609. SHOW: "show" + EVENT_KEY$3,
  3610. SHOWN: "shown" + EVENT_KEY$3,
  3611. HIDE: "hide" + EVENT_KEY$3,
  3612. HIDDEN: "hidden" + EVENT_KEY$3,
  3613. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3614. };
  3615. var ClassName$3 = {
  3616. SHOW: 'show',
  3617. COLLAPSE: 'collapse',
  3618. COLLAPSING: 'collapsing',
  3619. COLLAPSED: 'collapsed'
  3620. };
  3621. var Dimension = {
  3622. WIDTH: 'width',
  3623. HEIGHT: 'height'
  3624. };
  3625. var Selector$3 = {
  3626. ACTIVES: '.show, .collapsing',
  3627. DATA_TOGGLE: '[data-toggle="collapse"]'
  3628. };
  3629. /**
  3630. * ------------------------------------------------------------------------
  3631. * Class Definition
  3632. * ------------------------------------------------------------------------
  3633. */
  3634. var Collapse =
  3635. /*#__PURE__*/
  3636. function () {
  3637. function Collapse(element, config) {
  3638. this._isTransitioning = false;
  3639. this._element = element;
  3640. this._config = this._getConfig(config);
  3641. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3642. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3643. for (var i = 0, len = toggleList.length; i < len; i++) {
  3644. var elem = toggleList[i];
  3645. var selector = Util.getSelectorFromElement(elem);
  3646. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3647. return foundElem === element;
  3648. });
  3649. if (selector !== null && filterElement.length > 0) {
  3650. this._selector = selector;
  3651. this._triggerArray.push(elem);
  3652. }
  3653. }
  3654. this._parent = this._config.parent ? this._getParent() : null;
  3655. if (!this._config.parent) {
  3656. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3657. }
  3658. if (this._config.toggle) {
  3659. this.toggle();
  3660. }
  3661. } // Getters
  3662. var _proto = Collapse.prototype;
  3663. // Public
  3664. _proto.toggle = function toggle() {
  3665. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3666. this.hide();
  3667. } else {
  3668. this.show();
  3669. }
  3670. };
  3671. _proto.show = function show() {
  3672. var _this = this;
  3673. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3674. return;
  3675. }
  3676. var actives;
  3677. var activesData;
  3678. if (this._parent) {
  3679. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3680. if (typeof _this._config.parent === 'string') {
  3681. return elem.getAttribute('data-parent') === _this._config.parent;
  3682. }
  3683. return elem.classList.contains(ClassName$3.COLLAPSE);
  3684. });
  3685. if (actives.length === 0) {
  3686. actives = null;
  3687. }
  3688. }
  3689. if (actives) {
  3690. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3691. if (activesData && activesData._isTransitioning) {
  3692. return;
  3693. }
  3694. }
  3695. var startEvent = $.Event(Event$3.SHOW);
  3696. $(this._element).trigger(startEvent);
  3697. if (startEvent.isDefaultPrevented()) {
  3698. return;
  3699. }
  3700. if (actives) {
  3701. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3702. if (!activesData) {
  3703. $(actives).data(DATA_KEY$3, null);
  3704. }
  3705. }
  3706. var dimension = this._getDimension();
  3707. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3708. this._element.style[dimension] = 0;
  3709. if (this._triggerArray.length) {
  3710. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3711. }
  3712. this.setTransitioning(true);
  3713. var complete = function complete() {
  3714. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3715. _this._element.style[dimension] = '';
  3716. _this.setTransitioning(false);
  3717. $(_this._element).trigger(Event$3.SHOWN);
  3718. };
  3719. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3720. var scrollSize = "scroll" + capitalizedDimension;
  3721. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3722. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3723. this._element.style[dimension] = this._element[scrollSize] + "px";
  3724. };
  3725. _proto.hide = function hide() {
  3726. var _this2 = this;
  3727. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3728. return;
  3729. }
  3730. var startEvent = $.Event(Event$3.HIDE);
  3731. $(this._element).trigger(startEvent);
  3732. if (startEvent.isDefaultPrevented()) {
  3733. return;
  3734. }
  3735. var dimension = this._getDimension();
  3736. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3737. Util.reflow(this._element);
  3738. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3739. var triggerArrayLength = this._triggerArray.length;
  3740. if (triggerArrayLength > 0) {
  3741. for (var i = 0; i < triggerArrayLength; i++) {
  3742. var trigger = this._triggerArray[i];
  3743. var selector = Util.getSelectorFromElement(trigger);
  3744. if (selector !== null) {
  3745. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3746. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3747. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3748. }
  3749. }
  3750. }
  3751. }
  3752. this.setTransitioning(true);
  3753. var complete = function complete() {
  3754. _this2.setTransitioning(false);
  3755. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3756. };
  3757. this._element.style[dimension] = '';
  3758. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3759. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3760. };
  3761. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3762. this._isTransitioning = isTransitioning;
  3763. };
  3764. _proto.dispose = function dispose() {
  3765. $.removeData(this._element, DATA_KEY$3);
  3766. this._config = null;
  3767. this._parent = null;
  3768. this._element = null;
  3769. this._triggerArray = null;
  3770. this._isTransitioning = null;
  3771. } // Private
  3772. ;
  3773. _proto._getConfig = function _getConfig(config) {
  3774. config = _objectSpread2({}, Default$1, {}, config);
  3775. config.toggle = Boolean(config.toggle); // Coerce string values
  3776. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3777. return config;
  3778. };
  3779. _proto._getDimension = function _getDimension() {
  3780. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3781. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3782. };
  3783. _proto._getParent = function _getParent() {
  3784. var _this3 = this;
  3785. var parent;
  3786. if (Util.isElement(this._config.parent)) {
  3787. parent = this._config.parent; // It's a jQuery object
  3788. if (typeof this._config.parent.jquery !== 'undefined') {
  3789. parent = this._config.parent[0];
  3790. }
  3791. } else {
  3792. parent = document.querySelector(this._config.parent);
  3793. }
  3794. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3795. var children = [].slice.call(parent.querySelectorAll(selector));
  3796. $(children).each(function (i, element) {
  3797. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3798. });
  3799. return parent;
  3800. };
  3801. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3802. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3803. if (triggerArray.length) {
  3804. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3805. }
  3806. } // Static
  3807. ;
  3808. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3809. var selector = Util.getSelectorFromElement(element);
  3810. return selector ? document.querySelector(selector) : null;
  3811. };
  3812. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3813. return this.each(function () {
  3814. var $this = $(this);
  3815. var data = $this.data(DATA_KEY$3);
  3816. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3817. if (!data && _config.toggle && /show|hide/.test(config)) {
  3818. _config.toggle = false;
  3819. }
  3820. if (!data) {
  3821. data = new Collapse(this, _config);
  3822. $this.data(DATA_KEY$3, data);
  3823. }
  3824. if (typeof config === 'string') {
  3825. if (typeof data[config] === 'undefined') {
  3826. throw new TypeError("No method named \"" + config + "\"");
  3827. }
  3828. data[config]();
  3829. }
  3830. });
  3831. };
  3832. _createClass(Collapse, null, [{
  3833. key: "VERSION",
  3834. get: function get() {
  3835. return VERSION$3;
  3836. }
  3837. }, {
  3838. key: "Default",
  3839. get: function get() {
  3840. return Default$1;
  3841. }
  3842. }]);
  3843. return Collapse;
  3844. }();
  3845. /**
  3846. * ------------------------------------------------------------------------
  3847. * Data Api implementation
  3848. * ------------------------------------------------------------------------
  3849. */
  3850. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3851. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3852. if (event.currentTarget.tagName === 'A') {
  3853. event.preventDefault();
  3854. }
  3855. var $trigger = $(this);
  3856. var selector = Util.getSelectorFromElement(this);
  3857. var selectors = [].slice.call(document.querySelectorAll(selector));
  3858. $(selectors).each(function () {
  3859. var $target = $(this);
  3860. var data = $target.data(DATA_KEY$3);
  3861. var config = data ? 'toggle' : $trigger.data();
  3862. Collapse._jQueryInterface.call($target, config);
  3863. });
  3864. });
  3865. /**
  3866. * ------------------------------------------------------------------------
  3867. * jQuery
  3868. * ------------------------------------------------------------------------
  3869. */
  3870. $.fn[NAME$3] = Collapse._jQueryInterface;
  3871. $.fn[NAME$3].Constructor = Collapse;
  3872. $.fn[NAME$3].noConflict = function () {
  3873. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3874. return Collapse._jQueryInterface;
  3875. };
  3876. /**
  3877. * ------------------------------------------------------------------------
  3878. * Constants
  3879. * ------------------------------------------------------------------------
  3880. */
  3881. var NAME$4 = 'dropdown';
  3882. var VERSION$4 = '4.4.1';
  3883. var DATA_KEY$4 = 'bs.dropdown';
  3884. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3885. var DATA_API_KEY$4 = '.data-api';
  3886. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3887. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3888. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3889. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3890. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3891. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3892. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3893. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3894. var Event$4 = {
  3895. HIDE: "hide" + EVENT_KEY$4,
  3896. HIDDEN: "hidden" + EVENT_KEY$4,
  3897. SHOW: "show" + EVENT_KEY$4,
  3898. SHOWN: "shown" + EVENT_KEY$4,
  3899. CLICK: "click" + EVENT_KEY$4,
  3900. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3901. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3902. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3903. };
  3904. var ClassName$4 = {
  3905. DISABLED: 'disabled',
  3906. SHOW: 'show',
  3907. DROPUP: 'dropup',
  3908. DROPRIGHT: 'dropright',
  3909. DROPLEFT: 'dropleft',
  3910. MENURIGHT: 'dropdown-menu-right',
  3911. MENULEFT: 'dropdown-menu-left',
  3912. POSITION_STATIC: 'position-static'
  3913. };
  3914. var Selector$4 = {
  3915. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3916. FORM_CHILD: '.dropdown form',
  3917. MENU: '.dropdown-menu',
  3918. NAVBAR_NAV: '.navbar-nav',
  3919. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3920. };
  3921. var AttachmentMap = {
  3922. TOP: 'top-start',
  3923. TOPEND: 'top-end',
  3924. BOTTOM: 'bottom-start',
  3925. BOTTOMEND: 'bottom-end',
  3926. RIGHT: 'right-start',
  3927. RIGHTEND: 'right-end',
  3928. LEFT: 'left-start',
  3929. LEFTEND: 'left-end'
  3930. };
  3931. var Default$2 = {
  3932. offset: 0,
  3933. flip: true,
  3934. boundary: 'scrollParent',
  3935. reference: 'toggle',
  3936. display: 'dynamic',
  3937. popperConfig: null
  3938. };
  3939. var DefaultType$2 = {
  3940. offset: '(number|string|function)',
  3941. flip: 'boolean',
  3942. boundary: '(string|element)',
  3943. reference: '(string|element)',
  3944. display: 'string',
  3945. popperConfig: '(null|object)'
  3946. };
  3947. /**
  3948. * ------------------------------------------------------------------------
  3949. * Class Definition
  3950. * ------------------------------------------------------------------------
  3951. */
  3952. var Dropdown =
  3953. /*#__PURE__*/
  3954. function () {
  3955. function Dropdown(element, config) {
  3956. this._element = element;
  3957. this._popper = null;
  3958. this._config = this._getConfig(config);
  3959. this._menu = this._getMenuElement();
  3960. this._inNavbar = this._detectNavbar();
  3961. this._addEventListeners();
  3962. } // Getters
  3963. var _proto = Dropdown.prototype;
  3964. // Public
  3965. _proto.toggle = function toggle() {
  3966. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3967. return;
  3968. }
  3969. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3970. Dropdown._clearMenus();
  3971. if (isActive) {
  3972. return;
  3973. }
  3974. this.show(true);
  3975. };
  3976. _proto.show = function show(usePopper) {
  3977. if (usePopper === void 0) {
  3978. usePopper = false;
  3979. }
  3980. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3981. return;
  3982. }
  3983. var relatedTarget = {
  3984. relatedTarget: this._element
  3985. };
  3986. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3987. var parent = Dropdown._getParentFromElement(this._element);
  3988. $(parent).trigger(showEvent);
  3989. if (showEvent.isDefaultPrevented()) {
  3990. return;
  3991. } // Disable totally Popper.js for Dropdown in Navbar
  3992. if (!this._inNavbar && usePopper) {
  3993. /**
  3994. * Check for Popper dependency
  3995. * Popper - https://popper.js.org
  3996. */
  3997. if (typeof Popper === 'undefined') {
  3998. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3999. }
  4000. var referenceElement = this._element;
  4001. if (this._config.reference === 'parent') {
  4002. referenceElement = parent;
  4003. } else if (Util.isElement(this._config.reference)) {
  4004. referenceElement = this._config.reference; // Check if it's jQuery element
  4005. if (typeof this._config.reference.jquery !== 'undefined') {
  4006. referenceElement = this._config.reference[0];
  4007. }
  4008. } // If boundary is not `scrollParent`, then set position to `static`
  4009. // to allow the menu to "escape" the scroll parent's boundaries
  4010. // https://github.com/twbs/bootstrap/issues/24251
  4011. if (this._config.boundary !== 'scrollParent') {
  4012. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4013. }
  4014. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4015. } // If this is a touch-enabled device we add extra
  4016. // empty mouseover listeners to the body's immediate children;
  4017. // only needed because of broken event delegation on iOS
  4018. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4019. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4020. $(document.body).children().on('mouseover', null, $.noop);
  4021. }
  4022. this._element.focus();
  4023. this._element.setAttribute('aria-expanded', true);
  4024. $(this._menu).toggleClass(ClassName$4.SHOW);
  4025. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4026. };
  4027. _proto.hide = function hide() {
  4028. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4029. return;
  4030. }
  4031. var relatedTarget = {
  4032. relatedTarget: this._element
  4033. };
  4034. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4035. var parent = Dropdown._getParentFromElement(this._element);
  4036. $(parent).trigger(hideEvent);
  4037. if (hideEvent.isDefaultPrevented()) {
  4038. return;
  4039. }
  4040. if (this._popper) {
  4041. this._popper.destroy();
  4042. }
  4043. $(this._menu).toggleClass(ClassName$4.SHOW);
  4044. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4045. };
  4046. _proto.dispose = function dispose() {
  4047. $.removeData(this._element, DATA_KEY$4);
  4048. $(this._element).off(EVENT_KEY$4);
  4049. this._element = null;
  4050. this._menu = null;
  4051. if (this._popper !== null) {
  4052. this._popper.destroy();
  4053. this._popper = null;
  4054. }
  4055. };
  4056. _proto.update = function update() {
  4057. this._inNavbar = this._detectNavbar();
  4058. if (this._popper !== null) {
  4059. this._popper.scheduleUpdate();
  4060. }
  4061. } // Private
  4062. ;
  4063. _proto._addEventListeners = function _addEventListeners() {
  4064. var _this = this;
  4065. $(this._element).on(Event$4.CLICK, function (event) {
  4066. event.preventDefault();
  4067. event.stopPropagation();
  4068. _this.toggle();
  4069. });
  4070. };
  4071. _proto._getConfig = function _getConfig(config) {
  4072. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4073. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4074. return config;
  4075. };
  4076. _proto._getMenuElement = function _getMenuElement() {
  4077. if (!this._menu) {
  4078. var parent = Dropdown._getParentFromElement(this._element);
  4079. if (parent) {
  4080. this._menu = parent.querySelector(Selector$4.MENU);
  4081. }
  4082. }
  4083. return this._menu;
  4084. };
  4085. _proto._getPlacement = function _getPlacement() {
  4086. var $parentDropdown = $(this._element.parentNode);
  4087. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4088. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4089. placement = AttachmentMap.TOP;
  4090. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4091. placement = AttachmentMap.TOPEND;
  4092. }
  4093. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4094. placement = AttachmentMap.RIGHT;
  4095. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4096. placement = AttachmentMap.LEFT;
  4097. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4098. placement = AttachmentMap.BOTTOMEND;
  4099. }
  4100. return placement;
  4101. };
  4102. _proto._detectNavbar = function _detectNavbar() {
  4103. return $(this._element).closest('.navbar').length > 0;
  4104. };
  4105. _proto._getOffset = function _getOffset() {
  4106. var _this2 = this;
  4107. var offset = {};
  4108. if (typeof this._config.offset === 'function') {
  4109. offset.fn = function (data) {
  4110. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4111. return data;
  4112. };
  4113. } else {
  4114. offset.offset = this._config.offset;
  4115. }
  4116. return offset;
  4117. };
  4118. _proto._getPopperConfig = function _getPopperConfig() {
  4119. var popperConfig = {
  4120. placement: this._getPlacement(),
  4121. modifiers: {
  4122. offset: this._getOffset(),
  4123. flip: {
  4124. enabled: this._config.flip
  4125. },
  4126. preventOverflow: {
  4127. boundariesElement: this._config.boundary
  4128. }
  4129. }
  4130. }; // Disable Popper.js if we have a static display
  4131. if (this._config.display === 'static') {
  4132. popperConfig.modifiers.applyStyle = {
  4133. enabled: false
  4134. };
  4135. }
  4136. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4137. } // Static
  4138. ;
  4139. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4140. return this.each(function () {
  4141. var data = $(this).data(DATA_KEY$4);
  4142. var _config = typeof config === 'object' ? config : null;
  4143. if (!data) {
  4144. data = new Dropdown(this, _config);
  4145. $(this).data(DATA_KEY$4, data);
  4146. }
  4147. if (typeof config === 'string') {
  4148. if (typeof data[config] === 'undefined') {
  4149. throw new TypeError("No method named \"" + config + "\"");
  4150. }
  4151. data[config]();
  4152. }
  4153. });
  4154. };
  4155. Dropdown._clearMenus = function _clearMenus(event) {
  4156. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4157. return;
  4158. }
  4159. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4160. for (var i = 0, len = toggles.length; i < len; i++) {
  4161. var parent = Dropdown._getParentFromElement(toggles[i]);
  4162. var context = $(toggles[i]).data(DATA_KEY$4);
  4163. var relatedTarget = {
  4164. relatedTarget: toggles[i]
  4165. };
  4166. if (event && event.type === 'click') {
  4167. relatedTarget.clickEvent = event;
  4168. }
  4169. if (!context) {
  4170. continue;
  4171. }
  4172. var dropdownMenu = context._menu;
  4173. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4174. continue;
  4175. }
  4176. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4177. continue;
  4178. }
  4179. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4180. $(parent).trigger(hideEvent);
  4181. if (hideEvent.isDefaultPrevented()) {
  4182. continue;
  4183. } // If this is a touch-enabled device we remove the extra
  4184. // empty mouseover listeners we added for iOS support
  4185. if ('ontouchstart' in document.documentElement) {
  4186. $(document.body).children().off('mouseover', null, $.noop);
  4187. }
  4188. toggles[i].setAttribute('aria-expanded', 'false');
  4189. if (context._popper) {
  4190. context._popper.destroy();
  4191. }
  4192. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4193. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4194. }
  4195. };
  4196. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4197. var parent;
  4198. var selector = Util.getSelectorFromElement(element);
  4199. if (selector) {
  4200. parent = document.querySelector(selector);
  4201. }
  4202. return parent || element.parentNode;
  4203. } // eslint-disable-next-line complexity
  4204. ;
  4205. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4206. // If not input/textarea:
  4207. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4208. // If input/textarea:
  4209. // - If space key => not a dropdown command
  4210. // - If key is other than escape
  4211. // - If key is not up or down => not a dropdown command
  4212. // - If trigger inside the menu => not a dropdown command
  4213. 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)) {
  4214. return;
  4215. }
  4216. event.preventDefault();
  4217. event.stopPropagation();
  4218. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4219. return;
  4220. }
  4221. var parent = Dropdown._getParentFromElement(this);
  4222. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4223. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4224. return;
  4225. }
  4226. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4227. if (event.which === ESCAPE_KEYCODE) {
  4228. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4229. $(toggle).trigger('focus');
  4230. }
  4231. $(this).trigger('click');
  4232. return;
  4233. }
  4234. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4235. return $(item).is(':visible');
  4236. });
  4237. if (items.length === 0) {
  4238. return;
  4239. }
  4240. var index = items.indexOf(event.target);
  4241. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4242. // Up
  4243. index--;
  4244. }
  4245. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4246. // Down
  4247. index++;
  4248. }
  4249. if (index < 0) {
  4250. index = 0;
  4251. }
  4252. items[index].focus();
  4253. };
  4254. _createClass(Dropdown, null, [{
  4255. key: "VERSION",
  4256. get: function get() {
  4257. return VERSION$4;
  4258. }
  4259. }, {
  4260. key: "Default",
  4261. get: function get() {
  4262. return Default$2;
  4263. }
  4264. }, {
  4265. key: "DefaultType",
  4266. get: function get() {
  4267. return DefaultType$2;
  4268. }
  4269. }]);
  4270. return Dropdown;
  4271. }();
  4272. /**
  4273. * ------------------------------------------------------------------------
  4274. * Data Api implementation
  4275. * ------------------------------------------------------------------------
  4276. */
  4277. $(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) {
  4278. event.preventDefault();
  4279. event.stopPropagation();
  4280. Dropdown._jQueryInterface.call($(this), 'toggle');
  4281. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4282. e.stopPropagation();
  4283. });
  4284. /**
  4285. * ------------------------------------------------------------------------
  4286. * jQuery
  4287. * ------------------------------------------------------------------------
  4288. */
  4289. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4290. $.fn[NAME$4].Constructor = Dropdown;
  4291. $.fn[NAME$4].noConflict = function () {
  4292. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4293. return Dropdown._jQueryInterface;
  4294. };
  4295. /**
  4296. * ------------------------------------------------------------------------
  4297. * Constants
  4298. * ------------------------------------------------------------------------
  4299. */
  4300. var NAME$5 = 'modal';
  4301. var VERSION$5 = '4.4.1';
  4302. var DATA_KEY$5 = 'bs.modal';
  4303. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4304. var DATA_API_KEY$5 = '.data-api';
  4305. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4306. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4307. var Default$3 = {
  4308. backdrop: true,
  4309. keyboard: true,
  4310. focus: true,
  4311. show: true
  4312. };
  4313. var DefaultType$3 = {
  4314. backdrop: '(boolean|string)',
  4315. keyboard: 'boolean',
  4316. focus: 'boolean',
  4317. show: 'boolean'
  4318. };
  4319. var Event$5 = {
  4320. HIDE: "hide" + EVENT_KEY$5,
  4321. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4322. HIDDEN: "hidden" + EVENT_KEY$5,
  4323. SHOW: "show" + EVENT_KEY$5,
  4324. SHOWN: "shown" + EVENT_KEY$5,
  4325. FOCUSIN: "focusin" + EVENT_KEY$5,
  4326. RESIZE: "resize" + EVENT_KEY$5,
  4327. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4328. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4329. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4330. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4331. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4332. };
  4333. var ClassName$5 = {
  4334. SCROLLABLE: 'modal-dialog-scrollable',
  4335. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4336. BACKDROP: 'modal-backdrop',
  4337. OPEN: 'modal-open',
  4338. FADE: 'fade',
  4339. SHOW: 'show',
  4340. STATIC: 'modal-static'
  4341. };
  4342. var Selector$5 = {
  4343. DIALOG: '.modal-dialog',
  4344. MODAL_BODY: '.modal-body',
  4345. DATA_TOGGLE: '[data-toggle="modal"]',
  4346. DATA_DISMISS: '[data-dismiss="modal"]',
  4347. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4348. STICKY_CONTENT: '.sticky-top'
  4349. };
  4350. /**
  4351. * ------------------------------------------------------------------------
  4352. * Class Definition
  4353. * ------------------------------------------------------------------------
  4354. */
  4355. var Modal =
  4356. /*#__PURE__*/
  4357. function () {
  4358. function Modal(element, config) {
  4359. this._config = this._getConfig(config);
  4360. this._element = element;
  4361. this._dialog = element.querySelector(Selector$5.DIALOG);
  4362. this._backdrop = null;
  4363. this._isShown = false;
  4364. this._isBodyOverflowing = false;
  4365. this._ignoreBackdropClick = false;
  4366. this._isTransitioning = false;
  4367. this._scrollbarWidth = 0;
  4368. } // Getters
  4369. var _proto = Modal.prototype;
  4370. // Public
  4371. _proto.toggle = function toggle(relatedTarget) {
  4372. return this._isShown ? this.hide() : this.show(relatedTarget);
  4373. };
  4374. _proto.show = function show(relatedTarget) {
  4375. var _this = this;
  4376. if (this._isShown || this._isTransitioning) {
  4377. return;
  4378. }
  4379. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4380. this._isTransitioning = true;
  4381. }
  4382. var showEvent = $.Event(Event$5.SHOW, {
  4383. relatedTarget: relatedTarget
  4384. });
  4385. $(this._element).trigger(showEvent);
  4386. if (this._isShown || showEvent.isDefaultPrevented()) {
  4387. return;
  4388. }
  4389. this._isShown = true;
  4390. this._checkScrollbar();
  4391. this._setScrollbar();
  4392. this._adjustDialog();
  4393. this._setEscapeEvent();
  4394. this._setResizeEvent();
  4395. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4396. return _this.hide(event);
  4397. });
  4398. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4399. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4400. if ($(event.target).is(_this._element)) {
  4401. _this._ignoreBackdropClick = true;
  4402. }
  4403. });
  4404. });
  4405. this._showBackdrop(function () {
  4406. return _this._showElement(relatedTarget);
  4407. });
  4408. };
  4409. _proto.hide = function hide(event) {
  4410. var _this2 = this;
  4411. if (event) {
  4412. event.preventDefault();
  4413. }
  4414. if (!this._isShown || this._isTransitioning) {
  4415. return;
  4416. }
  4417. var hideEvent = $.Event(Event$5.HIDE);
  4418. $(this._element).trigger(hideEvent);
  4419. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4420. return;
  4421. }
  4422. this._isShown = false;
  4423. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4424. if (transition) {
  4425. this._isTransitioning = true;
  4426. }
  4427. this._setEscapeEvent();
  4428. this._setResizeEvent();
  4429. $(document).off(Event$5.FOCUSIN);
  4430. $(this._element).removeClass(ClassName$5.SHOW);
  4431. $(this._element).off(Event$5.CLICK_DISMISS);
  4432. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4433. if (transition) {
  4434. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4435. $(this._element).one(Util.TRANSITION_END, function (event) {
  4436. return _this2._hideModal(event);
  4437. }).emulateTransitionEnd(transitionDuration);
  4438. } else {
  4439. this._hideModal();
  4440. }
  4441. };
  4442. _proto.dispose = function dispose() {
  4443. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4444. return $(htmlElement).off(EVENT_KEY$5);
  4445. });
  4446. /**
  4447. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4448. * Do not move `document` in `htmlElements` array
  4449. * It will remove `Event.CLICK_DATA_API` event that should remain
  4450. */
  4451. $(document).off(Event$5.FOCUSIN);
  4452. $.removeData(this._element, DATA_KEY$5);
  4453. this._config = null;
  4454. this._element = null;
  4455. this._dialog = null;
  4456. this._backdrop = null;
  4457. this._isShown = null;
  4458. this._isBodyOverflowing = null;
  4459. this._ignoreBackdropClick = null;
  4460. this._isTransitioning = null;
  4461. this._scrollbarWidth = null;
  4462. };
  4463. _proto.handleUpdate = function handleUpdate() {
  4464. this._adjustDialog();
  4465. } // Private
  4466. ;
  4467. _proto._getConfig = function _getConfig(config) {
  4468. config = _objectSpread2({}, Default$3, {}, config);
  4469. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4470. return config;
  4471. };
  4472. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4473. var _this3 = this;
  4474. if (this._config.backdrop === 'static') {
  4475. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4476. $(this._element).trigger(hideEventPrevented);
  4477. if (hideEventPrevented.defaultPrevented) {
  4478. return;
  4479. }
  4480. this._element.classList.add(ClassName$5.STATIC);
  4481. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4482. $(this._element).one(Util.TRANSITION_END, function () {
  4483. _this3._element.classList.remove(ClassName$5.STATIC);
  4484. }).emulateTransitionEnd(modalTransitionDuration);
  4485. this._element.focus();
  4486. } else {
  4487. this.hide();
  4488. }
  4489. };
  4490. _proto._showElement = function _showElement(relatedTarget) {
  4491. var _this4 = this;
  4492. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4493. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4494. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4495. // Don't move modal's DOM position
  4496. document.body.appendChild(this._element);
  4497. }
  4498. this._element.style.display = 'block';
  4499. this._element.removeAttribute('aria-hidden');
  4500. this._element.setAttribute('aria-modal', true);
  4501. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4502. modalBody.scrollTop = 0;
  4503. } else {
  4504. this._element.scrollTop = 0;
  4505. }
  4506. if (transition) {
  4507. Util.reflow(this._element);
  4508. }
  4509. $(this._element).addClass(ClassName$5.SHOW);
  4510. if (this._config.focus) {
  4511. this._enforceFocus();
  4512. }
  4513. var shownEvent = $.Event(Event$5.SHOWN, {
  4514. relatedTarget: relatedTarget
  4515. });
  4516. var transitionComplete = function transitionComplete() {
  4517. if (_this4._config.focus) {
  4518. _this4._element.focus();
  4519. }
  4520. _this4._isTransitioning = false;
  4521. $(_this4._element).trigger(shownEvent);
  4522. };
  4523. if (transition) {
  4524. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4525. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4526. } else {
  4527. transitionComplete();
  4528. }
  4529. };
  4530. _proto._enforceFocus = function _enforceFocus() {
  4531. var _this5 = this;
  4532. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4533. .on(Event$5.FOCUSIN, function (event) {
  4534. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4535. _this5._element.focus();
  4536. }
  4537. });
  4538. };
  4539. _proto._setEscapeEvent = function _setEscapeEvent() {
  4540. var _this6 = this;
  4541. if (this._isShown && this._config.keyboard) {
  4542. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4543. if (event.which === ESCAPE_KEYCODE$1) {
  4544. _this6._triggerBackdropTransition();
  4545. }
  4546. });
  4547. } else if (!this._isShown) {
  4548. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4549. }
  4550. };
  4551. _proto._setResizeEvent = function _setResizeEvent() {
  4552. var _this7 = this;
  4553. if (this._isShown) {
  4554. $(window).on(Event$5.RESIZE, function (event) {
  4555. return _this7.handleUpdate(event);
  4556. });
  4557. } else {
  4558. $(window).off(Event$5.RESIZE);
  4559. }
  4560. };
  4561. _proto._hideModal = function _hideModal() {
  4562. var _this8 = this;
  4563. this._element.style.display = 'none';
  4564. this._element.setAttribute('aria-hidden', true);
  4565. this._element.removeAttribute('aria-modal');
  4566. this._isTransitioning = false;
  4567. this._showBackdrop(function () {
  4568. $(document.body).removeClass(ClassName$5.OPEN);
  4569. _this8._resetAdjustments();
  4570. _this8._resetScrollbar();
  4571. $(_this8._element).trigger(Event$5.HIDDEN);
  4572. });
  4573. };
  4574. _proto._removeBackdrop = function _removeBackdrop() {
  4575. if (this._backdrop) {
  4576. $(this._backdrop).remove();
  4577. this._backdrop = null;
  4578. }
  4579. };
  4580. _proto._showBackdrop = function _showBackdrop(callback) {
  4581. var _this9 = this;
  4582. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4583. if (this._isShown && this._config.backdrop) {
  4584. this._backdrop = document.createElement('div');
  4585. this._backdrop.className = ClassName$5.BACKDROP;
  4586. if (animate) {
  4587. this._backdrop.classList.add(animate);
  4588. }
  4589. $(this._backdrop).appendTo(document.body);
  4590. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4591. if (_this9._ignoreBackdropClick) {
  4592. _this9._ignoreBackdropClick = false;
  4593. return;
  4594. }
  4595. if (event.target !== event.currentTarget) {
  4596. return;
  4597. }
  4598. _this9._triggerBackdropTransition();
  4599. });
  4600. if (animate) {
  4601. Util.reflow(this._backdrop);
  4602. }
  4603. $(this._backdrop).addClass(ClassName$5.SHOW);
  4604. if (!callback) {
  4605. return;
  4606. }
  4607. if (!animate) {
  4608. callback();
  4609. return;
  4610. }
  4611. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4612. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4613. } else if (!this._isShown && this._backdrop) {
  4614. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4615. var callbackRemove = function callbackRemove() {
  4616. _this9._removeBackdrop();
  4617. if (callback) {
  4618. callback();
  4619. }
  4620. };
  4621. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4622. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4623. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4624. } else {
  4625. callbackRemove();
  4626. }
  4627. } else if (callback) {
  4628. callback();
  4629. }
  4630. } // ----------------------------------------------------------------------
  4631. // the following methods are used to handle overflowing modals
  4632. // todo (fat): these should probably be refactored out of modal.js
  4633. // ----------------------------------------------------------------------
  4634. ;
  4635. _proto._adjustDialog = function _adjustDialog() {
  4636. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4637. if (!this._isBodyOverflowing && isModalOverflowing) {
  4638. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4639. }
  4640. if (this._isBodyOverflowing && !isModalOverflowing) {
  4641. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4642. }
  4643. };
  4644. _proto._resetAdjustments = function _resetAdjustments() {
  4645. this._element.style.paddingLeft = '';
  4646. this._element.style.paddingRight = '';
  4647. };
  4648. _proto._checkScrollbar = function _checkScrollbar() {
  4649. var rect = document.body.getBoundingClientRect();
  4650. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4651. this._scrollbarWidth = this._getScrollbarWidth();
  4652. };
  4653. _proto._setScrollbar = function _setScrollbar() {
  4654. var _this10 = this;
  4655. if (this._isBodyOverflowing) {
  4656. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4657. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4658. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4659. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4660. $(fixedContent).each(function (index, element) {
  4661. var actualPadding = element.style.paddingRight;
  4662. var calculatedPadding = $(element).css('padding-right');
  4663. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4664. }); // Adjust sticky content margin
  4665. $(stickyContent).each(function (index, element) {
  4666. var actualMargin = element.style.marginRight;
  4667. var calculatedMargin = $(element).css('margin-right');
  4668. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4669. }); // Adjust body padding
  4670. var actualPadding = document.body.style.paddingRight;
  4671. var calculatedPadding = $(document.body).css('padding-right');
  4672. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4673. }
  4674. $(document.body).addClass(ClassName$5.OPEN);
  4675. };
  4676. _proto._resetScrollbar = function _resetScrollbar() {
  4677. // Restore fixed content padding
  4678. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4679. $(fixedContent).each(function (index, element) {
  4680. var padding = $(element).data('padding-right');
  4681. $(element).removeData('padding-right');
  4682. element.style.paddingRight = padding ? padding : '';
  4683. }); // Restore sticky content
  4684. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4685. $(elements).each(function (index, element) {
  4686. var margin = $(element).data('margin-right');
  4687. if (typeof margin !== 'undefined') {
  4688. $(element).css('margin-right', margin).removeData('margin-right');
  4689. }
  4690. }); // Restore body padding
  4691. var padding = $(document.body).data('padding-right');
  4692. $(document.body).removeData('padding-right');
  4693. document.body.style.paddingRight = padding ? padding : '';
  4694. };
  4695. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4696. // thx d.walsh
  4697. var scrollDiv = document.createElement('div');
  4698. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4699. document.body.appendChild(scrollDiv);
  4700. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4701. document.body.removeChild(scrollDiv);
  4702. return scrollbarWidth;
  4703. } // Static
  4704. ;
  4705. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4706. return this.each(function () {
  4707. var data = $(this).data(DATA_KEY$5);
  4708. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4709. if (!data) {
  4710. data = new Modal(this, _config);
  4711. $(this).data(DATA_KEY$5, data);
  4712. }
  4713. if (typeof config === 'string') {
  4714. if (typeof data[config] === 'undefined') {
  4715. throw new TypeError("No method named \"" + config + "\"");
  4716. }
  4717. data[config](relatedTarget);
  4718. } else if (_config.show) {
  4719. data.show(relatedTarget);
  4720. }
  4721. });
  4722. };
  4723. _createClass(Modal, null, [{
  4724. key: "VERSION",
  4725. get: function get() {
  4726. return VERSION$5;
  4727. }
  4728. }, {
  4729. key: "Default",
  4730. get: function get() {
  4731. return Default$3;
  4732. }
  4733. }]);
  4734. return Modal;
  4735. }();
  4736. /**
  4737. * ------------------------------------------------------------------------
  4738. * Data Api implementation
  4739. * ------------------------------------------------------------------------
  4740. */
  4741. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4742. var _this11 = this;
  4743. var target;
  4744. var selector = Util.getSelectorFromElement(this);
  4745. if (selector) {
  4746. target = document.querySelector(selector);
  4747. }
  4748. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4749. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4750. event.preventDefault();
  4751. }
  4752. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4753. if (showEvent.isDefaultPrevented()) {
  4754. // Only register focus restorer if modal will actually get shown
  4755. return;
  4756. }
  4757. $target.one(Event$5.HIDDEN, function () {
  4758. if ($(_this11).is(':visible')) {
  4759. _this11.focus();
  4760. }
  4761. });
  4762. });
  4763. Modal._jQueryInterface.call($(target), config, this);
  4764. });
  4765. /**
  4766. * ------------------------------------------------------------------------
  4767. * jQuery
  4768. * ------------------------------------------------------------------------
  4769. */
  4770. $.fn[NAME$5] = Modal._jQueryInterface;
  4771. $.fn[NAME$5].Constructor = Modal;
  4772. $.fn[NAME$5].noConflict = function () {
  4773. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4774. return Modal._jQueryInterface;
  4775. };
  4776. /**
  4777. * --------------------------------------------------------------------------
  4778. * Bootstrap (v4.4.1): tools/sanitizer.js
  4779. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4780. * --------------------------------------------------------------------------
  4781. */
  4782. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4783. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4784. var DefaultWhitelist = {
  4785. // Global attributes allowed on any supplied element below.
  4786. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4787. a: ['target', 'href', 'title', 'rel'],
  4788. area: [],
  4789. b: [],
  4790. br: [],
  4791. col: [],
  4792. code: [],
  4793. div: [],
  4794. em: [],
  4795. hr: [],
  4796. h1: [],
  4797. h2: [],
  4798. h3: [],
  4799. h4: [],
  4800. h5: [],
  4801. h6: [],
  4802. i: [],
  4803. img: ['src', 'alt', 'title', 'width', 'height'],
  4804. li: [],
  4805. ol: [],
  4806. p: [],
  4807. pre: [],
  4808. s: [],
  4809. small: [],
  4810. span: [],
  4811. sub: [],
  4812. sup: [],
  4813. strong: [],
  4814. u: [],
  4815. ul: []
  4816. };
  4817. /**
  4818. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4819. *
  4820. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4821. */
  4822. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4823. /**
  4824. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4825. *
  4826. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4827. */
  4828. 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;
  4829. function allowedAttribute(attr, allowedAttributeList) {
  4830. var attrName = attr.nodeName.toLowerCase();
  4831. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4832. if (uriAttrs.indexOf(attrName) !== -1) {
  4833. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4834. }
  4835. return true;
  4836. }
  4837. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4838. return attrRegex instanceof RegExp;
  4839. }); // Check if a regular expression validates the attribute.
  4840. for (var i = 0, l = regExp.length; i < l; i++) {
  4841. if (attrName.match(regExp[i])) {
  4842. return true;
  4843. }
  4844. }
  4845. return false;
  4846. }
  4847. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4848. if (unsafeHtml.length === 0) {
  4849. return unsafeHtml;
  4850. }
  4851. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4852. return sanitizeFn(unsafeHtml);
  4853. }
  4854. var domParser = new window.DOMParser();
  4855. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4856. var whitelistKeys = Object.keys(whiteList);
  4857. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4858. var _loop = function _loop(i, len) {
  4859. var el = elements[i];
  4860. var elName = el.nodeName.toLowerCase();
  4861. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4862. el.parentNode.removeChild(el);
  4863. return "continue";
  4864. }
  4865. var attributeList = [].slice.call(el.attributes);
  4866. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4867. attributeList.forEach(function (attr) {
  4868. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4869. el.removeAttribute(attr.nodeName);
  4870. }
  4871. });
  4872. };
  4873. for (var i = 0, len = elements.length; i < len; i++) {
  4874. var _ret = _loop(i);
  4875. if (_ret === "continue") continue;
  4876. }
  4877. return createdDocument.body.innerHTML;
  4878. }
  4879. /**
  4880. * ------------------------------------------------------------------------
  4881. * Constants
  4882. * ------------------------------------------------------------------------
  4883. */
  4884. var NAME$6 = 'tooltip';
  4885. var VERSION$6 = '4.4.1';
  4886. var DATA_KEY$6 = 'bs.tooltip';
  4887. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4888. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4889. var CLASS_PREFIX = 'bs-tooltip';
  4890. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4891. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4892. var DefaultType$4 = {
  4893. animation: 'boolean',
  4894. template: 'string',
  4895. title: '(string|element|function)',
  4896. trigger: 'string',
  4897. delay: '(number|object)',
  4898. html: 'boolean',
  4899. selector: '(string|boolean)',
  4900. placement: '(string|function)',
  4901. offset: '(number|string|function)',
  4902. container: '(string|element|boolean)',
  4903. fallbackPlacement: '(string|array)',
  4904. boundary: '(string|element)',
  4905. sanitize: 'boolean',
  4906. sanitizeFn: '(null|function)',
  4907. whiteList: 'object',
  4908. popperConfig: '(null|object)'
  4909. };
  4910. var AttachmentMap$1 = {
  4911. AUTO: 'auto',
  4912. TOP: 'top',
  4913. RIGHT: 'right',
  4914. BOTTOM: 'bottom',
  4915. LEFT: 'left'
  4916. };
  4917. var Default$4 = {
  4918. animation: true,
  4919. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4920. trigger: 'hover focus',
  4921. title: '',
  4922. delay: 0,
  4923. html: false,
  4924. selector: false,
  4925. placement: 'top',
  4926. offset: 0,
  4927. container: false,
  4928. fallbackPlacement: 'flip',
  4929. boundary: 'scrollParent',
  4930. sanitize: true,
  4931. sanitizeFn: null,
  4932. whiteList: DefaultWhitelist,
  4933. popperConfig: null
  4934. };
  4935. var HoverState = {
  4936. SHOW: 'show',
  4937. OUT: 'out'
  4938. };
  4939. var Event$6 = {
  4940. HIDE: "hide" + EVENT_KEY$6,
  4941. HIDDEN: "hidden" + EVENT_KEY$6,
  4942. SHOW: "show" + EVENT_KEY$6,
  4943. SHOWN: "shown" + EVENT_KEY$6,
  4944. INSERTED: "inserted" + EVENT_KEY$6,
  4945. CLICK: "click" + EVENT_KEY$6,
  4946. FOCUSIN: "focusin" + EVENT_KEY$6,
  4947. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4948. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4949. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4950. };
  4951. var ClassName$6 = {
  4952. FADE: 'fade',
  4953. SHOW: 'show'
  4954. };
  4955. var Selector$6 = {
  4956. TOOLTIP: '.tooltip',
  4957. TOOLTIP_INNER: '.tooltip-inner',
  4958. ARROW: '.arrow'
  4959. };
  4960. var Trigger = {
  4961. HOVER: 'hover',
  4962. FOCUS: 'focus',
  4963. CLICK: 'click',
  4964. MANUAL: 'manual'
  4965. };
  4966. /**
  4967. * ------------------------------------------------------------------------
  4968. * Class Definition
  4969. * ------------------------------------------------------------------------
  4970. */
  4971. var Tooltip =
  4972. /*#__PURE__*/
  4973. function () {
  4974. function Tooltip(element, config) {
  4975. if (typeof Popper === 'undefined') {
  4976. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4977. } // private
  4978. this._isEnabled = true;
  4979. this._timeout = 0;
  4980. this._hoverState = '';
  4981. this._activeTrigger = {};
  4982. this._popper = null; // Protected
  4983. this.element = element;
  4984. this.config = this._getConfig(config);
  4985. this.tip = null;
  4986. this._setListeners();
  4987. } // Getters
  4988. var _proto = Tooltip.prototype;
  4989. // Public
  4990. _proto.enable = function enable() {
  4991. this._isEnabled = true;
  4992. };
  4993. _proto.disable = function disable() {
  4994. this._isEnabled = false;
  4995. };
  4996. _proto.toggleEnabled = function toggleEnabled() {
  4997. this._isEnabled = !this._isEnabled;
  4998. };
  4999. _proto.toggle = function toggle(event) {
  5000. if (!this._isEnabled) {
  5001. return;
  5002. }
  5003. if (event) {
  5004. var dataKey = this.constructor.DATA_KEY;
  5005. var context = $(event.currentTarget).data(dataKey);
  5006. if (!context) {
  5007. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5008. $(event.currentTarget).data(dataKey, context);
  5009. }
  5010. context._activeTrigger.click = !context._activeTrigger.click;
  5011. if (context._isWithActiveTrigger()) {
  5012. context._enter(null, context);
  5013. } else {
  5014. context._leave(null, context);
  5015. }
  5016. } else {
  5017. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5018. this._leave(null, this);
  5019. return;
  5020. }
  5021. this._enter(null, this);
  5022. }
  5023. };
  5024. _proto.dispose = function dispose() {
  5025. clearTimeout(this._timeout);
  5026. $.removeData(this.element, this.constructor.DATA_KEY);
  5027. $(this.element).off(this.constructor.EVENT_KEY);
  5028. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5029. if (this.tip) {
  5030. $(this.tip).remove();
  5031. }
  5032. this._isEnabled = null;
  5033. this._timeout = null;
  5034. this._hoverState = null;
  5035. this._activeTrigger = null;
  5036. if (this._popper) {
  5037. this._popper.destroy();
  5038. }
  5039. this._popper = null;
  5040. this.element = null;
  5041. this.config = null;
  5042. this.tip = null;
  5043. };
  5044. _proto.show = function show() {
  5045. var _this = this;
  5046. if ($(this.element).css('display') === 'none') {
  5047. throw new Error('Please use show on visible elements');
  5048. }
  5049. var showEvent = $.Event(this.constructor.Event.SHOW);
  5050. if (this.isWithContent() && this._isEnabled) {
  5051. $(this.element).trigger(showEvent);
  5052. var shadowRoot = Util.findShadowRoot(this.element);
  5053. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5054. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5055. return;
  5056. }
  5057. var tip = this.getTipElement();
  5058. var tipId = Util.getUID(this.constructor.NAME);
  5059. tip.setAttribute('id', tipId);
  5060. this.element.setAttribute('aria-describedby', tipId);
  5061. this.setContent();
  5062. if (this.config.animation) {
  5063. $(tip).addClass(ClassName$6.FADE);
  5064. }
  5065. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5066. var attachment = this._getAttachment(placement);
  5067. this.addAttachmentClass(attachment);
  5068. var container = this._getContainer();
  5069. $(tip).data(this.constructor.DATA_KEY, this);
  5070. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5071. $(tip).appendTo(container);
  5072. }
  5073. $(this.element).trigger(this.constructor.Event.INSERTED);
  5074. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5075. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5076. // empty mouseover listeners to the body's immediate children;
  5077. // only needed because of broken event delegation on iOS
  5078. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5079. if ('ontouchstart' in document.documentElement) {
  5080. $(document.body).children().on('mouseover', null, $.noop);
  5081. }
  5082. var complete = function complete() {
  5083. if (_this.config.animation) {
  5084. _this._fixTransition();
  5085. }
  5086. var prevHoverState = _this._hoverState;
  5087. _this._hoverState = null;
  5088. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5089. if (prevHoverState === HoverState.OUT) {
  5090. _this._leave(null, _this);
  5091. }
  5092. };
  5093. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5094. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5095. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5096. } else {
  5097. complete();
  5098. }
  5099. }
  5100. };
  5101. _proto.hide = function hide(callback) {
  5102. var _this2 = this;
  5103. var tip = this.getTipElement();
  5104. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5105. var complete = function complete() {
  5106. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5107. tip.parentNode.removeChild(tip);
  5108. }
  5109. _this2._cleanTipClass();
  5110. _this2.element.removeAttribute('aria-describedby');
  5111. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5112. if (_this2._popper !== null) {
  5113. _this2._popper.destroy();
  5114. }
  5115. if (callback) {
  5116. callback();
  5117. }
  5118. };
  5119. $(this.element).trigger(hideEvent);
  5120. if (hideEvent.isDefaultPrevented()) {
  5121. return;
  5122. }
  5123. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5124. // empty mouseover listeners we added for iOS support
  5125. if ('ontouchstart' in document.documentElement) {
  5126. $(document.body).children().off('mouseover', null, $.noop);
  5127. }
  5128. this._activeTrigger[Trigger.CLICK] = false;
  5129. this._activeTrigger[Trigger.FOCUS] = false;
  5130. this._activeTrigger[Trigger.HOVER] = false;
  5131. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5132. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5133. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5134. } else {
  5135. complete();
  5136. }
  5137. this._hoverState = '';
  5138. };
  5139. _proto.update = function update() {
  5140. if (this._popper !== null) {
  5141. this._popper.scheduleUpdate();
  5142. }
  5143. } // Protected
  5144. ;
  5145. _proto.isWithContent = function isWithContent() {
  5146. return Boolean(this.getTitle());
  5147. };
  5148. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5149. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5150. };
  5151. _proto.getTipElement = function getTipElement() {
  5152. this.tip = this.tip || $(this.config.template)[0];
  5153. return this.tip;
  5154. };
  5155. _proto.setContent = function setContent() {
  5156. var tip = this.getTipElement();
  5157. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5158. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5159. };
  5160. _proto.setElementContent = function setElementContent($element, content) {
  5161. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5162. // Content is a DOM node or a jQuery
  5163. if (this.config.html) {
  5164. if (!$(content).parent().is($element)) {
  5165. $element.empty().append(content);
  5166. }
  5167. } else {
  5168. $element.text($(content).text());
  5169. }
  5170. return;
  5171. }
  5172. if (this.config.html) {
  5173. if (this.config.sanitize) {
  5174. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5175. }
  5176. $element.html(content);
  5177. } else {
  5178. $element.text(content);
  5179. }
  5180. };
  5181. _proto.getTitle = function getTitle() {
  5182. var title = this.element.getAttribute('data-original-title');
  5183. if (!title) {
  5184. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5185. }
  5186. return title;
  5187. } // Private
  5188. ;
  5189. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5190. var _this3 = this;
  5191. var defaultBsConfig = {
  5192. placement: attachment,
  5193. modifiers: {
  5194. offset: this._getOffset(),
  5195. flip: {
  5196. behavior: this.config.fallbackPlacement
  5197. },
  5198. arrow: {
  5199. element: Selector$6.ARROW
  5200. },
  5201. preventOverflow: {
  5202. boundariesElement: this.config.boundary
  5203. }
  5204. },
  5205. onCreate: function onCreate(data) {
  5206. if (data.originalPlacement !== data.placement) {
  5207. _this3._handlePopperPlacementChange(data);
  5208. }
  5209. },
  5210. onUpdate: function onUpdate(data) {
  5211. return _this3._handlePopperPlacementChange(data);
  5212. }
  5213. };
  5214. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5215. };
  5216. _proto._getOffset = function _getOffset() {
  5217. var _this4 = this;
  5218. var offset = {};
  5219. if (typeof this.config.offset === 'function') {
  5220. offset.fn = function (data) {
  5221. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5222. return data;
  5223. };
  5224. } else {
  5225. offset.offset = this.config.offset;
  5226. }
  5227. return offset;
  5228. };
  5229. _proto._getContainer = function _getContainer() {
  5230. if (this.config.container === false) {
  5231. return document.body;
  5232. }
  5233. if (Util.isElement(this.config.container)) {
  5234. return $(this.config.container);
  5235. }
  5236. return $(document).find(this.config.container);
  5237. };
  5238. _proto._getAttachment = function _getAttachment(placement) {
  5239. return AttachmentMap$1[placement.toUpperCase()];
  5240. };
  5241. _proto._setListeners = function _setListeners() {
  5242. var _this5 = this;
  5243. var triggers = this.config.trigger.split(' ');
  5244. triggers.forEach(function (trigger) {
  5245. if (trigger === 'click') {
  5246. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5247. return _this5.toggle(event);
  5248. });
  5249. } else if (trigger !== Trigger.MANUAL) {
  5250. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5251. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5252. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5253. return _this5._enter(event);
  5254. }).on(eventOut, _this5.config.selector, function (event) {
  5255. return _this5._leave(event);
  5256. });
  5257. }
  5258. });
  5259. this._hideModalHandler = function () {
  5260. if (_this5.element) {
  5261. _this5.hide();
  5262. }
  5263. };
  5264. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5265. if (this.config.selector) {
  5266. this.config = _objectSpread2({}, this.config, {
  5267. trigger: 'manual',
  5268. selector: ''
  5269. });
  5270. } else {
  5271. this._fixTitle();
  5272. }
  5273. };
  5274. _proto._fixTitle = function _fixTitle() {
  5275. var titleType = typeof this.element.getAttribute('data-original-title');
  5276. if (this.element.getAttribute('title') || titleType !== 'string') {
  5277. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5278. this.element.setAttribute('title', '');
  5279. }
  5280. };
  5281. _proto._enter = function _enter(event, context) {
  5282. var dataKey = this.constructor.DATA_KEY;
  5283. context = context || $(event.currentTarget).data(dataKey);
  5284. if (!context) {
  5285. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5286. $(event.currentTarget).data(dataKey, context);
  5287. }
  5288. if (event) {
  5289. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5290. }
  5291. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5292. context._hoverState = HoverState.SHOW;
  5293. return;
  5294. }
  5295. clearTimeout(context._timeout);
  5296. context._hoverState = HoverState.SHOW;
  5297. if (!context.config.delay || !context.config.delay.show) {
  5298. context.show();
  5299. return;
  5300. }
  5301. context._timeout = setTimeout(function () {
  5302. if (context._hoverState === HoverState.SHOW) {
  5303. context.show();
  5304. }
  5305. }, context.config.delay.show);
  5306. };
  5307. _proto._leave = function _leave(event, context) {
  5308. var dataKey = this.constructor.DATA_KEY;
  5309. context = context || $(event.currentTarget).data(dataKey);
  5310. if (!context) {
  5311. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5312. $(event.currentTarget).data(dataKey, context);
  5313. }
  5314. if (event) {
  5315. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5316. }
  5317. if (context._isWithActiveTrigger()) {
  5318. return;
  5319. }
  5320. clearTimeout(context._timeout);
  5321. context._hoverState = HoverState.OUT;
  5322. if (!context.config.delay || !context.config.delay.hide) {
  5323. context.hide();
  5324. return;
  5325. }
  5326. context._timeout = setTimeout(function () {
  5327. if (context._hoverState === HoverState.OUT) {
  5328. context.hide();
  5329. }
  5330. }, context.config.delay.hide);
  5331. };
  5332. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5333. for (var trigger in this._activeTrigger) {
  5334. if (this._activeTrigger[trigger]) {
  5335. return true;
  5336. }
  5337. }
  5338. return false;
  5339. };
  5340. _proto._getConfig = function _getConfig(config) {
  5341. var dataAttributes = $(this.element).data();
  5342. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5343. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5344. delete dataAttributes[dataAttr];
  5345. }
  5346. });
  5347. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5348. if (typeof config.delay === 'number') {
  5349. config.delay = {
  5350. show: config.delay,
  5351. hide: config.delay
  5352. };
  5353. }
  5354. if (typeof config.title === 'number') {
  5355. config.title = config.title.toString();
  5356. }
  5357. if (typeof config.content === 'number') {
  5358. config.content = config.content.toString();
  5359. }
  5360. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5361. if (config.sanitize) {
  5362. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5363. }
  5364. return config;
  5365. };
  5366. _proto._getDelegateConfig = function _getDelegateConfig() {
  5367. var config = {};
  5368. if (this.config) {
  5369. for (var key in this.config) {
  5370. if (this.constructor.Default[key] !== this.config[key]) {
  5371. config[key] = this.config[key];
  5372. }
  5373. }
  5374. }
  5375. return config;
  5376. };
  5377. _proto._cleanTipClass = function _cleanTipClass() {
  5378. var $tip = $(this.getTipElement());
  5379. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5380. if (tabClass !== null && tabClass.length) {
  5381. $tip.removeClass(tabClass.join(''));
  5382. }
  5383. };
  5384. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5385. var popperInstance = popperData.instance;
  5386. this.tip = popperInstance.popper;
  5387. this._cleanTipClass();
  5388. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5389. };
  5390. _proto._fixTransition = function _fixTransition() {
  5391. var tip = this.getTipElement();
  5392. var initConfigAnimation = this.config.animation;
  5393. if (tip.getAttribute('x-placement') !== null) {
  5394. return;
  5395. }
  5396. $(tip).removeClass(ClassName$6.FADE);
  5397. this.config.animation = false;
  5398. this.hide();
  5399. this.show();
  5400. this.config.animation = initConfigAnimation;
  5401. } // Static
  5402. ;
  5403. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5404. return this.each(function () {
  5405. var data = $(this).data(DATA_KEY$6);
  5406. var _config = typeof config === 'object' && config;
  5407. if (!data && /dispose|hide/.test(config)) {
  5408. return;
  5409. }
  5410. if (!data) {
  5411. data = new Tooltip(this, _config);
  5412. $(this).data(DATA_KEY$6, data);
  5413. }
  5414. if (typeof config === 'string') {
  5415. if (typeof data[config] === 'undefined') {
  5416. throw new TypeError("No method named \"" + config + "\"");
  5417. }
  5418. data[config]();
  5419. }
  5420. });
  5421. };
  5422. _createClass(Tooltip, null, [{
  5423. key: "VERSION",
  5424. get: function get() {
  5425. return VERSION$6;
  5426. }
  5427. }, {
  5428. key: "Default",
  5429. get: function get() {
  5430. return Default$4;
  5431. }
  5432. }, {
  5433. key: "NAME",
  5434. get: function get() {
  5435. return NAME$6;
  5436. }
  5437. }, {
  5438. key: "DATA_KEY",
  5439. get: function get() {
  5440. return DATA_KEY$6;
  5441. }
  5442. }, {
  5443. key: "Event",
  5444. get: function get() {
  5445. return Event$6;
  5446. }
  5447. }, {
  5448. key: "EVENT_KEY",
  5449. get: function get() {
  5450. return EVENT_KEY$6;
  5451. }
  5452. }, {
  5453. key: "DefaultType",
  5454. get: function get() {
  5455. return DefaultType$4;
  5456. }
  5457. }]);
  5458. return Tooltip;
  5459. }();
  5460. /**
  5461. * ------------------------------------------------------------------------
  5462. * jQuery
  5463. * ------------------------------------------------------------------------
  5464. */
  5465. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5466. $.fn[NAME$6].Constructor = Tooltip;
  5467. $.fn[NAME$6].noConflict = function () {
  5468. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5469. return Tooltip._jQueryInterface;
  5470. };
  5471. /**
  5472. * ------------------------------------------------------------------------
  5473. * Constants
  5474. * ------------------------------------------------------------------------
  5475. */
  5476. var NAME$7 = 'popover';
  5477. var VERSION$7 = '4.4.1';
  5478. var DATA_KEY$7 = 'bs.popover';
  5479. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5480. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5481. var CLASS_PREFIX$1 = 'bs-popover';
  5482. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5483. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5484. placement: 'right',
  5485. trigger: 'click',
  5486. content: '',
  5487. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5488. });
  5489. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5490. content: '(string|element|function)'
  5491. });
  5492. var ClassName$7 = {
  5493. FADE: 'fade',
  5494. SHOW: 'show'
  5495. };
  5496. var Selector$7 = {
  5497. TITLE: '.popover-header',
  5498. CONTENT: '.popover-body'
  5499. };
  5500. var Event$7 = {
  5501. HIDE: "hide" + EVENT_KEY$7,
  5502. HIDDEN: "hidden" + EVENT_KEY$7,
  5503. SHOW: "show" + EVENT_KEY$7,
  5504. SHOWN: "shown" + EVENT_KEY$7,
  5505. INSERTED: "inserted" + EVENT_KEY$7,
  5506. CLICK: "click" + EVENT_KEY$7,
  5507. FOCUSIN: "focusin" + EVENT_KEY$7,
  5508. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5509. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5510. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5511. };
  5512. /**
  5513. * ------------------------------------------------------------------------
  5514. * Class Definition
  5515. * ------------------------------------------------------------------------
  5516. */
  5517. var Popover =
  5518. /*#__PURE__*/
  5519. function (_Tooltip) {
  5520. _inheritsLoose(Popover, _Tooltip);
  5521. function Popover() {
  5522. return _Tooltip.apply(this, arguments) || this;
  5523. }
  5524. var _proto = Popover.prototype;
  5525. // Overrides
  5526. _proto.isWithContent = function isWithContent() {
  5527. return this.getTitle() || this._getContent();
  5528. };
  5529. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5530. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5531. };
  5532. _proto.getTipElement = function getTipElement() {
  5533. this.tip = this.tip || $(this.config.template)[0];
  5534. return this.tip;
  5535. };
  5536. _proto.setContent = function setContent() {
  5537. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5538. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5539. var content = this._getContent();
  5540. if (typeof content === 'function') {
  5541. content = content.call(this.element);
  5542. }
  5543. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5544. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5545. } // Private
  5546. ;
  5547. _proto._getContent = function _getContent() {
  5548. return this.element.getAttribute('data-content') || this.config.content;
  5549. };
  5550. _proto._cleanTipClass = function _cleanTipClass() {
  5551. var $tip = $(this.getTipElement());
  5552. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5553. if (tabClass !== null && tabClass.length > 0) {
  5554. $tip.removeClass(tabClass.join(''));
  5555. }
  5556. } // Static
  5557. ;
  5558. Popover._jQueryInterface = function _jQueryInterface(config) {
  5559. return this.each(function () {
  5560. var data = $(this).data(DATA_KEY$7);
  5561. var _config = typeof config === 'object' ? config : null;
  5562. if (!data && /dispose|hide/.test(config)) {
  5563. return;
  5564. }
  5565. if (!data) {
  5566. data = new Popover(this, _config);
  5567. $(this).data(DATA_KEY$7, data);
  5568. }
  5569. if (typeof config === 'string') {
  5570. if (typeof data[config] === 'undefined') {
  5571. throw new TypeError("No method named \"" + config + "\"");
  5572. }
  5573. data[config]();
  5574. }
  5575. });
  5576. };
  5577. _createClass(Popover, null, [{
  5578. key: "VERSION",
  5579. // Getters
  5580. get: function get() {
  5581. return VERSION$7;
  5582. }
  5583. }, {
  5584. key: "Default",
  5585. get: function get() {
  5586. return Default$5;
  5587. }
  5588. }, {
  5589. key: "NAME",
  5590. get: function get() {
  5591. return NAME$7;
  5592. }
  5593. }, {
  5594. key: "DATA_KEY",
  5595. get: function get() {
  5596. return DATA_KEY$7;
  5597. }
  5598. }, {
  5599. key: "Event",
  5600. get: function get() {
  5601. return Event$7;
  5602. }
  5603. }, {
  5604. key: "EVENT_KEY",
  5605. get: function get() {
  5606. return EVENT_KEY$7;
  5607. }
  5608. }, {
  5609. key: "DefaultType",
  5610. get: function get() {
  5611. return DefaultType$5;
  5612. }
  5613. }]);
  5614. return Popover;
  5615. }(Tooltip);
  5616. /**
  5617. * ------------------------------------------------------------------------
  5618. * jQuery
  5619. * ------------------------------------------------------------------------
  5620. */
  5621. $.fn[NAME$7] = Popover._jQueryInterface;
  5622. $.fn[NAME$7].Constructor = Popover;
  5623. $.fn[NAME$7].noConflict = function () {
  5624. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5625. return Popover._jQueryInterface;
  5626. };
  5627. /**
  5628. * ------------------------------------------------------------------------
  5629. * Constants
  5630. * ------------------------------------------------------------------------
  5631. */
  5632. var NAME$8 = 'scrollspy';
  5633. var VERSION$8 = '4.4.1';
  5634. var DATA_KEY$8 = 'bs.scrollspy';
  5635. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5636. var DATA_API_KEY$6 = '.data-api';
  5637. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5638. var Default$6 = {
  5639. offset: 10,
  5640. method: 'auto',
  5641. target: ''
  5642. };
  5643. var DefaultType$6 = {
  5644. offset: 'number',
  5645. method: 'string',
  5646. target: '(string|element)'
  5647. };
  5648. var Event$8 = {
  5649. ACTIVATE: "activate" + EVENT_KEY$8,
  5650. SCROLL: "scroll" + EVENT_KEY$8,
  5651. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5652. };
  5653. var ClassName$8 = {
  5654. DROPDOWN_ITEM: 'dropdown-item',
  5655. DROPDOWN_MENU: 'dropdown-menu',
  5656. ACTIVE: 'active'
  5657. };
  5658. var Selector$8 = {
  5659. DATA_SPY: '[data-spy="scroll"]',
  5660. ACTIVE: '.active',
  5661. NAV_LIST_GROUP: '.nav, .list-group',
  5662. NAV_LINKS: '.nav-link',
  5663. NAV_ITEMS: '.nav-item',
  5664. LIST_ITEMS: '.list-group-item',
  5665. DROPDOWN: '.dropdown',
  5666. DROPDOWN_ITEMS: '.dropdown-item',
  5667. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5668. };
  5669. var OffsetMethod = {
  5670. OFFSET: 'offset',
  5671. POSITION: 'position'
  5672. };
  5673. /**
  5674. * ------------------------------------------------------------------------
  5675. * Class Definition
  5676. * ------------------------------------------------------------------------
  5677. */
  5678. var ScrollSpy =
  5679. /*#__PURE__*/
  5680. function () {
  5681. function ScrollSpy(element, config) {
  5682. var _this = this;
  5683. this._element = element;
  5684. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5685. this._config = this._getConfig(config);
  5686. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5687. this._offsets = [];
  5688. this._targets = [];
  5689. this._activeTarget = null;
  5690. this._scrollHeight = 0;
  5691. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5692. return _this._process(event);
  5693. });
  5694. this.refresh();
  5695. this._process();
  5696. } // Getters
  5697. var _proto = ScrollSpy.prototype;
  5698. // Public
  5699. _proto.refresh = function refresh() {
  5700. var _this2 = this;
  5701. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5702. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5703. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5704. this._offsets = [];
  5705. this._targets = [];
  5706. this._scrollHeight = this._getScrollHeight();
  5707. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5708. targets.map(function (element) {
  5709. var target;
  5710. var targetSelector = Util.getSelectorFromElement(element);
  5711. if (targetSelector) {
  5712. target = document.querySelector(targetSelector);
  5713. }
  5714. if (target) {
  5715. var targetBCR = target.getBoundingClientRect();
  5716. if (targetBCR.width || targetBCR.height) {
  5717. // TODO (fat): remove sketch reliance on jQuery position/offset
  5718. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5719. }
  5720. }
  5721. return null;
  5722. }).filter(function (item) {
  5723. return item;
  5724. }).sort(function (a, b) {
  5725. return a[0] - b[0];
  5726. }).forEach(function (item) {
  5727. _this2._offsets.push(item[0]);
  5728. _this2._targets.push(item[1]);
  5729. });
  5730. };
  5731. _proto.dispose = function dispose() {
  5732. $.removeData(this._element, DATA_KEY$8);
  5733. $(this._scrollElement).off(EVENT_KEY$8);
  5734. this._element = null;
  5735. this._scrollElement = null;
  5736. this._config = null;
  5737. this._selector = null;
  5738. this._offsets = null;
  5739. this._targets = null;
  5740. this._activeTarget = null;
  5741. this._scrollHeight = null;
  5742. } // Private
  5743. ;
  5744. _proto._getConfig = function _getConfig(config) {
  5745. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5746. if (typeof config.target !== 'string') {
  5747. var id = $(config.target).attr('id');
  5748. if (!id) {
  5749. id = Util.getUID(NAME$8);
  5750. $(config.target).attr('id', id);
  5751. }
  5752. config.target = "#" + id;
  5753. }
  5754. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5755. return config;
  5756. };
  5757. _proto._getScrollTop = function _getScrollTop() {
  5758. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5759. };
  5760. _proto._getScrollHeight = function _getScrollHeight() {
  5761. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5762. };
  5763. _proto._getOffsetHeight = function _getOffsetHeight() {
  5764. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5765. };
  5766. _proto._process = function _process() {
  5767. var scrollTop = this._getScrollTop() + this._config.offset;
  5768. var scrollHeight = this._getScrollHeight();
  5769. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5770. if (this._scrollHeight !== scrollHeight) {
  5771. this.refresh();
  5772. }
  5773. if (scrollTop >= maxScroll) {
  5774. var target = this._targets[this._targets.length - 1];
  5775. if (this._activeTarget !== target) {
  5776. this._activate(target);
  5777. }
  5778. return;
  5779. }
  5780. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5781. this._activeTarget = null;
  5782. this._clear();
  5783. return;
  5784. }
  5785. var offsetLength = this._offsets.length;
  5786. for (var i = offsetLength; i--;) {
  5787. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5788. if (isActiveTarget) {
  5789. this._activate(this._targets[i]);
  5790. }
  5791. }
  5792. };
  5793. _proto._activate = function _activate(target) {
  5794. this._activeTarget = target;
  5795. this._clear();
  5796. var queries = this._selector.split(',').map(function (selector) {
  5797. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5798. });
  5799. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5800. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5801. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5802. $link.addClass(ClassName$8.ACTIVE);
  5803. } else {
  5804. // Set triggered link as active
  5805. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5806. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5807. $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
  5808. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5809. }
  5810. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5811. relatedTarget: target
  5812. });
  5813. };
  5814. _proto._clear = function _clear() {
  5815. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5816. return node.classList.contains(ClassName$8.ACTIVE);
  5817. }).forEach(function (node) {
  5818. return node.classList.remove(ClassName$8.ACTIVE);
  5819. });
  5820. } // Static
  5821. ;
  5822. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5823. return this.each(function () {
  5824. var data = $(this).data(DATA_KEY$8);
  5825. var _config = typeof config === 'object' && config;
  5826. if (!data) {
  5827. data = new ScrollSpy(this, _config);
  5828. $(this).data(DATA_KEY$8, data);
  5829. }
  5830. if (typeof config === 'string') {
  5831. if (typeof data[config] === 'undefined') {
  5832. throw new TypeError("No method named \"" + config + "\"");
  5833. }
  5834. data[config]();
  5835. }
  5836. });
  5837. };
  5838. _createClass(ScrollSpy, null, [{
  5839. key: "VERSION",
  5840. get: function get() {
  5841. return VERSION$8;
  5842. }
  5843. }, {
  5844. key: "Default",
  5845. get: function get() {
  5846. return Default$6;
  5847. }
  5848. }]);
  5849. return ScrollSpy;
  5850. }();
  5851. /**
  5852. * ------------------------------------------------------------------------
  5853. * Data Api implementation
  5854. * ------------------------------------------------------------------------
  5855. */
  5856. $(window).on(Event$8.LOAD_DATA_API, function () {
  5857. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5858. var scrollSpysLength = scrollSpys.length;
  5859. for (var i = scrollSpysLength; i--;) {
  5860. var $spy = $(scrollSpys[i]);
  5861. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5862. }
  5863. });
  5864. /**
  5865. * ------------------------------------------------------------------------
  5866. * jQuery
  5867. * ------------------------------------------------------------------------
  5868. */
  5869. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5870. $.fn[NAME$8].Constructor = ScrollSpy;
  5871. $.fn[NAME$8].noConflict = function () {
  5872. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5873. return ScrollSpy._jQueryInterface;
  5874. };
  5875. /**
  5876. * ------------------------------------------------------------------------
  5877. * Constants
  5878. * ------------------------------------------------------------------------
  5879. */
  5880. var NAME$9 = 'tab';
  5881. var VERSION$9 = '4.4.1';
  5882. var DATA_KEY$9 = 'bs.tab';
  5883. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5884. var DATA_API_KEY$7 = '.data-api';
  5885. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5886. var Event$9 = {
  5887. HIDE: "hide" + EVENT_KEY$9,
  5888. HIDDEN: "hidden" + EVENT_KEY$9,
  5889. SHOW: "show" + EVENT_KEY$9,
  5890. SHOWN: "shown" + EVENT_KEY$9,
  5891. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5892. };
  5893. var ClassName$9 = {
  5894. DROPDOWN_MENU: 'dropdown-menu',
  5895. ACTIVE: 'active',
  5896. DISABLED: 'disabled',
  5897. FADE: 'fade',
  5898. SHOW: 'show'
  5899. };
  5900. var Selector$9 = {
  5901. DROPDOWN: '.dropdown',
  5902. NAV_LIST_GROUP: '.nav, .list-group',
  5903. ACTIVE: '.active',
  5904. ACTIVE_UL: '> li > .active',
  5905. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5906. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5907. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5908. };
  5909. /**
  5910. * ------------------------------------------------------------------------
  5911. * Class Definition
  5912. * ------------------------------------------------------------------------
  5913. */
  5914. var Tab =
  5915. /*#__PURE__*/
  5916. function () {
  5917. function Tab(element) {
  5918. this._element = element;
  5919. } // Getters
  5920. var _proto = Tab.prototype;
  5921. // Public
  5922. _proto.show = function show() {
  5923. var _this = this;
  5924. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5925. return;
  5926. }
  5927. var target;
  5928. var previous;
  5929. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5930. var selector = Util.getSelectorFromElement(this._element);
  5931. if (listElement) {
  5932. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5933. previous = $.makeArray($(listElement).find(itemSelector));
  5934. previous = previous[previous.length - 1];
  5935. }
  5936. var hideEvent = $.Event(Event$9.HIDE, {
  5937. relatedTarget: this._element
  5938. });
  5939. var showEvent = $.Event(Event$9.SHOW, {
  5940. relatedTarget: previous
  5941. });
  5942. if (previous) {
  5943. $(previous).trigger(hideEvent);
  5944. }
  5945. $(this._element).trigger(showEvent);
  5946. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5947. return;
  5948. }
  5949. if (selector) {
  5950. target = document.querySelector(selector);
  5951. }
  5952. this._activate(this._element, listElement);
  5953. var complete = function complete() {
  5954. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5955. relatedTarget: _this._element
  5956. });
  5957. var shownEvent = $.Event(Event$9.SHOWN, {
  5958. relatedTarget: previous
  5959. });
  5960. $(previous).trigger(hiddenEvent);
  5961. $(_this._element).trigger(shownEvent);
  5962. };
  5963. if (target) {
  5964. this._activate(target, target.parentNode, complete);
  5965. } else {
  5966. complete();
  5967. }
  5968. };
  5969. _proto.dispose = function dispose() {
  5970. $.removeData(this._element, DATA_KEY$9);
  5971. this._element = null;
  5972. } // Private
  5973. ;
  5974. _proto._activate = function _activate(element, container, callback) {
  5975. var _this2 = this;
  5976. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5977. var active = activeElements[0];
  5978. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5979. var complete = function complete() {
  5980. return _this2._transitionComplete(element, active, callback);
  5981. };
  5982. if (active && isTransitioning) {
  5983. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5984. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5985. } else {
  5986. complete();
  5987. }
  5988. };
  5989. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5990. if (active) {
  5991. $(active).removeClass(ClassName$9.ACTIVE);
  5992. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5993. if (dropdownChild) {
  5994. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5995. }
  5996. if (active.getAttribute('role') === 'tab') {
  5997. active.setAttribute('aria-selected', false);
  5998. }
  5999. }
  6000. $(element).addClass(ClassName$9.ACTIVE);
  6001. if (element.getAttribute('role') === 'tab') {
  6002. element.setAttribute('aria-selected', true);
  6003. }
  6004. Util.reflow(element);
  6005. if (element.classList.contains(ClassName$9.FADE)) {
  6006. element.classList.add(ClassName$9.SHOW);
  6007. }
  6008. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6009. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6010. if (dropdownElement) {
  6011. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6012. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6013. }
  6014. element.setAttribute('aria-expanded', true);
  6015. }
  6016. if (callback) {
  6017. callback();
  6018. }
  6019. } // Static
  6020. ;
  6021. Tab._jQueryInterface = function _jQueryInterface(config) {
  6022. return this.each(function () {
  6023. var $this = $(this);
  6024. var data = $this.data(DATA_KEY$9);
  6025. if (!data) {
  6026. data = new Tab(this);
  6027. $this.data(DATA_KEY$9, data);
  6028. }
  6029. if (typeof config === 'string') {
  6030. if (typeof data[config] === 'undefined') {
  6031. throw new TypeError("No method named \"" + config + "\"");
  6032. }
  6033. data[config]();
  6034. }
  6035. });
  6036. };
  6037. _createClass(Tab, null, [{
  6038. key: "VERSION",
  6039. get: function get() {
  6040. return VERSION$9;
  6041. }
  6042. }]);
  6043. return Tab;
  6044. }();
  6045. /**
  6046. * ------------------------------------------------------------------------
  6047. * Data Api implementation
  6048. * ------------------------------------------------------------------------
  6049. */
  6050. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6051. event.preventDefault();
  6052. Tab._jQueryInterface.call($(this), 'show');
  6053. });
  6054. /**
  6055. * ------------------------------------------------------------------------
  6056. * jQuery
  6057. * ------------------------------------------------------------------------
  6058. */
  6059. $.fn[NAME$9] = Tab._jQueryInterface;
  6060. $.fn[NAME$9].Constructor = Tab;
  6061. $.fn[NAME$9].noConflict = function () {
  6062. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6063. return Tab._jQueryInterface;
  6064. };
  6065. /**
  6066. * ------------------------------------------------------------------------
  6067. * Constants
  6068. * ------------------------------------------------------------------------
  6069. */
  6070. var NAME$a = 'toast';
  6071. var VERSION$a = '4.4.1';
  6072. var DATA_KEY$a = 'bs.toast';
  6073. var EVENT_KEY$a = "." + DATA_KEY$a;
  6074. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6075. var Event$a = {
  6076. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6077. HIDE: "hide" + EVENT_KEY$a,
  6078. HIDDEN: "hidden" + EVENT_KEY$a,
  6079. SHOW: "show" + EVENT_KEY$a,
  6080. SHOWN: "shown" + EVENT_KEY$a
  6081. };
  6082. var ClassName$a = {
  6083. FADE: 'fade',
  6084. HIDE: 'hide',
  6085. SHOW: 'show',
  6086. SHOWING: 'showing'
  6087. };
  6088. var DefaultType$7 = {
  6089. animation: 'boolean',
  6090. autohide: 'boolean',
  6091. delay: 'number'
  6092. };
  6093. var Default$7 = {
  6094. animation: true,
  6095. autohide: true,
  6096. delay: 500
  6097. };
  6098. var Selector$a = {
  6099. DATA_DISMISS: '[data-dismiss="toast"]'
  6100. };
  6101. /**
  6102. * ------------------------------------------------------------------------
  6103. * Class Definition
  6104. * ------------------------------------------------------------------------
  6105. */
  6106. var Toast =
  6107. /*#__PURE__*/
  6108. function () {
  6109. function Toast(element, config) {
  6110. this._element = element;
  6111. this._config = this._getConfig(config);
  6112. this._timeout = null;
  6113. this._setListeners();
  6114. } // Getters
  6115. var _proto = Toast.prototype;
  6116. // Public
  6117. _proto.show = function show() {
  6118. var _this = this;
  6119. var showEvent = $.Event(Event$a.SHOW);
  6120. $(this._element).trigger(showEvent);
  6121. if (showEvent.isDefaultPrevented()) {
  6122. return;
  6123. }
  6124. if (this._config.animation) {
  6125. this._element.classList.add(ClassName$a.FADE);
  6126. }
  6127. var complete = function complete() {
  6128. _this._element.classList.remove(ClassName$a.SHOWING);
  6129. _this._element.classList.add(ClassName$a.SHOW);
  6130. $(_this._element).trigger(Event$a.SHOWN);
  6131. if (_this._config.autohide) {
  6132. _this._timeout = setTimeout(function () {
  6133. _this.hide();
  6134. }, _this._config.delay);
  6135. }
  6136. };
  6137. this._element.classList.remove(ClassName$a.HIDE);
  6138. Util.reflow(this._element);
  6139. this._element.classList.add(ClassName$a.SHOWING);
  6140. if (this._config.animation) {
  6141. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6142. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6143. } else {
  6144. complete();
  6145. }
  6146. };
  6147. _proto.hide = function hide() {
  6148. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6149. return;
  6150. }
  6151. var hideEvent = $.Event(Event$a.HIDE);
  6152. $(this._element).trigger(hideEvent);
  6153. if (hideEvent.isDefaultPrevented()) {
  6154. return;
  6155. }
  6156. this._close();
  6157. };
  6158. _proto.dispose = function dispose() {
  6159. clearTimeout(this._timeout);
  6160. this._timeout = null;
  6161. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6162. this._element.classList.remove(ClassName$a.SHOW);
  6163. }
  6164. $(this._element).off(Event$a.CLICK_DISMISS);
  6165. $.removeData(this._element, DATA_KEY$a);
  6166. this._element = null;
  6167. this._config = null;
  6168. } // Private
  6169. ;
  6170. _proto._getConfig = function _getConfig(config) {
  6171. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6172. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6173. return config;
  6174. };
  6175. _proto._setListeners = function _setListeners() {
  6176. var _this2 = this;
  6177. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6178. return _this2.hide();
  6179. });
  6180. };
  6181. _proto._close = function _close() {
  6182. var _this3 = this;
  6183. var complete = function complete() {
  6184. _this3._element.classList.add(ClassName$a.HIDE);
  6185. $(_this3._element).trigger(Event$a.HIDDEN);
  6186. };
  6187. this._element.classList.remove(ClassName$a.SHOW);
  6188. if (this._config.animation) {
  6189. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6190. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6191. } else {
  6192. complete();
  6193. }
  6194. } // Static
  6195. ;
  6196. Toast._jQueryInterface = function _jQueryInterface(config) {
  6197. return this.each(function () {
  6198. var $element = $(this);
  6199. var data = $element.data(DATA_KEY$a);
  6200. var _config = typeof config === 'object' && config;
  6201. if (!data) {
  6202. data = new Toast(this, _config);
  6203. $element.data(DATA_KEY$a, data);
  6204. }
  6205. if (typeof config === 'string') {
  6206. if (typeof data[config] === 'undefined') {
  6207. throw new TypeError("No method named \"" + config + "\"");
  6208. }
  6209. data[config](this);
  6210. }
  6211. });
  6212. };
  6213. _createClass(Toast, null, [{
  6214. key: "VERSION",
  6215. get: function get() {
  6216. return VERSION$a;
  6217. }
  6218. }, {
  6219. key: "DefaultType",
  6220. get: function get() {
  6221. return DefaultType$7;
  6222. }
  6223. }, {
  6224. key: "Default",
  6225. get: function get() {
  6226. return Default$7;
  6227. }
  6228. }]);
  6229. return Toast;
  6230. }();
  6231. /**
  6232. * ------------------------------------------------------------------------
  6233. * jQuery
  6234. * ------------------------------------------------------------------------
  6235. */
  6236. $.fn[NAME$a] = Toast._jQueryInterface;
  6237. $.fn[NAME$a].Constructor = Toast;
  6238. $.fn[NAME$a].noConflict = function () {
  6239. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6240. return Toast._jQueryInterface;
  6241. };
  6242. exports.Alert = Alert;
  6243. exports.Button = Button;
  6244. exports.Carousel = Carousel;
  6245. exports.Collapse = Collapse;
  6246. exports.Dropdown = Dropdown;
  6247. exports.Modal = Modal;
  6248. exports.Popover = Popover;
  6249. exports.Scrollspy = ScrollSpy;
  6250. exports.Tab = Tab;
  6251. exports.Toast = Toast;
  6252. exports.Tooltip = Tooltip;
  6253. exports.Util = Util;
  6254. Object.defineProperty(exports, '__esModule', { value: true });
  6255. })));
  6256. //# sourceMappingURL=bootstrap.js.map
  6257. /***/ }),
  6258. /***/ "./node_modules/buffer/index.js":
  6259. /*!**************************************!*\
  6260. !*** ./node_modules/buffer/index.js ***!
  6261. \**************************************/
  6262. /*! no static exports found */
  6263. /***/ (function(module, exports, __webpack_require__) {
  6264. "use strict";
  6265. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6266. * The buffer module from node.js, for the browser.
  6267. *
  6268. * @author Feross Aboukhadijeh <http://feross.org>
  6269. * @license MIT
  6270. */
  6271. /* eslint-disable no-proto */
  6272. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6273. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6274. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6275. exports.Buffer = Buffer
  6276. exports.SlowBuffer = SlowBuffer
  6277. exports.INSPECT_MAX_BYTES = 50
  6278. /**
  6279. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6280. * === true Use Uint8Array implementation (fastest)
  6281. * === false Use Object implementation (most compatible, even IE6)
  6282. *
  6283. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6284. * Opera 11.6+, iOS 4.2+.
  6285. *
  6286. * Due to various browser bugs, sometimes the Object implementation will be used even
  6287. * when the browser supports typed arrays.
  6288. *
  6289. * Note:
  6290. *
  6291. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6292. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6293. *
  6294. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6295. *
  6296. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6297. * incorrect length in some situations.
  6298. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6299. * get the Object implementation, which is slower but behaves correctly.
  6300. */
  6301. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6302. ? global.TYPED_ARRAY_SUPPORT
  6303. : typedArraySupport()
  6304. /*
  6305. * Export kMaxLength after typed array support is determined.
  6306. */
  6307. exports.kMaxLength = kMaxLength()
  6308. function typedArraySupport () {
  6309. try {
  6310. var arr = new Uint8Array(1)
  6311. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6312. return arr.foo() === 42 && // typed array instances can be augmented
  6313. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6314. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6315. } catch (e) {
  6316. return false
  6317. }
  6318. }
  6319. function kMaxLength () {
  6320. return Buffer.TYPED_ARRAY_SUPPORT
  6321. ? 0x7fffffff
  6322. : 0x3fffffff
  6323. }
  6324. function createBuffer (that, length) {
  6325. if (kMaxLength() < length) {
  6326. throw new RangeError('Invalid typed array length')
  6327. }
  6328. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6329. // Return an augmented `Uint8Array` instance, for best performance
  6330. that = new Uint8Array(length)
  6331. that.__proto__ = Buffer.prototype
  6332. } else {
  6333. // Fallback: Return an object instance of the Buffer class
  6334. if (that === null) {
  6335. that = new Buffer(length)
  6336. }
  6337. that.length = length
  6338. }
  6339. return that
  6340. }
  6341. /**
  6342. * The Buffer constructor returns instances of `Uint8Array` that have their
  6343. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6344. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6345. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6346. * returns a single octet.
  6347. *
  6348. * The `Uint8Array` prototype remains unmodified.
  6349. */
  6350. function Buffer (arg, encodingOrOffset, length) {
  6351. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6352. return new Buffer(arg, encodingOrOffset, length)
  6353. }
  6354. // Common case.
  6355. if (typeof arg === 'number') {
  6356. if (typeof encodingOrOffset === 'string') {
  6357. throw new Error(
  6358. 'If encoding is specified then the first argument must be a string'
  6359. )
  6360. }
  6361. return allocUnsafe(this, arg)
  6362. }
  6363. return from(this, arg, encodingOrOffset, length)
  6364. }
  6365. Buffer.poolSize = 8192 // not used by this implementation
  6366. // TODO: Legacy, not needed anymore. Remove in next major version.
  6367. Buffer._augment = function (arr) {
  6368. arr.__proto__ = Buffer.prototype
  6369. return arr
  6370. }
  6371. function from (that, value, encodingOrOffset, length) {
  6372. if (typeof value === 'number') {
  6373. throw new TypeError('"value" argument must not be a number')
  6374. }
  6375. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6376. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6377. }
  6378. if (typeof value === 'string') {
  6379. return fromString(that, value, encodingOrOffset)
  6380. }
  6381. return fromObject(that, value)
  6382. }
  6383. /**
  6384. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6385. * if value is a number.
  6386. * Buffer.from(str[, encoding])
  6387. * Buffer.from(array)
  6388. * Buffer.from(buffer)
  6389. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6390. **/
  6391. Buffer.from = function (value, encodingOrOffset, length) {
  6392. return from(null, value, encodingOrOffset, length)
  6393. }
  6394. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6395. Buffer.prototype.__proto__ = Uint8Array.prototype
  6396. Buffer.__proto__ = Uint8Array
  6397. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6398. Buffer[Symbol.species] === Buffer) {
  6399. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6400. Object.defineProperty(Buffer, Symbol.species, {
  6401. value: null,
  6402. configurable: true
  6403. })
  6404. }
  6405. }
  6406. function assertSize (size) {
  6407. if (typeof size !== 'number') {
  6408. throw new TypeError('"size" argument must be a number')
  6409. } else if (size < 0) {
  6410. throw new RangeError('"size" argument must not be negative')
  6411. }
  6412. }
  6413. function alloc (that, size, fill, encoding) {
  6414. assertSize(size)
  6415. if (size <= 0) {
  6416. return createBuffer(that, size)
  6417. }
  6418. if (fill !== undefined) {
  6419. // Only pay attention to encoding if it's a string. This
  6420. // prevents accidentally sending in a number that would
  6421. // be interpretted as a start offset.
  6422. return typeof encoding === 'string'
  6423. ? createBuffer(that, size).fill(fill, encoding)
  6424. : createBuffer(that, size).fill(fill)
  6425. }
  6426. return createBuffer(that, size)
  6427. }
  6428. /**
  6429. * Creates a new filled Buffer instance.
  6430. * alloc(size[, fill[, encoding]])
  6431. **/
  6432. Buffer.alloc = function (size, fill, encoding) {
  6433. return alloc(null, size, fill, encoding)
  6434. }
  6435. function allocUnsafe (that, size) {
  6436. assertSize(size)
  6437. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6438. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6439. for (var i = 0; i < size; ++i) {
  6440. that[i] = 0
  6441. }
  6442. }
  6443. return that
  6444. }
  6445. /**
  6446. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6447. * */
  6448. Buffer.allocUnsafe = function (size) {
  6449. return allocUnsafe(null, size)
  6450. }
  6451. /**
  6452. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6453. */
  6454. Buffer.allocUnsafeSlow = function (size) {
  6455. return allocUnsafe(null, size)
  6456. }
  6457. function fromString (that, string, encoding) {
  6458. if (typeof encoding !== 'string' || encoding === '') {
  6459. encoding = 'utf8'
  6460. }
  6461. if (!Buffer.isEncoding(encoding)) {
  6462. throw new TypeError('"encoding" must be a valid string encoding')
  6463. }
  6464. var length = byteLength(string, encoding) | 0
  6465. that = createBuffer(that, length)
  6466. var actual = that.write(string, encoding)
  6467. if (actual !== length) {
  6468. // Writing a hex string, for example, that contains invalid characters will
  6469. // cause everything after the first invalid character to be ignored. (e.g.
  6470. // 'abxxcd' will be treated as 'ab')
  6471. that = that.slice(0, actual)
  6472. }
  6473. return that
  6474. }
  6475. function fromArrayLike (that, array) {
  6476. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6477. that = createBuffer(that, length)
  6478. for (var i = 0; i < length; i += 1) {
  6479. that[i] = array[i] & 255
  6480. }
  6481. return that
  6482. }
  6483. function fromArrayBuffer (that, array, byteOffset, length) {
  6484. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6485. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6486. throw new RangeError('\'offset\' is out of bounds')
  6487. }
  6488. if (array.byteLength < byteOffset + (length || 0)) {
  6489. throw new RangeError('\'length\' is out of bounds')
  6490. }
  6491. if (byteOffset === undefined && length === undefined) {
  6492. array = new Uint8Array(array)
  6493. } else if (length === undefined) {
  6494. array = new Uint8Array(array, byteOffset)
  6495. } else {
  6496. array = new Uint8Array(array, byteOffset, length)
  6497. }
  6498. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6499. // Return an augmented `Uint8Array` instance, for best performance
  6500. that = array
  6501. that.__proto__ = Buffer.prototype
  6502. } else {
  6503. // Fallback: Return an object instance of the Buffer class
  6504. that = fromArrayLike(that, array)
  6505. }
  6506. return that
  6507. }
  6508. function fromObject (that, obj) {
  6509. if (Buffer.isBuffer(obj)) {
  6510. var len = checked(obj.length) | 0
  6511. that = createBuffer(that, len)
  6512. if (that.length === 0) {
  6513. return that
  6514. }
  6515. obj.copy(that, 0, 0, len)
  6516. return that
  6517. }
  6518. if (obj) {
  6519. if ((typeof ArrayBuffer !== 'undefined' &&
  6520. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6521. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6522. return createBuffer(that, 0)
  6523. }
  6524. return fromArrayLike(that, obj)
  6525. }
  6526. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6527. return fromArrayLike(that, obj.data)
  6528. }
  6529. }
  6530. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6531. }
  6532. function checked (length) {
  6533. // Note: cannot use `length < kMaxLength()` here because that fails when
  6534. // length is NaN (which is otherwise coerced to zero.)
  6535. if (length >= kMaxLength()) {
  6536. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6537. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6538. }
  6539. return length | 0
  6540. }
  6541. function SlowBuffer (length) {
  6542. if (+length != length) { // eslint-disable-line eqeqeq
  6543. length = 0
  6544. }
  6545. return Buffer.alloc(+length)
  6546. }
  6547. Buffer.isBuffer = function isBuffer (b) {
  6548. return !!(b != null && b._isBuffer)
  6549. }
  6550. Buffer.compare = function compare (a, b) {
  6551. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6552. throw new TypeError('Arguments must be Buffers')
  6553. }
  6554. if (a === b) return 0
  6555. var x = a.length
  6556. var y = b.length
  6557. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6558. if (a[i] !== b[i]) {
  6559. x = a[i]
  6560. y = b[i]
  6561. break
  6562. }
  6563. }
  6564. if (x < y) return -1
  6565. if (y < x) return 1
  6566. return 0
  6567. }
  6568. Buffer.isEncoding = function isEncoding (encoding) {
  6569. switch (String(encoding).toLowerCase()) {
  6570. case 'hex':
  6571. case 'utf8':
  6572. case 'utf-8':
  6573. case 'ascii':
  6574. case 'latin1':
  6575. case 'binary':
  6576. case 'base64':
  6577. case 'ucs2':
  6578. case 'ucs-2':
  6579. case 'utf16le':
  6580. case 'utf-16le':
  6581. return true
  6582. default:
  6583. return false
  6584. }
  6585. }
  6586. Buffer.concat = function concat (list, length) {
  6587. if (!isArray(list)) {
  6588. throw new TypeError('"list" argument must be an Array of Buffers')
  6589. }
  6590. if (list.length === 0) {
  6591. return Buffer.alloc(0)
  6592. }
  6593. var i
  6594. if (length === undefined) {
  6595. length = 0
  6596. for (i = 0; i < list.length; ++i) {
  6597. length += list[i].length
  6598. }
  6599. }
  6600. var buffer = Buffer.allocUnsafe(length)
  6601. var pos = 0
  6602. for (i = 0; i < list.length; ++i) {
  6603. var buf = list[i]
  6604. if (!Buffer.isBuffer(buf)) {
  6605. throw new TypeError('"list" argument must be an Array of Buffers')
  6606. }
  6607. buf.copy(buffer, pos)
  6608. pos += buf.length
  6609. }
  6610. return buffer
  6611. }
  6612. function byteLength (string, encoding) {
  6613. if (Buffer.isBuffer(string)) {
  6614. return string.length
  6615. }
  6616. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6617. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6618. return string.byteLength
  6619. }
  6620. if (typeof string !== 'string') {
  6621. string = '' + string
  6622. }
  6623. var len = string.length
  6624. if (len === 0) return 0
  6625. // Use a for loop to avoid recursion
  6626. var loweredCase = false
  6627. for (;;) {
  6628. switch (encoding) {
  6629. case 'ascii':
  6630. case 'latin1':
  6631. case 'binary':
  6632. return len
  6633. case 'utf8':
  6634. case 'utf-8':
  6635. case undefined:
  6636. return utf8ToBytes(string).length
  6637. case 'ucs2':
  6638. case 'ucs-2':
  6639. case 'utf16le':
  6640. case 'utf-16le':
  6641. return len * 2
  6642. case 'hex':
  6643. return len >>> 1
  6644. case 'base64':
  6645. return base64ToBytes(string).length
  6646. default:
  6647. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6648. encoding = ('' + encoding).toLowerCase()
  6649. loweredCase = true
  6650. }
  6651. }
  6652. }
  6653. Buffer.byteLength = byteLength
  6654. function slowToString (encoding, start, end) {
  6655. var loweredCase = false
  6656. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6657. // property of a typed array.
  6658. // This behaves neither like String nor Uint8Array in that we set start/end
  6659. // to their upper/lower bounds if the value passed is out of range.
  6660. // undefined is handled specially as per ECMA-262 6th Edition,
  6661. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6662. if (start === undefined || start < 0) {
  6663. start = 0
  6664. }
  6665. // Return early if start > this.length. Done here to prevent potential uint32
  6666. // coercion fail below.
  6667. if (start > this.length) {
  6668. return ''
  6669. }
  6670. if (end === undefined || end > this.length) {
  6671. end = this.length
  6672. }
  6673. if (end <= 0) {
  6674. return ''
  6675. }
  6676. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6677. end >>>= 0
  6678. start >>>= 0
  6679. if (end <= start) {
  6680. return ''
  6681. }
  6682. if (!encoding) encoding = 'utf8'
  6683. while (true) {
  6684. switch (encoding) {
  6685. case 'hex':
  6686. return hexSlice(this, start, end)
  6687. case 'utf8':
  6688. case 'utf-8':
  6689. return utf8Slice(this, start, end)
  6690. case 'ascii':
  6691. return asciiSlice(this, start, end)
  6692. case 'latin1':
  6693. case 'binary':
  6694. return latin1Slice(this, start, end)
  6695. case 'base64':
  6696. return base64Slice(this, start, end)
  6697. case 'ucs2':
  6698. case 'ucs-2':
  6699. case 'utf16le':
  6700. case 'utf-16le':
  6701. return utf16leSlice(this, start, end)
  6702. default:
  6703. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6704. encoding = (encoding + '').toLowerCase()
  6705. loweredCase = true
  6706. }
  6707. }
  6708. }
  6709. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6710. // Buffer instances.
  6711. Buffer.prototype._isBuffer = true
  6712. function swap (b, n, m) {
  6713. var i = b[n]
  6714. b[n] = b[m]
  6715. b[m] = i
  6716. }
  6717. Buffer.prototype.swap16 = function swap16 () {
  6718. var len = this.length
  6719. if (len % 2 !== 0) {
  6720. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6721. }
  6722. for (var i = 0; i < len; i += 2) {
  6723. swap(this, i, i + 1)
  6724. }
  6725. return this
  6726. }
  6727. Buffer.prototype.swap32 = function swap32 () {
  6728. var len = this.length
  6729. if (len % 4 !== 0) {
  6730. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6731. }
  6732. for (var i = 0; i < len; i += 4) {
  6733. swap(this, i, i + 3)
  6734. swap(this, i + 1, i + 2)
  6735. }
  6736. return this
  6737. }
  6738. Buffer.prototype.swap64 = function swap64 () {
  6739. var len = this.length
  6740. if (len % 8 !== 0) {
  6741. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6742. }
  6743. for (var i = 0; i < len; i += 8) {
  6744. swap(this, i, i + 7)
  6745. swap(this, i + 1, i + 6)
  6746. swap(this, i + 2, i + 5)
  6747. swap(this, i + 3, i + 4)
  6748. }
  6749. return this
  6750. }
  6751. Buffer.prototype.toString = function toString () {
  6752. var length = this.length | 0
  6753. if (length === 0) return ''
  6754. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6755. return slowToString.apply(this, arguments)
  6756. }
  6757. Buffer.prototype.equals = function equals (b) {
  6758. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6759. if (this === b) return true
  6760. return Buffer.compare(this, b) === 0
  6761. }
  6762. Buffer.prototype.inspect = function inspect () {
  6763. var str = ''
  6764. var max = exports.INSPECT_MAX_BYTES
  6765. if (this.length > 0) {
  6766. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6767. if (this.length > max) str += ' ... '
  6768. }
  6769. return '<Buffer ' + str + '>'
  6770. }
  6771. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6772. if (!Buffer.isBuffer(target)) {
  6773. throw new TypeError('Argument must be a Buffer')
  6774. }
  6775. if (start === undefined) {
  6776. start = 0
  6777. }
  6778. if (end === undefined) {
  6779. end = target ? target.length : 0
  6780. }
  6781. if (thisStart === undefined) {
  6782. thisStart = 0
  6783. }
  6784. if (thisEnd === undefined) {
  6785. thisEnd = this.length
  6786. }
  6787. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6788. throw new RangeError('out of range index')
  6789. }
  6790. if (thisStart >= thisEnd && start >= end) {
  6791. return 0
  6792. }
  6793. if (thisStart >= thisEnd) {
  6794. return -1
  6795. }
  6796. if (start >= end) {
  6797. return 1
  6798. }
  6799. start >>>= 0
  6800. end >>>= 0
  6801. thisStart >>>= 0
  6802. thisEnd >>>= 0
  6803. if (this === target) return 0
  6804. var x = thisEnd - thisStart
  6805. var y = end - start
  6806. var len = Math.min(x, y)
  6807. var thisCopy = this.slice(thisStart, thisEnd)
  6808. var targetCopy = target.slice(start, end)
  6809. for (var i = 0; i < len; ++i) {
  6810. if (thisCopy[i] !== targetCopy[i]) {
  6811. x = thisCopy[i]
  6812. y = targetCopy[i]
  6813. break
  6814. }
  6815. }
  6816. if (x < y) return -1
  6817. if (y < x) return 1
  6818. return 0
  6819. }
  6820. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6821. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6822. //
  6823. // Arguments:
  6824. // - buffer - a Buffer to search
  6825. // - val - a string, Buffer, or number
  6826. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6827. // - encoding - an optional encoding, relevant is val is a string
  6828. // - dir - true for indexOf, false for lastIndexOf
  6829. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6830. // Empty buffer means no match
  6831. if (buffer.length === 0) return -1
  6832. // Normalize byteOffset
  6833. if (typeof byteOffset === 'string') {
  6834. encoding = byteOffset
  6835. byteOffset = 0
  6836. } else if (byteOffset > 0x7fffffff) {
  6837. byteOffset = 0x7fffffff
  6838. } else if (byteOffset < -0x80000000) {
  6839. byteOffset = -0x80000000
  6840. }
  6841. byteOffset = +byteOffset // Coerce to Number.
  6842. if (isNaN(byteOffset)) {
  6843. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6844. byteOffset = dir ? 0 : (buffer.length - 1)
  6845. }
  6846. // Normalize byteOffset: negative offsets start from the end of the buffer
  6847. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6848. if (byteOffset >= buffer.length) {
  6849. if (dir) return -1
  6850. else byteOffset = buffer.length - 1
  6851. } else if (byteOffset < 0) {
  6852. if (dir) byteOffset = 0
  6853. else return -1
  6854. }
  6855. // Normalize val
  6856. if (typeof val === 'string') {
  6857. val = Buffer.from(val, encoding)
  6858. }
  6859. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6860. if (Buffer.isBuffer(val)) {
  6861. // Special case: looking for empty string/buffer always fails
  6862. if (val.length === 0) {
  6863. return -1
  6864. }
  6865. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6866. } else if (typeof val === 'number') {
  6867. val = val & 0xFF // Search for a byte value [0-255]
  6868. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6869. typeof Uint8Array.prototype.indexOf === 'function') {
  6870. if (dir) {
  6871. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6872. } else {
  6873. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6874. }
  6875. }
  6876. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6877. }
  6878. throw new TypeError('val must be string, number or Buffer')
  6879. }
  6880. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6881. var indexSize = 1
  6882. var arrLength = arr.length
  6883. var valLength = val.length
  6884. if (encoding !== undefined) {
  6885. encoding = String(encoding).toLowerCase()
  6886. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6887. encoding === 'utf16le' || encoding === 'utf-16le') {
  6888. if (arr.length < 2 || val.length < 2) {
  6889. return -1
  6890. }
  6891. indexSize = 2
  6892. arrLength /= 2
  6893. valLength /= 2
  6894. byteOffset /= 2
  6895. }
  6896. }
  6897. function read (buf, i) {
  6898. if (indexSize === 1) {
  6899. return buf[i]
  6900. } else {
  6901. return buf.readUInt16BE(i * indexSize)
  6902. }
  6903. }
  6904. var i
  6905. if (dir) {
  6906. var foundIndex = -1
  6907. for (i = byteOffset; i < arrLength; i++) {
  6908. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6909. if (foundIndex === -1) foundIndex = i
  6910. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6911. } else {
  6912. if (foundIndex !== -1) i -= i - foundIndex
  6913. foundIndex = -1
  6914. }
  6915. }
  6916. } else {
  6917. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6918. for (i = byteOffset; i >= 0; i--) {
  6919. var found = true
  6920. for (var j = 0; j < valLength; j++) {
  6921. if (read(arr, i + j) !== read(val, j)) {
  6922. found = false
  6923. break
  6924. }
  6925. }
  6926. if (found) return i
  6927. }
  6928. }
  6929. return -1
  6930. }
  6931. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6932. return this.indexOf(val, byteOffset, encoding) !== -1
  6933. }
  6934. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6935. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6936. }
  6937. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6938. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6939. }
  6940. function hexWrite (buf, string, offset, length) {
  6941. offset = Number(offset) || 0
  6942. var remaining = buf.length - offset
  6943. if (!length) {
  6944. length = remaining
  6945. } else {
  6946. length = Number(length)
  6947. if (length > remaining) {
  6948. length = remaining
  6949. }
  6950. }
  6951. // must be an even number of digits
  6952. var strLen = string.length
  6953. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6954. if (length > strLen / 2) {
  6955. length = strLen / 2
  6956. }
  6957. for (var i = 0; i < length; ++i) {
  6958. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6959. if (isNaN(parsed)) return i
  6960. buf[offset + i] = parsed
  6961. }
  6962. return i
  6963. }
  6964. function utf8Write (buf, string, offset, length) {
  6965. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6966. }
  6967. function asciiWrite (buf, string, offset, length) {
  6968. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6969. }
  6970. function latin1Write (buf, string, offset, length) {
  6971. return asciiWrite(buf, string, offset, length)
  6972. }
  6973. function base64Write (buf, string, offset, length) {
  6974. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6975. }
  6976. function ucs2Write (buf, string, offset, length) {
  6977. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6978. }
  6979. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6980. // Buffer#write(string)
  6981. if (offset === undefined) {
  6982. encoding = 'utf8'
  6983. length = this.length
  6984. offset = 0
  6985. // Buffer#write(string, encoding)
  6986. } else if (length === undefined && typeof offset === 'string') {
  6987. encoding = offset
  6988. length = this.length
  6989. offset = 0
  6990. // Buffer#write(string, offset[, length][, encoding])
  6991. } else if (isFinite(offset)) {
  6992. offset = offset | 0
  6993. if (isFinite(length)) {
  6994. length = length | 0
  6995. if (encoding === undefined) encoding = 'utf8'
  6996. } else {
  6997. encoding = length
  6998. length = undefined
  6999. }
  7000. // legacy write(string, encoding, offset, length) - remove in v0.13
  7001. } else {
  7002. throw new Error(
  7003. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7004. )
  7005. }
  7006. var remaining = this.length - offset
  7007. if (length === undefined || length > remaining) length = remaining
  7008. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7009. throw new RangeError('Attempt to write outside buffer bounds')
  7010. }
  7011. if (!encoding) encoding = 'utf8'
  7012. var loweredCase = false
  7013. for (;;) {
  7014. switch (encoding) {
  7015. case 'hex':
  7016. return hexWrite(this, string, offset, length)
  7017. case 'utf8':
  7018. case 'utf-8':
  7019. return utf8Write(this, string, offset, length)
  7020. case 'ascii':
  7021. return asciiWrite(this, string, offset, length)
  7022. case 'latin1':
  7023. case 'binary':
  7024. return latin1Write(this, string, offset, length)
  7025. case 'base64':
  7026. // Warning: maxLength not taken into account in base64Write
  7027. return base64Write(this, string, offset, length)
  7028. case 'ucs2':
  7029. case 'ucs-2':
  7030. case 'utf16le':
  7031. case 'utf-16le':
  7032. return ucs2Write(this, string, offset, length)
  7033. default:
  7034. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7035. encoding = ('' + encoding).toLowerCase()
  7036. loweredCase = true
  7037. }
  7038. }
  7039. }
  7040. Buffer.prototype.toJSON = function toJSON () {
  7041. return {
  7042. type: 'Buffer',
  7043. data: Array.prototype.slice.call(this._arr || this, 0)
  7044. }
  7045. }
  7046. function base64Slice (buf, start, end) {
  7047. if (start === 0 && end === buf.length) {
  7048. return base64.fromByteArray(buf)
  7049. } else {
  7050. return base64.fromByteArray(buf.slice(start, end))
  7051. }
  7052. }
  7053. function utf8Slice (buf, start, end) {
  7054. end = Math.min(buf.length, end)
  7055. var res = []
  7056. var i = start
  7057. while (i < end) {
  7058. var firstByte = buf[i]
  7059. var codePoint = null
  7060. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7061. : (firstByte > 0xDF) ? 3
  7062. : (firstByte > 0xBF) ? 2
  7063. : 1
  7064. if (i + bytesPerSequence <= end) {
  7065. var secondByte, thirdByte, fourthByte, tempCodePoint
  7066. switch (bytesPerSequence) {
  7067. case 1:
  7068. if (firstByte < 0x80) {
  7069. codePoint = firstByte
  7070. }
  7071. break
  7072. case 2:
  7073. secondByte = buf[i + 1]
  7074. if ((secondByte & 0xC0) === 0x80) {
  7075. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7076. if (tempCodePoint > 0x7F) {
  7077. codePoint = tempCodePoint
  7078. }
  7079. }
  7080. break
  7081. case 3:
  7082. secondByte = buf[i + 1]
  7083. thirdByte = buf[i + 2]
  7084. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7085. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7086. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7087. codePoint = tempCodePoint
  7088. }
  7089. }
  7090. break
  7091. case 4:
  7092. secondByte = buf[i + 1]
  7093. thirdByte = buf[i + 2]
  7094. fourthByte = buf[i + 3]
  7095. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7096. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7097. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7098. codePoint = tempCodePoint
  7099. }
  7100. }
  7101. }
  7102. }
  7103. if (codePoint === null) {
  7104. // we did not generate a valid codePoint so insert a
  7105. // replacement char (U+FFFD) and advance only 1 byte
  7106. codePoint = 0xFFFD
  7107. bytesPerSequence = 1
  7108. } else if (codePoint > 0xFFFF) {
  7109. // encode to utf16 (surrogate pair dance)
  7110. codePoint -= 0x10000
  7111. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7112. codePoint = 0xDC00 | codePoint & 0x3FF
  7113. }
  7114. res.push(codePoint)
  7115. i += bytesPerSequence
  7116. }
  7117. return decodeCodePointsArray(res)
  7118. }
  7119. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7120. // the lowest limit is Chrome, with 0x10000 args.
  7121. // We go 1 magnitude less, for safety
  7122. var MAX_ARGUMENTS_LENGTH = 0x1000
  7123. function decodeCodePointsArray (codePoints) {
  7124. var len = codePoints.length
  7125. if (len <= MAX_ARGUMENTS_LENGTH) {
  7126. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7127. }
  7128. // Decode in chunks to avoid "call stack size exceeded".
  7129. var res = ''
  7130. var i = 0
  7131. while (i < len) {
  7132. res += String.fromCharCode.apply(
  7133. String,
  7134. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7135. )
  7136. }
  7137. return res
  7138. }
  7139. function asciiSlice (buf, start, end) {
  7140. var ret = ''
  7141. end = Math.min(buf.length, end)
  7142. for (var i = start; i < end; ++i) {
  7143. ret += String.fromCharCode(buf[i] & 0x7F)
  7144. }
  7145. return ret
  7146. }
  7147. function latin1Slice (buf, start, end) {
  7148. var ret = ''
  7149. end = Math.min(buf.length, end)
  7150. for (var i = start; i < end; ++i) {
  7151. ret += String.fromCharCode(buf[i])
  7152. }
  7153. return ret
  7154. }
  7155. function hexSlice (buf, start, end) {
  7156. var len = buf.length
  7157. if (!start || start < 0) start = 0
  7158. if (!end || end < 0 || end > len) end = len
  7159. var out = ''
  7160. for (var i = start; i < end; ++i) {
  7161. out += toHex(buf[i])
  7162. }
  7163. return out
  7164. }
  7165. function utf16leSlice (buf, start, end) {
  7166. var bytes = buf.slice(start, end)
  7167. var res = ''
  7168. for (var i = 0; i < bytes.length; i += 2) {
  7169. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7170. }
  7171. return res
  7172. }
  7173. Buffer.prototype.slice = function slice (start, end) {
  7174. var len = this.length
  7175. start = ~~start
  7176. end = end === undefined ? len : ~~end
  7177. if (start < 0) {
  7178. start += len
  7179. if (start < 0) start = 0
  7180. } else if (start > len) {
  7181. start = len
  7182. }
  7183. if (end < 0) {
  7184. end += len
  7185. if (end < 0) end = 0
  7186. } else if (end > len) {
  7187. end = len
  7188. }
  7189. if (end < start) end = start
  7190. var newBuf
  7191. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7192. newBuf = this.subarray(start, end)
  7193. newBuf.__proto__ = Buffer.prototype
  7194. } else {
  7195. var sliceLen = end - start
  7196. newBuf = new Buffer(sliceLen, undefined)
  7197. for (var i = 0; i < sliceLen; ++i) {
  7198. newBuf[i] = this[i + start]
  7199. }
  7200. }
  7201. return newBuf
  7202. }
  7203. /*
  7204. * Need to make sure that buffer isn't trying to write out of bounds.
  7205. */
  7206. function checkOffset (offset, ext, length) {
  7207. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7208. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7209. }
  7210. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7211. offset = offset | 0
  7212. byteLength = byteLength | 0
  7213. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7214. var val = this[offset]
  7215. var mul = 1
  7216. var i = 0
  7217. while (++i < byteLength && (mul *= 0x100)) {
  7218. val += this[offset + i] * mul
  7219. }
  7220. return val
  7221. }
  7222. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7223. offset = offset | 0
  7224. byteLength = byteLength | 0
  7225. if (!noAssert) {
  7226. checkOffset(offset, byteLength, this.length)
  7227. }
  7228. var val = this[offset + --byteLength]
  7229. var mul = 1
  7230. while (byteLength > 0 && (mul *= 0x100)) {
  7231. val += this[offset + --byteLength] * mul
  7232. }
  7233. return val
  7234. }
  7235. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7236. if (!noAssert) checkOffset(offset, 1, this.length)
  7237. return this[offset]
  7238. }
  7239. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7240. if (!noAssert) checkOffset(offset, 2, this.length)
  7241. return this[offset] | (this[offset + 1] << 8)
  7242. }
  7243. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7244. if (!noAssert) checkOffset(offset, 2, this.length)
  7245. return (this[offset] << 8) | this[offset + 1]
  7246. }
  7247. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7248. if (!noAssert) checkOffset(offset, 4, this.length)
  7249. return ((this[offset]) |
  7250. (this[offset + 1] << 8) |
  7251. (this[offset + 2] << 16)) +
  7252. (this[offset + 3] * 0x1000000)
  7253. }
  7254. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7255. if (!noAssert) checkOffset(offset, 4, this.length)
  7256. return (this[offset] * 0x1000000) +
  7257. ((this[offset + 1] << 16) |
  7258. (this[offset + 2] << 8) |
  7259. this[offset + 3])
  7260. }
  7261. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7262. offset = offset | 0
  7263. byteLength = byteLength | 0
  7264. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7265. var val = this[offset]
  7266. var mul = 1
  7267. var i = 0
  7268. while (++i < byteLength && (mul *= 0x100)) {
  7269. val += this[offset + i] * mul
  7270. }
  7271. mul *= 0x80
  7272. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7273. return val
  7274. }
  7275. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7276. offset = offset | 0
  7277. byteLength = byteLength | 0
  7278. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7279. var i = byteLength
  7280. var mul = 1
  7281. var val = this[offset + --i]
  7282. while (i > 0 && (mul *= 0x100)) {
  7283. val += this[offset + --i] * mul
  7284. }
  7285. mul *= 0x80
  7286. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7287. return val
  7288. }
  7289. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7290. if (!noAssert) checkOffset(offset, 1, this.length)
  7291. if (!(this[offset] & 0x80)) return (this[offset])
  7292. return ((0xff - this[offset] + 1) * -1)
  7293. }
  7294. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7295. if (!noAssert) checkOffset(offset, 2, this.length)
  7296. var val = this[offset] | (this[offset + 1] << 8)
  7297. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7298. }
  7299. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7300. if (!noAssert) checkOffset(offset, 2, this.length)
  7301. var val = this[offset + 1] | (this[offset] << 8)
  7302. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7303. }
  7304. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7305. if (!noAssert) checkOffset(offset, 4, this.length)
  7306. return (this[offset]) |
  7307. (this[offset + 1] << 8) |
  7308. (this[offset + 2] << 16) |
  7309. (this[offset + 3] << 24)
  7310. }
  7311. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7312. if (!noAssert) checkOffset(offset, 4, this.length)
  7313. return (this[offset] << 24) |
  7314. (this[offset + 1] << 16) |
  7315. (this[offset + 2] << 8) |
  7316. (this[offset + 3])
  7317. }
  7318. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7319. if (!noAssert) checkOffset(offset, 4, this.length)
  7320. return ieee754.read(this, offset, true, 23, 4)
  7321. }
  7322. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7323. if (!noAssert) checkOffset(offset, 4, this.length)
  7324. return ieee754.read(this, offset, false, 23, 4)
  7325. }
  7326. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7327. if (!noAssert) checkOffset(offset, 8, this.length)
  7328. return ieee754.read(this, offset, true, 52, 8)
  7329. }
  7330. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7331. if (!noAssert) checkOffset(offset, 8, this.length)
  7332. return ieee754.read(this, offset, false, 52, 8)
  7333. }
  7334. function checkInt (buf, value, offset, ext, max, min) {
  7335. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7336. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7337. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7338. }
  7339. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7340. value = +value
  7341. offset = offset | 0
  7342. byteLength = byteLength | 0
  7343. if (!noAssert) {
  7344. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7345. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7346. }
  7347. var mul = 1
  7348. var i = 0
  7349. this[offset] = value & 0xFF
  7350. while (++i < byteLength && (mul *= 0x100)) {
  7351. this[offset + i] = (value / mul) & 0xFF
  7352. }
  7353. return offset + byteLength
  7354. }
  7355. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7356. value = +value
  7357. offset = offset | 0
  7358. byteLength = byteLength | 0
  7359. if (!noAssert) {
  7360. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7361. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7362. }
  7363. var i = byteLength - 1
  7364. var mul = 1
  7365. this[offset + i] = value & 0xFF
  7366. while (--i >= 0 && (mul *= 0x100)) {
  7367. this[offset + i] = (value / mul) & 0xFF
  7368. }
  7369. return offset + byteLength
  7370. }
  7371. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7372. value = +value
  7373. offset = offset | 0
  7374. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7375. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7376. this[offset] = (value & 0xff)
  7377. return offset + 1
  7378. }
  7379. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7380. if (value < 0) value = 0xffff + value + 1
  7381. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7382. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7383. (littleEndian ? i : 1 - i) * 8
  7384. }
  7385. }
  7386. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7387. value = +value
  7388. offset = offset | 0
  7389. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7390. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7391. this[offset] = (value & 0xff)
  7392. this[offset + 1] = (value >>> 8)
  7393. } else {
  7394. objectWriteUInt16(this, value, offset, true)
  7395. }
  7396. return offset + 2
  7397. }
  7398. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7399. value = +value
  7400. offset = offset | 0
  7401. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7402. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7403. this[offset] = (value >>> 8)
  7404. this[offset + 1] = (value & 0xff)
  7405. } else {
  7406. objectWriteUInt16(this, value, offset, false)
  7407. }
  7408. return offset + 2
  7409. }
  7410. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7411. if (value < 0) value = 0xffffffff + value + 1
  7412. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7413. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7414. }
  7415. }
  7416. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7417. value = +value
  7418. offset = offset | 0
  7419. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7420. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7421. this[offset + 3] = (value >>> 24)
  7422. this[offset + 2] = (value >>> 16)
  7423. this[offset + 1] = (value >>> 8)
  7424. this[offset] = (value & 0xff)
  7425. } else {
  7426. objectWriteUInt32(this, value, offset, true)
  7427. }
  7428. return offset + 4
  7429. }
  7430. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7431. value = +value
  7432. offset = offset | 0
  7433. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7434. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7435. this[offset] = (value >>> 24)
  7436. this[offset + 1] = (value >>> 16)
  7437. this[offset + 2] = (value >>> 8)
  7438. this[offset + 3] = (value & 0xff)
  7439. } else {
  7440. objectWriteUInt32(this, value, offset, false)
  7441. }
  7442. return offset + 4
  7443. }
  7444. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7445. value = +value
  7446. offset = offset | 0
  7447. if (!noAssert) {
  7448. var limit = Math.pow(2, 8 * byteLength - 1)
  7449. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7450. }
  7451. var i = 0
  7452. var mul = 1
  7453. var sub = 0
  7454. this[offset] = value & 0xFF
  7455. while (++i < byteLength && (mul *= 0x100)) {
  7456. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7457. sub = 1
  7458. }
  7459. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7460. }
  7461. return offset + byteLength
  7462. }
  7463. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7464. value = +value
  7465. offset = offset | 0
  7466. if (!noAssert) {
  7467. var limit = Math.pow(2, 8 * byteLength - 1)
  7468. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7469. }
  7470. var i = byteLength - 1
  7471. var mul = 1
  7472. var sub = 0
  7473. this[offset + i] = value & 0xFF
  7474. while (--i >= 0 && (mul *= 0x100)) {
  7475. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7476. sub = 1
  7477. }
  7478. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7479. }
  7480. return offset + byteLength
  7481. }
  7482. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7483. value = +value
  7484. offset = offset | 0
  7485. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7486. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7487. if (value < 0) value = 0xff + value + 1
  7488. this[offset] = (value & 0xff)
  7489. return offset + 1
  7490. }
  7491. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7492. value = +value
  7493. offset = offset | 0
  7494. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7495. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7496. this[offset] = (value & 0xff)
  7497. this[offset + 1] = (value >>> 8)
  7498. } else {
  7499. objectWriteUInt16(this, value, offset, true)
  7500. }
  7501. return offset + 2
  7502. }
  7503. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7504. value = +value
  7505. offset = offset | 0
  7506. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7507. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7508. this[offset] = (value >>> 8)
  7509. this[offset + 1] = (value & 0xff)
  7510. } else {
  7511. objectWriteUInt16(this, value, offset, false)
  7512. }
  7513. return offset + 2
  7514. }
  7515. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7516. value = +value
  7517. offset = offset | 0
  7518. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7519. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7520. this[offset] = (value & 0xff)
  7521. this[offset + 1] = (value >>> 8)
  7522. this[offset + 2] = (value >>> 16)
  7523. this[offset + 3] = (value >>> 24)
  7524. } else {
  7525. objectWriteUInt32(this, value, offset, true)
  7526. }
  7527. return offset + 4
  7528. }
  7529. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7530. value = +value
  7531. offset = offset | 0
  7532. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7533. if (value < 0) value = 0xffffffff + value + 1
  7534. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7535. this[offset] = (value >>> 24)
  7536. this[offset + 1] = (value >>> 16)
  7537. this[offset + 2] = (value >>> 8)
  7538. this[offset + 3] = (value & 0xff)
  7539. } else {
  7540. objectWriteUInt32(this, value, offset, false)
  7541. }
  7542. return offset + 4
  7543. }
  7544. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7545. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7546. if (offset < 0) throw new RangeError('Index out of range')
  7547. }
  7548. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7549. if (!noAssert) {
  7550. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7551. }
  7552. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7553. return offset + 4
  7554. }
  7555. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7556. return writeFloat(this, value, offset, true, noAssert)
  7557. }
  7558. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7559. return writeFloat(this, value, offset, false, noAssert)
  7560. }
  7561. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7562. if (!noAssert) {
  7563. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7564. }
  7565. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7566. return offset + 8
  7567. }
  7568. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7569. return writeDouble(this, value, offset, true, noAssert)
  7570. }
  7571. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7572. return writeDouble(this, value, offset, false, noAssert)
  7573. }
  7574. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7575. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7576. if (!start) start = 0
  7577. if (!end && end !== 0) end = this.length
  7578. if (targetStart >= target.length) targetStart = target.length
  7579. if (!targetStart) targetStart = 0
  7580. if (end > 0 && end < start) end = start
  7581. // Copy 0 bytes; we're done
  7582. if (end === start) return 0
  7583. if (target.length === 0 || this.length === 0) return 0
  7584. // Fatal error conditions
  7585. if (targetStart < 0) {
  7586. throw new RangeError('targetStart out of bounds')
  7587. }
  7588. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7589. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7590. // Are we oob?
  7591. if (end > this.length) end = this.length
  7592. if (target.length - targetStart < end - start) {
  7593. end = target.length - targetStart + start
  7594. }
  7595. var len = end - start
  7596. var i
  7597. if (this === target && start < targetStart && targetStart < end) {
  7598. // descending copy from end
  7599. for (i = len - 1; i >= 0; --i) {
  7600. target[i + targetStart] = this[i + start]
  7601. }
  7602. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7603. // ascending copy from start
  7604. for (i = 0; i < len; ++i) {
  7605. target[i + targetStart] = this[i + start]
  7606. }
  7607. } else {
  7608. Uint8Array.prototype.set.call(
  7609. target,
  7610. this.subarray(start, start + len),
  7611. targetStart
  7612. )
  7613. }
  7614. return len
  7615. }
  7616. // Usage:
  7617. // buffer.fill(number[, offset[, end]])
  7618. // buffer.fill(buffer[, offset[, end]])
  7619. // buffer.fill(string[, offset[, end]][, encoding])
  7620. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7621. // Handle string cases:
  7622. if (typeof val === 'string') {
  7623. if (typeof start === 'string') {
  7624. encoding = start
  7625. start = 0
  7626. end = this.length
  7627. } else if (typeof end === 'string') {
  7628. encoding = end
  7629. end = this.length
  7630. }
  7631. if (val.length === 1) {
  7632. var code = val.charCodeAt(0)
  7633. if (code < 256) {
  7634. val = code
  7635. }
  7636. }
  7637. if (encoding !== undefined && typeof encoding !== 'string') {
  7638. throw new TypeError('encoding must be a string')
  7639. }
  7640. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7641. throw new TypeError('Unknown encoding: ' + encoding)
  7642. }
  7643. } else if (typeof val === 'number') {
  7644. val = val & 255
  7645. }
  7646. // Invalid ranges are not set to a default, so can range check early.
  7647. if (start < 0 || this.length < start || this.length < end) {
  7648. throw new RangeError('Out of range index')
  7649. }
  7650. if (end <= start) {
  7651. return this
  7652. }
  7653. start = start >>> 0
  7654. end = end === undefined ? this.length : end >>> 0
  7655. if (!val) val = 0
  7656. var i
  7657. if (typeof val === 'number') {
  7658. for (i = start; i < end; ++i) {
  7659. this[i] = val
  7660. }
  7661. } else {
  7662. var bytes = Buffer.isBuffer(val)
  7663. ? val
  7664. : utf8ToBytes(new Buffer(val, encoding).toString())
  7665. var len = bytes.length
  7666. for (i = 0; i < end - start; ++i) {
  7667. this[i + start] = bytes[i % len]
  7668. }
  7669. }
  7670. return this
  7671. }
  7672. // HELPER FUNCTIONS
  7673. // ================
  7674. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7675. function base64clean (str) {
  7676. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7677. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7678. // Node converts strings with length < 2 to ''
  7679. if (str.length < 2) return ''
  7680. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7681. while (str.length % 4 !== 0) {
  7682. str = str + '='
  7683. }
  7684. return str
  7685. }
  7686. function stringtrim (str) {
  7687. if (str.trim) return str.trim()
  7688. return str.replace(/^\s+|\s+$/g, '')
  7689. }
  7690. function toHex (n) {
  7691. if (n < 16) return '0' + n.toString(16)
  7692. return n.toString(16)
  7693. }
  7694. function utf8ToBytes (string, units) {
  7695. units = units || Infinity
  7696. var codePoint
  7697. var length = string.length
  7698. var leadSurrogate = null
  7699. var bytes = []
  7700. for (var i = 0; i < length; ++i) {
  7701. codePoint = string.charCodeAt(i)
  7702. // is surrogate component
  7703. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7704. // last char was a lead
  7705. if (!leadSurrogate) {
  7706. // no lead yet
  7707. if (codePoint > 0xDBFF) {
  7708. // unexpected trail
  7709. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7710. continue
  7711. } else if (i + 1 === length) {
  7712. // unpaired lead
  7713. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7714. continue
  7715. }
  7716. // valid lead
  7717. leadSurrogate = codePoint
  7718. continue
  7719. }
  7720. // 2 leads in a row
  7721. if (codePoint < 0xDC00) {
  7722. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7723. leadSurrogate = codePoint
  7724. continue
  7725. }
  7726. // valid surrogate pair
  7727. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7728. } else if (leadSurrogate) {
  7729. // valid bmp char, but last char was a lead
  7730. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7731. }
  7732. leadSurrogate = null
  7733. // encode utf8
  7734. if (codePoint < 0x80) {
  7735. if ((units -= 1) < 0) break
  7736. bytes.push(codePoint)
  7737. } else if (codePoint < 0x800) {
  7738. if ((units -= 2) < 0) break
  7739. bytes.push(
  7740. codePoint >> 0x6 | 0xC0,
  7741. codePoint & 0x3F | 0x80
  7742. )
  7743. } else if (codePoint < 0x10000) {
  7744. if ((units -= 3) < 0) break
  7745. bytes.push(
  7746. codePoint >> 0xC | 0xE0,
  7747. codePoint >> 0x6 & 0x3F | 0x80,
  7748. codePoint & 0x3F | 0x80
  7749. )
  7750. } else if (codePoint < 0x110000) {
  7751. if ((units -= 4) < 0) break
  7752. bytes.push(
  7753. codePoint >> 0x12 | 0xF0,
  7754. codePoint >> 0xC & 0x3F | 0x80,
  7755. codePoint >> 0x6 & 0x3F | 0x80,
  7756. codePoint & 0x3F | 0x80
  7757. )
  7758. } else {
  7759. throw new Error('Invalid code point')
  7760. }
  7761. }
  7762. return bytes
  7763. }
  7764. function asciiToBytes (str) {
  7765. var byteArray = []
  7766. for (var i = 0; i < str.length; ++i) {
  7767. // Node's code seems to be doing this and not & 0x7F..
  7768. byteArray.push(str.charCodeAt(i) & 0xFF)
  7769. }
  7770. return byteArray
  7771. }
  7772. function utf16leToBytes (str, units) {
  7773. var c, hi, lo
  7774. var byteArray = []
  7775. for (var i = 0; i < str.length; ++i) {
  7776. if ((units -= 2) < 0) break
  7777. c = str.charCodeAt(i)
  7778. hi = c >> 8
  7779. lo = c % 256
  7780. byteArray.push(lo)
  7781. byteArray.push(hi)
  7782. }
  7783. return byteArray
  7784. }
  7785. function base64ToBytes (str) {
  7786. return base64.toByteArray(base64clean(str))
  7787. }
  7788. function blitBuffer (src, dst, offset, length) {
  7789. for (var i = 0; i < length; ++i) {
  7790. if ((i + offset >= dst.length) || (i >= src.length)) break
  7791. dst[i + offset] = src[i]
  7792. }
  7793. return i
  7794. }
  7795. function isnan (val) {
  7796. return val !== val // eslint-disable-line no-self-compare
  7797. }
  7798. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7799. /***/ }),
  7800. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7801. /*!**************************************************!*\
  7802. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7803. \**************************************************/
  7804. /*! no static exports found */
  7805. /***/ (function(module, exports, __webpack_require__) {
  7806. /*!
  7807. * clipboard.js v2.0.4
  7808. * https://zenorocha.github.io/clipboard.js
  7809. *
  7810. * Licensed MIT © Zeno Rocha
  7811. */
  7812. (function webpackUniversalModuleDefinition(root, factory) {
  7813. if(true)
  7814. module.exports = factory();
  7815. else {}
  7816. })(this, function() {
  7817. return /******/ (function(modules) { // webpackBootstrap
  7818. /******/ // The module cache
  7819. /******/ var installedModules = {};
  7820. /******/
  7821. /******/ // The require function
  7822. /******/ function __webpack_require__(moduleId) {
  7823. /******/
  7824. /******/ // Check if module is in cache
  7825. /******/ if(installedModules[moduleId]) {
  7826. /******/ return installedModules[moduleId].exports;
  7827. /******/ }
  7828. /******/ // Create a new module (and put it into the cache)
  7829. /******/ var module = installedModules[moduleId] = {
  7830. /******/ i: moduleId,
  7831. /******/ l: false,
  7832. /******/ exports: {}
  7833. /******/ };
  7834. /******/
  7835. /******/ // Execute the module function
  7836. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7837. /******/
  7838. /******/ // Flag the module as loaded
  7839. /******/ module.l = true;
  7840. /******/
  7841. /******/ // Return the exports of the module
  7842. /******/ return module.exports;
  7843. /******/ }
  7844. /******/
  7845. /******/
  7846. /******/ // expose the modules object (__webpack_modules__)
  7847. /******/ __webpack_require__.m = modules;
  7848. /******/
  7849. /******/ // expose the module cache
  7850. /******/ __webpack_require__.c = installedModules;
  7851. /******/
  7852. /******/ // define getter function for harmony exports
  7853. /******/ __webpack_require__.d = function(exports, name, getter) {
  7854. /******/ if(!__webpack_require__.o(exports, name)) {
  7855. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7856. /******/ }
  7857. /******/ };
  7858. /******/
  7859. /******/ // define __esModule on exports
  7860. /******/ __webpack_require__.r = function(exports) {
  7861. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7862. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7863. /******/ }
  7864. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7865. /******/ };
  7866. /******/
  7867. /******/ // create a fake namespace object
  7868. /******/ // mode & 1: value is a module id, require it
  7869. /******/ // mode & 2: merge all properties of value into the ns
  7870. /******/ // mode & 4: return value when already ns object
  7871. /******/ // mode & 8|1: behave like require
  7872. /******/ __webpack_require__.t = function(value, mode) {
  7873. /******/ if(mode & 1) value = __webpack_require__(value);
  7874. /******/ if(mode & 8) return value;
  7875. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7876. /******/ var ns = Object.create(null);
  7877. /******/ __webpack_require__.r(ns);
  7878. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7879. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7880. /******/ return ns;
  7881. /******/ };
  7882. /******/
  7883. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7884. /******/ __webpack_require__.n = function(module) {
  7885. /******/ var getter = module && module.__esModule ?
  7886. /******/ function getDefault() { return module['default']; } :
  7887. /******/ function getModuleExports() { return module; };
  7888. /******/ __webpack_require__.d(getter, 'a', getter);
  7889. /******/ return getter;
  7890. /******/ };
  7891. /******/
  7892. /******/ // Object.prototype.hasOwnProperty.call
  7893. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7894. /******/
  7895. /******/ // __webpack_public_path__
  7896. /******/ __webpack_require__.p = "";
  7897. /******/
  7898. /******/
  7899. /******/ // Load entry module and return exports
  7900. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7901. /******/ })
  7902. /************************************************************************/
  7903. /******/ ([
  7904. /* 0 */
  7905. /***/ (function(module, exports, __webpack_require__) {
  7906. "use strict";
  7907. 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; };
  7908. 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; }; }();
  7909. var _clipboardAction = __webpack_require__(1);
  7910. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7911. var _tinyEmitter = __webpack_require__(3);
  7912. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7913. var _goodListener = __webpack_require__(4);
  7914. var _goodListener2 = _interopRequireDefault(_goodListener);
  7915. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7916. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7917. 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; }
  7918. 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; }
  7919. /**
  7920. * Base class which takes one or more elements, adds event listeners to them,
  7921. * and instantiates a new `ClipboardAction` on each click.
  7922. */
  7923. var Clipboard = function (_Emitter) {
  7924. _inherits(Clipboard, _Emitter);
  7925. /**
  7926. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7927. * @param {Object} options
  7928. */
  7929. function Clipboard(trigger, options) {
  7930. _classCallCheck(this, Clipboard);
  7931. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7932. _this.resolveOptions(options);
  7933. _this.listenClick(trigger);
  7934. return _this;
  7935. }
  7936. /**
  7937. * Defines if attributes would be resolved using internal setter functions
  7938. * or custom functions that were passed in the constructor.
  7939. * @param {Object} options
  7940. */
  7941. _createClass(Clipboard, [{
  7942. key: 'resolveOptions',
  7943. value: function resolveOptions() {
  7944. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7945. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7946. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7947. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7948. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7949. }
  7950. /**
  7951. * Adds a click event listener to the passed trigger.
  7952. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7953. */
  7954. }, {
  7955. key: 'listenClick',
  7956. value: function listenClick(trigger) {
  7957. var _this2 = this;
  7958. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7959. return _this2.onClick(e);
  7960. });
  7961. }
  7962. /**
  7963. * Defines a new `ClipboardAction` on each click event.
  7964. * @param {Event} e
  7965. */
  7966. }, {
  7967. key: 'onClick',
  7968. value: function onClick(e) {
  7969. var trigger = e.delegateTarget || e.currentTarget;
  7970. if (this.clipboardAction) {
  7971. this.clipboardAction = null;
  7972. }
  7973. this.clipboardAction = new _clipboardAction2.default({
  7974. action: this.action(trigger),
  7975. target: this.target(trigger),
  7976. text: this.text(trigger),
  7977. container: this.container,
  7978. trigger: trigger,
  7979. emitter: this
  7980. });
  7981. }
  7982. /**
  7983. * Default `action` lookup function.
  7984. * @param {Element} trigger
  7985. */
  7986. }, {
  7987. key: 'defaultAction',
  7988. value: function defaultAction(trigger) {
  7989. return getAttributeValue('action', trigger);
  7990. }
  7991. /**
  7992. * Default `target` lookup function.
  7993. * @param {Element} trigger
  7994. */
  7995. }, {
  7996. key: 'defaultTarget',
  7997. value: function defaultTarget(trigger) {
  7998. var selector = getAttributeValue('target', trigger);
  7999. if (selector) {
  8000. return document.querySelector(selector);
  8001. }
  8002. }
  8003. /**
  8004. * Returns the support of the given action, or all actions if no action is
  8005. * given.
  8006. * @param {String} [action]
  8007. */
  8008. }, {
  8009. key: 'defaultText',
  8010. /**
  8011. * Default `text` lookup function.
  8012. * @param {Element} trigger
  8013. */
  8014. value: function defaultText(trigger) {
  8015. return getAttributeValue('text', trigger);
  8016. }
  8017. /**
  8018. * Destroy lifecycle.
  8019. */
  8020. }, {
  8021. key: 'destroy',
  8022. value: function destroy() {
  8023. this.listener.destroy();
  8024. if (this.clipboardAction) {
  8025. this.clipboardAction.destroy();
  8026. this.clipboardAction = null;
  8027. }
  8028. }
  8029. }], [{
  8030. key: 'isSupported',
  8031. value: function isSupported() {
  8032. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8033. var actions = typeof action === 'string' ? [action] : action;
  8034. var support = !!document.queryCommandSupported;
  8035. actions.forEach(function (action) {
  8036. support = support && !!document.queryCommandSupported(action);
  8037. });
  8038. return support;
  8039. }
  8040. }]);
  8041. return Clipboard;
  8042. }(_tinyEmitter2.default);
  8043. /**
  8044. * Helper function to retrieve attribute value.
  8045. * @param {String} suffix
  8046. * @param {Element} element
  8047. */
  8048. function getAttributeValue(suffix, element) {
  8049. var attribute = 'data-clipboard-' + suffix;
  8050. if (!element.hasAttribute(attribute)) {
  8051. return;
  8052. }
  8053. return element.getAttribute(attribute);
  8054. }
  8055. module.exports = Clipboard;
  8056. /***/ }),
  8057. /* 1 */
  8058. /***/ (function(module, exports, __webpack_require__) {
  8059. "use strict";
  8060. 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; };
  8061. 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; }; }();
  8062. var _select = __webpack_require__(2);
  8063. var _select2 = _interopRequireDefault(_select);
  8064. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8065. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8066. /**
  8067. * Inner class which performs selection from either `text` or `target`
  8068. * properties and then executes copy or cut operations.
  8069. */
  8070. var ClipboardAction = function () {
  8071. /**
  8072. * @param {Object} options
  8073. */
  8074. function ClipboardAction(options) {
  8075. _classCallCheck(this, ClipboardAction);
  8076. this.resolveOptions(options);
  8077. this.initSelection();
  8078. }
  8079. /**
  8080. * Defines base properties passed from constructor.
  8081. * @param {Object} options
  8082. */
  8083. _createClass(ClipboardAction, [{
  8084. key: 'resolveOptions',
  8085. value: function resolveOptions() {
  8086. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8087. this.action = options.action;
  8088. this.container = options.container;
  8089. this.emitter = options.emitter;
  8090. this.target = options.target;
  8091. this.text = options.text;
  8092. this.trigger = options.trigger;
  8093. this.selectedText = '';
  8094. }
  8095. /**
  8096. * Decides which selection strategy is going to be applied based
  8097. * on the existence of `text` and `target` properties.
  8098. */
  8099. }, {
  8100. key: 'initSelection',
  8101. value: function initSelection() {
  8102. if (this.text) {
  8103. this.selectFake();
  8104. } else if (this.target) {
  8105. this.selectTarget();
  8106. }
  8107. }
  8108. /**
  8109. * Creates a fake textarea element, sets its value from `text` property,
  8110. * and makes a selection on it.
  8111. */
  8112. }, {
  8113. key: 'selectFake',
  8114. value: function selectFake() {
  8115. var _this = this;
  8116. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8117. this.removeFake();
  8118. this.fakeHandlerCallback = function () {
  8119. return _this.removeFake();
  8120. };
  8121. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8122. this.fakeElem = document.createElement('textarea');
  8123. // Prevent zooming on iOS
  8124. this.fakeElem.style.fontSize = '12pt';
  8125. // Reset box model
  8126. this.fakeElem.style.border = '0';
  8127. this.fakeElem.style.padding = '0';
  8128. this.fakeElem.style.margin = '0';
  8129. // Move element out of screen horizontally
  8130. this.fakeElem.style.position = 'absolute';
  8131. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8132. // Move element to the same position vertically
  8133. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8134. this.fakeElem.style.top = yPosition + 'px';
  8135. this.fakeElem.setAttribute('readonly', '');
  8136. this.fakeElem.value = this.text;
  8137. this.container.appendChild(this.fakeElem);
  8138. this.selectedText = (0, _select2.default)(this.fakeElem);
  8139. this.copyText();
  8140. }
  8141. /**
  8142. * Only removes the fake element after another click event, that way
  8143. * a user can hit `Ctrl+C` to copy because selection still exists.
  8144. */
  8145. }, {
  8146. key: 'removeFake',
  8147. value: function removeFake() {
  8148. if (this.fakeHandler) {
  8149. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8150. this.fakeHandler = null;
  8151. this.fakeHandlerCallback = null;
  8152. }
  8153. if (this.fakeElem) {
  8154. this.container.removeChild(this.fakeElem);
  8155. this.fakeElem = null;
  8156. }
  8157. }
  8158. /**
  8159. * Selects the content from element passed on `target` property.
  8160. */
  8161. }, {
  8162. key: 'selectTarget',
  8163. value: function selectTarget() {
  8164. this.selectedText = (0, _select2.default)(this.target);
  8165. this.copyText();
  8166. }
  8167. /**
  8168. * Executes the copy operation based on the current selection.
  8169. */
  8170. }, {
  8171. key: 'copyText',
  8172. value: function copyText() {
  8173. var succeeded = void 0;
  8174. try {
  8175. succeeded = document.execCommand(this.action);
  8176. } catch (err) {
  8177. succeeded = false;
  8178. }
  8179. this.handleResult(succeeded);
  8180. }
  8181. /**
  8182. * Fires an event based on the copy operation result.
  8183. * @param {Boolean} succeeded
  8184. */
  8185. }, {
  8186. key: 'handleResult',
  8187. value: function handleResult(succeeded) {
  8188. this.emitter.emit(succeeded ? 'success' : 'error', {
  8189. action: this.action,
  8190. text: this.selectedText,
  8191. trigger: this.trigger,
  8192. clearSelection: this.clearSelection.bind(this)
  8193. });
  8194. }
  8195. /**
  8196. * Moves focus away from `target` and back to the trigger, removes current selection.
  8197. */
  8198. }, {
  8199. key: 'clearSelection',
  8200. value: function clearSelection() {
  8201. if (this.trigger) {
  8202. this.trigger.focus();
  8203. }
  8204. window.getSelection().removeAllRanges();
  8205. }
  8206. /**
  8207. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8208. * @param {String} action
  8209. */
  8210. }, {
  8211. key: 'destroy',
  8212. /**
  8213. * Destroy lifecycle.
  8214. */
  8215. value: function destroy() {
  8216. this.removeFake();
  8217. }
  8218. }, {
  8219. key: 'action',
  8220. set: function set() {
  8221. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8222. this._action = action;
  8223. if (this._action !== 'copy' && this._action !== 'cut') {
  8224. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8225. }
  8226. }
  8227. /**
  8228. * Gets the `action` property.
  8229. * @return {String}
  8230. */
  8231. ,
  8232. get: function get() {
  8233. return this._action;
  8234. }
  8235. /**
  8236. * Sets the `target` property using an element
  8237. * that will be have its content copied.
  8238. * @param {Element} target
  8239. */
  8240. }, {
  8241. key: 'target',
  8242. set: function set(target) {
  8243. if (target !== undefined) {
  8244. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8245. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8246. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8247. }
  8248. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8249. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8250. }
  8251. this._target = target;
  8252. } else {
  8253. throw new Error('Invalid "target" value, use a valid Element');
  8254. }
  8255. }
  8256. }
  8257. /**
  8258. * Gets the `target` property.
  8259. * @return {String|HTMLElement}
  8260. */
  8261. ,
  8262. get: function get() {
  8263. return this._target;
  8264. }
  8265. }]);
  8266. return ClipboardAction;
  8267. }();
  8268. module.exports = ClipboardAction;
  8269. /***/ }),
  8270. /* 2 */
  8271. /***/ (function(module, exports) {
  8272. function select(element) {
  8273. var selectedText;
  8274. if (element.nodeName === 'SELECT') {
  8275. element.focus();
  8276. selectedText = element.value;
  8277. }
  8278. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8279. var isReadOnly = element.hasAttribute('readonly');
  8280. if (!isReadOnly) {
  8281. element.setAttribute('readonly', '');
  8282. }
  8283. element.select();
  8284. element.setSelectionRange(0, element.value.length);
  8285. if (!isReadOnly) {
  8286. element.removeAttribute('readonly');
  8287. }
  8288. selectedText = element.value;
  8289. }
  8290. else {
  8291. if (element.hasAttribute('contenteditable')) {
  8292. element.focus();
  8293. }
  8294. var selection = window.getSelection();
  8295. var range = document.createRange();
  8296. range.selectNodeContents(element);
  8297. selection.removeAllRanges();
  8298. selection.addRange(range);
  8299. selectedText = selection.toString();
  8300. }
  8301. return selectedText;
  8302. }
  8303. module.exports = select;
  8304. /***/ }),
  8305. /* 3 */
  8306. /***/ (function(module, exports) {
  8307. function E () {
  8308. // Keep this empty so it's easier to inherit from
  8309. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8310. }
  8311. E.prototype = {
  8312. on: function (name, callback, ctx) {
  8313. var e = this.e || (this.e = {});
  8314. (e[name] || (e[name] = [])).push({
  8315. fn: callback,
  8316. ctx: ctx
  8317. });
  8318. return this;
  8319. },
  8320. once: function (name, callback, ctx) {
  8321. var self = this;
  8322. function listener () {
  8323. self.off(name, listener);
  8324. callback.apply(ctx, arguments);
  8325. };
  8326. listener._ = callback
  8327. return this.on(name, listener, ctx);
  8328. },
  8329. emit: function (name) {
  8330. var data = [].slice.call(arguments, 1);
  8331. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8332. var i = 0;
  8333. var len = evtArr.length;
  8334. for (i; i < len; i++) {
  8335. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8336. }
  8337. return this;
  8338. },
  8339. off: function (name, callback) {
  8340. var e = this.e || (this.e = {});
  8341. var evts = e[name];
  8342. var liveEvents = [];
  8343. if (evts && callback) {
  8344. for (var i = 0, len = evts.length; i < len; i++) {
  8345. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8346. liveEvents.push(evts[i]);
  8347. }
  8348. }
  8349. // Remove event from queue to prevent memory leak
  8350. // Suggested by https://github.com/lazd
  8351. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8352. (liveEvents.length)
  8353. ? e[name] = liveEvents
  8354. : delete e[name];
  8355. return this;
  8356. }
  8357. };
  8358. module.exports = E;
  8359. /***/ }),
  8360. /* 4 */
  8361. /***/ (function(module, exports, __webpack_require__) {
  8362. var is = __webpack_require__(5);
  8363. var delegate = __webpack_require__(6);
  8364. /**
  8365. * Validates all params and calls the right
  8366. * listener function based on its target type.
  8367. *
  8368. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8369. * @param {String} type
  8370. * @param {Function} callback
  8371. * @return {Object}
  8372. */
  8373. function listen(target, type, callback) {
  8374. if (!target && !type && !callback) {
  8375. throw new Error('Missing required arguments');
  8376. }
  8377. if (!is.string(type)) {
  8378. throw new TypeError('Second argument must be a String');
  8379. }
  8380. if (!is.fn(callback)) {
  8381. throw new TypeError('Third argument must be a Function');
  8382. }
  8383. if (is.node(target)) {
  8384. return listenNode(target, type, callback);
  8385. }
  8386. else if (is.nodeList(target)) {
  8387. return listenNodeList(target, type, callback);
  8388. }
  8389. else if (is.string(target)) {
  8390. return listenSelector(target, type, callback);
  8391. }
  8392. else {
  8393. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8394. }
  8395. }
  8396. /**
  8397. * Adds an event listener to a HTML element
  8398. * and returns a remove listener function.
  8399. *
  8400. * @param {HTMLElement} node
  8401. * @param {String} type
  8402. * @param {Function} callback
  8403. * @return {Object}
  8404. */
  8405. function listenNode(node, type, callback) {
  8406. node.addEventListener(type, callback);
  8407. return {
  8408. destroy: function() {
  8409. node.removeEventListener(type, callback);
  8410. }
  8411. }
  8412. }
  8413. /**
  8414. * Add an event listener to a list of HTML elements
  8415. * and returns a remove listener function.
  8416. *
  8417. * @param {NodeList|HTMLCollection} nodeList
  8418. * @param {String} type
  8419. * @param {Function} callback
  8420. * @return {Object}
  8421. */
  8422. function listenNodeList(nodeList, type, callback) {
  8423. Array.prototype.forEach.call(nodeList, function(node) {
  8424. node.addEventListener(type, callback);
  8425. });
  8426. return {
  8427. destroy: function() {
  8428. Array.prototype.forEach.call(nodeList, function(node) {
  8429. node.removeEventListener(type, callback);
  8430. });
  8431. }
  8432. }
  8433. }
  8434. /**
  8435. * Add an event listener to a selector
  8436. * and returns a remove listener function.
  8437. *
  8438. * @param {String} selector
  8439. * @param {String} type
  8440. * @param {Function} callback
  8441. * @return {Object}
  8442. */
  8443. function listenSelector(selector, type, callback) {
  8444. return delegate(document.body, selector, type, callback);
  8445. }
  8446. module.exports = listen;
  8447. /***/ }),
  8448. /* 5 */
  8449. /***/ (function(module, exports) {
  8450. /**
  8451. * Check if argument is a HTML element.
  8452. *
  8453. * @param {Object} value
  8454. * @return {Boolean}
  8455. */
  8456. exports.node = function(value) {
  8457. return value !== undefined
  8458. && value instanceof HTMLElement
  8459. && value.nodeType === 1;
  8460. };
  8461. /**
  8462. * Check if argument is a list of HTML elements.
  8463. *
  8464. * @param {Object} value
  8465. * @return {Boolean}
  8466. */
  8467. exports.nodeList = function(value) {
  8468. var type = Object.prototype.toString.call(value);
  8469. return value !== undefined
  8470. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8471. && ('length' in value)
  8472. && (value.length === 0 || exports.node(value[0]));
  8473. };
  8474. /**
  8475. * Check if argument is a string.
  8476. *
  8477. * @param {Object} value
  8478. * @return {Boolean}
  8479. */
  8480. exports.string = function(value) {
  8481. return typeof value === 'string'
  8482. || value instanceof String;
  8483. };
  8484. /**
  8485. * Check if argument is a function.
  8486. *
  8487. * @param {Object} value
  8488. * @return {Boolean}
  8489. */
  8490. exports.fn = function(value) {
  8491. var type = Object.prototype.toString.call(value);
  8492. return type === '[object Function]';
  8493. };
  8494. /***/ }),
  8495. /* 6 */
  8496. /***/ (function(module, exports, __webpack_require__) {
  8497. var closest = __webpack_require__(7);
  8498. /**
  8499. * Delegates event to a selector.
  8500. *
  8501. * @param {Element} element
  8502. * @param {String} selector
  8503. * @param {String} type
  8504. * @param {Function} callback
  8505. * @param {Boolean} useCapture
  8506. * @return {Object}
  8507. */
  8508. function _delegate(element, selector, type, callback, useCapture) {
  8509. var listenerFn = listener.apply(this, arguments);
  8510. element.addEventListener(type, listenerFn, useCapture);
  8511. return {
  8512. destroy: function() {
  8513. element.removeEventListener(type, listenerFn, useCapture);
  8514. }
  8515. }
  8516. }
  8517. /**
  8518. * Delegates event to a selector.
  8519. *
  8520. * @param {Element|String|Array} [elements]
  8521. * @param {String} selector
  8522. * @param {String} type
  8523. * @param {Function} callback
  8524. * @param {Boolean} useCapture
  8525. * @return {Object}
  8526. */
  8527. function delegate(elements, selector, type, callback, useCapture) {
  8528. // Handle the regular Element usage
  8529. if (typeof elements.addEventListener === 'function') {
  8530. return _delegate.apply(null, arguments);
  8531. }
  8532. // Handle Element-less usage, it defaults to global delegation
  8533. if (typeof type === 'function') {
  8534. // Use `document` as the first parameter, then apply arguments
  8535. // This is a short way to .unshift `arguments` without running into deoptimizations
  8536. return _delegate.bind(null, document).apply(null, arguments);
  8537. }
  8538. // Handle Selector-based usage
  8539. if (typeof elements === 'string') {
  8540. elements = document.querySelectorAll(elements);
  8541. }
  8542. // Handle Array-like based usage
  8543. return Array.prototype.map.call(elements, function (element) {
  8544. return _delegate(element, selector, type, callback, useCapture);
  8545. });
  8546. }
  8547. /**
  8548. * Finds closest match and invokes callback.
  8549. *
  8550. * @param {Element} element
  8551. * @param {String} selector
  8552. * @param {String} type
  8553. * @param {Function} callback
  8554. * @return {Function}
  8555. */
  8556. function listener(element, selector, type, callback) {
  8557. return function(e) {
  8558. e.delegateTarget = closest(e.target, selector);
  8559. if (e.delegateTarget) {
  8560. callback.call(element, e);
  8561. }
  8562. }
  8563. }
  8564. module.exports = delegate;
  8565. /***/ }),
  8566. /* 7 */
  8567. /***/ (function(module, exports) {
  8568. var DOCUMENT_NODE_TYPE = 9;
  8569. /**
  8570. * A polyfill for Element.matches()
  8571. */
  8572. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8573. var proto = Element.prototype;
  8574. proto.matches = proto.matchesSelector ||
  8575. proto.mozMatchesSelector ||
  8576. proto.msMatchesSelector ||
  8577. proto.oMatchesSelector ||
  8578. proto.webkitMatchesSelector;
  8579. }
  8580. /**
  8581. * Finds the closest parent that matches a selector.
  8582. *
  8583. * @param {Element} element
  8584. * @param {String} selector
  8585. * @return {Function}
  8586. */
  8587. function closest (element, selector) {
  8588. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8589. if (typeof element.matches === 'function' &&
  8590. element.matches(selector)) {
  8591. return element;
  8592. }
  8593. element = element.parentNode;
  8594. }
  8595. }
  8596. module.exports = closest;
  8597. /***/ })
  8598. /******/ ]);
  8599. });
  8600. /***/ }),
  8601. /***/ "./node_modules/ieee754/index.js":
  8602. /*!***************************************!*\
  8603. !*** ./node_modules/ieee754/index.js ***!
  8604. \***************************************/
  8605. /*! no static exports found */
  8606. /***/ (function(module, exports) {
  8607. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8608. var e, m
  8609. var eLen = (nBytes * 8) - mLen - 1
  8610. var eMax = (1 << eLen) - 1
  8611. var eBias = eMax >> 1
  8612. var nBits = -7
  8613. var i = isLE ? (nBytes - 1) : 0
  8614. var d = isLE ? -1 : 1
  8615. var s = buffer[offset + i]
  8616. i += d
  8617. e = s & ((1 << (-nBits)) - 1)
  8618. s >>= (-nBits)
  8619. nBits += eLen
  8620. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8621. m = e & ((1 << (-nBits)) - 1)
  8622. e >>= (-nBits)
  8623. nBits += mLen
  8624. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8625. if (e === 0) {
  8626. e = 1 - eBias
  8627. } else if (e === eMax) {
  8628. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8629. } else {
  8630. m = m + Math.pow(2, mLen)
  8631. e = e - eBias
  8632. }
  8633. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8634. }
  8635. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8636. var e, m, c
  8637. var eLen = (nBytes * 8) - mLen - 1
  8638. var eMax = (1 << eLen) - 1
  8639. var eBias = eMax >> 1
  8640. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8641. var i = isLE ? 0 : (nBytes - 1)
  8642. var d = isLE ? 1 : -1
  8643. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8644. value = Math.abs(value)
  8645. if (isNaN(value) || value === Infinity) {
  8646. m = isNaN(value) ? 1 : 0
  8647. e = eMax
  8648. } else {
  8649. e = Math.floor(Math.log(value) / Math.LN2)
  8650. if (value * (c = Math.pow(2, -e)) < 1) {
  8651. e--
  8652. c *= 2
  8653. }
  8654. if (e + eBias >= 1) {
  8655. value += rt / c
  8656. } else {
  8657. value += rt * Math.pow(2, 1 - eBias)
  8658. }
  8659. if (value * c >= 2) {
  8660. e++
  8661. c /= 2
  8662. }
  8663. if (e + eBias >= eMax) {
  8664. m = 0
  8665. e = eMax
  8666. } else if (e + eBias >= 1) {
  8667. m = ((value * c) - 1) * Math.pow(2, mLen)
  8668. e = e + eBias
  8669. } else {
  8670. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8671. e = 0
  8672. }
  8673. }
  8674. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8675. e = (e << mLen) | m
  8676. eLen += mLen
  8677. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8678. buffer[offset + i - d] |= s * 128
  8679. }
  8680. /***/ }),
  8681. /***/ "./node_modules/isarray/index.js":
  8682. /*!***************************************!*\
  8683. !*** ./node_modules/isarray/index.js ***!
  8684. \***************************************/
  8685. /*! no static exports found */
  8686. /***/ (function(module, exports) {
  8687. var toString = {}.toString;
  8688. module.exports = Array.isArray || function (arr) {
  8689. return toString.call(arr) == '[object Array]';
  8690. };
  8691. /***/ }),
  8692. /***/ "./node_modules/jquery/dist/jquery.js":
  8693. /*!********************************************!*\
  8694. !*** ./node_modules/jquery/dist/jquery.js ***!
  8695. \********************************************/
  8696. /*! no static exports found */
  8697. /***/ (function(module, exports, __webpack_require__) {
  8698. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8699. * jQuery JavaScript Library v3.4.1
  8700. * https://jquery.com/
  8701. *
  8702. * Includes Sizzle.js
  8703. * https://sizzlejs.com/
  8704. *
  8705. * Copyright JS Foundation and other contributors
  8706. * Released under the MIT license
  8707. * https://jquery.org/license
  8708. *
  8709. * Date: 2019-05-01T21:04Z
  8710. */
  8711. ( function( global, factory ) {
  8712. "use strict";
  8713. if ( true && typeof module.exports === "object" ) {
  8714. // For CommonJS and CommonJS-like environments where a proper `window`
  8715. // is present, execute the factory and get jQuery.
  8716. // For environments that do not have a `window` with a `document`
  8717. // (such as Node.js), expose a factory as module.exports.
  8718. // This accentuates the need for the creation of a real `window`.
  8719. // e.g. var jQuery = require("jquery")(window);
  8720. // See ticket #14549 for more info.
  8721. module.exports = global.document ?
  8722. factory( global, true ) :
  8723. function( w ) {
  8724. if ( !w.document ) {
  8725. throw new Error( "jQuery requires a window with a document" );
  8726. }
  8727. return factory( w );
  8728. };
  8729. } else {
  8730. factory( global );
  8731. }
  8732. // Pass this if window is not defined yet
  8733. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8734. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8735. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8736. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8737. // enough that all such attempts are guarded in a try block.
  8738. "use strict";
  8739. var arr = [];
  8740. var document = window.document;
  8741. var getProto = Object.getPrototypeOf;
  8742. var slice = arr.slice;
  8743. var concat = arr.concat;
  8744. var push = arr.push;
  8745. var indexOf = arr.indexOf;
  8746. var class2type = {};
  8747. var toString = class2type.toString;
  8748. var hasOwn = class2type.hasOwnProperty;
  8749. var fnToString = hasOwn.toString;
  8750. var ObjectFunctionString = fnToString.call( Object );
  8751. var support = {};
  8752. var isFunction = function isFunction( obj ) {
  8753. // Support: Chrome <=57, Firefox <=52
  8754. // In some browsers, typeof returns "function" for HTML <object> elements
  8755. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8756. // We don't want to classify *any* DOM node as a function.
  8757. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8758. };
  8759. var isWindow = function isWindow( obj ) {
  8760. return obj != null && obj === obj.window;
  8761. };
  8762. var preservedScriptAttributes = {
  8763. type: true,
  8764. src: true,
  8765. nonce: true,
  8766. noModule: true
  8767. };
  8768. function DOMEval( code, node, doc ) {
  8769. doc = doc || document;
  8770. var i, val,
  8771. script = doc.createElement( "script" );
  8772. script.text = code;
  8773. if ( node ) {
  8774. for ( i in preservedScriptAttributes ) {
  8775. // Support: Firefox 64+, Edge 18+
  8776. // Some browsers don't support the "nonce" property on scripts.
  8777. // On the other hand, just using `getAttribute` is not enough as
  8778. // the `nonce` attribute is reset to an empty string whenever it
  8779. // becomes browsing-context connected.
  8780. // See https://github.com/whatwg/html/issues/2369
  8781. // See https://html.spec.whatwg.org/#nonce-attributes
  8782. // The `node.getAttribute` check was added for the sake of
  8783. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8784. // via an object.
  8785. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8786. if ( val ) {
  8787. script.setAttribute( i, val );
  8788. }
  8789. }
  8790. }
  8791. doc.head.appendChild( script ).parentNode.removeChild( script );
  8792. }
  8793. function toType( obj ) {
  8794. if ( obj == null ) {
  8795. return obj + "";
  8796. }
  8797. // Support: Android <=2.3 only (functionish RegExp)
  8798. return typeof obj === "object" || typeof obj === "function" ?
  8799. class2type[ toString.call( obj ) ] || "object" :
  8800. typeof obj;
  8801. }
  8802. /* global Symbol */
  8803. // Defining this global in .eslintrc.json would create a danger of using the global
  8804. // unguarded in another place, it seems safer to define global only for this module
  8805. var
  8806. version = "3.4.1",
  8807. // Define a local copy of jQuery
  8808. jQuery = function( selector, context ) {
  8809. // The jQuery object is actually just the init constructor 'enhanced'
  8810. // Need init if jQuery is called (just allow error to be thrown if not included)
  8811. return new jQuery.fn.init( selector, context );
  8812. },
  8813. // Support: Android <=4.0 only
  8814. // Make sure we trim BOM and NBSP
  8815. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8816. jQuery.fn = jQuery.prototype = {
  8817. // The current version of jQuery being used
  8818. jquery: version,
  8819. constructor: jQuery,
  8820. // The default length of a jQuery object is 0
  8821. length: 0,
  8822. toArray: function() {
  8823. return slice.call( this );
  8824. },
  8825. // Get the Nth element in the matched element set OR
  8826. // Get the whole matched element set as a clean array
  8827. get: function( num ) {
  8828. // Return all the elements in a clean array
  8829. if ( num == null ) {
  8830. return slice.call( this );
  8831. }
  8832. // Return just the one element from the set
  8833. return num < 0 ? this[ num + this.length ] : this[ num ];
  8834. },
  8835. // Take an array of elements and push it onto the stack
  8836. // (returning the new matched element set)
  8837. pushStack: function( elems ) {
  8838. // Build a new jQuery matched element set
  8839. var ret = jQuery.merge( this.constructor(), elems );
  8840. // Add the old object onto the stack (as a reference)
  8841. ret.prevObject = this;
  8842. // Return the newly-formed element set
  8843. return ret;
  8844. },
  8845. // Execute a callback for every element in the matched set.
  8846. each: function( callback ) {
  8847. return jQuery.each( this, callback );
  8848. },
  8849. map: function( callback ) {
  8850. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8851. return callback.call( elem, i, elem );
  8852. } ) );
  8853. },
  8854. slice: function() {
  8855. return this.pushStack( slice.apply( this, arguments ) );
  8856. },
  8857. first: function() {
  8858. return this.eq( 0 );
  8859. },
  8860. last: function() {
  8861. return this.eq( -1 );
  8862. },
  8863. eq: function( i ) {
  8864. var len = this.length,
  8865. j = +i + ( i < 0 ? len : 0 );
  8866. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8867. },
  8868. end: function() {
  8869. return this.prevObject || this.constructor();
  8870. },
  8871. // For internal use only.
  8872. // Behaves like an Array's method, not like a jQuery method.
  8873. push: push,
  8874. sort: arr.sort,
  8875. splice: arr.splice
  8876. };
  8877. jQuery.extend = jQuery.fn.extend = function() {
  8878. var options, name, src, copy, copyIsArray, clone,
  8879. target = arguments[ 0 ] || {},
  8880. i = 1,
  8881. length = arguments.length,
  8882. deep = false;
  8883. // Handle a deep copy situation
  8884. if ( typeof target === "boolean" ) {
  8885. deep = target;
  8886. // Skip the boolean and the target
  8887. target = arguments[ i ] || {};
  8888. i++;
  8889. }
  8890. // Handle case when target is a string or something (possible in deep copy)
  8891. if ( typeof target !== "object" && !isFunction( target ) ) {
  8892. target = {};
  8893. }
  8894. // Extend jQuery itself if only one argument is passed
  8895. if ( i === length ) {
  8896. target = this;
  8897. i--;
  8898. }
  8899. for ( ; i < length; i++ ) {
  8900. // Only deal with non-null/undefined values
  8901. if ( ( options = arguments[ i ] ) != null ) {
  8902. // Extend the base object
  8903. for ( name in options ) {
  8904. copy = options[ name ];
  8905. // Prevent Object.prototype pollution
  8906. // Prevent never-ending loop
  8907. if ( name === "__proto__" || target === copy ) {
  8908. continue;
  8909. }
  8910. // Recurse if we're merging plain objects or arrays
  8911. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8912. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8913. src = target[ name ];
  8914. // Ensure proper type for the source value
  8915. if ( copyIsArray && !Array.isArray( src ) ) {
  8916. clone = [];
  8917. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8918. clone = {};
  8919. } else {
  8920. clone = src;
  8921. }
  8922. copyIsArray = false;
  8923. // Never move original objects, clone them
  8924. target[ name ] = jQuery.extend( deep, clone, copy );
  8925. // Don't bring in undefined values
  8926. } else if ( copy !== undefined ) {
  8927. target[ name ] = copy;
  8928. }
  8929. }
  8930. }
  8931. }
  8932. // Return the modified object
  8933. return target;
  8934. };
  8935. jQuery.extend( {
  8936. // Unique for each copy of jQuery on the page
  8937. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8938. // Assume jQuery is ready without the ready module
  8939. isReady: true,
  8940. error: function( msg ) {
  8941. throw new Error( msg );
  8942. },
  8943. noop: function() {},
  8944. isPlainObject: function( obj ) {
  8945. var proto, Ctor;
  8946. // Detect obvious negatives
  8947. // Use toString instead of jQuery.type to catch host objects
  8948. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8949. return false;
  8950. }
  8951. proto = getProto( obj );
  8952. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8953. if ( !proto ) {
  8954. return true;
  8955. }
  8956. // Objects with prototype are plain iff they were constructed by a global Object function
  8957. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8958. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8959. },
  8960. isEmptyObject: function( obj ) {
  8961. var name;
  8962. for ( name in obj ) {
  8963. return false;
  8964. }
  8965. return true;
  8966. },
  8967. // Evaluates a script in a global context
  8968. globalEval: function( code, options ) {
  8969. DOMEval( code, { nonce: options && options.nonce } );
  8970. },
  8971. each: function( obj, callback ) {
  8972. var length, i = 0;
  8973. if ( isArrayLike( obj ) ) {
  8974. length = obj.length;
  8975. for ( ; i < length; i++ ) {
  8976. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8977. break;
  8978. }
  8979. }
  8980. } else {
  8981. for ( i in obj ) {
  8982. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8983. break;
  8984. }
  8985. }
  8986. }
  8987. return obj;
  8988. },
  8989. // Support: Android <=4.0 only
  8990. trim: function( text ) {
  8991. return text == null ?
  8992. "" :
  8993. ( text + "" ).replace( rtrim, "" );
  8994. },
  8995. // results is for internal usage only
  8996. makeArray: function( arr, results ) {
  8997. var ret = results || [];
  8998. if ( arr != null ) {
  8999. if ( isArrayLike( Object( arr ) ) ) {
  9000. jQuery.merge( ret,
  9001. typeof arr === "string" ?
  9002. [ arr ] : arr
  9003. );
  9004. } else {
  9005. push.call( ret, arr );
  9006. }
  9007. }
  9008. return ret;
  9009. },
  9010. inArray: function( elem, arr, i ) {
  9011. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9012. },
  9013. // Support: Android <=4.0 only, PhantomJS 1 only
  9014. // push.apply(_, arraylike) throws on ancient WebKit
  9015. merge: function( first, second ) {
  9016. var len = +second.length,
  9017. j = 0,
  9018. i = first.length;
  9019. for ( ; j < len; j++ ) {
  9020. first[ i++ ] = second[ j ];
  9021. }
  9022. first.length = i;
  9023. return first;
  9024. },
  9025. grep: function( elems, callback, invert ) {
  9026. var callbackInverse,
  9027. matches = [],
  9028. i = 0,
  9029. length = elems.length,
  9030. callbackExpect = !invert;
  9031. // Go through the array, only saving the items
  9032. // that pass the validator function
  9033. for ( ; i < length; i++ ) {
  9034. callbackInverse = !callback( elems[ i ], i );
  9035. if ( callbackInverse !== callbackExpect ) {
  9036. matches.push( elems[ i ] );
  9037. }
  9038. }
  9039. return matches;
  9040. },
  9041. // arg is for internal usage only
  9042. map: function( elems, callback, arg ) {
  9043. var length, value,
  9044. i = 0,
  9045. ret = [];
  9046. // Go through the array, translating each of the items to their new values
  9047. if ( isArrayLike( elems ) ) {
  9048. length = elems.length;
  9049. for ( ; i < length; i++ ) {
  9050. value = callback( elems[ i ], i, arg );
  9051. if ( value != null ) {
  9052. ret.push( value );
  9053. }
  9054. }
  9055. // Go through every key on the object,
  9056. } else {
  9057. for ( i in elems ) {
  9058. value = callback( elems[ i ], i, arg );
  9059. if ( value != null ) {
  9060. ret.push( value );
  9061. }
  9062. }
  9063. }
  9064. // Flatten any nested arrays
  9065. return concat.apply( [], ret );
  9066. },
  9067. // A global GUID counter for objects
  9068. guid: 1,
  9069. // jQuery.support is not used in Core but other projects attach their
  9070. // properties to it so it needs to exist.
  9071. support: support
  9072. } );
  9073. if ( typeof Symbol === "function" ) {
  9074. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9075. }
  9076. // Populate the class2type map
  9077. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9078. function( i, name ) {
  9079. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9080. } );
  9081. function isArrayLike( obj ) {
  9082. // Support: real iOS 8.2 only (not reproducible in simulator)
  9083. // `in` check used to prevent JIT error (gh-2145)
  9084. // hasOwn isn't used here due to false negatives
  9085. // regarding Nodelist length in IE
  9086. var length = !!obj && "length" in obj && obj.length,
  9087. type = toType( obj );
  9088. if ( isFunction( obj ) || isWindow( obj ) ) {
  9089. return false;
  9090. }
  9091. return type === "array" || length === 0 ||
  9092. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9093. }
  9094. var Sizzle =
  9095. /*!
  9096. * Sizzle CSS Selector Engine v2.3.4
  9097. * https://sizzlejs.com/
  9098. *
  9099. * Copyright JS Foundation and other contributors
  9100. * Released under the MIT license
  9101. * https://js.foundation/
  9102. *
  9103. * Date: 2019-04-08
  9104. */
  9105. (function( window ) {
  9106. var i,
  9107. support,
  9108. Expr,
  9109. getText,
  9110. isXML,
  9111. tokenize,
  9112. compile,
  9113. select,
  9114. outermostContext,
  9115. sortInput,
  9116. hasDuplicate,
  9117. // Local document vars
  9118. setDocument,
  9119. document,
  9120. docElem,
  9121. documentIsHTML,
  9122. rbuggyQSA,
  9123. rbuggyMatches,
  9124. matches,
  9125. contains,
  9126. // Instance-specific data
  9127. expando = "sizzle" + 1 * new Date(),
  9128. preferredDoc = window.document,
  9129. dirruns = 0,
  9130. done = 0,
  9131. classCache = createCache(),
  9132. tokenCache = createCache(),
  9133. compilerCache = createCache(),
  9134. nonnativeSelectorCache = createCache(),
  9135. sortOrder = function( a, b ) {
  9136. if ( a === b ) {
  9137. hasDuplicate = true;
  9138. }
  9139. return 0;
  9140. },
  9141. // Instance methods
  9142. hasOwn = ({}).hasOwnProperty,
  9143. arr = [],
  9144. pop = arr.pop,
  9145. push_native = arr.push,
  9146. push = arr.push,
  9147. slice = arr.slice,
  9148. // Use a stripped-down indexOf as it's faster than native
  9149. // https://jsperf.com/thor-indexof-vs-for/5
  9150. indexOf = function( list, elem ) {
  9151. var i = 0,
  9152. len = list.length;
  9153. for ( ; i < len; i++ ) {
  9154. if ( list[i] === elem ) {
  9155. return i;
  9156. }
  9157. }
  9158. return -1;
  9159. },
  9160. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9161. // Regular expressions
  9162. // http://www.w3.org/TR/css3-selectors/#whitespace
  9163. whitespace = "[\\x20\\t\\r\\n\\f]",
  9164. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9165. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9166. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9167. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9168. // Operator (capture 2)
  9169. "*([*^$|!~]?=)" + whitespace +
  9170. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9171. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9172. "*\\]",
  9173. pseudos = ":(" + identifier + ")(?:\\((" +
  9174. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9175. // 1. quoted (capture 3; capture 4 or capture 5)
  9176. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9177. // 2. simple (capture 6)
  9178. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9179. // 3. anything else (capture 2)
  9180. ".*" +
  9181. ")\\)|)",
  9182. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9183. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9184. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9185. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9186. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9187. rdescend = new RegExp( whitespace + "|>" ),
  9188. rpseudo = new RegExp( pseudos ),
  9189. ridentifier = new RegExp( "^" + identifier + "$" ),
  9190. matchExpr = {
  9191. "ID": new RegExp( "^#(" + identifier + ")" ),
  9192. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9193. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9194. "ATTR": new RegExp( "^" + attributes ),
  9195. "PSEUDO": new RegExp( "^" + pseudos ),
  9196. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9197. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9198. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9199. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9200. // For use in libraries implementing .is()
  9201. // We use this for POS matching in `select`
  9202. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9203. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9204. },
  9205. rhtml = /HTML$/i,
  9206. rinputs = /^(?:input|select|textarea|button)$/i,
  9207. rheader = /^h\d$/i,
  9208. rnative = /^[^{]+\{\s*\[native \w/,
  9209. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9210. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9211. rsibling = /[+~]/,
  9212. // CSS escapes
  9213. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9214. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9215. funescape = function( _, escaped, escapedWhitespace ) {
  9216. var high = "0x" + escaped - 0x10000;
  9217. // NaN means non-codepoint
  9218. // Support: Firefox<24
  9219. // Workaround erroneous numeric interpretation of +"0x"
  9220. return high !== high || escapedWhitespace ?
  9221. escaped :
  9222. high < 0 ?
  9223. // BMP codepoint
  9224. String.fromCharCode( high + 0x10000 ) :
  9225. // Supplemental Plane codepoint (surrogate pair)
  9226. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9227. },
  9228. // CSS string/identifier serialization
  9229. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9230. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9231. fcssescape = function( ch, asCodePoint ) {
  9232. if ( asCodePoint ) {
  9233. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9234. if ( ch === "\0" ) {
  9235. return "\uFFFD";
  9236. }
  9237. // Control characters and (dependent upon position) numbers get escaped as code points
  9238. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9239. }
  9240. // Other potentially-special ASCII characters get backslash-escaped
  9241. return "\\" + ch;
  9242. },
  9243. // Used for iframes
  9244. // See setDocument()
  9245. // Removing the function wrapper causes a "Permission Denied"
  9246. // error in IE
  9247. unloadHandler = function() {
  9248. setDocument();
  9249. },
  9250. inDisabledFieldset = addCombinator(
  9251. function( elem ) {
  9252. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9253. },
  9254. { dir: "parentNode", next: "legend" }
  9255. );
  9256. // Optimize for push.apply( _, NodeList )
  9257. try {
  9258. push.apply(
  9259. (arr = slice.call( preferredDoc.childNodes )),
  9260. preferredDoc.childNodes
  9261. );
  9262. // Support: Android<4.0
  9263. // Detect silently failing push.apply
  9264. arr[ preferredDoc.childNodes.length ].nodeType;
  9265. } catch ( e ) {
  9266. push = { apply: arr.length ?
  9267. // Leverage slice if possible
  9268. function( target, els ) {
  9269. push_native.apply( target, slice.call(els) );
  9270. } :
  9271. // Support: IE<9
  9272. // Otherwise append directly
  9273. function( target, els ) {
  9274. var j = target.length,
  9275. i = 0;
  9276. // Can't trust NodeList.length
  9277. while ( (target[j++] = els[i++]) ) {}
  9278. target.length = j - 1;
  9279. }
  9280. };
  9281. }
  9282. function Sizzle( selector, context, results, seed ) {
  9283. var m, i, elem, nid, match, groups, newSelector,
  9284. newContext = context && context.ownerDocument,
  9285. // nodeType defaults to 9, since context defaults to document
  9286. nodeType = context ? context.nodeType : 9;
  9287. results = results || [];
  9288. // Return early from calls with invalid selector or context
  9289. if ( typeof selector !== "string" || !selector ||
  9290. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9291. return results;
  9292. }
  9293. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9294. if ( !seed ) {
  9295. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9296. setDocument( context );
  9297. }
  9298. context = context || document;
  9299. if ( documentIsHTML ) {
  9300. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9301. // (excepting DocumentFragment context, where the methods don't exist)
  9302. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9303. // ID selector
  9304. if ( (m = match[1]) ) {
  9305. // Document context
  9306. if ( nodeType === 9 ) {
  9307. if ( (elem = context.getElementById( m )) ) {
  9308. // Support: IE, Opera, Webkit
  9309. // TODO: identify versions
  9310. // getElementById can match elements by name instead of ID
  9311. if ( elem.id === m ) {
  9312. results.push( elem );
  9313. return results;
  9314. }
  9315. } else {
  9316. return results;
  9317. }
  9318. // Element context
  9319. } else {
  9320. // Support: IE, Opera, Webkit
  9321. // TODO: identify versions
  9322. // getElementById can match elements by name instead of ID
  9323. if ( newContext && (elem = newContext.getElementById( m )) &&
  9324. contains( context, elem ) &&
  9325. elem.id === m ) {
  9326. results.push( elem );
  9327. return results;
  9328. }
  9329. }
  9330. // Type selector
  9331. } else if ( match[2] ) {
  9332. push.apply( results, context.getElementsByTagName( selector ) );
  9333. return results;
  9334. // Class selector
  9335. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9336. context.getElementsByClassName ) {
  9337. push.apply( results, context.getElementsByClassName( m ) );
  9338. return results;
  9339. }
  9340. }
  9341. // Take advantage of querySelectorAll
  9342. if ( support.qsa &&
  9343. !nonnativeSelectorCache[ selector + " " ] &&
  9344. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9345. // Support: IE 8 only
  9346. // Exclude object elements
  9347. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9348. newSelector = selector;
  9349. newContext = context;
  9350. // qSA considers elements outside a scoping root when evaluating child or
  9351. // descendant combinators, which is not what we want.
  9352. // In such cases, we work around the behavior by prefixing every selector in the
  9353. // list with an ID selector referencing the scope context.
  9354. // Thanks to Andrew Dupont for this technique.
  9355. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9356. // Capture the context ID, setting it first if necessary
  9357. if ( (nid = context.getAttribute( "id" )) ) {
  9358. nid = nid.replace( rcssescape, fcssescape );
  9359. } else {
  9360. context.setAttribute( "id", (nid = expando) );
  9361. }
  9362. // Prefix every selector in the list
  9363. groups = tokenize( selector );
  9364. i = groups.length;
  9365. while ( i-- ) {
  9366. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9367. }
  9368. newSelector = groups.join( "," );
  9369. // Expand context for sibling selectors
  9370. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9371. context;
  9372. }
  9373. try {
  9374. push.apply( results,
  9375. newContext.querySelectorAll( newSelector )
  9376. );
  9377. return results;
  9378. } catch ( qsaError ) {
  9379. nonnativeSelectorCache( selector, true );
  9380. } finally {
  9381. if ( nid === expando ) {
  9382. context.removeAttribute( "id" );
  9383. }
  9384. }
  9385. }
  9386. }
  9387. }
  9388. // All others
  9389. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9390. }
  9391. /**
  9392. * Create key-value caches of limited size
  9393. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9394. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9395. * deleting the oldest entry
  9396. */
  9397. function createCache() {
  9398. var keys = [];
  9399. function cache( key, value ) {
  9400. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9401. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9402. // Only keep the most recent entries
  9403. delete cache[ keys.shift() ];
  9404. }
  9405. return (cache[ key + " " ] = value);
  9406. }
  9407. return cache;
  9408. }
  9409. /**
  9410. * Mark a function for special use by Sizzle
  9411. * @param {Function} fn The function to mark
  9412. */
  9413. function markFunction( fn ) {
  9414. fn[ expando ] = true;
  9415. return fn;
  9416. }
  9417. /**
  9418. * Support testing using an element
  9419. * @param {Function} fn Passed the created element and returns a boolean result
  9420. */
  9421. function assert( fn ) {
  9422. var el = document.createElement("fieldset");
  9423. try {
  9424. return !!fn( el );
  9425. } catch (e) {
  9426. return false;
  9427. } finally {
  9428. // Remove from its parent by default
  9429. if ( el.parentNode ) {
  9430. el.parentNode.removeChild( el );
  9431. }
  9432. // release memory in IE
  9433. el = null;
  9434. }
  9435. }
  9436. /**
  9437. * Adds the same handler for all of the specified attrs
  9438. * @param {String} attrs Pipe-separated list of attributes
  9439. * @param {Function} handler The method that will be applied
  9440. */
  9441. function addHandle( attrs, handler ) {
  9442. var arr = attrs.split("|"),
  9443. i = arr.length;
  9444. while ( i-- ) {
  9445. Expr.attrHandle[ arr[i] ] = handler;
  9446. }
  9447. }
  9448. /**
  9449. * Checks document order of two siblings
  9450. * @param {Element} a
  9451. * @param {Element} b
  9452. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9453. */
  9454. function siblingCheck( a, b ) {
  9455. var cur = b && a,
  9456. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9457. a.sourceIndex - b.sourceIndex;
  9458. // Use IE sourceIndex if available on both nodes
  9459. if ( diff ) {
  9460. return diff;
  9461. }
  9462. // Check if b follows a
  9463. if ( cur ) {
  9464. while ( (cur = cur.nextSibling) ) {
  9465. if ( cur === b ) {
  9466. return -1;
  9467. }
  9468. }
  9469. }
  9470. return a ? 1 : -1;
  9471. }
  9472. /**
  9473. * Returns a function to use in pseudos for input types
  9474. * @param {String} type
  9475. */
  9476. function createInputPseudo( type ) {
  9477. return function( elem ) {
  9478. var name = elem.nodeName.toLowerCase();
  9479. return name === "input" && elem.type === type;
  9480. };
  9481. }
  9482. /**
  9483. * Returns a function to use in pseudos for buttons
  9484. * @param {String} type
  9485. */
  9486. function createButtonPseudo( type ) {
  9487. return function( elem ) {
  9488. var name = elem.nodeName.toLowerCase();
  9489. return (name === "input" || name === "button") && elem.type === type;
  9490. };
  9491. }
  9492. /**
  9493. * Returns a function to use in pseudos for :enabled/:disabled
  9494. * @param {Boolean} disabled true for :disabled; false for :enabled
  9495. */
  9496. function createDisabledPseudo( disabled ) {
  9497. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9498. return function( elem ) {
  9499. // Only certain elements can match :enabled or :disabled
  9500. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9501. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9502. if ( "form" in elem ) {
  9503. // Check for inherited disabledness on relevant non-disabled elements:
  9504. // * listed form-associated elements in a disabled fieldset
  9505. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9506. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9507. // * option elements in a disabled optgroup
  9508. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9509. // All such elements have a "form" property.
  9510. if ( elem.parentNode && elem.disabled === false ) {
  9511. // Option elements defer to a parent optgroup if present
  9512. if ( "label" in elem ) {
  9513. if ( "label" in elem.parentNode ) {
  9514. return elem.parentNode.disabled === disabled;
  9515. } else {
  9516. return elem.disabled === disabled;
  9517. }
  9518. }
  9519. // Support: IE 6 - 11
  9520. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9521. return elem.isDisabled === disabled ||
  9522. // Where there is no isDisabled, check manually
  9523. /* jshint -W018 */
  9524. elem.isDisabled !== !disabled &&
  9525. inDisabledFieldset( elem ) === disabled;
  9526. }
  9527. return elem.disabled === disabled;
  9528. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9529. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9530. // even exist on them, let alone have a boolean value.
  9531. } else if ( "label" in elem ) {
  9532. return elem.disabled === disabled;
  9533. }
  9534. // Remaining elements are neither :enabled nor :disabled
  9535. return false;
  9536. };
  9537. }
  9538. /**
  9539. * Returns a function to use in pseudos for positionals
  9540. * @param {Function} fn
  9541. */
  9542. function createPositionalPseudo( fn ) {
  9543. return markFunction(function( argument ) {
  9544. argument = +argument;
  9545. return markFunction(function( seed, matches ) {
  9546. var j,
  9547. matchIndexes = fn( [], seed.length, argument ),
  9548. i = matchIndexes.length;
  9549. // Match elements found at the specified indexes
  9550. while ( i-- ) {
  9551. if ( seed[ (j = matchIndexes[i]) ] ) {
  9552. seed[j] = !(matches[j] = seed[j]);
  9553. }
  9554. }
  9555. });
  9556. });
  9557. }
  9558. /**
  9559. * Checks a node for validity as a Sizzle context
  9560. * @param {Element|Object=} context
  9561. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9562. */
  9563. function testContext( context ) {
  9564. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9565. }
  9566. // Expose support vars for convenience
  9567. support = Sizzle.support = {};
  9568. /**
  9569. * Detects XML nodes
  9570. * @param {Element|Object} elem An element or a document
  9571. * @returns {Boolean} True iff elem is a non-HTML XML node
  9572. */
  9573. isXML = Sizzle.isXML = function( elem ) {
  9574. var namespace = elem.namespaceURI,
  9575. docElem = (elem.ownerDocument || elem).documentElement;
  9576. // Support: IE <=8
  9577. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9578. // https://bugs.jquery.com/ticket/4833
  9579. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9580. };
  9581. /**
  9582. * Sets document-related variables once based on the current document
  9583. * @param {Element|Object} [doc] An element or document object to use to set the document
  9584. * @returns {Object} Returns the current document
  9585. */
  9586. setDocument = Sizzle.setDocument = function( node ) {
  9587. var hasCompare, subWindow,
  9588. doc = node ? node.ownerDocument || node : preferredDoc;
  9589. // Return early if doc is invalid or already selected
  9590. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9591. return document;
  9592. }
  9593. // Update global variables
  9594. document = doc;
  9595. docElem = document.documentElement;
  9596. documentIsHTML = !isXML( document );
  9597. // Support: IE 9-11, Edge
  9598. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9599. if ( preferredDoc !== document &&
  9600. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9601. // Support: IE 11, Edge
  9602. if ( subWindow.addEventListener ) {
  9603. subWindow.addEventListener( "unload", unloadHandler, false );
  9604. // Support: IE 9 - 10 only
  9605. } else if ( subWindow.attachEvent ) {
  9606. subWindow.attachEvent( "onunload", unloadHandler );
  9607. }
  9608. }
  9609. /* Attributes
  9610. ---------------------------------------------------------------------- */
  9611. // Support: IE<8
  9612. // Verify that getAttribute really returns attributes and not properties
  9613. // (excepting IE8 booleans)
  9614. support.attributes = assert(function( el ) {
  9615. el.className = "i";
  9616. return !el.getAttribute("className");
  9617. });
  9618. /* getElement(s)By*
  9619. ---------------------------------------------------------------------- */
  9620. // Check if getElementsByTagName("*") returns only elements
  9621. support.getElementsByTagName = assert(function( el ) {
  9622. el.appendChild( document.createComment("") );
  9623. return !el.getElementsByTagName("*").length;
  9624. });
  9625. // Support: IE<9
  9626. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9627. // Support: IE<10
  9628. // Check if getElementById returns elements by name
  9629. // The broken getElementById methods don't pick up programmatically-set names,
  9630. // so use a roundabout getElementsByName test
  9631. support.getById = assert(function( el ) {
  9632. docElem.appendChild( el ).id = expando;
  9633. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9634. });
  9635. // ID filter and find
  9636. if ( support.getById ) {
  9637. Expr.filter["ID"] = function( id ) {
  9638. var attrId = id.replace( runescape, funescape );
  9639. return function( elem ) {
  9640. return elem.getAttribute("id") === attrId;
  9641. };
  9642. };
  9643. Expr.find["ID"] = function( id, context ) {
  9644. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9645. var elem = context.getElementById( id );
  9646. return elem ? [ elem ] : [];
  9647. }
  9648. };
  9649. } else {
  9650. Expr.filter["ID"] = function( id ) {
  9651. var attrId = id.replace( runescape, funescape );
  9652. return function( elem ) {
  9653. var node = typeof elem.getAttributeNode !== "undefined" &&
  9654. elem.getAttributeNode("id");
  9655. return node && node.value === attrId;
  9656. };
  9657. };
  9658. // Support: IE 6 - 7 only
  9659. // getElementById is not reliable as a find shortcut
  9660. Expr.find["ID"] = function( id, context ) {
  9661. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9662. var node, i, elems,
  9663. elem = context.getElementById( id );
  9664. if ( elem ) {
  9665. // Verify the id attribute
  9666. node = elem.getAttributeNode("id");
  9667. if ( node && node.value === id ) {
  9668. return [ elem ];
  9669. }
  9670. // Fall back on getElementsByName
  9671. elems = context.getElementsByName( id );
  9672. i = 0;
  9673. while ( (elem = elems[i++]) ) {
  9674. node = elem.getAttributeNode("id");
  9675. if ( node && node.value === id ) {
  9676. return [ elem ];
  9677. }
  9678. }
  9679. }
  9680. return [];
  9681. }
  9682. };
  9683. }
  9684. // Tag
  9685. Expr.find["TAG"] = support.getElementsByTagName ?
  9686. function( tag, context ) {
  9687. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9688. return context.getElementsByTagName( tag );
  9689. // DocumentFragment nodes don't have gEBTN
  9690. } else if ( support.qsa ) {
  9691. return context.querySelectorAll( tag );
  9692. }
  9693. } :
  9694. function( tag, context ) {
  9695. var elem,
  9696. tmp = [],
  9697. i = 0,
  9698. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9699. results = context.getElementsByTagName( tag );
  9700. // Filter out possible comments
  9701. if ( tag === "*" ) {
  9702. while ( (elem = results[i++]) ) {
  9703. if ( elem.nodeType === 1 ) {
  9704. tmp.push( elem );
  9705. }
  9706. }
  9707. return tmp;
  9708. }
  9709. return results;
  9710. };
  9711. // Class
  9712. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9713. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9714. return context.getElementsByClassName( className );
  9715. }
  9716. };
  9717. /* QSA/matchesSelector
  9718. ---------------------------------------------------------------------- */
  9719. // QSA and matchesSelector support
  9720. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9721. rbuggyMatches = [];
  9722. // qSa(:focus) reports false when true (Chrome 21)
  9723. // We allow this because of a bug in IE8/9 that throws an error
  9724. // whenever `document.activeElement` is accessed on an iframe
  9725. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9726. // See https://bugs.jquery.com/ticket/13378
  9727. rbuggyQSA = [];
  9728. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9729. // Build QSA regex
  9730. // Regex strategy adopted from Diego Perini
  9731. assert(function( el ) {
  9732. // Select is set to empty string on purpose
  9733. // This is to test IE's treatment of not explicitly
  9734. // setting a boolean content attribute,
  9735. // since its presence should be enough
  9736. // https://bugs.jquery.com/ticket/12359
  9737. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9738. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9739. "<option selected=''></option></select>";
  9740. // Support: IE8, Opera 11-12.16
  9741. // Nothing should be selected when empty strings follow ^= or $= or *=
  9742. // The test attribute must be unknown in Opera but "safe" for WinRT
  9743. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9744. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9745. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9746. }
  9747. // Support: IE8
  9748. // Boolean attributes and "value" are not treated correctly
  9749. if ( !el.querySelectorAll("[selected]").length ) {
  9750. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9751. }
  9752. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9753. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9754. rbuggyQSA.push("~=");
  9755. }
  9756. // Webkit/Opera - :checked should return selected option elements
  9757. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9758. // IE8 throws error here and will not see later tests
  9759. if ( !el.querySelectorAll(":checked").length ) {
  9760. rbuggyQSA.push(":checked");
  9761. }
  9762. // Support: Safari 8+, iOS 8+
  9763. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9764. // In-page `selector#id sibling-combinator selector` fails
  9765. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9766. rbuggyQSA.push(".#.+[+~]");
  9767. }
  9768. });
  9769. assert(function( el ) {
  9770. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9771. "<select disabled='disabled'><option/></select>";
  9772. // Support: Windows 8 Native Apps
  9773. // The type and name attributes are restricted during .innerHTML assignment
  9774. var input = document.createElement("input");
  9775. input.setAttribute( "type", "hidden" );
  9776. el.appendChild( input ).setAttribute( "name", "D" );
  9777. // Support: IE8
  9778. // Enforce case-sensitivity of name attribute
  9779. if ( el.querySelectorAll("[name=d]").length ) {
  9780. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9781. }
  9782. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9783. // IE8 throws error here and will not see later tests
  9784. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9785. rbuggyQSA.push( ":enabled", ":disabled" );
  9786. }
  9787. // Support: IE9-11+
  9788. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9789. docElem.appendChild( el ).disabled = true;
  9790. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9791. rbuggyQSA.push( ":enabled", ":disabled" );
  9792. }
  9793. // Opera 10-11 does not throw on post-comma invalid pseudos
  9794. el.querySelectorAll("*,:x");
  9795. rbuggyQSA.push(",.*:");
  9796. });
  9797. }
  9798. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9799. docElem.webkitMatchesSelector ||
  9800. docElem.mozMatchesSelector ||
  9801. docElem.oMatchesSelector ||
  9802. docElem.msMatchesSelector) )) ) {
  9803. assert(function( el ) {
  9804. // Check to see if it's possible to do matchesSelector
  9805. // on a disconnected node (IE 9)
  9806. support.disconnectedMatch = matches.call( el, "*" );
  9807. // This should fail with an exception
  9808. // Gecko does not error, returns false instead
  9809. matches.call( el, "[s!='']:x" );
  9810. rbuggyMatches.push( "!=", pseudos );
  9811. });
  9812. }
  9813. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9814. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9815. /* Contains
  9816. ---------------------------------------------------------------------- */
  9817. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9818. // Element contains another
  9819. // Purposefully self-exclusive
  9820. // As in, an element does not contain itself
  9821. contains = hasCompare || rnative.test( docElem.contains ) ?
  9822. function( a, b ) {
  9823. var adown = a.nodeType === 9 ? a.documentElement : a,
  9824. bup = b && b.parentNode;
  9825. return a === bup || !!( bup && bup.nodeType === 1 && (
  9826. adown.contains ?
  9827. adown.contains( bup ) :
  9828. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9829. ));
  9830. } :
  9831. function( a, b ) {
  9832. if ( b ) {
  9833. while ( (b = b.parentNode) ) {
  9834. if ( b === a ) {
  9835. return true;
  9836. }
  9837. }
  9838. }
  9839. return false;
  9840. };
  9841. /* Sorting
  9842. ---------------------------------------------------------------------- */
  9843. // Document order sorting
  9844. sortOrder = hasCompare ?
  9845. function( a, b ) {
  9846. // Flag for duplicate removal
  9847. if ( a === b ) {
  9848. hasDuplicate = true;
  9849. return 0;
  9850. }
  9851. // Sort on method existence if only one input has compareDocumentPosition
  9852. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9853. if ( compare ) {
  9854. return compare;
  9855. }
  9856. // Calculate position if both inputs belong to the same document
  9857. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9858. a.compareDocumentPosition( b ) :
  9859. // Otherwise we know they are disconnected
  9860. 1;
  9861. // Disconnected nodes
  9862. if ( compare & 1 ||
  9863. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9864. // Choose the first element that is related to our preferred document
  9865. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9866. return -1;
  9867. }
  9868. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9869. return 1;
  9870. }
  9871. // Maintain original order
  9872. return sortInput ?
  9873. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9874. 0;
  9875. }
  9876. return compare & 4 ? -1 : 1;
  9877. } :
  9878. function( a, b ) {
  9879. // Exit early if the nodes are identical
  9880. if ( a === b ) {
  9881. hasDuplicate = true;
  9882. return 0;
  9883. }
  9884. var cur,
  9885. i = 0,
  9886. aup = a.parentNode,
  9887. bup = b.parentNode,
  9888. ap = [ a ],
  9889. bp = [ b ];
  9890. // Parentless nodes are either documents or disconnected
  9891. if ( !aup || !bup ) {
  9892. return a === document ? -1 :
  9893. b === document ? 1 :
  9894. aup ? -1 :
  9895. bup ? 1 :
  9896. sortInput ?
  9897. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9898. 0;
  9899. // If the nodes are siblings, we can do a quick check
  9900. } else if ( aup === bup ) {
  9901. return siblingCheck( a, b );
  9902. }
  9903. // Otherwise we need full lists of their ancestors for comparison
  9904. cur = a;
  9905. while ( (cur = cur.parentNode) ) {
  9906. ap.unshift( cur );
  9907. }
  9908. cur = b;
  9909. while ( (cur = cur.parentNode) ) {
  9910. bp.unshift( cur );
  9911. }
  9912. // Walk down the tree looking for a discrepancy
  9913. while ( ap[i] === bp[i] ) {
  9914. i++;
  9915. }
  9916. return i ?
  9917. // Do a sibling check if the nodes have a common ancestor
  9918. siblingCheck( ap[i], bp[i] ) :
  9919. // Otherwise nodes in our document sort first
  9920. ap[i] === preferredDoc ? -1 :
  9921. bp[i] === preferredDoc ? 1 :
  9922. 0;
  9923. };
  9924. return document;
  9925. };
  9926. Sizzle.matches = function( expr, elements ) {
  9927. return Sizzle( expr, null, null, elements );
  9928. };
  9929. Sizzle.matchesSelector = function( elem, expr ) {
  9930. // Set document vars if needed
  9931. if ( ( elem.ownerDocument || elem ) !== document ) {
  9932. setDocument( elem );
  9933. }
  9934. if ( support.matchesSelector && documentIsHTML &&
  9935. !nonnativeSelectorCache[ expr + " " ] &&
  9936. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9937. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9938. try {
  9939. var ret = matches.call( elem, expr );
  9940. // IE 9's matchesSelector returns false on disconnected nodes
  9941. if ( ret || support.disconnectedMatch ||
  9942. // As well, disconnected nodes are said to be in a document
  9943. // fragment in IE 9
  9944. elem.document && elem.document.nodeType !== 11 ) {
  9945. return ret;
  9946. }
  9947. } catch (e) {
  9948. nonnativeSelectorCache( expr, true );
  9949. }
  9950. }
  9951. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9952. };
  9953. Sizzle.contains = function( context, elem ) {
  9954. // Set document vars if needed
  9955. if ( ( context.ownerDocument || context ) !== document ) {
  9956. setDocument( context );
  9957. }
  9958. return contains( context, elem );
  9959. };
  9960. Sizzle.attr = function( elem, name ) {
  9961. // Set document vars if needed
  9962. if ( ( elem.ownerDocument || elem ) !== document ) {
  9963. setDocument( elem );
  9964. }
  9965. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9966. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9967. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9968. fn( elem, name, !documentIsHTML ) :
  9969. undefined;
  9970. return val !== undefined ?
  9971. val :
  9972. support.attributes || !documentIsHTML ?
  9973. elem.getAttribute( name ) :
  9974. (val = elem.getAttributeNode(name)) && val.specified ?
  9975. val.value :
  9976. null;
  9977. };
  9978. Sizzle.escape = function( sel ) {
  9979. return (sel + "").replace( rcssescape, fcssescape );
  9980. };
  9981. Sizzle.error = function( msg ) {
  9982. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9983. };
  9984. /**
  9985. * Document sorting and removing duplicates
  9986. * @param {ArrayLike} results
  9987. */
  9988. Sizzle.uniqueSort = function( results ) {
  9989. var elem,
  9990. duplicates = [],
  9991. j = 0,
  9992. i = 0;
  9993. // Unless we *know* we can detect duplicates, assume their presence
  9994. hasDuplicate = !support.detectDuplicates;
  9995. sortInput = !support.sortStable && results.slice( 0 );
  9996. results.sort( sortOrder );
  9997. if ( hasDuplicate ) {
  9998. while ( (elem = results[i++]) ) {
  9999. if ( elem === results[ i ] ) {
  10000. j = duplicates.push( i );
  10001. }
  10002. }
  10003. while ( j-- ) {
  10004. results.splice( duplicates[ j ], 1 );
  10005. }
  10006. }
  10007. // Clear input after sorting to release objects
  10008. // See https://github.com/jquery/sizzle/pull/225
  10009. sortInput = null;
  10010. return results;
  10011. };
  10012. /**
  10013. * Utility function for retrieving the text value of an array of DOM nodes
  10014. * @param {Array|Element} elem
  10015. */
  10016. getText = Sizzle.getText = function( elem ) {
  10017. var node,
  10018. ret = "",
  10019. i = 0,
  10020. nodeType = elem.nodeType;
  10021. if ( !nodeType ) {
  10022. // If no nodeType, this is expected to be an array
  10023. while ( (node = elem[i++]) ) {
  10024. // Do not traverse comment nodes
  10025. ret += getText( node );
  10026. }
  10027. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10028. // Use textContent for elements
  10029. // innerText usage removed for consistency of new lines (jQuery #11153)
  10030. if ( typeof elem.textContent === "string" ) {
  10031. return elem.textContent;
  10032. } else {
  10033. // Traverse its children
  10034. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10035. ret += getText( elem );
  10036. }
  10037. }
  10038. } else if ( nodeType === 3 || nodeType === 4 ) {
  10039. return elem.nodeValue;
  10040. }
  10041. // Do not include comment or processing instruction nodes
  10042. return ret;
  10043. };
  10044. Expr = Sizzle.selectors = {
  10045. // Can be adjusted by the user
  10046. cacheLength: 50,
  10047. createPseudo: markFunction,
  10048. match: matchExpr,
  10049. attrHandle: {},
  10050. find: {},
  10051. relative: {
  10052. ">": { dir: "parentNode", first: true },
  10053. " ": { dir: "parentNode" },
  10054. "+": { dir: "previousSibling", first: true },
  10055. "~": { dir: "previousSibling" }
  10056. },
  10057. preFilter: {
  10058. "ATTR": function( match ) {
  10059. match[1] = match[1].replace( runescape, funescape );
  10060. // Move the given value to match[3] whether quoted or unquoted
  10061. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10062. if ( match[2] === "~=" ) {
  10063. match[3] = " " + match[3] + " ";
  10064. }
  10065. return match.slice( 0, 4 );
  10066. },
  10067. "CHILD": function( match ) {
  10068. /* matches from matchExpr["CHILD"]
  10069. 1 type (only|nth|...)
  10070. 2 what (child|of-type)
  10071. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10072. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10073. 5 sign of xn-component
  10074. 6 x of xn-component
  10075. 7 sign of y-component
  10076. 8 y of y-component
  10077. */
  10078. match[1] = match[1].toLowerCase();
  10079. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10080. // nth-* requires argument
  10081. if ( !match[3] ) {
  10082. Sizzle.error( match[0] );
  10083. }
  10084. // numeric x and y parameters for Expr.filter.CHILD
  10085. // remember that false/true cast respectively to 0/1
  10086. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10087. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10088. // other types prohibit arguments
  10089. } else if ( match[3] ) {
  10090. Sizzle.error( match[0] );
  10091. }
  10092. return match;
  10093. },
  10094. "PSEUDO": function( match ) {
  10095. var excess,
  10096. unquoted = !match[6] && match[2];
  10097. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10098. return null;
  10099. }
  10100. // Accept quoted arguments as-is
  10101. if ( match[3] ) {
  10102. match[2] = match[4] || match[5] || "";
  10103. // Strip excess characters from unquoted arguments
  10104. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10105. // Get excess from tokenize (recursively)
  10106. (excess = tokenize( unquoted, true )) &&
  10107. // advance to the next closing parenthesis
  10108. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10109. // excess is a negative index
  10110. match[0] = match[0].slice( 0, excess );
  10111. match[2] = unquoted.slice( 0, excess );
  10112. }
  10113. // Return only captures needed by the pseudo filter method (type and argument)
  10114. return match.slice( 0, 3 );
  10115. }
  10116. },
  10117. filter: {
  10118. "TAG": function( nodeNameSelector ) {
  10119. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10120. return nodeNameSelector === "*" ?
  10121. function() { return true; } :
  10122. function( elem ) {
  10123. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10124. };
  10125. },
  10126. "CLASS": function( className ) {
  10127. var pattern = classCache[ className + " " ];
  10128. return pattern ||
  10129. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10130. classCache( className, function( elem ) {
  10131. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10132. });
  10133. },
  10134. "ATTR": function( name, operator, check ) {
  10135. return function( elem ) {
  10136. var result = Sizzle.attr( elem, name );
  10137. if ( result == null ) {
  10138. return operator === "!=";
  10139. }
  10140. if ( !operator ) {
  10141. return true;
  10142. }
  10143. result += "";
  10144. return operator === "=" ? result === check :
  10145. operator === "!=" ? result !== check :
  10146. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10147. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10148. operator === "$=" ? check && result.slice( -check.length ) === check :
  10149. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10150. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10151. false;
  10152. };
  10153. },
  10154. "CHILD": function( type, what, argument, first, last ) {
  10155. var simple = type.slice( 0, 3 ) !== "nth",
  10156. forward = type.slice( -4 ) !== "last",
  10157. ofType = what === "of-type";
  10158. return first === 1 && last === 0 ?
  10159. // Shortcut for :nth-*(n)
  10160. function( elem ) {
  10161. return !!elem.parentNode;
  10162. } :
  10163. function( elem, context, xml ) {
  10164. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10165. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10166. parent = elem.parentNode,
  10167. name = ofType && elem.nodeName.toLowerCase(),
  10168. useCache = !xml && !ofType,
  10169. diff = false;
  10170. if ( parent ) {
  10171. // :(first|last|only)-(child|of-type)
  10172. if ( simple ) {
  10173. while ( dir ) {
  10174. node = elem;
  10175. while ( (node = node[ dir ]) ) {
  10176. if ( ofType ?
  10177. node.nodeName.toLowerCase() === name :
  10178. node.nodeType === 1 ) {
  10179. return false;
  10180. }
  10181. }
  10182. // Reverse direction for :only-* (if we haven't yet done so)
  10183. start = dir = type === "only" && !start && "nextSibling";
  10184. }
  10185. return true;
  10186. }
  10187. start = [ forward ? parent.firstChild : parent.lastChild ];
  10188. // non-xml :nth-child(...) stores cache data on `parent`
  10189. if ( forward && useCache ) {
  10190. // Seek `elem` from a previously-cached index
  10191. // ...in a gzip-friendly way
  10192. node = parent;
  10193. outerCache = node[ expando ] || (node[ expando ] = {});
  10194. // Support: IE <9 only
  10195. // Defend against cloned attroperties (jQuery gh-1709)
  10196. uniqueCache = outerCache[ node.uniqueID ] ||
  10197. (outerCache[ node.uniqueID ] = {});
  10198. cache = uniqueCache[ type ] || [];
  10199. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10200. diff = nodeIndex && cache[ 2 ];
  10201. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10202. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10203. // Fallback to seeking `elem` from the start
  10204. (diff = nodeIndex = 0) || start.pop()) ) {
  10205. // When found, cache indexes on `parent` and break
  10206. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10207. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10208. break;
  10209. }
  10210. }
  10211. } else {
  10212. // Use previously-cached element index if available
  10213. if ( useCache ) {
  10214. // ...in a gzip-friendly way
  10215. node = elem;
  10216. outerCache = node[ expando ] || (node[ expando ] = {});
  10217. // Support: IE <9 only
  10218. // Defend against cloned attroperties (jQuery gh-1709)
  10219. uniqueCache = outerCache[ node.uniqueID ] ||
  10220. (outerCache[ node.uniqueID ] = {});
  10221. cache = uniqueCache[ type ] || [];
  10222. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10223. diff = nodeIndex;
  10224. }
  10225. // xml :nth-child(...)
  10226. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10227. if ( diff === false ) {
  10228. // Use the same loop as above to seek `elem` from the start
  10229. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10230. (diff = nodeIndex = 0) || start.pop()) ) {
  10231. if ( ( ofType ?
  10232. node.nodeName.toLowerCase() === name :
  10233. node.nodeType === 1 ) &&
  10234. ++diff ) {
  10235. // Cache the index of each encountered element
  10236. if ( useCache ) {
  10237. outerCache = node[ expando ] || (node[ expando ] = {});
  10238. // Support: IE <9 only
  10239. // Defend against cloned attroperties (jQuery gh-1709)
  10240. uniqueCache = outerCache[ node.uniqueID ] ||
  10241. (outerCache[ node.uniqueID ] = {});
  10242. uniqueCache[ type ] = [ dirruns, diff ];
  10243. }
  10244. if ( node === elem ) {
  10245. break;
  10246. }
  10247. }
  10248. }
  10249. }
  10250. }
  10251. // Incorporate the offset, then check against cycle size
  10252. diff -= last;
  10253. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10254. }
  10255. };
  10256. },
  10257. "PSEUDO": function( pseudo, argument ) {
  10258. // pseudo-class names are case-insensitive
  10259. // http://www.w3.org/TR/selectors/#pseudo-classes
  10260. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10261. // Remember that setFilters inherits from pseudos
  10262. var args,
  10263. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10264. Sizzle.error( "unsupported pseudo: " + pseudo );
  10265. // The user may use createPseudo to indicate that
  10266. // arguments are needed to create the filter function
  10267. // just as Sizzle does
  10268. if ( fn[ expando ] ) {
  10269. return fn( argument );
  10270. }
  10271. // But maintain support for old signatures
  10272. if ( fn.length > 1 ) {
  10273. args = [ pseudo, pseudo, "", argument ];
  10274. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10275. markFunction(function( seed, matches ) {
  10276. var idx,
  10277. matched = fn( seed, argument ),
  10278. i = matched.length;
  10279. while ( i-- ) {
  10280. idx = indexOf( seed, matched[i] );
  10281. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10282. }
  10283. }) :
  10284. function( elem ) {
  10285. return fn( elem, 0, args );
  10286. };
  10287. }
  10288. return fn;
  10289. }
  10290. },
  10291. pseudos: {
  10292. // Potentially complex pseudos
  10293. "not": markFunction(function( selector ) {
  10294. // Trim the selector passed to compile
  10295. // to avoid treating leading and trailing
  10296. // spaces as combinators
  10297. var input = [],
  10298. results = [],
  10299. matcher = compile( selector.replace( rtrim, "$1" ) );
  10300. return matcher[ expando ] ?
  10301. markFunction(function( seed, matches, context, xml ) {
  10302. var elem,
  10303. unmatched = matcher( seed, null, xml, [] ),
  10304. i = seed.length;
  10305. // Match elements unmatched by `matcher`
  10306. while ( i-- ) {
  10307. if ( (elem = unmatched[i]) ) {
  10308. seed[i] = !(matches[i] = elem);
  10309. }
  10310. }
  10311. }) :
  10312. function( elem, context, xml ) {
  10313. input[0] = elem;
  10314. matcher( input, null, xml, results );
  10315. // Don't keep the element (issue #299)
  10316. input[0] = null;
  10317. return !results.pop();
  10318. };
  10319. }),
  10320. "has": markFunction(function( selector ) {
  10321. return function( elem ) {
  10322. return Sizzle( selector, elem ).length > 0;
  10323. };
  10324. }),
  10325. "contains": markFunction(function( text ) {
  10326. text = text.replace( runescape, funescape );
  10327. return function( elem ) {
  10328. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10329. };
  10330. }),
  10331. // "Whether an element is represented by a :lang() selector
  10332. // is based solely on the element's language value
  10333. // being equal to the identifier C,
  10334. // or beginning with the identifier C immediately followed by "-".
  10335. // The matching of C against the element's language value is performed case-insensitively.
  10336. // The identifier C does not have to be a valid language name."
  10337. // http://www.w3.org/TR/selectors/#lang-pseudo
  10338. "lang": markFunction( function( lang ) {
  10339. // lang value must be a valid identifier
  10340. if ( !ridentifier.test(lang || "") ) {
  10341. Sizzle.error( "unsupported lang: " + lang );
  10342. }
  10343. lang = lang.replace( runescape, funescape ).toLowerCase();
  10344. return function( elem ) {
  10345. var elemLang;
  10346. do {
  10347. if ( (elemLang = documentIsHTML ?
  10348. elem.lang :
  10349. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10350. elemLang = elemLang.toLowerCase();
  10351. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10352. }
  10353. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10354. return false;
  10355. };
  10356. }),
  10357. // Miscellaneous
  10358. "target": function( elem ) {
  10359. var hash = window.location && window.location.hash;
  10360. return hash && hash.slice( 1 ) === elem.id;
  10361. },
  10362. "root": function( elem ) {
  10363. return elem === docElem;
  10364. },
  10365. "focus": function( elem ) {
  10366. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10367. },
  10368. // Boolean properties
  10369. "enabled": createDisabledPseudo( false ),
  10370. "disabled": createDisabledPseudo( true ),
  10371. "checked": function( elem ) {
  10372. // In CSS3, :checked should return both checked and selected elements
  10373. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10374. var nodeName = elem.nodeName.toLowerCase();
  10375. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10376. },
  10377. "selected": function( elem ) {
  10378. // Accessing this property makes selected-by-default
  10379. // options in Safari work properly
  10380. if ( elem.parentNode ) {
  10381. elem.parentNode.selectedIndex;
  10382. }
  10383. return elem.selected === true;
  10384. },
  10385. // Contents
  10386. "empty": function( elem ) {
  10387. // http://www.w3.org/TR/selectors/#empty-pseudo
  10388. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10389. // but not by others (comment: 8; processing instruction: 7; etc.)
  10390. // nodeType < 6 works because attributes (2) do not appear as children
  10391. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10392. if ( elem.nodeType < 6 ) {
  10393. return false;
  10394. }
  10395. }
  10396. return true;
  10397. },
  10398. "parent": function( elem ) {
  10399. return !Expr.pseudos["empty"]( elem );
  10400. },
  10401. // Element/input types
  10402. "header": function( elem ) {
  10403. return rheader.test( elem.nodeName );
  10404. },
  10405. "input": function( elem ) {
  10406. return rinputs.test( elem.nodeName );
  10407. },
  10408. "button": function( elem ) {
  10409. var name = elem.nodeName.toLowerCase();
  10410. return name === "input" && elem.type === "button" || name === "button";
  10411. },
  10412. "text": function( elem ) {
  10413. var attr;
  10414. return elem.nodeName.toLowerCase() === "input" &&
  10415. elem.type === "text" &&
  10416. // Support: IE<8
  10417. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10418. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10419. },
  10420. // Position-in-collection
  10421. "first": createPositionalPseudo(function() {
  10422. return [ 0 ];
  10423. }),
  10424. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10425. return [ length - 1 ];
  10426. }),
  10427. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10428. return [ argument < 0 ? argument + length : argument ];
  10429. }),
  10430. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10431. var i = 0;
  10432. for ( ; i < length; i += 2 ) {
  10433. matchIndexes.push( i );
  10434. }
  10435. return matchIndexes;
  10436. }),
  10437. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10438. var i = 1;
  10439. for ( ; i < length; i += 2 ) {
  10440. matchIndexes.push( i );
  10441. }
  10442. return matchIndexes;
  10443. }),
  10444. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10445. var i = argument < 0 ?
  10446. argument + length :
  10447. argument > length ?
  10448. length :
  10449. argument;
  10450. for ( ; --i >= 0; ) {
  10451. matchIndexes.push( i );
  10452. }
  10453. return matchIndexes;
  10454. }),
  10455. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10456. var i = argument < 0 ? argument + length : argument;
  10457. for ( ; ++i < length; ) {
  10458. matchIndexes.push( i );
  10459. }
  10460. return matchIndexes;
  10461. })
  10462. }
  10463. };
  10464. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10465. // Add button/input type pseudos
  10466. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10467. Expr.pseudos[ i ] = createInputPseudo( i );
  10468. }
  10469. for ( i in { submit: true, reset: true } ) {
  10470. Expr.pseudos[ i ] = createButtonPseudo( i );
  10471. }
  10472. // Easy API for creating new setFilters
  10473. function setFilters() {}
  10474. setFilters.prototype = Expr.filters = Expr.pseudos;
  10475. Expr.setFilters = new setFilters();
  10476. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10477. var matched, match, tokens, type,
  10478. soFar, groups, preFilters,
  10479. cached = tokenCache[ selector + " " ];
  10480. if ( cached ) {
  10481. return parseOnly ? 0 : cached.slice( 0 );
  10482. }
  10483. soFar = selector;
  10484. groups = [];
  10485. preFilters = Expr.preFilter;
  10486. while ( soFar ) {
  10487. // Comma and first run
  10488. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10489. if ( match ) {
  10490. // Don't consume trailing commas as valid
  10491. soFar = soFar.slice( match[0].length ) || soFar;
  10492. }
  10493. groups.push( (tokens = []) );
  10494. }
  10495. matched = false;
  10496. // Combinators
  10497. if ( (match = rcombinators.exec( soFar )) ) {
  10498. matched = match.shift();
  10499. tokens.push({
  10500. value: matched,
  10501. // Cast descendant combinators to space
  10502. type: match[0].replace( rtrim, " " )
  10503. });
  10504. soFar = soFar.slice( matched.length );
  10505. }
  10506. // Filters
  10507. for ( type in Expr.filter ) {
  10508. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10509. (match = preFilters[ type ]( match ))) ) {
  10510. matched = match.shift();
  10511. tokens.push({
  10512. value: matched,
  10513. type: type,
  10514. matches: match
  10515. });
  10516. soFar = soFar.slice( matched.length );
  10517. }
  10518. }
  10519. if ( !matched ) {
  10520. break;
  10521. }
  10522. }
  10523. // Return the length of the invalid excess
  10524. // if we're just parsing
  10525. // Otherwise, throw an error or return tokens
  10526. return parseOnly ?
  10527. soFar.length :
  10528. soFar ?
  10529. Sizzle.error( selector ) :
  10530. // Cache the tokens
  10531. tokenCache( selector, groups ).slice( 0 );
  10532. };
  10533. function toSelector( tokens ) {
  10534. var i = 0,
  10535. len = tokens.length,
  10536. selector = "";
  10537. for ( ; i < len; i++ ) {
  10538. selector += tokens[i].value;
  10539. }
  10540. return selector;
  10541. }
  10542. function addCombinator( matcher, combinator, base ) {
  10543. var dir = combinator.dir,
  10544. skip = combinator.next,
  10545. key = skip || dir,
  10546. checkNonElements = base && key === "parentNode",
  10547. doneName = done++;
  10548. return combinator.first ?
  10549. // Check against closest ancestor/preceding element
  10550. function( elem, context, xml ) {
  10551. while ( (elem = elem[ dir ]) ) {
  10552. if ( elem.nodeType === 1 || checkNonElements ) {
  10553. return matcher( elem, context, xml );
  10554. }
  10555. }
  10556. return false;
  10557. } :
  10558. // Check against all ancestor/preceding elements
  10559. function( elem, context, xml ) {
  10560. var oldCache, uniqueCache, outerCache,
  10561. newCache = [ dirruns, doneName ];
  10562. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10563. if ( xml ) {
  10564. while ( (elem = elem[ dir ]) ) {
  10565. if ( elem.nodeType === 1 || checkNonElements ) {
  10566. if ( matcher( elem, context, xml ) ) {
  10567. return true;
  10568. }
  10569. }
  10570. }
  10571. } else {
  10572. while ( (elem = elem[ dir ]) ) {
  10573. if ( elem.nodeType === 1 || checkNonElements ) {
  10574. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10575. // Support: IE <9 only
  10576. // Defend against cloned attroperties (jQuery gh-1709)
  10577. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10578. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10579. elem = elem[ dir ] || elem;
  10580. } else if ( (oldCache = uniqueCache[ key ]) &&
  10581. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10582. // Assign to newCache so results back-propagate to previous elements
  10583. return (newCache[ 2 ] = oldCache[ 2 ]);
  10584. } else {
  10585. // Reuse newcache so results back-propagate to previous elements
  10586. uniqueCache[ key ] = newCache;
  10587. // A match means we're done; a fail means we have to keep checking
  10588. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10589. return true;
  10590. }
  10591. }
  10592. }
  10593. }
  10594. }
  10595. return false;
  10596. };
  10597. }
  10598. function elementMatcher( matchers ) {
  10599. return matchers.length > 1 ?
  10600. function( elem, context, xml ) {
  10601. var i = matchers.length;
  10602. while ( i-- ) {
  10603. if ( !matchers[i]( elem, context, xml ) ) {
  10604. return false;
  10605. }
  10606. }
  10607. return true;
  10608. } :
  10609. matchers[0];
  10610. }
  10611. function multipleContexts( selector, contexts, results ) {
  10612. var i = 0,
  10613. len = contexts.length;
  10614. for ( ; i < len; i++ ) {
  10615. Sizzle( selector, contexts[i], results );
  10616. }
  10617. return results;
  10618. }
  10619. function condense( unmatched, map, filter, context, xml ) {
  10620. var elem,
  10621. newUnmatched = [],
  10622. i = 0,
  10623. len = unmatched.length,
  10624. mapped = map != null;
  10625. for ( ; i < len; i++ ) {
  10626. if ( (elem = unmatched[i]) ) {
  10627. if ( !filter || filter( elem, context, xml ) ) {
  10628. newUnmatched.push( elem );
  10629. if ( mapped ) {
  10630. map.push( i );
  10631. }
  10632. }
  10633. }
  10634. }
  10635. return newUnmatched;
  10636. }
  10637. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10638. if ( postFilter && !postFilter[ expando ] ) {
  10639. postFilter = setMatcher( postFilter );
  10640. }
  10641. if ( postFinder && !postFinder[ expando ] ) {
  10642. postFinder = setMatcher( postFinder, postSelector );
  10643. }
  10644. return markFunction(function( seed, results, context, xml ) {
  10645. var temp, i, elem,
  10646. preMap = [],
  10647. postMap = [],
  10648. preexisting = results.length,
  10649. // Get initial elements from seed or context
  10650. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10651. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10652. matcherIn = preFilter && ( seed || !selector ) ?
  10653. condense( elems, preMap, preFilter, context, xml ) :
  10654. elems,
  10655. matcherOut = matcher ?
  10656. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10657. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10658. // ...intermediate processing is necessary
  10659. [] :
  10660. // ...otherwise use results directly
  10661. results :
  10662. matcherIn;
  10663. // Find primary matches
  10664. if ( matcher ) {
  10665. matcher( matcherIn, matcherOut, context, xml );
  10666. }
  10667. // Apply postFilter
  10668. if ( postFilter ) {
  10669. temp = condense( matcherOut, postMap );
  10670. postFilter( temp, [], context, xml );
  10671. // Un-match failing elements by moving them back to matcherIn
  10672. i = temp.length;
  10673. while ( i-- ) {
  10674. if ( (elem = temp[i]) ) {
  10675. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10676. }
  10677. }
  10678. }
  10679. if ( seed ) {
  10680. if ( postFinder || preFilter ) {
  10681. if ( postFinder ) {
  10682. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10683. temp = [];
  10684. i = matcherOut.length;
  10685. while ( i-- ) {
  10686. if ( (elem = matcherOut[i]) ) {
  10687. // Restore matcherIn since elem is not yet a final match
  10688. temp.push( (matcherIn[i] = elem) );
  10689. }
  10690. }
  10691. postFinder( null, (matcherOut = []), temp, xml );
  10692. }
  10693. // Move matched elements from seed to results to keep them synchronized
  10694. i = matcherOut.length;
  10695. while ( i-- ) {
  10696. if ( (elem = matcherOut[i]) &&
  10697. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10698. seed[temp] = !(results[temp] = elem);
  10699. }
  10700. }
  10701. }
  10702. // Add elements to results, through postFinder if defined
  10703. } else {
  10704. matcherOut = condense(
  10705. matcherOut === results ?
  10706. matcherOut.splice( preexisting, matcherOut.length ) :
  10707. matcherOut
  10708. );
  10709. if ( postFinder ) {
  10710. postFinder( null, results, matcherOut, xml );
  10711. } else {
  10712. push.apply( results, matcherOut );
  10713. }
  10714. }
  10715. });
  10716. }
  10717. function matcherFromTokens( tokens ) {
  10718. var checkContext, matcher, j,
  10719. len = tokens.length,
  10720. leadingRelative = Expr.relative[ tokens[0].type ],
  10721. implicitRelative = leadingRelative || Expr.relative[" "],
  10722. i = leadingRelative ? 1 : 0,
  10723. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10724. matchContext = addCombinator( function( elem ) {
  10725. return elem === checkContext;
  10726. }, implicitRelative, true ),
  10727. matchAnyContext = addCombinator( function( elem ) {
  10728. return indexOf( checkContext, elem ) > -1;
  10729. }, implicitRelative, true ),
  10730. matchers = [ function( elem, context, xml ) {
  10731. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10732. (checkContext = context).nodeType ?
  10733. matchContext( elem, context, xml ) :
  10734. matchAnyContext( elem, context, xml ) );
  10735. // Avoid hanging onto element (issue #299)
  10736. checkContext = null;
  10737. return ret;
  10738. } ];
  10739. for ( ; i < len; i++ ) {
  10740. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10741. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10742. } else {
  10743. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10744. // Return special upon seeing a positional matcher
  10745. if ( matcher[ expando ] ) {
  10746. // Find the next relative operator (if any) for proper handling
  10747. j = ++i;
  10748. for ( ; j < len; j++ ) {
  10749. if ( Expr.relative[ tokens[j].type ] ) {
  10750. break;
  10751. }
  10752. }
  10753. return setMatcher(
  10754. i > 1 && elementMatcher( matchers ),
  10755. i > 1 && toSelector(
  10756. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10757. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10758. ).replace( rtrim, "$1" ),
  10759. matcher,
  10760. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10761. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10762. j < len && toSelector( tokens )
  10763. );
  10764. }
  10765. matchers.push( matcher );
  10766. }
  10767. }
  10768. return elementMatcher( matchers );
  10769. }
  10770. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10771. var bySet = setMatchers.length > 0,
  10772. byElement = elementMatchers.length > 0,
  10773. superMatcher = function( seed, context, xml, results, outermost ) {
  10774. var elem, j, matcher,
  10775. matchedCount = 0,
  10776. i = "0",
  10777. unmatched = seed && [],
  10778. setMatched = [],
  10779. contextBackup = outermostContext,
  10780. // We must always have either seed elements or outermost context
  10781. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10782. // Use integer dirruns iff this is the outermost matcher
  10783. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10784. len = elems.length;
  10785. if ( outermost ) {
  10786. outermostContext = context === document || context || outermost;
  10787. }
  10788. // Add elements passing elementMatchers directly to results
  10789. // Support: IE<9, Safari
  10790. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10791. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10792. if ( byElement && elem ) {
  10793. j = 0;
  10794. if ( !context && elem.ownerDocument !== document ) {
  10795. setDocument( elem );
  10796. xml = !documentIsHTML;
  10797. }
  10798. while ( (matcher = elementMatchers[j++]) ) {
  10799. if ( matcher( elem, context || document, xml) ) {
  10800. results.push( elem );
  10801. break;
  10802. }
  10803. }
  10804. if ( outermost ) {
  10805. dirruns = dirrunsUnique;
  10806. }
  10807. }
  10808. // Track unmatched elements for set filters
  10809. if ( bySet ) {
  10810. // They will have gone through all possible matchers
  10811. if ( (elem = !matcher && elem) ) {
  10812. matchedCount--;
  10813. }
  10814. // Lengthen the array for every element, matched or not
  10815. if ( seed ) {
  10816. unmatched.push( elem );
  10817. }
  10818. }
  10819. }
  10820. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10821. // makes the latter nonnegative.
  10822. matchedCount += i;
  10823. // Apply set filters to unmatched elements
  10824. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10825. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10826. // no element matchers and no seed.
  10827. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10828. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10829. // numerically zero.
  10830. if ( bySet && i !== matchedCount ) {
  10831. j = 0;
  10832. while ( (matcher = setMatchers[j++]) ) {
  10833. matcher( unmatched, setMatched, context, xml );
  10834. }
  10835. if ( seed ) {
  10836. // Reintegrate element matches to eliminate the need for sorting
  10837. if ( matchedCount > 0 ) {
  10838. while ( i-- ) {
  10839. if ( !(unmatched[i] || setMatched[i]) ) {
  10840. setMatched[i] = pop.call( results );
  10841. }
  10842. }
  10843. }
  10844. // Discard index placeholder values to get only actual matches
  10845. setMatched = condense( setMatched );
  10846. }
  10847. // Add matches to results
  10848. push.apply( results, setMatched );
  10849. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10850. if ( outermost && !seed && setMatched.length > 0 &&
  10851. ( matchedCount + setMatchers.length ) > 1 ) {
  10852. Sizzle.uniqueSort( results );
  10853. }
  10854. }
  10855. // Override manipulation of globals by nested matchers
  10856. if ( outermost ) {
  10857. dirruns = dirrunsUnique;
  10858. outermostContext = contextBackup;
  10859. }
  10860. return unmatched;
  10861. };
  10862. return bySet ?
  10863. markFunction( superMatcher ) :
  10864. superMatcher;
  10865. }
  10866. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10867. var i,
  10868. setMatchers = [],
  10869. elementMatchers = [],
  10870. cached = compilerCache[ selector + " " ];
  10871. if ( !cached ) {
  10872. // Generate a function of recursive functions that can be used to check each element
  10873. if ( !match ) {
  10874. match = tokenize( selector );
  10875. }
  10876. i = match.length;
  10877. while ( i-- ) {
  10878. cached = matcherFromTokens( match[i] );
  10879. if ( cached[ expando ] ) {
  10880. setMatchers.push( cached );
  10881. } else {
  10882. elementMatchers.push( cached );
  10883. }
  10884. }
  10885. // Cache the compiled function
  10886. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10887. // Save selector and tokenization
  10888. cached.selector = selector;
  10889. }
  10890. return cached;
  10891. };
  10892. /**
  10893. * A low-level selection function that works with Sizzle's compiled
  10894. * selector functions
  10895. * @param {String|Function} selector A selector or a pre-compiled
  10896. * selector function built with Sizzle.compile
  10897. * @param {Element} context
  10898. * @param {Array} [results]
  10899. * @param {Array} [seed] A set of elements to match against
  10900. */
  10901. select = Sizzle.select = function( selector, context, results, seed ) {
  10902. var i, tokens, token, type, find,
  10903. compiled = typeof selector === "function" && selector,
  10904. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10905. results = results || [];
  10906. // Try to minimize operations if there is only one selector in the list and no seed
  10907. // (the latter of which guarantees us context)
  10908. if ( match.length === 1 ) {
  10909. // Reduce context if the leading compound selector is an ID
  10910. tokens = match[0] = match[0].slice( 0 );
  10911. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10912. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10913. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10914. if ( !context ) {
  10915. return results;
  10916. // Precompiled matchers will still verify ancestry, so step up a level
  10917. } else if ( compiled ) {
  10918. context = context.parentNode;
  10919. }
  10920. selector = selector.slice( tokens.shift().value.length );
  10921. }
  10922. // Fetch a seed set for right-to-left matching
  10923. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10924. while ( i-- ) {
  10925. token = tokens[i];
  10926. // Abort if we hit a combinator
  10927. if ( Expr.relative[ (type = token.type) ] ) {
  10928. break;
  10929. }
  10930. if ( (find = Expr.find[ type ]) ) {
  10931. // Search, expanding context for leading sibling combinators
  10932. if ( (seed = find(
  10933. token.matches[0].replace( runescape, funescape ),
  10934. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10935. )) ) {
  10936. // If seed is empty or no tokens remain, we can return early
  10937. tokens.splice( i, 1 );
  10938. selector = seed.length && toSelector( tokens );
  10939. if ( !selector ) {
  10940. push.apply( results, seed );
  10941. return results;
  10942. }
  10943. break;
  10944. }
  10945. }
  10946. }
  10947. }
  10948. // Compile and execute a filtering function if one is not provided
  10949. // Provide `match` to avoid retokenization if we modified the selector above
  10950. ( compiled || compile( selector, match ) )(
  10951. seed,
  10952. context,
  10953. !documentIsHTML,
  10954. results,
  10955. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10956. );
  10957. return results;
  10958. };
  10959. // One-time assignments
  10960. // Sort stability
  10961. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10962. // Support: Chrome 14-35+
  10963. // Always assume duplicates if they aren't passed to the comparison function
  10964. support.detectDuplicates = !!hasDuplicate;
  10965. // Initialize against the default document
  10966. setDocument();
  10967. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10968. // Detached nodes confoundingly follow *each other*
  10969. support.sortDetached = assert(function( el ) {
  10970. // Should return 1, but returns 4 (following)
  10971. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10972. });
  10973. // Support: IE<8
  10974. // Prevent attribute/property "interpolation"
  10975. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10976. if ( !assert(function( el ) {
  10977. el.innerHTML = "<a href='#'></a>";
  10978. return el.firstChild.getAttribute("href") === "#" ;
  10979. }) ) {
  10980. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10981. if ( !isXML ) {
  10982. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10983. }
  10984. });
  10985. }
  10986. // Support: IE<9
  10987. // Use defaultValue in place of getAttribute("value")
  10988. if ( !support.attributes || !assert(function( el ) {
  10989. el.innerHTML = "<input/>";
  10990. el.firstChild.setAttribute( "value", "" );
  10991. return el.firstChild.getAttribute( "value" ) === "";
  10992. }) ) {
  10993. addHandle( "value", function( elem, name, isXML ) {
  10994. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10995. return elem.defaultValue;
  10996. }
  10997. });
  10998. }
  10999. // Support: IE<9
  11000. // Use getAttributeNode to fetch booleans when getAttribute lies
  11001. if ( !assert(function( el ) {
  11002. return el.getAttribute("disabled") == null;
  11003. }) ) {
  11004. addHandle( booleans, function( elem, name, isXML ) {
  11005. var val;
  11006. if ( !isXML ) {
  11007. return elem[ name ] === true ? name.toLowerCase() :
  11008. (val = elem.getAttributeNode( name )) && val.specified ?
  11009. val.value :
  11010. null;
  11011. }
  11012. });
  11013. }
  11014. return Sizzle;
  11015. })( window );
  11016. jQuery.find = Sizzle;
  11017. jQuery.expr = Sizzle.selectors;
  11018. // Deprecated
  11019. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11020. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11021. jQuery.text = Sizzle.getText;
  11022. jQuery.isXMLDoc = Sizzle.isXML;
  11023. jQuery.contains = Sizzle.contains;
  11024. jQuery.escapeSelector = Sizzle.escape;
  11025. var dir = function( elem, dir, until ) {
  11026. var matched = [],
  11027. truncate = until !== undefined;
  11028. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11029. if ( elem.nodeType === 1 ) {
  11030. if ( truncate && jQuery( elem ).is( until ) ) {
  11031. break;
  11032. }
  11033. matched.push( elem );
  11034. }
  11035. }
  11036. return matched;
  11037. };
  11038. var siblings = function( n, elem ) {
  11039. var matched = [];
  11040. for ( ; n; n = n.nextSibling ) {
  11041. if ( n.nodeType === 1 && n !== elem ) {
  11042. matched.push( n );
  11043. }
  11044. }
  11045. return matched;
  11046. };
  11047. var rneedsContext = jQuery.expr.match.needsContext;
  11048. function nodeName( elem, name ) {
  11049. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11050. };
  11051. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11052. // Implement the identical functionality for filter and not
  11053. function winnow( elements, qualifier, not ) {
  11054. if ( isFunction( qualifier ) ) {
  11055. return jQuery.grep( elements, function( elem, i ) {
  11056. return !!qualifier.call( elem, i, elem ) !== not;
  11057. } );
  11058. }
  11059. // Single element
  11060. if ( qualifier.nodeType ) {
  11061. return jQuery.grep( elements, function( elem ) {
  11062. return ( elem === qualifier ) !== not;
  11063. } );
  11064. }
  11065. // Arraylike of elements (jQuery, arguments, Array)
  11066. if ( typeof qualifier !== "string" ) {
  11067. return jQuery.grep( elements, function( elem ) {
  11068. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11069. } );
  11070. }
  11071. // Filtered directly for both simple and complex selectors
  11072. return jQuery.filter( qualifier, elements, not );
  11073. }
  11074. jQuery.filter = function( expr, elems, not ) {
  11075. var elem = elems[ 0 ];
  11076. if ( not ) {
  11077. expr = ":not(" + expr + ")";
  11078. }
  11079. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11080. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11081. }
  11082. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11083. return elem.nodeType === 1;
  11084. } ) );
  11085. };
  11086. jQuery.fn.extend( {
  11087. find: function( selector ) {
  11088. var i, ret,
  11089. len = this.length,
  11090. self = this;
  11091. if ( typeof selector !== "string" ) {
  11092. return this.pushStack( jQuery( selector ).filter( function() {
  11093. for ( i = 0; i < len; i++ ) {
  11094. if ( jQuery.contains( self[ i ], this ) ) {
  11095. return true;
  11096. }
  11097. }
  11098. } ) );
  11099. }
  11100. ret = this.pushStack( [] );
  11101. for ( i = 0; i < len; i++ ) {
  11102. jQuery.find( selector, self[ i ], ret );
  11103. }
  11104. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11105. },
  11106. filter: function( selector ) {
  11107. return this.pushStack( winnow( this, selector || [], false ) );
  11108. },
  11109. not: function( selector ) {
  11110. return this.pushStack( winnow( this, selector || [], true ) );
  11111. },
  11112. is: function( selector ) {
  11113. return !!winnow(
  11114. this,
  11115. // If this is a positional/relative selector, check membership in the returned set
  11116. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11117. typeof selector === "string" && rneedsContext.test( selector ) ?
  11118. jQuery( selector ) :
  11119. selector || [],
  11120. false
  11121. ).length;
  11122. }
  11123. } );
  11124. // Initialize a jQuery object
  11125. // A central reference to the root jQuery(document)
  11126. var rootjQuery,
  11127. // A simple way to check for HTML strings
  11128. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11129. // Strict HTML recognition (#11290: must start with <)
  11130. // Shortcut simple #id case for speed
  11131. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11132. init = jQuery.fn.init = function( selector, context, root ) {
  11133. var match, elem;
  11134. // HANDLE: $(""), $(null), $(undefined), $(false)
  11135. if ( !selector ) {
  11136. return this;
  11137. }
  11138. // Method init() accepts an alternate rootjQuery
  11139. // so migrate can support jQuery.sub (gh-2101)
  11140. root = root || rootjQuery;
  11141. // Handle HTML strings
  11142. if ( typeof selector === "string" ) {
  11143. if ( selector[ 0 ] === "<" &&
  11144. selector[ selector.length - 1 ] === ">" &&
  11145. selector.length >= 3 ) {
  11146. // Assume that strings that start and end with <> are HTML and skip the regex check
  11147. match = [ null, selector, null ];
  11148. } else {
  11149. match = rquickExpr.exec( selector );
  11150. }
  11151. // Match html or make sure no context is specified for #id
  11152. if ( match && ( match[ 1 ] || !context ) ) {
  11153. // HANDLE: $(html) -> $(array)
  11154. if ( match[ 1 ] ) {
  11155. context = context instanceof jQuery ? context[ 0 ] : context;
  11156. // Option to run scripts is true for back-compat
  11157. // Intentionally let the error be thrown if parseHTML is not present
  11158. jQuery.merge( this, jQuery.parseHTML(
  11159. match[ 1 ],
  11160. context && context.nodeType ? context.ownerDocument || context : document,
  11161. true
  11162. ) );
  11163. // HANDLE: $(html, props)
  11164. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11165. for ( match in context ) {
  11166. // Properties of context are called as methods if possible
  11167. if ( isFunction( this[ match ] ) ) {
  11168. this[ match ]( context[ match ] );
  11169. // ...and otherwise set as attributes
  11170. } else {
  11171. this.attr( match, context[ match ] );
  11172. }
  11173. }
  11174. }
  11175. return this;
  11176. // HANDLE: $(#id)
  11177. } else {
  11178. elem = document.getElementById( match[ 2 ] );
  11179. if ( elem ) {
  11180. // Inject the element directly into the jQuery object
  11181. this[ 0 ] = elem;
  11182. this.length = 1;
  11183. }
  11184. return this;
  11185. }
  11186. // HANDLE: $(expr, $(...))
  11187. } else if ( !context || context.jquery ) {
  11188. return ( context || root ).find( selector );
  11189. // HANDLE: $(expr, context)
  11190. // (which is just equivalent to: $(context).find(expr)
  11191. } else {
  11192. return this.constructor( context ).find( selector );
  11193. }
  11194. // HANDLE: $(DOMElement)
  11195. } else if ( selector.nodeType ) {
  11196. this[ 0 ] = selector;
  11197. this.length = 1;
  11198. return this;
  11199. // HANDLE: $(function)
  11200. // Shortcut for document ready
  11201. } else if ( isFunction( selector ) ) {
  11202. return root.ready !== undefined ?
  11203. root.ready( selector ) :
  11204. // Execute immediately if ready is not present
  11205. selector( jQuery );
  11206. }
  11207. return jQuery.makeArray( selector, this );
  11208. };
  11209. // Give the init function the jQuery prototype for later instantiation
  11210. init.prototype = jQuery.fn;
  11211. // Initialize central reference
  11212. rootjQuery = jQuery( document );
  11213. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11214. // Methods guaranteed to produce a unique set when starting from a unique set
  11215. guaranteedUnique = {
  11216. children: true,
  11217. contents: true,
  11218. next: true,
  11219. prev: true
  11220. };
  11221. jQuery.fn.extend( {
  11222. has: function( target ) {
  11223. var targets = jQuery( target, this ),
  11224. l = targets.length;
  11225. return this.filter( function() {
  11226. var i = 0;
  11227. for ( ; i < l; i++ ) {
  11228. if ( jQuery.contains( this, targets[ i ] ) ) {
  11229. return true;
  11230. }
  11231. }
  11232. } );
  11233. },
  11234. closest: function( selectors, context ) {
  11235. var cur,
  11236. i = 0,
  11237. l = this.length,
  11238. matched = [],
  11239. targets = typeof selectors !== "string" && jQuery( selectors );
  11240. // Positional selectors never match, since there's no _selection_ context
  11241. if ( !rneedsContext.test( selectors ) ) {
  11242. for ( ; i < l; i++ ) {
  11243. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11244. // Always skip document fragments
  11245. if ( cur.nodeType < 11 && ( targets ?
  11246. targets.index( cur ) > -1 :
  11247. // Don't pass non-elements to Sizzle
  11248. cur.nodeType === 1 &&
  11249. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11250. matched.push( cur );
  11251. break;
  11252. }
  11253. }
  11254. }
  11255. }
  11256. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11257. },
  11258. // Determine the position of an element within the set
  11259. index: function( elem ) {
  11260. // No argument, return index in parent
  11261. if ( !elem ) {
  11262. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11263. }
  11264. // Index in selector
  11265. if ( typeof elem === "string" ) {
  11266. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11267. }
  11268. // Locate the position of the desired element
  11269. return indexOf.call( this,
  11270. // If it receives a jQuery object, the first element is used
  11271. elem.jquery ? elem[ 0 ] : elem
  11272. );
  11273. },
  11274. add: function( selector, context ) {
  11275. return this.pushStack(
  11276. jQuery.uniqueSort(
  11277. jQuery.merge( this.get(), jQuery( selector, context ) )
  11278. )
  11279. );
  11280. },
  11281. addBack: function( selector ) {
  11282. return this.add( selector == null ?
  11283. this.prevObject : this.prevObject.filter( selector )
  11284. );
  11285. }
  11286. } );
  11287. function sibling( cur, dir ) {
  11288. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11289. return cur;
  11290. }
  11291. jQuery.each( {
  11292. parent: function( elem ) {
  11293. var parent = elem.parentNode;
  11294. return parent && parent.nodeType !== 11 ? parent : null;
  11295. },
  11296. parents: function( elem ) {
  11297. return dir( elem, "parentNode" );
  11298. },
  11299. parentsUntil: function( elem, i, until ) {
  11300. return dir( elem, "parentNode", until );
  11301. },
  11302. next: function( elem ) {
  11303. return sibling( elem, "nextSibling" );
  11304. },
  11305. prev: function( elem ) {
  11306. return sibling( elem, "previousSibling" );
  11307. },
  11308. nextAll: function( elem ) {
  11309. return dir( elem, "nextSibling" );
  11310. },
  11311. prevAll: function( elem ) {
  11312. return dir( elem, "previousSibling" );
  11313. },
  11314. nextUntil: function( elem, i, until ) {
  11315. return dir( elem, "nextSibling", until );
  11316. },
  11317. prevUntil: function( elem, i, until ) {
  11318. return dir( elem, "previousSibling", until );
  11319. },
  11320. siblings: function( elem ) {
  11321. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11322. },
  11323. children: function( elem ) {
  11324. return siblings( elem.firstChild );
  11325. },
  11326. contents: function( elem ) {
  11327. if ( typeof elem.contentDocument !== "undefined" ) {
  11328. return elem.contentDocument;
  11329. }
  11330. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11331. // Treat the template element as a regular one in browsers that
  11332. // don't support it.
  11333. if ( nodeName( elem, "template" ) ) {
  11334. elem = elem.content || elem;
  11335. }
  11336. return jQuery.merge( [], elem.childNodes );
  11337. }
  11338. }, function( name, fn ) {
  11339. jQuery.fn[ name ] = function( until, selector ) {
  11340. var matched = jQuery.map( this, fn, until );
  11341. if ( name.slice( -5 ) !== "Until" ) {
  11342. selector = until;
  11343. }
  11344. if ( selector && typeof selector === "string" ) {
  11345. matched = jQuery.filter( selector, matched );
  11346. }
  11347. if ( this.length > 1 ) {
  11348. // Remove duplicates
  11349. if ( !guaranteedUnique[ name ] ) {
  11350. jQuery.uniqueSort( matched );
  11351. }
  11352. // Reverse order for parents* and prev-derivatives
  11353. if ( rparentsprev.test( name ) ) {
  11354. matched.reverse();
  11355. }
  11356. }
  11357. return this.pushStack( matched );
  11358. };
  11359. } );
  11360. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11361. // Convert String-formatted options into Object-formatted ones
  11362. function createOptions( options ) {
  11363. var object = {};
  11364. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11365. object[ flag ] = true;
  11366. } );
  11367. return object;
  11368. }
  11369. /*
  11370. * Create a callback list using the following parameters:
  11371. *
  11372. * options: an optional list of space-separated options that will change how
  11373. * the callback list behaves or a more traditional option object
  11374. *
  11375. * By default a callback list will act like an event callback list and can be
  11376. * "fired" multiple times.
  11377. *
  11378. * Possible options:
  11379. *
  11380. * once: will ensure the callback list can only be fired once (like a Deferred)
  11381. *
  11382. * memory: will keep track of previous values and will call any callback added
  11383. * after the list has been fired right away with the latest "memorized"
  11384. * values (like a Deferred)
  11385. *
  11386. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11387. *
  11388. * stopOnFalse: interrupt callings when a callback returns false
  11389. *
  11390. */
  11391. jQuery.Callbacks = function( options ) {
  11392. // Convert options from String-formatted to Object-formatted if needed
  11393. // (we check in cache first)
  11394. options = typeof options === "string" ?
  11395. createOptions( options ) :
  11396. jQuery.extend( {}, options );
  11397. var // Flag to know if list is currently firing
  11398. firing,
  11399. // Last fire value for non-forgettable lists
  11400. memory,
  11401. // Flag to know if list was already fired
  11402. fired,
  11403. // Flag to prevent firing
  11404. locked,
  11405. // Actual callback list
  11406. list = [],
  11407. // Queue of execution data for repeatable lists
  11408. queue = [],
  11409. // Index of currently firing callback (modified by add/remove as needed)
  11410. firingIndex = -1,
  11411. // Fire callbacks
  11412. fire = function() {
  11413. // Enforce single-firing
  11414. locked = locked || options.once;
  11415. // Execute callbacks for all pending executions,
  11416. // respecting firingIndex overrides and runtime changes
  11417. fired = firing = true;
  11418. for ( ; queue.length; firingIndex = -1 ) {
  11419. memory = queue.shift();
  11420. while ( ++firingIndex < list.length ) {
  11421. // Run callback and check for early termination
  11422. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11423. options.stopOnFalse ) {
  11424. // Jump to end and forget the data so .add doesn't re-fire
  11425. firingIndex = list.length;
  11426. memory = false;
  11427. }
  11428. }
  11429. }
  11430. // Forget the data if we're done with it
  11431. if ( !options.memory ) {
  11432. memory = false;
  11433. }
  11434. firing = false;
  11435. // Clean up if we're done firing for good
  11436. if ( locked ) {
  11437. // Keep an empty list if we have data for future add calls
  11438. if ( memory ) {
  11439. list = [];
  11440. // Otherwise, this object is spent
  11441. } else {
  11442. list = "";
  11443. }
  11444. }
  11445. },
  11446. // Actual Callbacks object
  11447. self = {
  11448. // Add a callback or a collection of callbacks to the list
  11449. add: function() {
  11450. if ( list ) {
  11451. // If we have memory from a past run, we should fire after adding
  11452. if ( memory && !firing ) {
  11453. firingIndex = list.length - 1;
  11454. queue.push( memory );
  11455. }
  11456. ( function add( args ) {
  11457. jQuery.each( args, function( _, arg ) {
  11458. if ( isFunction( arg ) ) {
  11459. if ( !options.unique || !self.has( arg ) ) {
  11460. list.push( arg );
  11461. }
  11462. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11463. // Inspect recursively
  11464. add( arg );
  11465. }
  11466. } );
  11467. } )( arguments );
  11468. if ( memory && !firing ) {
  11469. fire();
  11470. }
  11471. }
  11472. return this;
  11473. },
  11474. // Remove a callback from the list
  11475. remove: function() {
  11476. jQuery.each( arguments, function( _, arg ) {
  11477. var index;
  11478. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11479. list.splice( index, 1 );
  11480. // Handle firing indexes
  11481. if ( index <= firingIndex ) {
  11482. firingIndex--;
  11483. }
  11484. }
  11485. } );
  11486. return this;
  11487. },
  11488. // Check if a given callback is in the list.
  11489. // If no argument is given, return whether or not list has callbacks attached.
  11490. has: function( fn ) {
  11491. return fn ?
  11492. jQuery.inArray( fn, list ) > -1 :
  11493. list.length > 0;
  11494. },
  11495. // Remove all callbacks from the list
  11496. empty: function() {
  11497. if ( list ) {
  11498. list = [];
  11499. }
  11500. return this;
  11501. },
  11502. // Disable .fire and .add
  11503. // Abort any current/pending executions
  11504. // Clear all callbacks and values
  11505. disable: function() {
  11506. locked = queue = [];
  11507. list = memory = "";
  11508. return this;
  11509. },
  11510. disabled: function() {
  11511. return !list;
  11512. },
  11513. // Disable .fire
  11514. // Also disable .add unless we have memory (since it would have no effect)
  11515. // Abort any pending executions
  11516. lock: function() {
  11517. locked = queue = [];
  11518. if ( !memory && !firing ) {
  11519. list = memory = "";
  11520. }
  11521. return this;
  11522. },
  11523. locked: function() {
  11524. return !!locked;
  11525. },
  11526. // Call all callbacks with the given context and arguments
  11527. fireWith: function( context, args ) {
  11528. if ( !locked ) {
  11529. args = args || [];
  11530. args = [ context, args.slice ? args.slice() : args ];
  11531. queue.push( args );
  11532. if ( !firing ) {
  11533. fire();
  11534. }
  11535. }
  11536. return this;
  11537. },
  11538. // Call all the callbacks with the given arguments
  11539. fire: function() {
  11540. self.fireWith( this, arguments );
  11541. return this;
  11542. },
  11543. // To know if the callbacks have already been called at least once
  11544. fired: function() {
  11545. return !!fired;
  11546. }
  11547. };
  11548. return self;
  11549. };
  11550. function Identity( v ) {
  11551. return v;
  11552. }
  11553. function Thrower( ex ) {
  11554. throw ex;
  11555. }
  11556. function adoptValue( value, resolve, reject, noValue ) {
  11557. var method;
  11558. try {
  11559. // Check for promise aspect first to privilege synchronous behavior
  11560. if ( value && isFunction( ( method = value.promise ) ) ) {
  11561. method.call( value ).done( resolve ).fail( reject );
  11562. // Other thenables
  11563. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11564. method.call( value, resolve, reject );
  11565. // Other non-thenables
  11566. } else {
  11567. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11568. // * false: [ value ].slice( 0 ) => resolve( value )
  11569. // * true: [ value ].slice( 1 ) => resolve()
  11570. resolve.apply( undefined, [ value ].slice( noValue ) );
  11571. }
  11572. // For Promises/A+, convert exceptions into rejections
  11573. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11574. // Deferred#then to conditionally suppress rejection.
  11575. } catch ( value ) {
  11576. // Support: Android 4.0 only
  11577. // Strict mode functions invoked without .call/.apply get global-object context
  11578. reject.apply( undefined, [ value ] );
  11579. }
  11580. }
  11581. jQuery.extend( {
  11582. Deferred: function( func ) {
  11583. var tuples = [
  11584. // action, add listener, callbacks,
  11585. // ... .then handlers, argument index, [final state]
  11586. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11587. jQuery.Callbacks( "memory" ), 2 ],
  11588. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11589. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11590. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11591. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11592. ],
  11593. state = "pending",
  11594. promise = {
  11595. state: function() {
  11596. return state;
  11597. },
  11598. always: function() {
  11599. deferred.done( arguments ).fail( arguments );
  11600. return this;
  11601. },
  11602. "catch": function( fn ) {
  11603. return promise.then( null, fn );
  11604. },
  11605. // Keep pipe for back-compat
  11606. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11607. var fns = arguments;
  11608. return jQuery.Deferred( function( newDefer ) {
  11609. jQuery.each( tuples, function( i, tuple ) {
  11610. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11611. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11612. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11613. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11614. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11615. deferred[ tuple[ 1 ] ]( function() {
  11616. var returned = fn && fn.apply( this, arguments );
  11617. if ( returned && isFunction( returned.promise ) ) {
  11618. returned.promise()
  11619. .progress( newDefer.notify )
  11620. .done( newDefer.resolve )
  11621. .fail( newDefer.reject );
  11622. } else {
  11623. newDefer[ tuple[ 0 ] + "With" ](
  11624. this,
  11625. fn ? [ returned ] : arguments
  11626. );
  11627. }
  11628. } );
  11629. } );
  11630. fns = null;
  11631. } ).promise();
  11632. },
  11633. then: function( onFulfilled, onRejected, onProgress ) {
  11634. var maxDepth = 0;
  11635. function resolve( depth, deferred, handler, special ) {
  11636. return function() {
  11637. var that = this,
  11638. args = arguments,
  11639. mightThrow = function() {
  11640. var returned, then;
  11641. // Support: Promises/A+ section 2.3.3.3.3
  11642. // https://promisesaplus.com/#point-59
  11643. // Ignore double-resolution attempts
  11644. if ( depth < maxDepth ) {
  11645. return;
  11646. }
  11647. returned = handler.apply( that, args );
  11648. // Support: Promises/A+ section 2.3.1
  11649. // https://promisesaplus.com/#point-48
  11650. if ( returned === deferred.promise() ) {
  11651. throw new TypeError( "Thenable self-resolution" );
  11652. }
  11653. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11654. // https://promisesaplus.com/#point-54
  11655. // https://promisesaplus.com/#point-75
  11656. // Retrieve `then` only once
  11657. then = returned &&
  11658. // Support: Promises/A+ section 2.3.4
  11659. // https://promisesaplus.com/#point-64
  11660. // Only check objects and functions for thenability
  11661. ( typeof returned === "object" ||
  11662. typeof returned === "function" ) &&
  11663. returned.then;
  11664. // Handle a returned thenable
  11665. if ( isFunction( then ) ) {
  11666. // Special processors (notify) just wait for resolution
  11667. if ( special ) {
  11668. then.call(
  11669. returned,
  11670. resolve( maxDepth, deferred, Identity, special ),
  11671. resolve( maxDepth, deferred, Thrower, special )
  11672. );
  11673. // Normal processors (resolve) also hook into progress
  11674. } else {
  11675. // ...and disregard older resolution values
  11676. maxDepth++;
  11677. then.call(
  11678. returned,
  11679. resolve( maxDepth, deferred, Identity, special ),
  11680. resolve( maxDepth, deferred, Thrower, special ),
  11681. resolve( maxDepth, deferred, Identity,
  11682. deferred.notifyWith )
  11683. );
  11684. }
  11685. // Handle all other returned values
  11686. } else {
  11687. // Only substitute handlers pass on context
  11688. // and multiple values (non-spec behavior)
  11689. if ( handler !== Identity ) {
  11690. that = undefined;
  11691. args = [ returned ];
  11692. }
  11693. // Process the value(s)
  11694. // Default process is resolve
  11695. ( special || deferred.resolveWith )( that, args );
  11696. }
  11697. },
  11698. // Only normal processors (resolve) catch and reject exceptions
  11699. process = special ?
  11700. mightThrow :
  11701. function() {
  11702. try {
  11703. mightThrow();
  11704. } catch ( e ) {
  11705. if ( jQuery.Deferred.exceptionHook ) {
  11706. jQuery.Deferred.exceptionHook( e,
  11707. process.stackTrace );
  11708. }
  11709. // Support: Promises/A+ section 2.3.3.3.4.1
  11710. // https://promisesaplus.com/#point-61
  11711. // Ignore post-resolution exceptions
  11712. if ( depth + 1 >= maxDepth ) {
  11713. // Only substitute handlers pass on context
  11714. // and multiple values (non-spec behavior)
  11715. if ( handler !== Thrower ) {
  11716. that = undefined;
  11717. args = [ e ];
  11718. }
  11719. deferred.rejectWith( that, args );
  11720. }
  11721. }
  11722. };
  11723. // Support: Promises/A+ section 2.3.3.3.1
  11724. // https://promisesaplus.com/#point-57
  11725. // Re-resolve promises immediately to dodge false rejection from
  11726. // subsequent errors
  11727. if ( depth ) {
  11728. process();
  11729. } else {
  11730. // Call an optional hook to record the stack, in case of exception
  11731. // since it's otherwise lost when execution goes async
  11732. if ( jQuery.Deferred.getStackHook ) {
  11733. process.stackTrace = jQuery.Deferred.getStackHook();
  11734. }
  11735. window.setTimeout( process );
  11736. }
  11737. };
  11738. }
  11739. return jQuery.Deferred( function( newDefer ) {
  11740. // progress_handlers.add( ... )
  11741. tuples[ 0 ][ 3 ].add(
  11742. resolve(
  11743. 0,
  11744. newDefer,
  11745. isFunction( onProgress ) ?
  11746. onProgress :
  11747. Identity,
  11748. newDefer.notifyWith
  11749. )
  11750. );
  11751. // fulfilled_handlers.add( ... )
  11752. tuples[ 1 ][ 3 ].add(
  11753. resolve(
  11754. 0,
  11755. newDefer,
  11756. isFunction( onFulfilled ) ?
  11757. onFulfilled :
  11758. Identity
  11759. )
  11760. );
  11761. // rejected_handlers.add( ... )
  11762. tuples[ 2 ][ 3 ].add(
  11763. resolve(
  11764. 0,
  11765. newDefer,
  11766. isFunction( onRejected ) ?
  11767. onRejected :
  11768. Thrower
  11769. )
  11770. );
  11771. } ).promise();
  11772. },
  11773. // Get a promise for this deferred
  11774. // If obj is provided, the promise aspect is added to the object
  11775. promise: function( obj ) {
  11776. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11777. }
  11778. },
  11779. deferred = {};
  11780. // Add list-specific methods
  11781. jQuery.each( tuples, function( i, tuple ) {
  11782. var list = tuple[ 2 ],
  11783. stateString = tuple[ 5 ];
  11784. // promise.progress = list.add
  11785. // promise.done = list.add
  11786. // promise.fail = list.add
  11787. promise[ tuple[ 1 ] ] = list.add;
  11788. // Handle state
  11789. if ( stateString ) {
  11790. list.add(
  11791. function() {
  11792. // state = "resolved" (i.e., fulfilled)
  11793. // state = "rejected"
  11794. state = stateString;
  11795. },
  11796. // rejected_callbacks.disable
  11797. // fulfilled_callbacks.disable
  11798. tuples[ 3 - i ][ 2 ].disable,
  11799. // rejected_handlers.disable
  11800. // fulfilled_handlers.disable
  11801. tuples[ 3 - i ][ 3 ].disable,
  11802. // progress_callbacks.lock
  11803. tuples[ 0 ][ 2 ].lock,
  11804. // progress_handlers.lock
  11805. tuples[ 0 ][ 3 ].lock
  11806. );
  11807. }
  11808. // progress_handlers.fire
  11809. // fulfilled_handlers.fire
  11810. // rejected_handlers.fire
  11811. list.add( tuple[ 3 ].fire );
  11812. // deferred.notify = function() { deferred.notifyWith(...) }
  11813. // deferred.resolve = function() { deferred.resolveWith(...) }
  11814. // deferred.reject = function() { deferred.rejectWith(...) }
  11815. deferred[ tuple[ 0 ] ] = function() {
  11816. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11817. return this;
  11818. };
  11819. // deferred.notifyWith = list.fireWith
  11820. // deferred.resolveWith = list.fireWith
  11821. // deferred.rejectWith = list.fireWith
  11822. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11823. } );
  11824. // Make the deferred a promise
  11825. promise.promise( deferred );
  11826. // Call given func if any
  11827. if ( func ) {
  11828. func.call( deferred, deferred );
  11829. }
  11830. // All done!
  11831. return deferred;
  11832. },
  11833. // Deferred helper
  11834. when: function( singleValue ) {
  11835. var
  11836. // count of uncompleted subordinates
  11837. remaining = arguments.length,
  11838. // count of unprocessed arguments
  11839. i = remaining,
  11840. // subordinate fulfillment data
  11841. resolveContexts = Array( i ),
  11842. resolveValues = slice.call( arguments ),
  11843. // the master Deferred
  11844. master = jQuery.Deferred(),
  11845. // subordinate callback factory
  11846. updateFunc = function( i ) {
  11847. return function( value ) {
  11848. resolveContexts[ i ] = this;
  11849. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11850. if ( !( --remaining ) ) {
  11851. master.resolveWith( resolveContexts, resolveValues );
  11852. }
  11853. };
  11854. };
  11855. // Single- and empty arguments are adopted like Promise.resolve
  11856. if ( remaining <= 1 ) {
  11857. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11858. !remaining );
  11859. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11860. if ( master.state() === "pending" ||
  11861. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11862. return master.then();
  11863. }
  11864. }
  11865. // Multiple arguments are aggregated like Promise.all array elements
  11866. while ( i-- ) {
  11867. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11868. }
  11869. return master.promise();
  11870. }
  11871. } );
  11872. // These usually indicate a programmer mistake during development,
  11873. // warn about them ASAP rather than swallowing them by default.
  11874. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11875. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11876. // Support: IE 8 - 9 only
  11877. // Console exists when dev tools are open, which can happen at any time
  11878. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11879. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11880. }
  11881. };
  11882. jQuery.readyException = function( error ) {
  11883. window.setTimeout( function() {
  11884. throw error;
  11885. } );
  11886. };
  11887. // The deferred used on DOM ready
  11888. var readyList = jQuery.Deferred();
  11889. jQuery.fn.ready = function( fn ) {
  11890. readyList
  11891. .then( fn )
  11892. // Wrap jQuery.readyException in a function so that the lookup
  11893. // happens at the time of error handling instead of callback
  11894. // registration.
  11895. .catch( function( error ) {
  11896. jQuery.readyException( error );
  11897. } );
  11898. return this;
  11899. };
  11900. jQuery.extend( {
  11901. // Is the DOM ready to be used? Set to true once it occurs.
  11902. isReady: false,
  11903. // A counter to track how many items to wait for before
  11904. // the ready event fires. See #6781
  11905. readyWait: 1,
  11906. // Handle when the DOM is ready
  11907. ready: function( wait ) {
  11908. // Abort if there are pending holds or we're already ready
  11909. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11910. return;
  11911. }
  11912. // Remember that the DOM is ready
  11913. jQuery.isReady = true;
  11914. // If a normal DOM Ready event fired, decrement, and wait if need be
  11915. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11916. return;
  11917. }
  11918. // If there are functions bound, to execute
  11919. readyList.resolveWith( document, [ jQuery ] );
  11920. }
  11921. } );
  11922. jQuery.ready.then = readyList.then;
  11923. // The ready event handler and self cleanup method
  11924. function completed() {
  11925. document.removeEventListener( "DOMContentLoaded", completed );
  11926. window.removeEventListener( "load", completed );
  11927. jQuery.ready();
  11928. }
  11929. // Catch cases where $(document).ready() is called
  11930. // after the browser event has already occurred.
  11931. // Support: IE <=9 - 10 only
  11932. // Older IE sometimes signals "interactive" too soon
  11933. if ( document.readyState === "complete" ||
  11934. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11935. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11936. window.setTimeout( jQuery.ready );
  11937. } else {
  11938. // Use the handy event callback
  11939. document.addEventListener( "DOMContentLoaded", completed );
  11940. // A fallback to window.onload, that will always work
  11941. window.addEventListener( "load", completed );
  11942. }
  11943. // Multifunctional method to get and set values of a collection
  11944. // The value/s can optionally be executed if it's a function
  11945. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11946. var i = 0,
  11947. len = elems.length,
  11948. bulk = key == null;
  11949. // Sets many values
  11950. if ( toType( key ) === "object" ) {
  11951. chainable = true;
  11952. for ( i in key ) {
  11953. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11954. }
  11955. // Sets one value
  11956. } else if ( value !== undefined ) {
  11957. chainable = true;
  11958. if ( !isFunction( value ) ) {
  11959. raw = true;
  11960. }
  11961. if ( bulk ) {
  11962. // Bulk operations run against the entire set
  11963. if ( raw ) {
  11964. fn.call( elems, value );
  11965. fn = null;
  11966. // ...except when executing function values
  11967. } else {
  11968. bulk = fn;
  11969. fn = function( elem, key, value ) {
  11970. return bulk.call( jQuery( elem ), value );
  11971. };
  11972. }
  11973. }
  11974. if ( fn ) {
  11975. for ( ; i < len; i++ ) {
  11976. fn(
  11977. elems[ i ], key, raw ?
  11978. value :
  11979. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11980. );
  11981. }
  11982. }
  11983. }
  11984. if ( chainable ) {
  11985. return elems;
  11986. }
  11987. // Gets
  11988. if ( bulk ) {
  11989. return fn.call( elems );
  11990. }
  11991. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11992. };
  11993. // Matches dashed string for camelizing
  11994. var rmsPrefix = /^-ms-/,
  11995. rdashAlpha = /-([a-z])/g;
  11996. // Used by camelCase as callback to replace()
  11997. function fcamelCase( all, letter ) {
  11998. return letter.toUpperCase();
  11999. }
  12000. // Convert dashed to camelCase; used by the css and data modules
  12001. // Support: IE <=9 - 11, Edge 12 - 15
  12002. // Microsoft forgot to hump their vendor prefix (#9572)
  12003. function camelCase( string ) {
  12004. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12005. }
  12006. var acceptData = function( owner ) {
  12007. // Accepts only:
  12008. // - Node
  12009. // - Node.ELEMENT_NODE
  12010. // - Node.DOCUMENT_NODE
  12011. // - Object
  12012. // - Any
  12013. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12014. };
  12015. function Data() {
  12016. this.expando = jQuery.expando + Data.uid++;
  12017. }
  12018. Data.uid = 1;
  12019. Data.prototype = {
  12020. cache: function( owner ) {
  12021. // Check if the owner object already has a cache
  12022. var value = owner[ this.expando ];
  12023. // If not, create one
  12024. if ( !value ) {
  12025. value = {};
  12026. // We can accept data for non-element nodes in modern browsers,
  12027. // but we should not, see #8335.
  12028. // Always return an empty object.
  12029. if ( acceptData( owner ) ) {
  12030. // If it is a node unlikely to be stringify-ed or looped over
  12031. // use plain assignment
  12032. if ( owner.nodeType ) {
  12033. owner[ this.expando ] = value;
  12034. // Otherwise secure it in a non-enumerable property
  12035. // configurable must be true to allow the property to be
  12036. // deleted when data is removed
  12037. } else {
  12038. Object.defineProperty( owner, this.expando, {
  12039. value: value,
  12040. configurable: true
  12041. } );
  12042. }
  12043. }
  12044. }
  12045. return value;
  12046. },
  12047. set: function( owner, data, value ) {
  12048. var prop,
  12049. cache = this.cache( owner );
  12050. // Handle: [ owner, key, value ] args
  12051. // Always use camelCase key (gh-2257)
  12052. if ( typeof data === "string" ) {
  12053. cache[ camelCase( data ) ] = value;
  12054. // Handle: [ owner, { properties } ] args
  12055. } else {
  12056. // Copy the properties one-by-one to the cache object
  12057. for ( prop in data ) {
  12058. cache[ camelCase( prop ) ] = data[ prop ];
  12059. }
  12060. }
  12061. return cache;
  12062. },
  12063. get: function( owner, key ) {
  12064. return key === undefined ?
  12065. this.cache( owner ) :
  12066. // Always use camelCase key (gh-2257)
  12067. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12068. },
  12069. access: function( owner, key, value ) {
  12070. // In cases where either:
  12071. //
  12072. // 1. No key was specified
  12073. // 2. A string key was specified, but no value provided
  12074. //
  12075. // Take the "read" path and allow the get method to determine
  12076. // which value to return, respectively either:
  12077. //
  12078. // 1. The entire cache object
  12079. // 2. The data stored at the key
  12080. //
  12081. if ( key === undefined ||
  12082. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12083. return this.get( owner, key );
  12084. }
  12085. // When the key is not a string, or both a key and value
  12086. // are specified, set or extend (existing objects) with either:
  12087. //
  12088. // 1. An object of properties
  12089. // 2. A key and value
  12090. //
  12091. this.set( owner, key, value );
  12092. // Since the "set" path can have two possible entry points
  12093. // return the expected data based on which path was taken[*]
  12094. return value !== undefined ? value : key;
  12095. },
  12096. remove: function( owner, key ) {
  12097. var i,
  12098. cache = owner[ this.expando ];
  12099. if ( cache === undefined ) {
  12100. return;
  12101. }
  12102. if ( key !== undefined ) {
  12103. // Support array or space separated string of keys
  12104. if ( Array.isArray( key ) ) {
  12105. // If key is an array of keys...
  12106. // We always set camelCase keys, so remove that.
  12107. key = key.map( camelCase );
  12108. } else {
  12109. key = camelCase( key );
  12110. // If a key with the spaces exists, use it.
  12111. // Otherwise, create an array by matching non-whitespace
  12112. key = key in cache ?
  12113. [ key ] :
  12114. ( key.match( rnothtmlwhite ) || [] );
  12115. }
  12116. i = key.length;
  12117. while ( i-- ) {
  12118. delete cache[ key[ i ] ];
  12119. }
  12120. }
  12121. // Remove the expando if there's no more data
  12122. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12123. // Support: Chrome <=35 - 45
  12124. // Webkit & Blink performance suffers when deleting properties
  12125. // from DOM nodes, so set to undefined instead
  12126. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12127. if ( owner.nodeType ) {
  12128. owner[ this.expando ] = undefined;
  12129. } else {
  12130. delete owner[ this.expando ];
  12131. }
  12132. }
  12133. },
  12134. hasData: function( owner ) {
  12135. var cache = owner[ this.expando ];
  12136. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12137. }
  12138. };
  12139. var dataPriv = new Data();
  12140. var dataUser = new Data();
  12141. // Implementation Summary
  12142. //
  12143. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12144. // 2. Improve the module's maintainability by reducing the storage
  12145. // paths to a single mechanism.
  12146. // 3. Use the same single mechanism to support "private" and "user" data.
  12147. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12148. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12149. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12150. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12151. rmultiDash = /[A-Z]/g;
  12152. function getData( data ) {
  12153. if ( data === "true" ) {
  12154. return true;
  12155. }
  12156. if ( data === "false" ) {
  12157. return false;
  12158. }
  12159. if ( data === "null" ) {
  12160. return null;
  12161. }
  12162. // Only convert to a number if it doesn't change the string
  12163. if ( data === +data + "" ) {
  12164. return +data;
  12165. }
  12166. if ( rbrace.test( data ) ) {
  12167. return JSON.parse( data );
  12168. }
  12169. return data;
  12170. }
  12171. function dataAttr( elem, key, data ) {
  12172. var name;
  12173. // If nothing was found internally, try to fetch any
  12174. // data from the HTML5 data-* attribute
  12175. if ( data === undefined && elem.nodeType === 1 ) {
  12176. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12177. data = elem.getAttribute( name );
  12178. if ( typeof data === "string" ) {
  12179. try {
  12180. data = getData( data );
  12181. } catch ( e ) {}
  12182. // Make sure we set the data so it isn't changed later
  12183. dataUser.set( elem, key, data );
  12184. } else {
  12185. data = undefined;
  12186. }
  12187. }
  12188. return data;
  12189. }
  12190. jQuery.extend( {
  12191. hasData: function( elem ) {
  12192. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12193. },
  12194. data: function( elem, name, data ) {
  12195. return dataUser.access( elem, name, data );
  12196. },
  12197. removeData: function( elem, name ) {
  12198. dataUser.remove( elem, name );
  12199. },
  12200. // TODO: Now that all calls to _data and _removeData have been replaced
  12201. // with direct calls to dataPriv methods, these can be deprecated.
  12202. _data: function( elem, name, data ) {
  12203. return dataPriv.access( elem, name, data );
  12204. },
  12205. _removeData: function( elem, name ) {
  12206. dataPriv.remove( elem, name );
  12207. }
  12208. } );
  12209. jQuery.fn.extend( {
  12210. data: function( key, value ) {
  12211. var i, name, data,
  12212. elem = this[ 0 ],
  12213. attrs = elem && elem.attributes;
  12214. // Gets all values
  12215. if ( key === undefined ) {
  12216. if ( this.length ) {
  12217. data = dataUser.get( elem );
  12218. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12219. i = attrs.length;
  12220. while ( i-- ) {
  12221. // Support: IE 11 only
  12222. // The attrs elements can be null (#14894)
  12223. if ( attrs[ i ] ) {
  12224. name = attrs[ i ].name;
  12225. if ( name.indexOf( "data-" ) === 0 ) {
  12226. name = camelCase( name.slice( 5 ) );
  12227. dataAttr( elem, name, data[ name ] );
  12228. }
  12229. }
  12230. }
  12231. dataPriv.set( elem, "hasDataAttrs", true );
  12232. }
  12233. }
  12234. return data;
  12235. }
  12236. // Sets multiple values
  12237. if ( typeof key === "object" ) {
  12238. return this.each( function() {
  12239. dataUser.set( this, key );
  12240. } );
  12241. }
  12242. return access( this, function( value ) {
  12243. var data;
  12244. // The calling jQuery object (element matches) is not empty
  12245. // (and therefore has an element appears at this[ 0 ]) and the
  12246. // `value` parameter was not undefined. An empty jQuery object
  12247. // will result in `undefined` for elem = this[ 0 ] which will
  12248. // throw an exception if an attempt to read a data cache is made.
  12249. if ( elem && value === undefined ) {
  12250. // Attempt to get data from the cache
  12251. // The key will always be camelCased in Data
  12252. data = dataUser.get( elem, key );
  12253. if ( data !== undefined ) {
  12254. return data;
  12255. }
  12256. // Attempt to "discover" the data in
  12257. // HTML5 custom data-* attrs
  12258. data = dataAttr( elem, key );
  12259. if ( data !== undefined ) {
  12260. return data;
  12261. }
  12262. // We tried really hard, but the data doesn't exist.
  12263. return;
  12264. }
  12265. // Set the data...
  12266. this.each( function() {
  12267. // We always store the camelCased key
  12268. dataUser.set( this, key, value );
  12269. } );
  12270. }, null, value, arguments.length > 1, null, true );
  12271. },
  12272. removeData: function( key ) {
  12273. return this.each( function() {
  12274. dataUser.remove( this, key );
  12275. } );
  12276. }
  12277. } );
  12278. jQuery.extend( {
  12279. queue: function( elem, type, data ) {
  12280. var queue;
  12281. if ( elem ) {
  12282. type = ( type || "fx" ) + "queue";
  12283. queue = dataPriv.get( elem, type );
  12284. // Speed up dequeue by getting out quickly if this is just a lookup
  12285. if ( data ) {
  12286. if ( !queue || Array.isArray( data ) ) {
  12287. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12288. } else {
  12289. queue.push( data );
  12290. }
  12291. }
  12292. return queue || [];
  12293. }
  12294. },
  12295. dequeue: function( elem, type ) {
  12296. type = type || "fx";
  12297. var queue = jQuery.queue( elem, type ),
  12298. startLength = queue.length,
  12299. fn = queue.shift(),
  12300. hooks = jQuery._queueHooks( elem, type ),
  12301. next = function() {
  12302. jQuery.dequeue( elem, type );
  12303. };
  12304. // If the fx queue is dequeued, always remove the progress sentinel
  12305. if ( fn === "inprogress" ) {
  12306. fn = queue.shift();
  12307. startLength--;
  12308. }
  12309. if ( fn ) {
  12310. // Add a progress sentinel to prevent the fx queue from being
  12311. // automatically dequeued
  12312. if ( type === "fx" ) {
  12313. queue.unshift( "inprogress" );
  12314. }
  12315. // Clear up the last queue stop function
  12316. delete hooks.stop;
  12317. fn.call( elem, next, hooks );
  12318. }
  12319. if ( !startLength && hooks ) {
  12320. hooks.empty.fire();
  12321. }
  12322. },
  12323. // Not public - generate a queueHooks object, or return the current one
  12324. _queueHooks: function( elem, type ) {
  12325. var key = type + "queueHooks";
  12326. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12327. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12328. dataPriv.remove( elem, [ type + "queue", key ] );
  12329. } )
  12330. } );
  12331. }
  12332. } );
  12333. jQuery.fn.extend( {
  12334. queue: function( type, data ) {
  12335. var setter = 2;
  12336. if ( typeof type !== "string" ) {
  12337. data = type;
  12338. type = "fx";
  12339. setter--;
  12340. }
  12341. if ( arguments.length < setter ) {
  12342. return jQuery.queue( this[ 0 ], type );
  12343. }
  12344. return data === undefined ?
  12345. this :
  12346. this.each( function() {
  12347. var queue = jQuery.queue( this, type, data );
  12348. // Ensure a hooks for this queue
  12349. jQuery._queueHooks( this, type );
  12350. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12351. jQuery.dequeue( this, type );
  12352. }
  12353. } );
  12354. },
  12355. dequeue: function( type ) {
  12356. return this.each( function() {
  12357. jQuery.dequeue( this, type );
  12358. } );
  12359. },
  12360. clearQueue: function( type ) {
  12361. return this.queue( type || "fx", [] );
  12362. },
  12363. // Get a promise resolved when queues of a certain type
  12364. // are emptied (fx is the type by default)
  12365. promise: function( type, obj ) {
  12366. var tmp,
  12367. count = 1,
  12368. defer = jQuery.Deferred(),
  12369. elements = this,
  12370. i = this.length,
  12371. resolve = function() {
  12372. if ( !( --count ) ) {
  12373. defer.resolveWith( elements, [ elements ] );
  12374. }
  12375. };
  12376. if ( typeof type !== "string" ) {
  12377. obj = type;
  12378. type = undefined;
  12379. }
  12380. type = type || "fx";
  12381. while ( i-- ) {
  12382. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12383. if ( tmp && tmp.empty ) {
  12384. count++;
  12385. tmp.empty.add( resolve );
  12386. }
  12387. }
  12388. resolve();
  12389. return defer.promise( obj );
  12390. }
  12391. } );
  12392. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12393. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12394. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12395. var documentElement = document.documentElement;
  12396. var isAttached = function( elem ) {
  12397. return jQuery.contains( elem.ownerDocument, elem );
  12398. },
  12399. composed = { composed: true };
  12400. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12401. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12402. // Support: iOS 10.0-10.2 only
  12403. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12404. // leading to errors. We need to check for `getRootNode`.
  12405. if ( documentElement.getRootNode ) {
  12406. isAttached = function( elem ) {
  12407. return jQuery.contains( elem.ownerDocument, elem ) ||
  12408. elem.getRootNode( composed ) === elem.ownerDocument;
  12409. };
  12410. }
  12411. var isHiddenWithinTree = function( elem, el ) {
  12412. // isHiddenWithinTree might be called from jQuery#filter function;
  12413. // in that case, element will be second argument
  12414. elem = el || elem;
  12415. // Inline style trumps all
  12416. return elem.style.display === "none" ||
  12417. elem.style.display === "" &&
  12418. // Otherwise, check computed style
  12419. // Support: Firefox <=43 - 45
  12420. // Disconnected elements can have computed display: none, so first confirm that elem is
  12421. // in the document.
  12422. isAttached( elem ) &&
  12423. jQuery.css( elem, "display" ) === "none";
  12424. };
  12425. var swap = function( elem, options, callback, args ) {
  12426. var ret, name,
  12427. old = {};
  12428. // Remember the old values, and insert the new ones
  12429. for ( name in options ) {
  12430. old[ name ] = elem.style[ name ];
  12431. elem.style[ name ] = options[ name ];
  12432. }
  12433. ret = callback.apply( elem, args || [] );
  12434. // Revert the old values
  12435. for ( name in options ) {
  12436. elem.style[ name ] = old[ name ];
  12437. }
  12438. return ret;
  12439. };
  12440. function adjustCSS( elem, prop, valueParts, tween ) {
  12441. var adjusted, scale,
  12442. maxIterations = 20,
  12443. currentValue = tween ?
  12444. function() {
  12445. return tween.cur();
  12446. } :
  12447. function() {
  12448. return jQuery.css( elem, prop, "" );
  12449. },
  12450. initial = currentValue(),
  12451. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12452. // Starting value computation is required for potential unit mismatches
  12453. initialInUnit = elem.nodeType &&
  12454. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12455. rcssNum.exec( jQuery.css( elem, prop ) );
  12456. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12457. // Support: Firefox <=54
  12458. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12459. initial = initial / 2;
  12460. // Trust units reported by jQuery.css
  12461. unit = unit || initialInUnit[ 3 ];
  12462. // Iteratively approximate from a nonzero starting point
  12463. initialInUnit = +initial || 1;
  12464. while ( maxIterations-- ) {
  12465. // Evaluate and update our best guess (doubling guesses that zero out).
  12466. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12467. jQuery.style( elem, prop, initialInUnit + unit );
  12468. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12469. maxIterations = 0;
  12470. }
  12471. initialInUnit = initialInUnit / scale;
  12472. }
  12473. initialInUnit = initialInUnit * 2;
  12474. jQuery.style( elem, prop, initialInUnit + unit );
  12475. // Make sure we update the tween properties later on
  12476. valueParts = valueParts || [];
  12477. }
  12478. if ( valueParts ) {
  12479. initialInUnit = +initialInUnit || +initial || 0;
  12480. // Apply relative offset (+=/-=) if specified
  12481. adjusted = valueParts[ 1 ] ?
  12482. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12483. +valueParts[ 2 ];
  12484. if ( tween ) {
  12485. tween.unit = unit;
  12486. tween.start = initialInUnit;
  12487. tween.end = adjusted;
  12488. }
  12489. }
  12490. return adjusted;
  12491. }
  12492. var defaultDisplayMap = {};
  12493. function getDefaultDisplay( elem ) {
  12494. var temp,
  12495. doc = elem.ownerDocument,
  12496. nodeName = elem.nodeName,
  12497. display = defaultDisplayMap[ nodeName ];
  12498. if ( display ) {
  12499. return display;
  12500. }
  12501. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12502. display = jQuery.css( temp, "display" );
  12503. temp.parentNode.removeChild( temp );
  12504. if ( display === "none" ) {
  12505. display = "block";
  12506. }
  12507. defaultDisplayMap[ nodeName ] = display;
  12508. return display;
  12509. }
  12510. function showHide( elements, show ) {
  12511. var display, elem,
  12512. values = [],
  12513. index = 0,
  12514. length = elements.length;
  12515. // Determine new display value for elements that need to change
  12516. for ( ; index < length; index++ ) {
  12517. elem = elements[ index ];
  12518. if ( !elem.style ) {
  12519. continue;
  12520. }
  12521. display = elem.style.display;
  12522. if ( show ) {
  12523. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12524. // check is required in this first loop unless we have a nonempty display value (either
  12525. // inline or about-to-be-restored)
  12526. if ( display === "none" ) {
  12527. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12528. if ( !values[ index ] ) {
  12529. elem.style.display = "";
  12530. }
  12531. }
  12532. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12533. values[ index ] = getDefaultDisplay( elem );
  12534. }
  12535. } else {
  12536. if ( display !== "none" ) {
  12537. values[ index ] = "none";
  12538. // Remember what we're overwriting
  12539. dataPriv.set( elem, "display", display );
  12540. }
  12541. }
  12542. }
  12543. // Set the display of the elements in a second loop to avoid constant reflow
  12544. for ( index = 0; index < length; index++ ) {
  12545. if ( values[ index ] != null ) {
  12546. elements[ index ].style.display = values[ index ];
  12547. }
  12548. }
  12549. return elements;
  12550. }
  12551. jQuery.fn.extend( {
  12552. show: function() {
  12553. return showHide( this, true );
  12554. },
  12555. hide: function() {
  12556. return showHide( this );
  12557. },
  12558. toggle: function( state ) {
  12559. if ( typeof state === "boolean" ) {
  12560. return state ? this.show() : this.hide();
  12561. }
  12562. return this.each( function() {
  12563. if ( isHiddenWithinTree( this ) ) {
  12564. jQuery( this ).show();
  12565. } else {
  12566. jQuery( this ).hide();
  12567. }
  12568. } );
  12569. }
  12570. } );
  12571. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12572. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12573. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12574. // We have to close these tags to support XHTML (#13200)
  12575. var wrapMap = {
  12576. // Support: IE <=9 only
  12577. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12578. // XHTML parsers do not magically insert elements in the
  12579. // same way that tag soup parsers do. So we cannot shorten
  12580. // this by omitting <tbody> or other required elements.
  12581. thead: [ 1, "<table>", "</table>" ],
  12582. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12583. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12584. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12585. _default: [ 0, "", "" ]
  12586. };
  12587. // Support: IE <=9 only
  12588. wrapMap.optgroup = wrapMap.option;
  12589. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12590. wrapMap.th = wrapMap.td;
  12591. function getAll( context, tag ) {
  12592. // Support: IE <=9 - 11 only
  12593. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12594. var ret;
  12595. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12596. ret = context.getElementsByTagName( tag || "*" );
  12597. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12598. ret = context.querySelectorAll( tag || "*" );
  12599. } else {
  12600. ret = [];
  12601. }
  12602. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12603. return jQuery.merge( [ context ], ret );
  12604. }
  12605. return ret;
  12606. }
  12607. // Mark scripts as having already been evaluated
  12608. function setGlobalEval( elems, refElements ) {
  12609. var i = 0,
  12610. l = elems.length;
  12611. for ( ; i < l; i++ ) {
  12612. dataPriv.set(
  12613. elems[ i ],
  12614. "globalEval",
  12615. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12616. );
  12617. }
  12618. }
  12619. var rhtml = /<|&#?\w+;/;
  12620. function buildFragment( elems, context, scripts, selection, ignored ) {
  12621. var elem, tmp, tag, wrap, attached, j,
  12622. fragment = context.createDocumentFragment(),
  12623. nodes = [],
  12624. i = 0,
  12625. l = elems.length;
  12626. for ( ; i < l; i++ ) {
  12627. elem = elems[ i ];
  12628. if ( elem || elem === 0 ) {
  12629. // Add nodes directly
  12630. if ( toType( elem ) === "object" ) {
  12631. // Support: Android <=4.0 only, PhantomJS 1 only
  12632. // push.apply(_, arraylike) throws on ancient WebKit
  12633. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12634. // Convert non-html into a text node
  12635. } else if ( !rhtml.test( elem ) ) {
  12636. nodes.push( context.createTextNode( elem ) );
  12637. // Convert html into DOM nodes
  12638. } else {
  12639. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12640. // Deserialize a standard representation
  12641. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12642. wrap = wrapMap[ tag ] || wrapMap._default;
  12643. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12644. // Descend through wrappers to the right content
  12645. j = wrap[ 0 ];
  12646. while ( j-- ) {
  12647. tmp = tmp.lastChild;
  12648. }
  12649. // Support: Android <=4.0 only, PhantomJS 1 only
  12650. // push.apply(_, arraylike) throws on ancient WebKit
  12651. jQuery.merge( nodes, tmp.childNodes );
  12652. // Remember the top-level container
  12653. tmp = fragment.firstChild;
  12654. // Ensure the created nodes are orphaned (#12392)
  12655. tmp.textContent = "";
  12656. }
  12657. }
  12658. }
  12659. // Remove wrapper from fragment
  12660. fragment.textContent = "";
  12661. i = 0;
  12662. while ( ( elem = nodes[ i++ ] ) ) {
  12663. // Skip elements already in the context collection (trac-4087)
  12664. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12665. if ( ignored ) {
  12666. ignored.push( elem );
  12667. }
  12668. continue;
  12669. }
  12670. attached = isAttached( elem );
  12671. // Append to fragment
  12672. tmp = getAll( fragment.appendChild( elem ), "script" );
  12673. // Preserve script evaluation history
  12674. if ( attached ) {
  12675. setGlobalEval( tmp );
  12676. }
  12677. // Capture executables
  12678. if ( scripts ) {
  12679. j = 0;
  12680. while ( ( elem = tmp[ j++ ] ) ) {
  12681. if ( rscriptType.test( elem.type || "" ) ) {
  12682. scripts.push( elem );
  12683. }
  12684. }
  12685. }
  12686. }
  12687. return fragment;
  12688. }
  12689. ( function() {
  12690. var fragment = document.createDocumentFragment(),
  12691. div = fragment.appendChild( document.createElement( "div" ) ),
  12692. input = document.createElement( "input" );
  12693. // Support: Android 4.0 - 4.3 only
  12694. // Check state lost if the name is set (#11217)
  12695. // Support: Windows Web Apps (WWA)
  12696. // `name` and `type` must use .setAttribute for WWA (#14901)
  12697. input.setAttribute( "type", "radio" );
  12698. input.setAttribute( "checked", "checked" );
  12699. input.setAttribute( "name", "t" );
  12700. div.appendChild( input );
  12701. // Support: Android <=4.1 only
  12702. // Older WebKit doesn't clone checked state correctly in fragments
  12703. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12704. // Support: IE <=11 only
  12705. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12706. div.innerHTML = "<textarea>x</textarea>";
  12707. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12708. } )();
  12709. var
  12710. rkeyEvent = /^key/,
  12711. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12712. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12713. function returnTrue() {
  12714. return true;
  12715. }
  12716. function returnFalse() {
  12717. return false;
  12718. }
  12719. // Support: IE <=9 - 11+
  12720. // focus() and blur() are asynchronous, except when they are no-op.
  12721. // So expect focus to be synchronous when the element is already active,
  12722. // and blur to be synchronous when the element is not already active.
  12723. // (focus and blur are always synchronous in other supported browsers,
  12724. // this just defines when we can count on it).
  12725. function expectSync( elem, type ) {
  12726. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12727. }
  12728. // Support: IE <=9 only
  12729. // Accessing document.activeElement can throw unexpectedly
  12730. // https://bugs.jquery.com/ticket/13393
  12731. function safeActiveElement() {
  12732. try {
  12733. return document.activeElement;
  12734. } catch ( err ) { }
  12735. }
  12736. function on( elem, types, selector, data, fn, one ) {
  12737. var origFn, type;
  12738. // Types can be a map of types/handlers
  12739. if ( typeof types === "object" ) {
  12740. // ( types-Object, selector, data )
  12741. if ( typeof selector !== "string" ) {
  12742. // ( types-Object, data )
  12743. data = data || selector;
  12744. selector = undefined;
  12745. }
  12746. for ( type in types ) {
  12747. on( elem, type, selector, data, types[ type ], one );
  12748. }
  12749. return elem;
  12750. }
  12751. if ( data == null && fn == null ) {
  12752. // ( types, fn )
  12753. fn = selector;
  12754. data = selector = undefined;
  12755. } else if ( fn == null ) {
  12756. if ( typeof selector === "string" ) {
  12757. // ( types, selector, fn )
  12758. fn = data;
  12759. data = undefined;
  12760. } else {
  12761. // ( types, data, fn )
  12762. fn = data;
  12763. data = selector;
  12764. selector = undefined;
  12765. }
  12766. }
  12767. if ( fn === false ) {
  12768. fn = returnFalse;
  12769. } else if ( !fn ) {
  12770. return elem;
  12771. }
  12772. if ( one === 1 ) {
  12773. origFn = fn;
  12774. fn = function( event ) {
  12775. // Can use an empty set, since event contains the info
  12776. jQuery().off( event );
  12777. return origFn.apply( this, arguments );
  12778. };
  12779. // Use same guid so caller can remove using origFn
  12780. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12781. }
  12782. return elem.each( function() {
  12783. jQuery.event.add( this, types, fn, data, selector );
  12784. } );
  12785. }
  12786. /*
  12787. * Helper functions for managing events -- not part of the public interface.
  12788. * Props to Dean Edwards' addEvent library for many of the ideas.
  12789. */
  12790. jQuery.event = {
  12791. global: {},
  12792. add: function( elem, types, handler, data, selector ) {
  12793. var handleObjIn, eventHandle, tmp,
  12794. events, t, handleObj,
  12795. special, handlers, type, namespaces, origType,
  12796. elemData = dataPriv.get( elem );
  12797. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12798. if ( !elemData ) {
  12799. return;
  12800. }
  12801. // Caller can pass in an object of custom data in lieu of the handler
  12802. if ( handler.handler ) {
  12803. handleObjIn = handler;
  12804. handler = handleObjIn.handler;
  12805. selector = handleObjIn.selector;
  12806. }
  12807. // Ensure that invalid selectors throw exceptions at attach time
  12808. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12809. if ( selector ) {
  12810. jQuery.find.matchesSelector( documentElement, selector );
  12811. }
  12812. // Make sure that the handler has a unique ID, used to find/remove it later
  12813. if ( !handler.guid ) {
  12814. handler.guid = jQuery.guid++;
  12815. }
  12816. // Init the element's event structure and main handler, if this is the first
  12817. if ( !( events = elemData.events ) ) {
  12818. events = elemData.events = {};
  12819. }
  12820. if ( !( eventHandle = elemData.handle ) ) {
  12821. eventHandle = elemData.handle = function( e ) {
  12822. // Discard the second event of a jQuery.event.trigger() and
  12823. // when an event is called after a page has unloaded
  12824. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12825. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12826. };
  12827. }
  12828. // Handle multiple events separated by a space
  12829. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12830. t = types.length;
  12831. while ( t-- ) {
  12832. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12833. type = origType = tmp[ 1 ];
  12834. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12835. // There *must* be a type, no attaching namespace-only handlers
  12836. if ( !type ) {
  12837. continue;
  12838. }
  12839. // If event changes its type, use the special event handlers for the changed type
  12840. special = jQuery.event.special[ type ] || {};
  12841. // If selector defined, determine special event api type, otherwise given type
  12842. type = ( selector ? special.delegateType : special.bindType ) || type;
  12843. // Update special based on newly reset type
  12844. special = jQuery.event.special[ type ] || {};
  12845. // handleObj is passed to all event handlers
  12846. handleObj = jQuery.extend( {
  12847. type: type,
  12848. origType: origType,
  12849. data: data,
  12850. handler: handler,
  12851. guid: handler.guid,
  12852. selector: selector,
  12853. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12854. namespace: namespaces.join( "." )
  12855. }, handleObjIn );
  12856. // Init the event handler queue if we're the first
  12857. if ( !( handlers = events[ type ] ) ) {
  12858. handlers = events[ type ] = [];
  12859. handlers.delegateCount = 0;
  12860. // Only use addEventListener if the special events handler returns false
  12861. if ( !special.setup ||
  12862. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12863. if ( elem.addEventListener ) {
  12864. elem.addEventListener( type, eventHandle );
  12865. }
  12866. }
  12867. }
  12868. if ( special.add ) {
  12869. special.add.call( elem, handleObj );
  12870. if ( !handleObj.handler.guid ) {
  12871. handleObj.handler.guid = handler.guid;
  12872. }
  12873. }
  12874. // Add to the element's handler list, delegates in front
  12875. if ( selector ) {
  12876. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12877. } else {
  12878. handlers.push( handleObj );
  12879. }
  12880. // Keep track of which events have ever been used, for event optimization
  12881. jQuery.event.global[ type ] = true;
  12882. }
  12883. },
  12884. // Detach an event or set of events from an element
  12885. remove: function( elem, types, handler, selector, mappedTypes ) {
  12886. var j, origCount, tmp,
  12887. events, t, handleObj,
  12888. special, handlers, type, namespaces, origType,
  12889. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12890. if ( !elemData || !( events = elemData.events ) ) {
  12891. return;
  12892. }
  12893. // Once for each type.namespace in types; type may be omitted
  12894. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12895. t = types.length;
  12896. while ( t-- ) {
  12897. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12898. type = origType = tmp[ 1 ];
  12899. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12900. // Unbind all events (on this namespace, if provided) for the element
  12901. if ( !type ) {
  12902. for ( type in events ) {
  12903. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12904. }
  12905. continue;
  12906. }
  12907. special = jQuery.event.special[ type ] || {};
  12908. type = ( selector ? special.delegateType : special.bindType ) || type;
  12909. handlers = events[ type ] || [];
  12910. tmp = tmp[ 2 ] &&
  12911. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12912. // Remove matching events
  12913. origCount = j = handlers.length;
  12914. while ( j-- ) {
  12915. handleObj = handlers[ j ];
  12916. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12917. ( !handler || handler.guid === handleObj.guid ) &&
  12918. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12919. ( !selector || selector === handleObj.selector ||
  12920. selector === "**" && handleObj.selector ) ) {
  12921. handlers.splice( j, 1 );
  12922. if ( handleObj.selector ) {
  12923. handlers.delegateCount--;
  12924. }
  12925. if ( special.remove ) {
  12926. special.remove.call( elem, handleObj );
  12927. }
  12928. }
  12929. }
  12930. // Remove generic event handler if we removed something and no more handlers exist
  12931. // (avoids potential for endless recursion during removal of special event handlers)
  12932. if ( origCount && !handlers.length ) {
  12933. if ( !special.teardown ||
  12934. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12935. jQuery.removeEvent( elem, type, elemData.handle );
  12936. }
  12937. delete events[ type ];
  12938. }
  12939. }
  12940. // Remove data and the expando if it's no longer used
  12941. if ( jQuery.isEmptyObject( events ) ) {
  12942. dataPriv.remove( elem, "handle events" );
  12943. }
  12944. },
  12945. dispatch: function( nativeEvent ) {
  12946. // Make a writable jQuery.Event from the native event object
  12947. var event = jQuery.event.fix( nativeEvent );
  12948. var i, j, ret, matched, handleObj, handlerQueue,
  12949. args = new Array( arguments.length ),
  12950. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12951. special = jQuery.event.special[ event.type ] || {};
  12952. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12953. args[ 0 ] = event;
  12954. for ( i = 1; i < arguments.length; i++ ) {
  12955. args[ i ] = arguments[ i ];
  12956. }
  12957. event.delegateTarget = this;
  12958. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12959. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12960. return;
  12961. }
  12962. // Determine handlers
  12963. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12964. // Run delegates first; they may want to stop propagation beneath us
  12965. i = 0;
  12966. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12967. event.currentTarget = matched.elem;
  12968. j = 0;
  12969. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12970. !event.isImmediatePropagationStopped() ) {
  12971. // If the event is namespaced, then each handler is only invoked if it is
  12972. // specially universal or its namespaces are a superset of the event's.
  12973. if ( !event.rnamespace || handleObj.namespace === false ||
  12974. event.rnamespace.test( handleObj.namespace ) ) {
  12975. event.handleObj = handleObj;
  12976. event.data = handleObj.data;
  12977. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12978. handleObj.handler ).apply( matched.elem, args );
  12979. if ( ret !== undefined ) {
  12980. if ( ( event.result = ret ) === false ) {
  12981. event.preventDefault();
  12982. event.stopPropagation();
  12983. }
  12984. }
  12985. }
  12986. }
  12987. }
  12988. // Call the postDispatch hook for the mapped type
  12989. if ( special.postDispatch ) {
  12990. special.postDispatch.call( this, event );
  12991. }
  12992. return event.result;
  12993. },
  12994. handlers: function( event, handlers ) {
  12995. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12996. handlerQueue = [],
  12997. delegateCount = handlers.delegateCount,
  12998. cur = event.target;
  12999. // Find delegate handlers
  13000. if ( delegateCount &&
  13001. // Support: IE <=9
  13002. // Black-hole SVG <use> instance trees (trac-13180)
  13003. cur.nodeType &&
  13004. // Support: Firefox <=42
  13005. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13006. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13007. // Support: IE 11 only
  13008. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13009. !( event.type === "click" && event.button >= 1 ) ) {
  13010. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13011. // Don't check non-elements (#13208)
  13012. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13013. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13014. matchedHandlers = [];
  13015. matchedSelectors = {};
  13016. for ( i = 0; i < delegateCount; i++ ) {
  13017. handleObj = handlers[ i ];
  13018. // Don't conflict with Object.prototype properties (#13203)
  13019. sel = handleObj.selector + " ";
  13020. if ( matchedSelectors[ sel ] === undefined ) {
  13021. matchedSelectors[ sel ] = handleObj.needsContext ?
  13022. jQuery( sel, this ).index( cur ) > -1 :
  13023. jQuery.find( sel, this, null, [ cur ] ).length;
  13024. }
  13025. if ( matchedSelectors[ sel ] ) {
  13026. matchedHandlers.push( handleObj );
  13027. }
  13028. }
  13029. if ( matchedHandlers.length ) {
  13030. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13031. }
  13032. }
  13033. }
  13034. }
  13035. // Add the remaining (directly-bound) handlers
  13036. cur = this;
  13037. if ( delegateCount < handlers.length ) {
  13038. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13039. }
  13040. return handlerQueue;
  13041. },
  13042. addProp: function( name, hook ) {
  13043. Object.defineProperty( jQuery.Event.prototype, name, {
  13044. enumerable: true,
  13045. configurable: true,
  13046. get: isFunction( hook ) ?
  13047. function() {
  13048. if ( this.originalEvent ) {
  13049. return hook( this.originalEvent );
  13050. }
  13051. } :
  13052. function() {
  13053. if ( this.originalEvent ) {
  13054. return this.originalEvent[ name ];
  13055. }
  13056. },
  13057. set: function( value ) {
  13058. Object.defineProperty( this, name, {
  13059. enumerable: true,
  13060. configurable: true,
  13061. writable: true,
  13062. value: value
  13063. } );
  13064. }
  13065. } );
  13066. },
  13067. fix: function( originalEvent ) {
  13068. return originalEvent[ jQuery.expando ] ?
  13069. originalEvent :
  13070. new jQuery.Event( originalEvent );
  13071. },
  13072. special: {
  13073. load: {
  13074. // Prevent triggered image.load events from bubbling to window.load
  13075. noBubble: true
  13076. },
  13077. click: {
  13078. // Utilize native event to ensure correct state for checkable inputs
  13079. setup: function( data ) {
  13080. // For mutual compressibility with _default, replace `this` access with a local var.
  13081. // `|| data` is dead code meant only to preserve the variable through minification.
  13082. var el = this || data;
  13083. // Claim the first handler
  13084. if ( rcheckableType.test( el.type ) &&
  13085. el.click && nodeName( el, "input" ) ) {
  13086. // dataPriv.set( el, "click", ... )
  13087. leverageNative( el, "click", returnTrue );
  13088. }
  13089. // Return false to allow normal processing in the caller
  13090. return false;
  13091. },
  13092. trigger: function( data ) {
  13093. // For mutual compressibility with _default, replace `this` access with a local var.
  13094. // `|| data` is dead code meant only to preserve the variable through minification.
  13095. var el = this || data;
  13096. // Force setup before triggering a click
  13097. if ( rcheckableType.test( el.type ) &&
  13098. el.click && nodeName( el, "input" ) ) {
  13099. leverageNative( el, "click" );
  13100. }
  13101. // Return non-false to allow normal event-path propagation
  13102. return true;
  13103. },
  13104. // For cross-browser consistency, suppress native .click() on links
  13105. // Also prevent it if we're currently inside a leveraged native-event stack
  13106. _default: function( event ) {
  13107. var target = event.target;
  13108. return rcheckableType.test( target.type ) &&
  13109. target.click && nodeName( target, "input" ) &&
  13110. dataPriv.get( target, "click" ) ||
  13111. nodeName( target, "a" );
  13112. }
  13113. },
  13114. beforeunload: {
  13115. postDispatch: function( event ) {
  13116. // Support: Firefox 20+
  13117. // Firefox doesn't alert if the returnValue field is not set.
  13118. if ( event.result !== undefined && event.originalEvent ) {
  13119. event.originalEvent.returnValue = event.result;
  13120. }
  13121. }
  13122. }
  13123. }
  13124. };
  13125. // Ensure the presence of an event listener that handles manually-triggered
  13126. // synthetic events by interrupting progress until reinvoked in response to
  13127. // *native* events that it fires directly, ensuring that state changes have
  13128. // already occurred before other listeners are invoked.
  13129. function leverageNative( el, type, expectSync ) {
  13130. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13131. if ( !expectSync ) {
  13132. if ( dataPriv.get( el, type ) === undefined ) {
  13133. jQuery.event.add( el, type, returnTrue );
  13134. }
  13135. return;
  13136. }
  13137. // Register the controller as a special universal handler for all event namespaces
  13138. dataPriv.set( el, type, false );
  13139. jQuery.event.add( el, type, {
  13140. namespace: false,
  13141. handler: function( event ) {
  13142. var notAsync, result,
  13143. saved = dataPriv.get( this, type );
  13144. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13145. // Interrupt processing of the outer synthetic .trigger()ed event
  13146. // Saved data should be false in such cases, but might be a leftover capture object
  13147. // from an async native handler (gh-4350)
  13148. if ( !saved.length ) {
  13149. // Store arguments for use when handling the inner native event
  13150. // There will always be at least one argument (an event object), so this array
  13151. // will not be confused with a leftover capture object.
  13152. saved = slice.call( arguments );
  13153. dataPriv.set( this, type, saved );
  13154. // Trigger the native event and capture its result
  13155. // Support: IE <=9 - 11+
  13156. // focus() and blur() are asynchronous
  13157. notAsync = expectSync( this, type );
  13158. this[ type ]();
  13159. result = dataPriv.get( this, type );
  13160. if ( saved !== result || notAsync ) {
  13161. dataPriv.set( this, type, false );
  13162. } else {
  13163. result = {};
  13164. }
  13165. if ( saved !== result ) {
  13166. // Cancel the outer synthetic event
  13167. event.stopImmediatePropagation();
  13168. event.preventDefault();
  13169. return result.value;
  13170. }
  13171. // If this is an inner synthetic event for an event with a bubbling surrogate
  13172. // (focus or blur), assume that the surrogate already propagated from triggering the
  13173. // native event and prevent that from happening again here.
  13174. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13175. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13176. // less bad than duplication.
  13177. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13178. event.stopPropagation();
  13179. }
  13180. // If this is a native event triggered above, everything is now in order
  13181. // Fire an inner synthetic event with the original arguments
  13182. } else if ( saved.length ) {
  13183. // ...and capture the result
  13184. dataPriv.set( this, type, {
  13185. value: jQuery.event.trigger(
  13186. // Support: IE <=9 - 11+
  13187. // Extend with the prototype to reset the above stopImmediatePropagation()
  13188. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13189. saved.slice( 1 ),
  13190. this
  13191. )
  13192. } );
  13193. // Abort handling of the native event
  13194. event.stopImmediatePropagation();
  13195. }
  13196. }
  13197. } );
  13198. }
  13199. jQuery.removeEvent = function( elem, type, handle ) {
  13200. // This "if" is needed for plain objects
  13201. if ( elem.removeEventListener ) {
  13202. elem.removeEventListener( type, handle );
  13203. }
  13204. };
  13205. jQuery.Event = function( src, props ) {
  13206. // Allow instantiation without the 'new' keyword
  13207. if ( !( this instanceof jQuery.Event ) ) {
  13208. return new jQuery.Event( src, props );
  13209. }
  13210. // Event object
  13211. if ( src && src.type ) {
  13212. this.originalEvent = src;
  13213. this.type = src.type;
  13214. // Events bubbling up the document may have been marked as prevented
  13215. // by a handler lower down the tree; reflect the correct value.
  13216. this.isDefaultPrevented = src.defaultPrevented ||
  13217. src.defaultPrevented === undefined &&
  13218. // Support: Android <=2.3 only
  13219. src.returnValue === false ?
  13220. returnTrue :
  13221. returnFalse;
  13222. // Create target properties
  13223. // Support: Safari <=6 - 7 only
  13224. // Target should not be a text node (#504, #13143)
  13225. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13226. src.target.parentNode :
  13227. src.target;
  13228. this.currentTarget = src.currentTarget;
  13229. this.relatedTarget = src.relatedTarget;
  13230. // Event type
  13231. } else {
  13232. this.type = src;
  13233. }
  13234. // Put explicitly provided properties onto the event object
  13235. if ( props ) {
  13236. jQuery.extend( this, props );
  13237. }
  13238. // Create a timestamp if incoming event doesn't have one
  13239. this.timeStamp = src && src.timeStamp || Date.now();
  13240. // Mark it as fixed
  13241. this[ jQuery.expando ] = true;
  13242. };
  13243. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13244. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13245. jQuery.Event.prototype = {
  13246. constructor: jQuery.Event,
  13247. isDefaultPrevented: returnFalse,
  13248. isPropagationStopped: returnFalse,
  13249. isImmediatePropagationStopped: returnFalse,
  13250. isSimulated: false,
  13251. preventDefault: function() {
  13252. var e = this.originalEvent;
  13253. this.isDefaultPrevented = returnTrue;
  13254. if ( e && !this.isSimulated ) {
  13255. e.preventDefault();
  13256. }
  13257. },
  13258. stopPropagation: function() {
  13259. var e = this.originalEvent;
  13260. this.isPropagationStopped = returnTrue;
  13261. if ( e && !this.isSimulated ) {
  13262. e.stopPropagation();
  13263. }
  13264. },
  13265. stopImmediatePropagation: function() {
  13266. var e = this.originalEvent;
  13267. this.isImmediatePropagationStopped = returnTrue;
  13268. if ( e && !this.isSimulated ) {
  13269. e.stopImmediatePropagation();
  13270. }
  13271. this.stopPropagation();
  13272. }
  13273. };
  13274. // Includes all common event props including KeyEvent and MouseEvent specific props
  13275. jQuery.each( {
  13276. altKey: true,
  13277. bubbles: true,
  13278. cancelable: true,
  13279. changedTouches: true,
  13280. ctrlKey: true,
  13281. detail: true,
  13282. eventPhase: true,
  13283. metaKey: true,
  13284. pageX: true,
  13285. pageY: true,
  13286. shiftKey: true,
  13287. view: true,
  13288. "char": true,
  13289. code: true,
  13290. charCode: true,
  13291. key: true,
  13292. keyCode: true,
  13293. button: true,
  13294. buttons: true,
  13295. clientX: true,
  13296. clientY: true,
  13297. offsetX: true,
  13298. offsetY: true,
  13299. pointerId: true,
  13300. pointerType: true,
  13301. screenX: true,
  13302. screenY: true,
  13303. targetTouches: true,
  13304. toElement: true,
  13305. touches: true,
  13306. which: function( event ) {
  13307. var button = event.button;
  13308. // Add which for key events
  13309. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13310. return event.charCode != null ? event.charCode : event.keyCode;
  13311. }
  13312. // Add which for click: 1 === left; 2 === middle; 3 === right
  13313. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13314. if ( button & 1 ) {
  13315. return 1;
  13316. }
  13317. if ( button & 2 ) {
  13318. return 3;
  13319. }
  13320. if ( button & 4 ) {
  13321. return 2;
  13322. }
  13323. return 0;
  13324. }
  13325. return event.which;
  13326. }
  13327. }, jQuery.event.addProp );
  13328. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13329. jQuery.event.special[ type ] = {
  13330. // Utilize native event if possible so blur/focus sequence is correct
  13331. setup: function() {
  13332. // Claim the first handler
  13333. // dataPriv.set( this, "focus", ... )
  13334. // dataPriv.set( this, "blur", ... )
  13335. leverageNative( this, type, expectSync );
  13336. // Return false to allow normal processing in the caller
  13337. return false;
  13338. },
  13339. trigger: function() {
  13340. // Force setup before trigger
  13341. leverageNative( this, type );
  13342. // Return non-false to allow normal event-path propagation
  13343. return true;
  13344. },
  13345. delegateType: delegateType
  13346. };
  13347. } );
  13348. // Create mouseenter/leave events using mouseover/out and event-time checks
  13349. // so that event delegation works in jQuery.
  13350. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13351. //
  13352. // Support: Safari 7 only
  13353. // Safari sends mouseenter too often; see:
  13354. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13355. // for the description of the bug (it existed in older Chrome versions as well).
  13356. jQuery.each( {
  13357. mouseenter: "mouseover",
  13358. mouseleave: "mouseout",
  13359. pointerenter: "pointerover",
  13360. pointerleave: "pointerout"
  13361. }, function( orig, fix ) {
  13362. jQuery.event.special[ orig ] = {
  13363. delegateType: fix,
  13364. bindType: fix,
  13365. handle: function( event ) {
  13366. var ret,
  13367. target = this,
  13368. related = event.relatedTarget,
  13369. handleObj = event.handleObj;
  13370. // For mouseenter/leave call the handler if related is outside the target.
  13371. // NB: No relatedTarget if the mouse left/entered the browser window
  13372. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13373. event.type = handleObj.origType;
  13374. ret = handleObj.handler.apply( this, arguments );
  13375. event.type = fix;
  13376. }
  13377. return ret;
  13378. }
  13379. };
  13380. } );
  13381. jQuery.fn.extend( {
  13382. on: function( types, selector, data, fn ) {
  13383. return on( this, types, selector, data, fn );
  13384. },
  13385. one: function( types, selector, data, fn ) {
  13386. return on( this, types, selector, data, fn, 1 );
  13387. },
  13388. off: function( types, selector, fn ) {
  13389. var handleObj, type;
  13390. if ( types && types.preventDefault && types.handleObj ) {
  13391. // ( event ) dispatched jQuery.Event
  13392. handleObj = types.handleObj;
  13393. jQuery( types.delegateTarget ).off(
  13394. handleObj.namespace ?
  13395. handleObj.origType + "." + handleObj.namespace :
  13396. handleObj.origType,
  13397. handleObj.selector,
  13398. handleObj.handler
  13399. );
  13400. return this;
  13401. }
  13402. if ( typeof types === "object" ) {
  13403. // ( types-object [, selector] )
  13404. for ( type in types ) {
  13405. this.off( type, selector, types[ type ] );
  13406. }
  13407. return this;
  13408. }
  13409. if ( selector === false || typeof selector === "function" ) {
  13410. // ( types [, fn] )
  13411. fn = selector;
  13412. selector = undefined;
  13413. }
  13414. if ( fn === false ) {
  13415. fn = returnFalse;
  13416. }
  13417. return this.each( function() {
  13418. jQuery.event.remove( this, types, fn, selector );
  13419. } );
  13420. }
  13421. } );
  13422. var
  13423. /* eslint-disable max-len */
  13424. // See https://github.com/eslint/eslint/issues/3229
  13425. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13426. /* eslint-enable */
  13427. // Support: IE <=10 - 11, Edge 12 - 13 only
  13428. // In IE/Edge using regex groups here causes severe slowdowns.
  13429. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13430. rnoInnerhtml = /<script|<style|<link/i,
  13431. // checked="checked" or checked
  13432. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13433. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13434. // Prefer a tbody over its parent table for containing new rows
  13435. function manipulationTarget( elem, content ) {
  13436. if ( nodeName( elem, "table" ) &&
  13437. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13438. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13439. }
  13440. return elem;
  13441. }
  13442. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13443. function disableScript( elem ) {
  13444. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13445. return elem;
  13446. }
  13447. function restoreScript( elem ) {
  13448. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13449. elem.type = elem.type.slice( 5 );
  13450. } else {
  13451. elem.removeAttribute( "type" );
  13452. }
  13453. return elem;
  13454. }
  13455. function cloneCopyEvent( src, dest ) {
  13456. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13457. if ( dest.nodeType !== 1 ) {
  13458. return;
  13459. }
  13460. // 1. Copy private data: events, handlers, etc.
  13461. if ( dataPriv.hasData( src ) ) {
  13462. pdataOld = dataPriv.access( src );
  13463. pdataCur = dataPriv.set( dest, pdataOld );
  13464. events = pdataOld.events;
  13465. if ( events ) {
  13466. delete pdataCur.handle;
  13467. pdataCur.events = {};
  13468. for ( type in events ) {
  13469. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13470. jQuery.event.add( dest, type, events[ type ][ i ] );
  13471. }
  13472. }
  13473. }
  13474. }
  13475. // 2. Copy user data
  13476. if ( dataUser.hasData( src ) ) {
  13477. udataOld = dataUser.access( src );
  13478. udataCur = jQuery.extend( {}, udataOld );
  13479. dataUser.set( dest, udataCur );
  13480. }
  13481. }
  13482. // Fix IE bugs, see support tests
  13483. function fixInput( src, dest ) {
  13484. var nodeName = dest.nodeName.toLowerCase();
  13485. // Fails to persist the checked state of a cloned checkbox or radio button.
  13486. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13487. dest.checked = src.checked;
  13488. // Fails to return the selected option to the default selected state when cloning options
  13489. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13490. dest.defaultValue = src.defaultValue;
  13491. }
  13492. }
  13493. function domManip( collection, args, callback, ignored ) {
  13494. // Flatten any nested arrays
  13495. args = concat.apply( [], args );
  13496. var fragment, first, scripts, hasScripts, node, doc,
  13497. i = 0,
  13498. l = collection.length,
  13499. iNoClone = l - 1,
  13500. value = args[ 0 ],
  13501. valueIsFunction = isFunction( value );
  13502. // We can't cloneNode fragments that contain checked, in WebKit
  13503. if ( valueIsFunction ||
  13504. ( l > 1 && typeof value === "string" &&
  13505. !support.checkClone && rchecked.test( value ) ) ) {
  13506. return collection.each( function( index ) {
  13507. var self = collection.eq( index );
  13508. if ( valueIsFunction ) {
  13509. args[ 0 ] = value.call( this, index, self.html() );
  13510. }
  13511. domManip( self, args, callback, ignored );
  13512. } );
  13513. }
  13514. if ( l ) {
  13515. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13516. first = fragment.firstChild;
  13517. if ( fragment.childNodes.length === 1 ) {
  13518. fragment = first;
  13519. }
  13520. // Require either new content or an interest in ignored elements to invoke the callback
  13521. if ( first || ignored ) {
  13522. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13523. hasScripts = scripts.length;
  13524. // Use the original fragment for the last item
  13525. // instead of the first because it can end up
  13526. // being emptied incorrectly in certain situations (#8070).
  13527. for ( ; i < l; i++ ) {
  13528. node = fragment;
  13529. if ( i !== iNoClone ) {
  13530. node = jQuery.clone( node, true, true );
  13531. // Keep references to cloned scripts for later restoration
  13532. if ( hasScripts ) {
  13533. // Support: Android <=4.0 only, PhantomJS 1 only
  13534. // push.apply(_, arraylike) throws on ancient WebKit
  13535. jQuery.merge( scripts, getAll( node, "script" ) );
  13536. }
  13537. }
  13538. callback.call( collection[ i ], node, i );
  13539. }
  13540. if ( hasScripts ) {
  13541. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13542. // Reenable scripts
  13543. jQuery.map( scripts, restoreScript );
  13544. // Evaluate executable scripts on first document insertion
  13545. for ( i = 0; i < hasScripts; i++ ) {
  13546. node = scripts[ i ];
  13547. if ( rscriptType.test( node.type || "" ) &&
  13548. !dataPriv.access( node, "globalEval" ) &&
  13549. jQuery.contains( doc, node ) ) {
  13550. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13551. // Optional AJAX dependency, but won't run scripts if not present
  13552. if ( jQuery._evalUrl && !node.noModule ) {
  13553. jQuery._evalUrl( node.src, {
  13554. nonce: node.nonce || node.getAttribute( "nonce" )
  13555. } );
  13556. }
  13557. } else {
  13558. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13559. }
  13560. }
  13561. }
  13562. }
  13563. }
  13564. }
  13565. return collection;
  13566. }
  13567. function remove( elem, selector, keepData ) {
  13568. var node,
  13569. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13570. i = 0;
  13571. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13572. if ( !keepData && node.nodeType === 1 ) {
  13573. jQuery.cleanData( getAll( node ) );
  13574. }
  13575. if ( node.parentNode ) {
  13576. if ( keepData && isAttached( node ) ) {
  13577. setGlobalEval( getAll( node, "script" ) );
  13578. }
  13579. node.parentNode.removeChild( node );
  13580. }
  13581. }
  13582. return elem;
  13583. }
  13584. jQuery.extend( {
  13585. htmlPrefilter: function( html ) {
  13586. return html.replace( rxhtmlTag, "<$1></$2>" );
  13587. },
  13588. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13589. var i, l, srcElements, destElements,
  13590. clone = elem.cloneNode( true ),
  13591. inPage = isAttached( elem );
  13592. // Fix IE cloning issues
  13593. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13594. !jQuery.isXMLDoc( elem ) ) {
  13595. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13596. destElements = getAll( clone );
  13597. srcElements = getAll( elem );
  13598. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13599. fixInput( srcElements[ i ], destElements[ i ] );
  13600. }
  13601. }
  13602. // Copy the events from the original to the clone
  13603. if ( dataAndEvents ) {
  13604. if ( deepDataAndEvents ) {
  13605. srcElements = srcElements || getAll( elem );
  13606. destElements = destElements || getAll( clone );
  13607. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13608. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13609. }
  13610. } else {
  13611. cloneCopyEvent( elem, clone );
  13612. }
  13613. }
  13614. // Preserve script evaluation history
  13615. destElements = getAll( clone, "script" );
  13616. if ( destElements.length > 0 ) {
  13617. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13618. }
  13619. // Return the cloned set
  13620. return clone;
  13621. },
  13622. cleanData: function( elems ) {
  13623. var data, elem, type,
  13624. special = jQuery.event.special,
  13625. i = 0;
  13626. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13627. if ( acceptData( elem ) ) {
  13628. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13629. if ( data.events ) {
  13630. for ( type in data.events ) {
  13631. if ( special[ type ] ) {
  13632. jQuery.event.remove( elem, type );
  13633. // This is a shortcut to avoid jQuery.event.remove's overhead
  13634. } else {
  13635. jQuery.removeEvent( elem, type, data.handle );
  13636. }
  13637. }
  13638. }
  13639. // Support: Chrome <=35 - 45+
  13640. // Assign undefined instead of using delete, see Data#remove
  13641. elem[ dataPriv.expando ] = undefined;
  13642. }
  13643. if ( elem[ dataUser.expando ] ) {
  13644. // Support: Chrome <=35 - 45+
  13645. // Assign undefined instead of using delete, see Data#remove
  13646. elem[ dataUser.expando ] = undefined;
  13647. }
  13648. }
  13649. }
  13650. }
  13651. } );
  13652. jQuery.fn.extend( {
  13653. detach: function( selector ) {
  13654. return remove( this, selector, true );
  13655. },
  13656. remove: function( selector ) {
  13657. return remove( this, selector );
  13658. },
  13659. text: function( value ) {
  13660. return access( this, function( value ) {
  13661. return value === undefined ?
  13662. jQuery.text( this ) :
  13663. this.empty().each( function() {
  13664. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13665. this.textContent = value;
  13666. }
  13667. } );
  13668. }, null, value, arguments.length );
  13669. },
  13670. append: function() {
  13671. return domManip( this, arguments, function( elem ) {
  13672. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13673. var target = manipulationTarget( this, elem );
  13674. target.appendChild( elem );
  13675. }
  13676. } );
  13677. },
  13678. prepend: function() {
  13679. return domManip( this, arguments, function( elem ) {
  13680. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13681. var target = manipulationTarget( this, elem );
  13682. target.insertBefore( elem, target.firstChild );
  13683. }
  13684. } );
  13685. },
  13686. before: function() {
  13687. return domManip( this, arguments, function( elem ) {
  13688. if ( this.parentNode ) {
  13689. this.parentNode.insertBefore( elem, this );
  13690. }
  13691. } );
  13692. },
  13693. after: function() {
  13694. return domManip( this, arguments, function( elem ) {
  13695. if ( this.parentNode ) {
  13696. this.parentNode.insertBefore( elem, this.nextSibling );
  13697. }
  13698. } );
  13699. },
  13700. empty: function() {
  13701. var elem,
  13702. i = 0;
  13703. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13704. if ( elem.nodeType === 1 ) {
  13705. // Prevent memory leaks
  13706. jQuery.cleanData( getAll( elem, false ) );
  13707. // Remove any remaining nodes
  13708. elem.textContent = "";
  13709. }
  13710. }
  13711. return this;
  13712. },
  13713. clone: function( dataAndEvents, deepDataAndEvents ) {
  13714. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13715. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13716. return this.map( function() {
  13717. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13718. } );
  13719. },
  13720. html: function( value ) {
  13721. return access( this, function( value ) {
  13722. var elem = this[ 0 ] || {},
  13723. i = 0,
  13724. l = this.length;
  13725. if ( value === undefined && elem.nodeType === 1 ) {
  13726. return elem.innerHTML;
  13727. }
  13728. // See if we can take a shortcut and just use innerHTML
  13729. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13730. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13731. value = jQuery.htmlPrefilter( value );
  13732. try {
  13733. for ( ; i < l; i++ ) {
  13734. elem = this[ i ] || {};
  13735. // Remove element nodes and prevent memory leaks
  13736. if ( elem.nodeType === 1 ) {
  13737. jQuery.cleanData( getAll( elem, false ) );
  13738. elem.innerHTML = value;
  13739. }
  13740. }
  13741. elem = 0;
  13742. // If using innerHTML throws an exception, use the fallback method
  13743. } catch ( e ) {}
  13744. }
  13745. if ( elem ) {
  13746. this.empty().append( value );
  13747. }
  13748. }, null, value, arguments.length );
  13749. },
  13750. replaceWith: function() {
  13751. var ignored = [];
  13752. // Make the changes, replacing each non-ignored context element with the new content
  13753. return domManip( this, arguments, function( elem ) {
  13754. var parent = this.parentNode;
  13755. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13756. jQuery.cleanData( getAll( this ) );
  13757. if ( parent ) {
  13758. parent.replaceChild( elem, this );
  13759. }
  13760. }
  13761. // Force callback invocation
  13762. }, ignored );
  13763. }
  13764. } );
  13765. jQuery.each( {
  13766. appendTo: "append",
  13767. prependTo: "prepend",
  13768. insertBefore: "before",
  13769. insertAfter: "after",
  13770. replaceAll: "replaceWith"
  13771. }, function( name, original ) {
  13772. jQuery.fn[ name ] = function( selector ) {
  13773. var elems,
  13774. ret = [],
  13775. insert = jQuery( selector ),
  13776. last = insert.length - 1,
  13777. i = 0;
  13778. for ( ; i <= last; i++ ) {
  13779. elems = i === last ? this : this.clone( true );
  13780. jQuery( insert[ i ] )[ original ]( elems );
  13781. // Support: Android <=4.0 only, PhantomJS 1 only
  13782. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13783. push.apply( ret, elems.get() );
  13784. }
  13785. return this.pushStack( ret );
  13786. };
  13787. } );
  13788. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13789. var getStyles = function( elem ) {
  13790. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13791. // IE throws on elements created in popups
  13792. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13793. var view = elem.ownerDocument.defaultView;
  13794. if ( !view || !view.opener ) {
  13795. view = window;
  13796. }
  13797. return view.getComputedStyle( elem );
  13798. };
  13799. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13800. ( function() {
  13801. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13802. // so they're executed at the same time to save the second computation.
  13803. function computeStyleTests() {
  13804. // This is a singleton, we need to execute it only once
  13805. if ( !div ) {
  13806. return;
  13807. }
  13808. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13809. "margin-top:1px;padding:0;border:0";
  13810. div.style.cssText =
  13811. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13812. "margin:auto;border:1px;padding:1px;" +
  13813. "width:60%;top:1%";
  13814. documentElement.appendChild( container ).appendChild( div );
  13815. var divStyle = window.getComputedStyle( div );
  13816. pixelPositionVal = divStyle.top !== "1%";
  13817. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13818. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13819. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13820. // Some styles come back with percentage values, even though they shouldn't
  13821. div.style.right = "60%";
  13822. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13823. // Support: IE 9 - 11 only
  13824. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13825. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13826. // Support: IE 9 only
  13827. // Detect overflow:scroll screwiness (gh-3699)
  13828. // Support: Chrome <=64
  13829. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13830. div.style.position = "absolute";
  13831. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13832. documentElement.removeChild( container );
  13833. // Nullify the div so it wouldn't be stored in the memory and
  13834. // it will also be a sign that checks already performed
  13835. div = null;
  13836. }
  13837. function roundPixelMeasures( measure ) {
  13838. return Math.round( parseFloat( measure ) );
  13839. }
  13840. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13841. reliableMarginLeftVal,
  13842. container = document.createElement( "div" ),
  13843. div = document.createElement( "div" );
  13844. // Finish early in limited (non-browser) environments
  13845. if ( !div.style ) {
  13846. return;
  13847. }
  13848. // Support: IE <=9 - 11 only
  13849. // Style of cloned element affects source element cloned (#8908)
  13850. div.style.backgroundClip = "content-box";
  13851. div.cloneNode( true ).style.backgroundClip = "";
  13852. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13853. jQuery.extend( support, {
  13854. boxSizingReliable: function() {
  13855. computeStyleTests();
  13856. return boxSizingReliableVal;
  13857. },
  13858. pixelBoxStyles: function() {
  13859. computeStyleTests();
  13860. return pixelBoxStylesVal;
  13861. },
  13862. pixelPosition: function() {
  13863. computeStyleTests();
  13864. return pixelPositionVal;
  13865. },
  13866. reliableMarginLeft: function() {
  13867. computeStyleTests();
  13868. return reliableMarginLeftVal;
  13869. },
  13870. scrollboxSize: function() {
  13871. computeStyleTests();
  13872. return scrollboxSizeVal;
  13873. }
  13874. } );
  13875. } )();
  13876. function curCSS( elem, name, computed ) {
  13877. var width, minWidth, maxWidth, ret,
  13878. // Support: Firefox 51+
  13879. // Retrieving style before computed somehow
  13880. // fixes an issue with getting wrong values
  13881. // on detached elements
  13882. style = elem.style;
  13883. computed = computed || getStyles( elem );
  13884. // getPropertyValue is needed for:
  13885. // .css('filter') (IE 9 only, #12537)
  13886. // .css('--customProperty) (#3144)
  13887. if ( computed ) {
  13888. ret = computed.getPropertyValue( name ) || computed[ name ];
  13889. if ( ret === "" && !isAttached( elem ) ) {
  13890. ret = jQuery.style( elem, name );
  13891. }
  13892. // A tribute to the "awesome hack by Dean Edwards"
  13893. // Android Browser returns percentage for some values,
  13894. // but width seems to be reliably pixels.
  13895. // This is against the CSSOM draft spec:
  13896. // https://drafts.csswg.org/cssom/#resolved-values
  13897. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13898. // Remember the original values
  13899. width = style.width;
  13900. minWidth = style.minWidth;
  13901. maxWidth = style.maxWidth;
  13902. // Put in the new values to get a computed value out
  13903. style.minWidth = style.maxWidth = style.width = ret;
  13904. ret = computed.width;
  13905. // Revert the changed values
  13906. style.width = width;
  13907. style.minWidth = minWidth;
  13908. style.maxWidth = maxWidth;
  13909. }
  13910. }
  13911. return ret !== undefined ?
  13912. // Support: IE <=9 - 11 only
  13913. // IE returns zIndex value as an integer.
  13914. ret + "" :
  13915. ret;
  13916. }
  13917. function addGetHookIf( conditionFn, hookFn ) {
  13918. // Define the hook, we'll check on the first run if it's really needed.
  13919. return {
  13920. get: function() {
  13921. if ( conditionFn() ) {
  13922. // Hook not needed (or it's not possible to use it due
  13923. // to missing dependency), remove it.
  13924. delete this.get;
  13925. return;
  13926. }
  13927. // Hook needed; redefine it so that the support test is not executed again.
  13928. return ( this.get = hookFn ).apply( this, arguments );
  13929. }
  13930. };
  13931. }
  13932. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13933. emptyStyle = document.createElement( "div" ).style,
  13934. vendorProps = {};
  13935. // Return a vendor-prefixed property or undefined
  13936. function vendorPropName( name ) {
  13937. // Check for vendor prefixed names
  13938. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13939. i = cssPrefixes.length;
  13940. while ( i-- ) {
  13941. name = cssPrefixes[ i ] + capName;
  13942. if ( name in emptyStyle ) {
  13943. return name;
  13944. }
  13945. }
  13946. }
  13947. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13948. function finalPropName( name ) {
  13949. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13950. if ( final ) {
  13951. return final;
  13952. }
  13953. if ( name in emptyStyle ) {
  13954. return name;
  13955. }
  13956. return vendorProps[ name ] = vendorPropName( name ) || name;
  13957. }
  13958. var
  13959. // Swappable if display is none or starts with table
  13960. // except "table", "table-cell", or "table-caption"
  13961. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13962. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13963. rcustomProp = /^--/,
  13964. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13965. cssNormalTransform = {
  13966. letterSpacing: "0",
  13967. fontWeight: "400"
  13968. };
  13969. function setPositiveNumber( elem, value, subtract ) {
  13970. // Any relative (+/-) values have already been
  13971. // normalized at this point
  13972. var matches = rcssNum.exec( value );
  13973. return matches ?
  13974. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13975. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13976. value;
  13977. }
  13978. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13979. var i = dimension === "width" ? 1 : 0,
  13980. extra = 0,
  13981. delta = 0;
  13982. // Adjustment may not be necessary
  13983. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13984. return 0;
  13985. }
  13986. for ( ; i < 4; i += 2 ) {
  13987. // Both box models exclude margin
  13988. if ( box === "margin" ) {
  13989. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13990. }
  13991. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13992. if ( !isBorderBox ) {
  13993. // Add padding
  13994. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13995. // For "border" or "margin", add border
  13996. if ( box !== "padding" ) {
  13997. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13998. // But still keep track of it otherwise
  13999. } else {
  14000. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14001. }
  14002. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14003. // "padding" or "margin"
  14004. } else {
  14005. // For "content", subtract padding
  14006. if ( box === "content" ) {
  14007. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14008. }
  14009. // For "content" or "padding", subtract border
  14010. if ( box !== "margin" ) {
  14011. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14012. }
  14013. }
  14014. }
  14015. // Account for positive content-box scroll gutter when requested by providing computedVal
  14016. if ( !isBorderBox && computedVal >= 0 ) {
  14017. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14018. // Assuming integer scroll gutter, subtract the rest and round down
  14019. delta += Math.max( 0, Math.ceil(
  14020. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14021. computedVal -
  14022. delta -
  14023. extra -
  14024. 0.5
  14025. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14026. // Use an explicit zero to avoid NaN (gh-3964)
  14027. ) ) || 0;
  14028. }
  14029. return delta;
  14030. }
  14031. function getWidthOrHeight( elem, dimension, extra ) {
  14032. // Start with computed style
  14033. var styles = getStyles( elem ),
  14034. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14035. // Fake content-box until we know it's needed to know the true value.
  14036. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14037. isBorderBox = boxSizingNeeded &&
  14038. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14039. valueIsBorderBox = isBorderBox,
  14040. val = curCSS( elem, dimension, styles ),
  14041. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14042. // Support: Firefox <=54
  14043. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14044. if ( rnumnonpx.test( val ) ) {
  14045. if ( !extra ) {
  14046. return val;
  14047. }
  14048. val = "auto";
  14049. }
  14050. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14051. // This happens for inline elements with no explicit setting (gh-3571)
  14052. // Support: Android <=4.1 - 4.3 only
  14053. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14054. // Support: IE 9-11 only
  14055. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14056. // We use getClientRects() to check for hidden/disconnected.
  14057. // In those cases, the computed value can be trusted to be border-box
  14058. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14059. val === "auto" ||
  14060. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14061. elem.getClientRects().length ) {
  14062. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14063. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14064. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14065. // retrieved value as a content box dimension.
  14066. valueIsBorderBox = offsetProp in elem;
  14067. if ( valueIsBorderBox ) {
  14068. val = elem[ offsetProp ];
  14069. }
  14070. }
  14071. // Normalize "" and auto
  14072. val = parseFloat( val ) || 0;
  14073. // Adjust for the element's box model
  14074. return ( val +
  14075. boxModelAdjustment(
  14076. elem,
  14077. dimension,
  14078. extra || ( isBorderBox ? "border" : "content" ),
  14079. valueIsBorderBox,
  14080. styles,
  14081. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14082. val
  14083. )
  14084. ) + "px";
  14085. }
  14086. jQuery.extend( {
  14087. // Add in style property hooks for overriding the default
  14088. // behavior of getting and setting a style property
  14089. cssHooks: {
  14090. opacity: {
  14091. get: function( elem, computed ) {
  14092. if ( computed ) {
  14093. // We should always get a number back from opacity
  14094. var ret = curCSS( elem, "opacity" );
  14095. return ret === "" ? "1" : ret;
  14096. }
  14097. }
  14098. }
  14099. },
  14100. // Don't automatically add "px" to these possibly-unitless properties
  14101. cssNumber: {
  14102. "animationIterationCount": true,
  14103. "columnCount": true,
  14104. "fillOpacity": true,
  14105. "flexGrow": true,
  14106. "flexShrink": true,
  14107. "fontWeight": true,
  14108. "gridArea": true,
  14109. "gridColumn": true,
  14110. "gridColumnEnd": true,
  14111. "gridColumnStart": true,
  14112. "gridRow": true,
  14113. "gridRowEnd": true,
  14114. "gridRowStart": true,
  14115. "lineHeight": true,
  14116. "opacity": true,
  14117. "order": true,
  14118. "orphans": true,
  14119. "widows": true,
  14120. "zIndex": true,
  14121. "zoom": true
  14122. },
  14123. // Add in properties whose names you wish to fix before
  14124. // setting or getting the value
  14125. cssProps: {},
  14126. // Get and set the style property on a DOM Node
  14127. style: function( elem, name, value, extra ) {
  14128. // Don't set styles on text and comment nodes
  14129. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14130. return;
  14131. }
  14132. // Make sure that we're working with the right name
  14133. var ret, type, hooks,
  14134. origName = camelCase( name ),
  14135. isCustomProp = rcustomProp.test( name ),
  14136. style = elem.style;
  14137. // Make sure that we're working with the right name. We don't
  14138. // want to query the value if it is a CSS custom property
  14139. // since they are user-defined.
  14140. if ( !isCustomProp ) {
  14141. name = finalPropName( origName );
  14142. }
  14143. // Gets hook for the prefixed version, then unprefixed version
  14144. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14145. // Check if we're setting a value
  14146. if ( value !== undefined ) {
  14147. type = typeof value;
  14148. // Convert "+=" or "-=" to relative numbers (#7345)
  14149. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14150. value = adjustCSS( elem, name, ret );
  14151. // Fixes bug #9237
  14152. type = "number";
  14153. }
  14154. // Make sure that null and NaN values aren't set (#7116)
  14155. if ( value == null || value !== value ) {
  14156. return;
  14157. }
  14158. // If a number was passed in, add the unit (except for certain CSS properties)
  14159. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14160. // "px" to a few hardcoded values.
  14161. if ( type === "number" && !isCustomProp ) {
  14162. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14163. }
  14164. // background-* props affect original clone's values
  14165. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14166. style[ name ] = "inherit";
  14167. }
  14168. // If a hook was provided, use that value, otherwise just set the specified value
  14169. if ( !hooks || !( "set" in hooks ) ||
  14170. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14171. if ( isCustomProp ) {
  14172. style.setProperty( name, value );
  14173. } else {
  14174. style[ name ] = value;
  14175. }
  14176. }
  14177. } else {
  14178. // If a hook was provided get the non-computed value from there
  14179. if ( hooks && "get" in hooks &&
  14180. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14181. return ret;
  14182. }
  14183. // Otherwise just get the value from the style object
  14184. return style[ name ];
  14185. }
  14186. },
  14187. css: function( elem, name, extra, styles ) {
  14188. var val, num, hooks,
  14189. origName = camelCase( name ),
  14190. isCustomProp = rcustomProp.test( name );
  14191. // Make sure that we're working with the right name. We don't
  14192. // want to modify the value if it is a CSS custom property
  14193. // since they are user-defined.
  14194. if ( !isCustomProp ) {
  14195. name = finalPropName( origName );
  14196. }
  14197. // Try prefixed name followed by the unprefixed name
  14198. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14199. // If a hook was provided get the computed value from there
  14200. if ( hooks && "get" in hooks ) {
  14201. val = hooks.get( elem, true, extra );
  14202. }
  14203. // Otherwise, if a way to get the computed value exists, use that
  14204. if ( val === undefined ) {
  14205. val = curCSS( elem, name, styles );
  14206. }
  14207. // Convert "normal" to computed value
  14208. if ( val === "normal" && name in cssNormalTransform ) {
  14209. val = cssNormalTransform[ name ];
  14210. }
  14211. // Make numeric if forced or a qualifier was provided and val looks numeric
  14212. if ( extra === "" || extra ) {
  14213. num = parseFloat( val );
  14214. return extra === true || isFinite( num ) ? num || 0 : val;
  14215. }
  14216. return val;
  14217. }
  14218. } );
  14219. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14220. jQuery.cssHooks[ dimension ] = {
  14221. get: function( elem, computed, extra ) {
  14222. if ( computed ) {
  14223. // Certain elements can have dimension info if we invisibly show them
  14224. // but it must have a current display style that would benefit
  14225. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14226. // Support: Safari 8+
  14227. // Table columns in Safari have non-zero offsetWidth & zero
  14228. // getBoundingClientRect().width unless display is changed.
  14229. // Support: IE <=11 only
  14230. // Running getBoundingClientRect on a disconnected node
  14231. // in IE throws an error.
  14232. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14233. swap( elem, cssShow, function() {
  14234. return getWidthOrHeight( elem, dimension, extra );
  14235. } ) :
  14236. getWidthOrHeight( elem, dimension, extra );
  14237. }
  14238. },
  14239. set: function( elem, value, extra ) {
  14240. var matches,
  14241. styles = getStyles( elem ),
  14242. // Only read styles.position if the test has a chance to fail
  14243. // to avoid forcing a reflow.
  14244. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14245. styles.position === "absolute",
  14246. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14247. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14248. isBorderBox = boxSizingNeeded &&
  14249. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14250. subtract = extra ?
  14251. boxModelAdjustment(
  14252. elem,
  14253. dimension,
  14254. extra,
  14255. isBorderBox,
  14256. styles
  14257. ) :
  14258. 0;
  14259. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14260. // faking a content-box to get border and padding (gh-3699)
  14261. if ( isBorderBox && scrollboxSizeBuggy ) {
  14262. subtract -= Math.ceil(
  14263. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14264. parseFloat( styles[ dimension ] ) -
  14265. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14266. 0.5
  14267. );
  14268. }
  14269. // Convert to pixels if value adjustment is needed
  14270. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14271. ( matches[ 3 ] || "px" ) !== "px" ) {
  14272. elem.style[ dimension ] = value;
  14273. value = jQuery.css( elem, dimension );
  14274. }
  14275. return setPositiveNumber( elem, value, subtract );
  14276. }
  14277. };
  14278. } );
  14279. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14280. function( elem, computed ) {
  14281. if ( computed ) {
  14282. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14283. elem.getBoundingClientRect().left -
  14284. swap( elem, { marginLeft: 0 }, function() {
  14285. return elem.getBoundingClientRect().left;
  14286. } )
  14287. ) + "px";
  14288. }
  14289. }
  14290. );
  14291. // These hooks are used by animate to expand properties
  14292. jQuery.each( {
  14293. margin: "",
  14294. padding: "",
  14295. border: "Width"
  14296. }, function( prefix, suffix ) {
  14297. jQuery.cssHooks[ prefix + suffix ] = {
  14298. expand: function( value ) {
  14299. var i = 0,
  14300. expanded = {},
  14301. // Assumes a single number if not a string
  14302. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14303. for ( ; i < 4; i++ ) {
  14304. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14305. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14306. }
  14307. return expanded;
  14308. }
  14309. };
  14310. if ( prefix !== "margin" ) {
  14311. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14312. }
  14313. } );
  14314. jQuery.fn.extend( {
  14315. css: function( name, value ) {
  14316. return access( this, function( elem, name, value ) {
  14317. var styles, len,
  14318. map = {},
  14319. i = 0;
  14320. if ( Array.isArray( name ) ) {
  14321. styles = getStyles( elem );
  14322. len = name.length;
  14323. for ( ; i < len; i++ ) {
  14324. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14325. }
  14326. return map;
  14327. }
  14328. return value !== undefined ?
  14329. jQuery.style( elem, name, value ) :
  14330. jQuery.css( elem, name );
  14331. }, name, value, arguments.length > 1 );
  14332. }
  14333. } );
  14334. function Tween( elem, options, prop, end, easing ) {
  14335. return new Tween.prototype.init( elem, options, prop, end, easing );
  14336. }
  14337. jQuery.Tween = Tween;
  14338. Tween.prototype = {
  14339. constructor: Tween,
  14340. init: function( elem, options, prop, end, easing, unit ) {
  14341. this.elem = elem;
  14342. this.prop = prop;
  14343. this.easing = easing || jQuery.easing._default;
  14344. this.options = options;
  14345. this.start = this.now = this.cur();
  14346. this.end = end;
  14347. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14348. },
  14349. cur: function() {
  14350. var hooks = Tween.propHooks[ this.prop ];
  14351. return hooks && hooks.get ?
  14352. hooks.get( this ) :
  14353. Tween.propHooks._default.get( this );
  14354. },
  14355. run: function( percent ) {
  14356. var eased,
  14357. hooks = Tween.propHooks[ this.prop ];
  14358. if ( this.options.duration ) {
  14359. this.pos = eased = jQuery.easing[ this.easing ](
  14360. percent, this.options.duration * percent, 0, 1, this.options.duration
  14361. );
  14362. } else {
  14363. this.pos = eased = percent;
  14364. }
  14365. this.now = ( this.end - this.start ) * eased + this.start;
  14366. if ( this.options.step ) {
  14367. this.options.step.call( this.elem, this.now, this );
  14368. }
  14369. if ( hooks && hooks.set ) {
  14370. hooks.set( this );
  14371. } else {
  14372. Tween.propHooks._default.set( this );
  14373. }
  14374. return this;
  14375. }
  14376. };
  14377. Tween.prototype.init.prototype = Tween.prototype;
  14378. Tween.propHooks = {
  14379. _default: {
  14380. get: function( tween ) {
  14381. var result;
  14382. // Use a property on the element directly when it is not a DOM element,
  14383. // or when there is no matching style property that exists.
  14384. if ( tween.elem.nodeType !== 1 ||
  14385. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14386. return tween.elem[ tween.prop ];
  14387. }
  14388. // Passing an empty string as a 3rd parameter to .css will automatically
  14389. // attempt a parseFloat and fallback to a string if the parse fails.
  14390. // Simple values such as "10px" are parsed to Float;
  14391. // complex values such as "rotate(1rad)" are returned as-is.
  14392. result = jQuery.css( tween.elem, tween.prop, "" );
  14393. // Empty strings, null, undefined and "auto" are converted to 0.
  14394. return !result || result === "auto" ? 0 : result;
  14395. },
  14396. set: function( tween ) {
  14397. // Use step hook for back compat.
  14398. // Use cssHook if its there.
  14399. // Use .style if available and use plain properties where available.
  14400. if ( jQuery.fx.step[ tween.prop ] ) {
  14401. jQuery.fx.step[ tween.prop ]( tween );
  14402. } else if ( tween.elem.nodeType === 1 && (
  14403. jQuery.cssHooks[ tween.prop ] ||
  14404. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14405. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14406. } else {
  14407. tween.elem[ tween.prop ] = tween.now;
  14408. }
  14409. }
  14410. }
  14411. };
  14412. // Support: IE <=9 only
  14413. // Panic based approach to setting things on disconnected nodes
  14414. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14415. set: function( tween ) {
  14416. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14417. tween.elem[ tween.prop ] = tween.now;
  14418. }
  14419. }
  14420. };
  14421. jQuery.easing = {
  14422. linear: function( p ) {
  14423. return p;
  14424. },
  14425. swing: function( p ) {
  14426. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14427. },
  14428. _default: "swing"
  14429. };
  14430. jQuery.fx = Tween.prototype.init;
  14431. // Back compat <1.8 extension point
  14432. jQuery.fx.step = {};
  14433. var
  14434. fxNow, inProgress,
  14435. rfxtypes = /^(?:toggle|show|hide)$/,
  14436. rrun = /queueHooks$/;
  14437. function schedule() {
  14438. if ( inProgress ) {
  14439. if ( document.hidden === false && window.requestAnimationFrame ) {
  14440. window.requestAnimationFrame( schedule );
  14441. } else {
  14442. window.setTimeout( schedule, jQuery.fx.interval );
  14443. }
  14444. jQuery.fx.tick();
  14445. }
  14446. }
  14447. // Animations created synchronously will run synchronously
  14448. function createFxNow() {
  14449. window.setTimeout( function() {
  14450. fxNow = undefined;
  14451. } );
  14452. return ( fxNow = Date.now() );
  14453. }
  14454. // Generate parameters to create a standard animation
  14455. function genFx( type, includeWidth ) {
  14456. var which,
  14457. i = 0,
  14458. attrs = { height: type };
  14459. // If we include width, step value is 1 to do all cssExpand values,
  14460. // otherwise step value is 2 to skip over Left and Right
  14461. includeWidth = includeWidth ? 1 : 0;
  14462. for ( ; i < 4; i += 2 - includeWidth ) {
  14463. which = cssExpand[ i ];
  14464. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14465. }
  14466. if ( includeWidth ) {
  14467. attrs.opacity = attrs.width = type;
  14468. }
  14469. return attrs;
  14470. }
  14471. function createTween( value, prop, animation ) {
  14472. var tween,
  14473. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14474. index = 0,
  14475. length = collection.length;
  14476. for ( ; index < length; index++ ) {
  14477. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14478. // We're done with this property
  14479. return tween;
  14480. }
  14481. }
  14482. }
  14483. function defaultPrefilter( elem, props, opts ) {
  14484. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14485. isBox = "width" in props || "height" in props,
  14486. anim = this,
  14487. orig = {},
  14488. style = elem.style,
  14489. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14490. dataShow = dataPriv.get( elem, "fxshow" );
  14491. // Queue-skipping animations hijack the fx hooks
  14492. if ( !opts.queue ) {
  14493. hooks = jQuery._queueHooks( elem, "fx" );
  14494. if ( hooks.unqueued == null ) {
  14495. hooks.unqueued = 0;
  14496. oldfire = hooks.empty.fire;
  14497. hooks.empty.fire = function() {
  14498. if ( !hooks.unqueued ) {
  14499. oldfire();
  14500. }
  14501. };
  14502. }
  14503. hooks.unqueued++;
  14504. anim.always( function() {
  14505. // Ensure the complete handler is called before this completes
  14506. anim.always( function() {
  14507. hooks.unqueued--;
  14508. if ( !jQuery.queue( elem, "fx" ).length ) {
  14509. hooks.empty.fire();
  14510. }
  14511. } );
  14512. } );
  14513. }
  14514. // Detect show/hide animations
  14515. for ( prop in props ) {
  14516. value = props[ prop ];
  14517. if ( rfxtypes.test( value ) ) {
  14518. delete props[ prop ];
  14519. toggle = toggle || value === "toggle";
  14520. if ( value === ( hidden ? "hide" : "show" ) ) {
  14521. // Pretend to be hidden if this is a "show" and
  14522. // there is still data from a stopped show/hide
  14523. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14524. hidden = true;
  14525. // Ignore all other no-op show/hide data
  14526. } else {
  14527. continue;
  14528. }
  14529. }
  14530. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14531. }
  14532. }
  14533. // Bail out if this is a no-op like .hide().hide()
  14534. propTween = !jQuery.isEmptyObject( props );
  14535. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14536. return;
  14537. }
  14538. // Restrict "overflow" and "display" styles during box animations
  14539. if ( isBox && elem.nodeType === 1 ) {
  14540. // Support: IE <=9 - 11, Edge 12 - 15
  14541. // Record all 3 overflow attributes because IE does not infer the shorthand
  14542. // from identically-valued overflowX and overflowY and Edge just mirrors
  14543. // the overflowX value there.
  14544. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14545. // Identify a display type, preferring old show/hide data over the CSS cascade
  14546. restoreDisplay = dataShow && dataShow.display;
  14547. if ( restoreDisplay == null ) {
  14548. restoreDisplay = dataPriv.get( elem, "display" );
  14549. }
  14550. display = jQuery.css( elem, "display" );
  14551. if ( display === "none" ) {
  14552. if ( restoreDisplay ) {
  14553. display = restoreDisplay;
  14554. } else {
  14555. // Get nonempty value(s) by temporarily forcing visibility
  14556. showHide( [ elem ], true );
  14557. restoreDisplay = elem.style.display || restoreDisplay;
  14558. display = jQuery.css( elem, "display" );
  14559. showHide( [ elem ] );
  14560. }
  14561. }
  14562. // Animate inline elements as inline-block
  14563. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14564. if ( jQuery.css( elem, "float" ) === "none" ) {
  14565. // Restore the original display value at the end of pure show/hide animations
  14566. if ( !propTween ) {
  14567. anim.done( function() {
  14568. style.display = restoreDisplay;
  14569. } );
  14570. if ( restoreDisplay == null ) {
  14571. display = style.display;
  14572. restoreDisplay = display === "none" ? "" : display;
  14573. }
  14574. }
  14575. style.display = "inline-block";
  14576. }
  14577. }
  14578. }
  14579. if ( opts.overflow ) {
  14580. style.overflow = "hidden";
  14581. anim.always( function() {
  14582. style.overflow = opts.overflow[ 0 ];
  14583. style.overflowX = opts.overflow[ 1 ];
  14584. style.overflowY = opts.overflow[ 2 ];
  14585. } );
  14586. }
  14587. // Implement show/hide animations
  14588. propTween = false;
  14589. for ( prop in orig ) {
  14590. // General show/hide setup for this element animation
  14591. if ( !propTween ) {
  14592. if ( dataShow ) {
  14593. if ( "hidden" in dataShow ) {
  14594. hidden = dataShow.hidden;
  14595. }
  14596. } else {
  14597. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14598. }
  14599. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14600. if ( toggle ) {
  14601. dataShow.hidden = !hidden;
  14602. }
  14603. // Show elements before animating them
  14604. if ( hidden ) {
  14605. showHide( [ elem ], true );
  14606. }
  14607. /* eslint-disable no-loop-func */
  14608. anim.done( function() {
  14609. /* eslint-enable no-loop-func */
  14610. // The final step of a "hide" animation is actually hiding the element
  14611. if ( !hidden ) {
  14612. showHide( [ elem ] );
  14613. }
  14614. dataPriv.remove( elem, "fxshow" );
  14615. for ( prop in orig ) {
  14616. jQuery.style( elem, prop, orig[ prop ] );
  14617. }
  14618. } );
  14619. }
  14620. // Per-property setup
  14621. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14622. if ( !( prop in dataShow ) ) {
  14623. dataShow[ prop ] = propTween.start;
  14624. if ( hidden ) {
  14625. propTween.end = propTween.start;
  14626. propTween.start = 0;
  14627. }
  14628. }
  14629. }
  14630. }
  14631. function propFilter( props, specialEasing ) {
  14632. var index, name, easing, value, hooks;
  14633. // camelCase, specialEasing and expand cssHook pass
  14634. for ( index in props ) {
  14635. name = camelCase( index );
  14636. easing = specialEasing[ name ];
  14637. value = props[ index ];
  14638. if ( Array.isArray( value ) ) {
  14639. easing = value[ 1 ];
  14640. value = props[ index ] = value[ 0 ];
  14641. }
  14642. if ( index !== name ) {
  14643. props[ name ] = value;
  14644. delete props[ index ];
  14645. }
  14646. hooks = jQuery.cssHooks[ name ];
  14647. if ( hooks && "expand" in hooks ) {
  14648. value = hooks.expand( value );
  14649. delete props[ name ];
  14650. // Not quite $.extend, this won't overwrite existing keys.
  14651. // Reusing 'index' because we have the correct "name"
  14652. for ( index in value ) {
  14653. if ( !( index in props ) ) {
  14654. props[ index ] = value[ index ];
  14655. specialEasing[ index ] = easing;
  14656. }
  14657. }
  14658. } else {
  14659. specialEasing[ name ] = easing;
  14660. }
  14661. }
  14662. }
  14663. function Animation( elem, properties, options ) {
  14664. var result,
  14665. stopped,
  14666. index = 0,
  14667. length = Animation.prefilters.length,
  14668. deferred = jQuery.Deferred().always( function() {
  14669. // Don't match elem in the :animated selector
  14670. delete tick.elem;
  14671. } ),
  14672. tick = function() {
  14673. if ( stopped ) {
  14674. return false;
  14675. }
  14676. var currentTime = fxNow || createFxNow(),
  14677. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14678. // Support: Android 2.3 only
  14679. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14680. temp = remaining / animation.duration || 0,
  14681. percent = 1 - temp,
  14682. index = 0,
  14683. length = animation.tweens.length;
  14684. for ( ; index < length; index++ ) {
  14685. animation.tweens[ index ].run( percent );
  14686. }
  14687. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14688. // If there's more to do, yield
  14689. if ( percent < 1 && length ) {
  14690. return remaining;
  14691. }
  14692. // If this was an empty animation, synthesize a final progress notification
  14693. if ( !length ) {
  14694. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14695. }
  14696. // Resolve the animation and report its conclusion
  14697. deferred.resolveWith( elem, [ animation ] );
  14698. return false;
  14699. },
  14700. animation = deferred.promise( {
  14701. elem: elem,
  14702. props: jQuery.extend( {}, properties ),
  14703. opts: jQuery.extend( true, {
  14704. specialEasing: {},
  14705. easing: jQuery.easing._default
  14706. }, options ),
  14707. originalProperties: properties,
  14708. originalOptions: options,
  14709. startTime: fxNow || createFxNow(),
  14710. duration: options.duration,
  14711. tweens: [],
  14712. createTween: function( prop, end ) {
  14713. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14714. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14715. animation.tweens.push( tween );
  14716. return tween;
  14717. },
  14718. stop: function( gotoEnd ) {
  14719. var index = 0,
  14720. // If we are going to the end, we want to run all the tweens
  14721. // otherwise we skip this part
  14722. length = gotoEnd ? animation.tweens.length : 0;
  14723. if ( stopped ) {
  14724. return this;
  14725. }
  14726. stopped = true;
  14727. for ( ; index < length; index++ ) {
  14728. animation.tweens[ index ].run( 1 );
  14729. }
  14730. // Resolve when we played the last frame; otherwise, reject
  14731. if ( gotoEnd ) {
  14732. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14733. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14734. } else {
  14735. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14736. }
  14737. return this;
  14738. }
  14739. } ),
  14740. props = animation.props;
  14741. propFilter( props, animation.opts.specialEasing );
  14742. for ( ; index < length; index++ ) {
  14743. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14744. if ( result ) {
  14745. if ( isFunction( result.stop ) ) {
  14746. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14747. result.stop.bind( result );
  14748. }
  14749. return result;
  14750. }
  14751. }
  14752. jQuery.map( props, createTween, animation );
  14753. if ( isFunction( animation.opts.start ) ) {
  14754. animation.opts.start.call( elem, animation );
  14755. }
  14756. // Attach callbacks from options
  14757. animation
  14758. .progress( animation.opts.progress )
  14759. .done( animation.opts.done, animation.opts.complete )
  14760. .fail( animation.opts.fail )
  14761. .always( animation.opts.always );
  14762. jQuery.fx.timer(
  14763. jQuery.extend( tick, {
  14764. elem: elem,
  14765. anim: animation,
  14766. queue: animation.opts.queue
  14767. } )
  14768. );
  14769. return animation;
  14770. }
  14771. jQuery.Animation = jQuery.extend( Animation, {
  14772. tweeners: {
  14773. "*": [ function( prop, value ) {
  14774. var tween = this.createTween( prop, value );
  14775. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14776. return tween;
  14777. } ]
  14778. },
  14779. tweener: function( props, callback ) {
  14780. if ( isFunction( props ) ) {
  14781. callback = props;
  14782. props = [ "*" ];
  14783. } else {
  14784. props = props.match( rnothtmlwhite );
  14785. }
  14786. var prop,
  14787. index = 0,
  14788. length = props.length;
  14789. for ( ; index < length; index++ ) {
  14790. prop = props[ index ];
  14791. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14792. Animation.tweeners[ prop ].unshift( callback );
  14793. }
  14794. },
  14795. prefilters: [ defaultPrefilter ],
  14796. prefilter: function( callback, prepend ) {
  14797. if ( prepend ) {
  14798. Animation.prefilters.unshift( callback );
  14799. } else {
  14800. Animation.prefilters.push( callback );
  14801. }
  14802. }
  14803. } );
  14804. jQuery.speed = function( speed, easing, fn ) {
  14805. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14806. complete: fn || !fn && easing ||
  14807. isFunction( speed ) && speed,
  14808. duration: speed,
  14809. easing: fn && easing || easing && !isFunction( easing ) && easing
  14810. };
  14811. // Go to the end state if fx are off
  14812. if ( jQuery.fx.off ) {
  14813. opt.duration = 0;
  14814. } else {
  14815. if ( typeof opt.duration !== "number" ) {
  14816. if ( opt.duration in jQuery.fx.speeds ) {
  14817. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14818. } else {
  14819. opt.duration = jQuery.fx.speeds._default;
  14820. }
  14821. }
  14822. }
  14823. // Normalize opt.queue - true/undefined/null -> "fx"
  14824. if ( opt.queue == null || opt.queue === true ) {
  14825. opt.queue = "fx";
  14826. }
  14827. // Queueing
  14828. opt.old = opt.complete;
  14829. opt.complete = function() {
  14830. if ( isFunction( opt.old ) ) {
  14831. opt.old.call( this );
  14832. }
  14833. if ( opt.queue ) {
  14834. jQuery.dequeue( this, opt.queue );
  14835. }
  14836. };
  14837. return opt;
  14838. };
  14839. jQuery.fn.extend( {
  14840. fadeTo: function( speed, to, easing, callback ) {
  14841. // Show any hidden elements after setting opacity to 0
  14842. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14843. // Animate to the value specified
  14844. .end().animate( { opacity: to }, speed, easing, callback );
  14845. },
  14846. animate: function( prop, speed, easing, callback ) {
  14847. var empty = jQuery.isEmptyObject( prop ),
  14848. optall = jQuery.speed( speed, easing, callback ),
  14849. doAnimation = function() {
  14850. // Operate on a copy of prop so per-property easing won't be lost
  14851. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14852. // Empty animations, or finishing resolves immediately
  14853. if ( empty || dataPriv.get( this, "finish" ) ) {
  14854. anim.stop( true );
  14855. }
  14856. };
  14857. doAnimation.finish = doAnimation;
  14858. return empty || optall.queue === false ?
  14859. this.each( doAnimation ) :
  14860. this.queue( optall.queue, doAnimation );
  14861. },
  14862. stop: function( type, clearQueue, gotoEnd ) {
  14863. var stopQueue = function( hooks ) {
  14864. var stop = hooks.stop;
  14865. delete hooks.stop;
  14866. stop( gotoEnd );
  14867. };
  14868. if ( typeof type !== "string" ) {
  14869. gotoEnd = clearQueue;
  14870. clearQueue = type;
  14871. type = undefined;
  14872. }
  14873. if ( clearQueue && type !== false ) {
  14874. this.queue( type || "fx", [] );
  14875. }
  14876. return this.each( function() {
  14877. var dequeue = true,
  14878. index = type != null && type + "queueHooks",
  14879. timers = jQuery.timers,
  14880. data = dataPriv.get( this );
  14881. if ( index ) {
  14882. if ( data[ index ] && data[ index ].stop ) {
  14883. stopQueue( data[ index ] );
  14884. }
  14885. } else {
  14886. for ( index in data ) {
  14887. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14888. stopQueue( data[ index ] );
  14889. }
  14890. }
  14891. }
  14892. for ( index = timers.length; index--; ) {
  14893. if ( timers[ index ].elem === this &&
  14894. ( type == null || timers[ index ].queue === type ) ) {
  14895. timers[ index ].anim.stop( gotoEnd );
  14896. dequeue = false;
  14897. timers.splice( index, 1 );
  14898. }
  14899. }
  14900. // Start the next in the queue if the last step wasn't forced.
  14901. // Timers currently will call their complete callbacks, which
  14902. // will dequeue but only if they were gotoEnd.
  14903. if ( dequeue || !gotoEnd ) {
  14904. jQuery.dequeue( this, type );
  14905. }
  14906. } );
  14907. },
  14908. finish: function( type ) {
  14909. if ( type !== false ) {
  14910. type = type || "fx";
  14911. }
  14912. return this.each( function() {
  14913. var index,
  14914. data = dataPriv.get( this ),
  14915. queue = data[ type + "queue" ],
  14916. hooks = data[ type + "queueHooks" ],
  14917. timers = jQuery.timers,
  14918. length = queue ? queue.length : 0;
  14919. // Enable finishing flag on private data
  14920. data.finish = true;
  14921. // Empty the queue first
  14922. jQuery.queue( this, type, [] );
  14923. if ( hooks && hooks.stop ) {
  14924. hooks.stop.call( this, true );
  14925. }
  14926. // Look for any active animations, and finish them
  14927. for ( index = timers.length; index--; ) {
  14928. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14929. timers[ index ].anim.stop( true );
  14930. timers.splice( index, 1 );
  14931. }
  14932. }
  14933. // Look for any animations in the old queue and finish them
  14934. for ( index = 0; index < length; index++ ) {
  14935. if ( queue[ index ] && queue[ index ].finish ) {
  14936. queue[ index ].finish.call( this );
  14937. }
  14938. }
  14939. // Turn off finishing flag
  14940. delete data.finish;
  14941. } );
  14942. }
  14943. } );
  14944. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14945. var cssFn = jQuery.fn[ name ];
  14946. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14947. return speed == null || typeof speed === "boolean" ?
  14948. cssFn.apply( this, arguments ) :
  14949. this.animate( genFx( name, true ), speed, easing, callback );
  14950. };
  14951. } );
  14952. // Generate shortcuts for custom animations
  14953. jQuery.each( {
  14954. slideDown: genFx( "show" ),
  14955. slideUp: genFx( "hide" ),
  14956. slideToggle: genFx( "toggle" ),
  14957. fadeIn: { opacity: "show" },
  14958. fadeOut: { opacity: "hide" },
  14959. fadeToggle: { opacity: "toggle" }
  14960. }, function( name, props ) {
  14961. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14962. return this.animate( props, speed, easing, callback );
  14963. };
  14964. } );
  14965. jQuery.timers = [];
  14966. jQuery.fx.tick = function() {
  14967. var timer,
  14968. i = 0,
  14969. timers = jQuery.timers;
  14970. fxNow = Date.now();
  14971. for ( ; i < timers.length; i++ ) {
  14972. timer = timers[ i ];
  14973. // Run the timer and safely remove it when done (allowing for external removal)
  14974. if ( !timer() && timers[ i ] === timer ) {
  14975. timers.splice( i--, 1 );
  14976. }
  14977. }
  14978. if ( !timers.length ) {
  14979. jQuery.fx.stop();
  14980. }
  14981. fxNow = undefined;
  14982. };
  14983. jQuery.fx.timer = function( timer ) {
  14984. jQuery.timers.push( timer );
  14985. jQuery.fx.start();
  14986. };
  14987. jQuery.fx.interval = 13;
  14988. jQuery.fx.start = function() {
  14989. if ( inProgress ) {
  14990. return;
  14991. }
  14992. inProgress = true;
  14993. schedule();
  14994. };
  14995. jQuery.fx.stop = function() {
  14996. inProgress = null;
  14997. };
  14998. jQuery.fx.speeds = {
  14999. slow: 600,
  15000. fast: 200,
  15001. // Default speed
  15002. _default: 400
  15003. };
  15004. // Based off of the plugin by Clint Helfers, with permission.
  15005. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15006. jQuery.fn.delay = function( time, type ) {
  15007. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15008. type = type || "fx";
  15009. return this.queue( type, function( next, hooks ) {
  15010. var timeout = window.setTimeout( next, time );
  15011. hooks.stop = function() {
  15012. window.clearTimeout( timeout );
  15013. };
  15014. } );
  15015. };
  15016. ( function() {
  15017. var input = document.createElement( "input" ),
  15018. select = document.createElement( "select" ),
  15019. opt = select.appendChild( document.createElement( "option" ) );
  15020. input.type = "checkbox";
  15021. // Support: Android <=4.3 only
  15022. // Default value for a checkbox should be "on"
  15023. support.checkOn = input.value !== "";
  15024. // Support: IE <=11 only
  15025. // Must access selectedIndex to make default options select
  15026. support.optSelected = opt.selected;
  15027. // Support: IE <=11 only
  15028. // An input loses its value after becoming a radio
  15029. input = document.createElement( "input" );
  15030. input.value = "t";
  15031. input.type = "radio";
  15032. support.radioValue = input.value === "t";
  15033. } )();
  15034. var boolHook,
  15035. attrHandle = jQuery.expr.attrHandle;
  15036. jQuery.fn.extend( {
  15037. attr: function( name, value ) {
  15038. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15039. },
  15040. removeAttr: function( name ) {
  15041. return this.each( function() {
  15042. jQuery.removeAttr( this, name );
  15043. } );
  15044. }
  15045. } );
  15046. jQuery.extend( {
  15047. attr: function( elem, name, value ) {
  15048. var ret, hooks,
  15049. nType = elem.nodeType;
  15050. // Don't get/set attributes on text, comment and attribute nodes
  15051. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15052. return;
  15053. }
  15054. // Fallback to prop when attributes are not supported
  15055. if ( typeof elem.getAttribute === "undefined" ) {
  15056. return jQuery.prop( elem, name, value );
  15057. }
  15058. // Attribute hooks are determined by the lowercase version
  15059. // Grab necessary hook if one is defined
  15060. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15061. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15062. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15063. }
  15064. if ( value !== undefined ) {
  15065. if ( value === null ) {
  15066. jQuery.removeAttr( elem, name );
  15067. return;
  15068. }
  15069. if ( hooks && "set" in hooks &&
  15070. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15071. return ret;
  15072. }
  15073. elem.setAttribute( name, value + "" );
  15074. return value;
  15075. }
  15076. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15077. return ret;
  15078. }
  15079. ret = jQuery.find.attr( elem, name );
  15080. // Non-existent attributes return null, we normalize to undefined
  15081. return ret == null ? undefined : ret;
  15082. },
  15083. attrHooks: {
  15084. type: {
  15085. set: function( elem, value ) {
  15086. if ( !support.radioValue && value === "radio" &&
  15087. nodeName( elem, "input" ) ) {
  15088. var val = elem.value;
  15089. elem.setAttribute( "type", value );
  15090. if ( val ) {
  15091. elem.value = val;
  15092. }
  15093. return value;
  15094. }
  15095. }
  15096. }
  15097. },
  15098. removeAttr: function( elem, value ) {
  15099. var name,
  15100. i = 0,
  15101. // Attribute names can contain non-HTML whitespace characters
  15102. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15103. attrNames = value && value.match( rnothtmlwhite );
  15104. if ( attrNames && elem.nodeType === 1 ) {
  15105. while ( ( name = attrNames[ i++ ] ) ) {
  15106. elem.removeAttribute( name );
  15107. }
  15108. }
  15109. }
  15110. } );
  15111. // Hooks for boolean attributes
  15112. boolHook = {
  15113. set: function( elem, value, name ) {
  15114. if ( value === false ) {
  15115. // Remove boolean attributes when set to false
  15116. jQuery.removeAttr( elem, name );
  15117. } else {
  15118. elem.setAttribute( name, name );
  15119. }
  15120. return name;
  15121. }
  15122. };
  15123. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15124. var getter = attrHandle[ name ] || jQuery.find.attr;
  15125. attrHandle[ name ] = function( elem, name, isXML ) {
  15126. var ret, handle,
  15127. lowercaseName = name.toLowerCase();
  15128. if ( !isXML ) {
  15129. // Avoid an infinite loop by temporarily removing this function from the getter
  15130. handle = attrHandle[ lowercaseName ];
  15131. attrHandle[ lowercaseName ] = ret;
  15132. ret = getter( elem, name, isXML ) != null ?
  15133. lowercaseName :
  15134. null;
  15135. attrHandle[ lowercaseName ] = handle;
  15136. }
  15137. return ret;
  15138. };
  15139. } );
  15140. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15141. rclickable = /^(?:a|area)$/i;
  15142. jQuery.fn.extend( {
  15143. prop: function( name, value ) {
  15144. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15145. },
  15146. removeProp: function( name ) {
  15147. return this.each( function() {
  15148. delete this[ jQuery.propFix[ name ] || name ];
  15149. } );
  15150. }
  15151. } );
  15152. jQuery.extend( {
  15153. prop: function( elem, name, value ) {
  15154. var ret, hooks,
  15155. nType = elem.nodeType;
  15156. // Don't get/set properties on text, comment and attribute nodes
  15157. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15158. return;
  15159. }
  15160. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15161. // Fix name and attach hooks
  15162. name = jQuery.propFix[ name ] || name;
  15163. hooks = jQuery.propHooks[ name ];
  15164. }
  15165. if ( value !== undefined ) {
  15166. if ( hooks && "set" in hooks &&
  15167. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15168. return ret;
  15169. }
  15170. return ( elem[ name ] = value );
  15171. }
  15172. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15173. return ret;
  15174. }
  15175. return elem[ name ];
  15176. },
  15177. propHooks: {
  15178. tabIndex: {
  15179. get: function( elem ) {
  15180. // Support: IE <=9 - 11 only
  15181. // elem.tabIndex doesn't always return the
  15182. // correct value when it hasn't been explicitly set
  15183. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15184. // Use proper attribute retrieval(#12072)
  15185. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15186. if ( tabindex ) {
  15187. return parseInt( tabindex, 10 );
  15188. }
  15189. if (
  15190. rfocusable.test( elem.nodeName ) ||
  15191. rclickable.test( elem.nodeName ) &&
  15192. elem.href
  15193. ) {
  15194. return 0;
  15195. }
  15196. return -1;
  15197. }
  15198. }
  15199. },
  15200. propFix: {
  15201. "for": "htmlFor",
  15202. "class": "className"
  15203. }
  15204. } );
  15205. // Support: IE <=11 only
  15206. // Accessing the selectedIndex property
  15207. // forces the browser to respect setting selected
  15208. // on the option
  15209. // The getter ensures a default option is selected
  15210. // when in an optgroup
  15211. // eslint rule "no-unused-expressions" is disabled for this code
  15212. // since it considers such accessions noop
  15213. if ( !support.optSelected ) {
  15214. jQuery.propHooks.selected = {
  15215. get: function( elem ) {
  15216. /* eslint no-unused-expressions: "off" */
  15217. var parent = elem.parentNode;
  15218. if ( parent && parent.parentNode ) {
  15219. parent.parentNode.selectedIndex;
  15220. }
  15221. return null;
  15222. },
  15223. set: function( elem ) {
  15224. /* eslint no-unused-expressions: "off" */
  15225. var parent = elem.parentNode;
  15226. if ( parent ) {
  15227. parent.selectedIndex;
  15228. if ( parent.parentNode ) {
  15229. parent.parentNode.selectedIndex;
  15230. }
  15231. }
  15232. }
  15233. };
  15234. }
  15235. jQuery.each( [
  15236. "tabIndex",
  15237. "readOnly",
  15238. "maxLength",
  15239. "cellSpacing",
  15240. "cellPadding",
  15241. "rowSpan",
  15242. "colSpan",
  15243. "useMap",
  15244. "frameBorder",
  15245. "contentEditable"
  15246. ], function() {
  15247. jQuery.propFix[ this.toLowerCase() ] = this;
  15248. } );
  15249. // Strip and collapse whitespace according to HTML spec
  15250. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15251. function stripAndCollapse( value ) {
  15252. var tokens = value.match( rnothtmlwhite ) || [];
  15253. return tokens.join( " " );
  15254. }
  15255. function getClass( elem ) {
  15256. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15257. }
  15258. function classesToArray( value ) {
  15259. if ( Array.isArray( value ) ) {
  15260. return value;
  15261. }
  15262. if ( typeof value === "string" ) {
  15263. return value.match( rnothtmlwhite ) || [];
  15264. }
  15265. return [];
  15266. }
  15267. jQuery.fn.extend( {
  15268. addClass: function( value ) {
  15269. var classes, elem, cur, curValue, clazz, j, finalValue,
  15270. i = 0;
  15271. if ( isFunction( value ) ) {
  15272. return this.each( function( j ) {
  15273. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15274. } );
  15275. }
  15276. classes = classesToArray( value );
  15277. if ( classes.length ) {
  15278. while ( ( elem = this[ i++ ] ) ) {
  15279. curValue = getClass( elem );
  15280. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15281. if ( cur ) {
  15282. j = 0;
  15283. while ( ( clazz = classes[ j++ ] ) ) {
  15284. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15285. cur += clazz + " ";
  15286. }
  15287. }
  15288. // Only assign if different to avoid unneeded rendering.
  15289. finalValue = stripAndCollapse( cur );
  15290. if ( curValue !== finalValue ) {
  15291. elem.setAttribute( "class", finalValue );
  15292. }
  15293. }
  15294. }
  15295. }
  15296. return this;
  15297. },
  15298. removeClass: function( value ) {
  15299. var classes, elem, cur, curValue, clazz, j, finalValue,
  15300. i = 0;
  15301. if ( isFunction( value ) ) {
  15302. return this.each( function( j ) {
  15303. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15304. } );
  15305. }
  15306. if ( !arguments.length ) {
  15307. return this.attr( "class", "" );
  15308. }
  15309. classes = classesToArray( value );
  15310. if ( classes.length ) {
  15311. while ( ( elem = this[ i++ ] ) ) {
  15312. curValue = getClass( elem );
  15313. // This expression is here for better compressibility (see addClass)
  15314. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15315. if ( cur ) {
  15316. j = 0;
  15317. while ( ( clazz = classes[ j++ ] ) ) {
  15318. // Remove *all* instances
  15319. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15320. cur = cur.replace( " " + clazz + " ", " " );
  15321. }
  15322. }
  15323. // Only assign if different to avoid unneeded rendering.
  15324. finalValue = stripAndCollapse( cur );
  15325. if ( curValue !== finalValue ) {
  15326. elem.setAttribute( "class", finalValue );
  15327. }
  15328. }
  15329. }
  15330. }
  15331. return this;
  15332. },
  15333. toggleClass: function( value, stateVal ) {
  15334. var type = typeof value,
  15335. isValidValue = type === "string" || Array.isArray( value );
  15336. if ( typeof stateVal === "boolean" && isValidValue ) {
  15337. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15338. }
  15339. if ( isFunction( value ) ) {
  15340. return this.each( function( i ) {
  15341. jQuery( this ).toggleClass(
  15342. value.call( this, i, getClass( this ), stateVal ),
  15343. stateVal
  15344. );
  15345. } );
  15346. }
  15347. return this.each( function() {
  15348. var className, i, self, classNames;
  15349. if ( isValidValue ) {
  15350. // Toggle individual class names
  15351. i = 0;
  15352. self = jQuery( this );
  15353. classNames = classesToArray( value );
  15354. while ( ( className = classNames[ i++ ] ) ) {
  15355. // Check each className given, space separated list
  15356. if ( self.hasClass( className ) ) {
  15357. self.removeClass( className );
  15358. } else {
  15359. self.addClass( className );
  15360. }
  15361. }
  15362. // Toggle whole class name
  15363. } else if ( value === undefined || type === "boolean" ) {
  15364. className = getClass( this );
  15365. if ( className ) {
  15366. // Store className if set
  15367. dataPriv.set( this, "__className__", className );
  15368. }
  15369. // If the element has a class name or if we're passed `false`,
  15370. // then remove the whole classname (if there was one, the above saved it).
  15371. // Otherwise bring back whatever was previously saved (if anything),
  15372. // falling back to the empty string if nothing was stored.
  15373. if ( this.setAttribute ) {
  15374. this.setAttribute( "class",
  15375. className || value === false ?
  15376. "" :
  15377. dataPriv.get( this, "__className__" ) || ""
  15378. );
  15379. }
  15380. }
  15381. } );
  15382. },
  15383. hasClass: function( selector ) {
  15384. var className, elem,
  15385. i = 0;
  15386. className = " " + selector + " ";
  15387. while ( ( elem = this[ i++ ] ) ) {
  15388. if ( elem.nodeType === 1 &&
  15389. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15390. return true;
  15391. }
  15392. }
  15393. return false;
  15394. }
  15395. } );
  15396. var rreturn = /\r/g;
  15397. jQuery.fn.extend( {
  15398. val: function( value ) {
  15399. var hooks, ret, valueIsFunction,
  15400. elem = this[ 0 ];
  15401. if ( !arguments.length ) {
  15402. if ( elem ) {
  15403. hooks = jQuery.valHooks[ elem.type ] ||
  15404. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15405. if ( hooks &&
  15406. "get" in hooks &&
  15407. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15408. ) {
  15409. return ret;
  15410. }
  15411. ret = elem.value;
  15412. // Handle most common string cases
  15413. if ( typeof ret === "string" ) {
  15414. return ret.replace( rreturn, "" );
  15415. }
  15416. // Handle cases where value is null/undef or number
  15417. return ret == null ? "" : ret;
  15418. }
  15419. return;
  15420. }
  15421. valueIsFunction = isFunction( value );
  15422. return this.each( function( i ) {
  15423. var val;
  15424. if ( this.nodeType !== 1 ) {
  15425. return;
  15426. }
  15427. if ( valueIsFunction ) {
  15428. val = value.call( this, i, jQuery( this ).val() );
  15429. } else {
  15430. val = value;
  15431. }
  15432. // Treat null/undefined as ""; convert numbers to string
  15433. if ( val == null ) {
  15434. val = "";
  15435. } else if ( typeof val === "number" ) {
  15436. val += "";
  15437. } else if ( Array.isArray( val ) ) {
  15438. val = jQuery.map( val, function( value ) {
  15439. return value == null ? "" : value + "";
  15440. } );
  15441. }
  15442. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15443. // If set returns undefined, fall back to normal setting
  15444. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15445. this.value = val;
  15446. }
  15447. } );
  15448. }
  15449. } );
  15450. jQuery.extend( {
  15451. valHooks: {
  15452. option: {
  15453. get: function( elem ) {
  15454. var val = jQuery.find.attr( elem, "value" );
  15455. return val != null ?
  15456. val :
  15457. // Support: IE <=10 - 11 only
  15458. // option.text throws exceptions (#14686, #14858)
  15459. // Strip and collapse whitespace
  15460. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15461. stripAndCollapse( jQuery.text( elem ) );
  15462. }
  15463. },
  15464. select: {
  15465. get: function( elem ) {
  15466. var value, option, i,
  15467. options = elem.options,
  15468. index = elem.selectedIndex,
  15469. one = elem.type === "select-one",
  15470. values = one ? null : [],
  15471. max = one ? index + 1 : options.length;
  15472. if ( index < 0 ) {
  15473. i = max;
  15474. } else {
  15475. i = one ? index : 0;
  15476. }
  15477. // Loop through all the selected options
  15478. for ( ; i < max; i++ ) {
  15479. option = options[ i ];
  15480. // Support: IE <=9 only
  15481. // IE8-9 doesn't update selected after form reset (#2551)
  15482. if ( ( option.selected || i === index ) &&
  15483. // Don't return options that are disabled or in a disabled optgroup
  15484. !option.disabled &&
  15485. ( !option.parentNode.disabled ||
  15486. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15487. // Get the specific value for the option
  15488. value = jQuery( option ).val();
  15489. // We don't need an array for one selects
  15490. if ( one ) {
  15491. return value;
  15492. }
  15493. // Multi-Selects return an array
  15494. values.push( value );
  15495. }
  15496. }
  15497. return values;
  15498. },
  15499. set: function( elem, value ) {
  15500. var optionSet, option,
  15501. options = elem.options,
  15502. values = jQuery.makeArray( value ),
  15503. i = options.length;
  15504. while ( i-- ) {
  15505. option = options[ i ];
  15506. /* eslint-disable no-cond-assign */
  15507. if ( option.selected =
  15508. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15509. ) {
  15510. optionSet = true;
  15511. }
  15512. /* eslint-enable no-cond-assign */
  15513. }
  15514. // Force browsers to behave consistently when non-matching value is set
  15515. if ( !optionSet ) {
  15516. elem.selectedIndex = -1;
  15517. }
  15518. return values;
  15519. }
  15520. }
  15521. }
  15522. } );
  15523. // Radios and checkboxes getter/setter
  15524. jQuery.each( [ "radio", "checkbox" ], function() {
  15525. jQuery.valHooks[ this ] = {
  15526. set: function( elem, value ) {
  15527. if ( Array.isArray( value ) ) {
  15528. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15529. }
  15530. }
  15531. };
  15532. if ( !support.checkOn ) {
  15533. jQuery.valHooks[ this ].get = function( elem ) {
  15534. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15535. };
  15536. }
  15537. } );
  15538. // Return jQuery for attributes-only inclusion
  15539. support.focusin = "onfocusin" in window;
  15540. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15541. stopPropagationCallback = function( e ) {
  15542. e.stopPropagation();
  15543. };
  15544. jQuery.extend( jQuery.event, {
  15545. trigger: function( event, data, elem, onlyHandlers ) {
  15546. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15547. eventPath = [ elem || document ],
  15548. type = hasOwn.call( event, "type" ) ? event.type : event,
  15549. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15550. cur = lastElement = tmp = elem = elem || document;
  15551. // Don't do events on text and comment nodes
  15552. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15553. return;
  15554. }
  15555. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15556. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15557. return;
  15558. }
  15559. if ( type.indexOf( "." ) > -1 ) {
  15560. // Namespaced trigger; create a regexp to match event type in handle()
  15561. namespaces = type.split( "." );
  15562. type = namespaces.shift();
  15563. namespaces.sort();
  15564. }
  15565. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15566. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15567. event = event[ jQuery.expando ] ?
  15568. event :
  15569. new jQuery.Event( type, typeof event === "object" && event );
  15570. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15571. event.isTrigger = onlyHandlers ? 2 : 3;
  15572. event.namespace = namespaces.join( "." );
  15573. event.rnamespace = event.namespace ?
  15574. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15575. null;
  15576. // Clean up the event in case it is being reused
  15577. event.result = undefined;
  15578. if ( !event.target ) {
  15579. event.target = elem;
  15580. }
  15581. // Clone any incoming data and prepend the event, creating the handler arg list
  15582. data = data == null ?
  15583. [ event ] :
  15584. jQuery.makeArray( data, [ event ] );
  15585. // Allow special events to draw outside the lines
  15586. special = jQuery.event.special[ type ] || {};
  15587. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15588. return;
  15589. }
  15590. // Determine event propagation path in advance, per W3C events spec (#9951)
  15591. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15592. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15593. bubbleType = special.delegateType || type;
  15594. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15595. cur = cur.parentNode;
  15596. }
  15597. for ( ; cur; cur = cur.parentNode ) {
  15598. eventPath.push( cur );
  15599. tmp = cur;
  15600. }
  15601. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15602. if ( tmp === ( elem.ownerDocument || document ) ) {
  15603. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15604. }
  15605. }
  15606. // Fire handlers on the event path
  15607. i = 0;
  15608. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15609. lastElement = cur;
  15610. event.type = i > 1 ?
  15611. bubbleType :
  15612. special.bindType || type;
  15613. // jQuery handler
  15614. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15615. dataPriv.get( cur, "handle" );
  15616. if ( handle ) {
  15617. handle.apply( cur, data );
  15618. }
  15619. // Native handler
  15620. handle = ontype && cur[ ontype ];
  15621. if ( handle && handle.apply && acceptData( cur ) ) {
  15622. event.result = handle.apply( cur, data );
  15623. if ( event.result === false ) {
  15624. event.preventDefault();
  15625. }
  15626. }
  15627. }
  15628. event.type = type;
  15629. // If nobody prevented the default action, do it now
  15630. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15631. if ( ( !special._default ||
  15632. special._default.apply( eventPath.pop(), data ) === false ) &&
  15633. acceptData( elem ) ) {
  15634. // Call a native DOM method on the target with the same name as the event.
  15635. // Don't do default actions on window, that's where global variables be (#6170)
  15636. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15637. // Don't re-trigger an onFOO event when we call its FOO() method
  15638. tmp = elem[ ontype ];
  15639. if ( tmp ) {
  15640. elem[ ontype ] = null;
  15641. }
  15642. // Prevent re-triggering of the same event, since we already bubbled it above
  15643. jQuery.event.triggered = type;
  15644. if ( event.isPropagationStopped() ) {
  15645. lastElement.addEventListener( type, stopPropagationCallback );
  15646. }
  15647. elem[ type ]();
  15648. if ( event.isPropagationStopped() ) {
  15649. lastElement.removeEventListener( type, stopPropagationCallback );
  15650. }
  15651. jQuery.event.triggered = undefined;
  15652. if ( tmp ) {
  15653. elem[ ontype ] = tmp;
  15654. }
  15655. }
  15656. }
  15657. }
  15658. return event.result;
  15659. },
  15660. // Piggyback on a donor event to simulate a different one
  15661. // Used only for `focus(in | out)` events
  15662. simulate: function( type, elem, event ) {
  15663. var e = jQuery.extend(
  15664. new jQuery.Event(),
  15665. event,
  15666. {
  15667. type: type,
  15668. isSimulated: true
  15669. }
  15670. );
  15671. jQuery.event.trigger( e, null, elem );
  15672. }
  15673. } );
  15674. jQuery.fn.extend( {
  15675. trigger: function( type, data ) {
  15676. return this.each( function() {
  15677. jQuery.event.trigger( type, data, this );
  15678. } );
  15679. },
  15680. triggerHandler: function( type, data ) {
  15681. var elem = this[ 0 ];
  15682. if ( elem ) {
  15683. return jQuery.event.trigger( type, data, elem, true );
  15684. }
  15685. }
  15686. } );
  15687. // Support: Firefox <=44
  15688. // Firefox doesn't have focus(in | out) events
  15689. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15690. //
  15691. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15692. // focus(in | out) events fire after focus & blur events,
  15693. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15694. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15695. if ( !support.focusin ) {
  15696. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15697. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15698. var handler = function( event ) {
  15699. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15700. };
  15701. jQuery.event.special[ fix ] = {
  15702. setup: function() {
  15703. var doc = this.ownerDocument || this,
  15704. attaches = dataPriv.access( doc, fix );
  15705. if ( !attaches ) {
  15706. doc.addEventListener( orig, handler, true );
  15707. }
  15708. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15709. },
  15710. teardown: function() {
  15711. var doc = this.ownerDocument || this,
  15712. attaches = dataPriv.access( doc, fix ) - 1;
  15713. if ( !attaches ) {
  15714. doc.removeEventListener( orig, handler, true );
  15715. dataPriv.remove( doc, fix );
  15716. } else {
  15717. dataPriv.access( doc, fix, attaches );
  15718. }
  15719. }
  15720. };
  15721. } );
  15722. }
  15723. var location = window.location;
  15724. var nonce = Date.now();
  15725. var rquery = ( /\?/ );
  15726. // Cross-browser xml parsing
  15727. jQuery.parseXML = function( data ) {
  15728. var xml;
  15729. if ( !data || typeof data !== "string" ) {
  15730. return null;
  15731. }
  15732. // Support: IE 9 - 11 only
  15733. // IE throws on parseFromString with invalid input.
  15734. try {
  15735. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15736. } catch ( e ) {
  15737. xml = undefined;
  15738. }
  15739. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15740. jQuery.error( "Invalid XML: " + data );
  15741. }
  15742. return xml;
  15743. };
  15744. var
  15745. rbracket = /\[\]$/,
  15746. rCRLF = /\r?\n/g,
  15747. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15748. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15749. function buildParams( prefix, obj, traditional, add ) {
  15750. var name;
  15751. if ( Array.isArray( obj ) ) {
  15752. // Serialize array item.
  15753. jQuery.each( obj, function( i, v ) {
  15754. if ( traditional || rbracket.test( prefix ) ) {
  15755. // Treat each array item as a scalar.
  15756. add( prefix, v );
  15757. } else {
  15758. // Item is non-scalar (array or object), encode its numeric index.
  15759. buildParams(
  15760. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15761. v,
  15762. traditional,
  15763. add
  15764. );
  15765. }
  15766. } );
  15767. } else if ( !traditional && toType( obj ) === "object" ) {
  15768. // Serialize object item.
  15769. for ( name in obj ) {
  15770. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15771. }
  15772. } else {
  15773. // Serialize scalar item.
  15774. add( prefix, obj );
  15775. }
  15776. }
  15777. // Serialize an array of form elements or a set of
  15778. // key/values into a query string
  15779. jQuery.param = function( a, traditional ) {
  15780. var prefix,
  15781. s = [],
  15782. add = function( key, valueOrFunction ) {
  15783. // If value is a function, invoke it and use its return value
  15784. var value = isFunction( valueOrFunction ) ?
  15785. valueOrFunction() :
  15786. valueOrFunction;
  15787. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15788. encodeURIComponent( value == null ? "" : value );
  15789. };
  15790. if ( a == null ) {
  15791. return "";
  15792. }
  15793. // If an array was passed in, assume that it is an array of form elements.
  15794. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15795. // Serialize the form elements
  15796. jQuery.each( a, function() {
  15797. add( this.name, this.value );
  15798. } );
  15799. } else {
  15800. // If traditional, encode the "old" way (the way 1.3.2 or older
  15801. // did it), otherwise encode params recursively.
  15802. for ( prefix in a ) {
  15803. buildParams( prefix, a[ prefix ], traditional, add );
  15804. }
  15805. }
  15806. // Return the resulting serialization
  15807. return s.join( "&" );
  15808. };
  15809. jQuery.fn.extend( {
  15810. serialize: function() {
  15811. return jQuery.param( this.serializeArray() );
  15812. },
  15813. serializeArray: function() {
  15814. return this.map( function() {
  15815. // Can add propHook for "elements" to filter or add form elements
  15816. var elements = jQuery.prop( this, "elements" );
  15817. return elements ? jQuery.makeArray( elements ) : this;
  15818. } )
  15819. .filter( function() {
  15820. var type = this.type;
  15821. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15822. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15823. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15824. ( this.checked || !rcheckableType.test( type ) );
  15825. } )
  15826. .map( function( i, elem ) {
  15827. var val = jQuery( this ).val();
  15828. if ( val == null ) {
  15829. return null;
  15830. }
  15831. if ( Array.isArray( val ) ) {
  15832. return jQuery.map( val, function( val ) {
  15833. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15834. } );
  15835. }
  15836. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15837. } ).get();
  15838. }
  15839. } );
  15840. var
  15841. r20 = /%20/g,
  15842. rhash = /#.*$/,
  15843. rantiCache = /([?&])_=[^&]*/,
  15844. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15845. // #7653, #8125, #8152: local protocol detection
  15846. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15847. rnoContent = /^(?:GET|HEAD)$/,
  15848. rprotocol = /^\/\//,
  15849. /* Prefilters
  15850. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15851. * 2) These are called:
  15852. * - BEFORE asking for a transport
  15853. * - AFTER param serialization (s.data is a string if s.processData is true)
  15854. * 3) key is the dataType
  15855. * 4) the catchall symbol "*" can be used
  15856. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15857. */
  15858. prefilters = {},
  15859. /* Transports bindings
  15860. * 1) key is the dataType
  15861. * 2) the catchall symbol "*" can be used
  15862. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15863. */
  15864. transports = {},
  15865. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15866. allTypes = "*/".concat( "*" ),
  15867. // Anchor tag for parsing the document origin
  15868. originAnchor = document.createElement( "a" );
  15869. originAnchor.href = location.href;
  15870. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15871. function addToPrefiltersOrTransports( structure ) {
  15872. // dataTypeExpression is optional and defaults to "*"
  15873. return function( dataTypeExpression, func ) {
  15874. if ( typeof dataTypeExpression !== "string" ) {
  15875. func = dataTypeExpression;
  15876. dataTypeExpression = "*";
  15877. }
  15878. var dataType,
  15879. i = 0,
  15880. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15881. if ( isFunction( func ) ) {
  15882. // For each dataType in the dataTypeExpression
  15883. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15884. // Prepend if requested
  15885. if ( dataType[ 0 ] === "+" ) {
  15886. dataType = dataType.slice( 1 ) || "*";
  15887. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15888. // Otherwise append
  15889. } else {
  15890. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15891. }
  15892. }
  15893. }
  15894. };
  15895. }
  15896. // Base inspection function for prefilters and transports
  15897. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15898. var inspected = {},
  15899. seekingTransport = ( structure === transports );
  15900. function inspect( dataType ) {
  15901. var selected;
  15902. inspected[ dataType ] = true;
  15903. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15904. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15905. if ( typeof dataTypeOrTransport === "string" &&
  15906. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15907. options.dataTypes.unshift( dataTypeOrTransport );
  15908. inspect( dataTypeOrTransport );
  15909. return false;
  15910. } else if ( seekingTransport ) {
  15911. return !( selected = dataTypeOrTransport );
  15912. }
  15913. } );
  15914. return selected;
  15915. }
  15916. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15917. }
  15918. // A special extend for ajax options
  15919. // that takes "flat" options (not to be deep extended)
  15920. // Fixes #9887
  15921. function ajaxExtend( target, src ) {
  15922. var key, deep,
  15923. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15924. for ( key in src ) {
  15925. if ( src[ key ] !== undefined ) {
  15926. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15927. }
  15928. }
  15929. if ( deep ) {
  15930. jQuery.extend( true, target, deep );
  15931. }
  15932. return target;
  15933. }
  15934. /* Handles responses to an ajax request:
  15935. * - finds the right dataType (mediates between content-type and expected dataType)
  15936. * - returns the corresponding response
  15937. */
  15938. function ajaxHandleResponses( s, jqXHR, responses ) {
  15939. var ct, type, finalDataType, firstDataType,
  15940. contents = s.contents,
  15941. dataTypes = s.dataTypes;
  15942. // Remove auto dataType and get content-type in the process
  15943. while ( dataTypes[ 0 ] === "*" ) {
  15944. dataTypes.shift();
  15945. if ( ct === undefined ) {
  15946. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15947. }
  15948. }
  15949. // Check if we're dealing with a known content-type
  15950. if ( ct ) {
  15951. for ( type in contents ) {
  15952. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15953. dataTypes.unshift( type );
  15954. break;
  15955. }
  15956. }
  15957. }
  15958. // Check to see if we have a response for the expected dataType
  15959. if ( dataTypes[ 0 ] in responses ) {
  15960. finalDataType = dataTypes[ 0 ];
  15961. } else {
  15962. // Try convertible dataTypes
  15963. for ( type in responses ) {
  15964. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15965. finalDataType = type;
  15966. break;
  15967. }
  15968. if ( !firstDataType ) {
  15969. firstDataType = type;
  15970. }
  15971. }
  15972. // Or just use first one
  15973. finalDataType = finalDataType || firstDataType;
  15974. }
  15975. // If we found a dataType
  15976. // We add the dataType to the list if needed
  15977. // and return the corresponding response
  15978. if ( finalDataType ) {
  15979. if ( finalDataType !== dataTypes[ 0 ] ) {
  15980. dataTypes.unshift( finalDataType );
  15981. }
  15982. return responses[ finalDataType ];
  15983. }
  15984. }
  15985. /* Chain conversions given the request and the original response
  15986. * Also sets the responseXXX fields on the jqXHR instance
  15987. */
  15988. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15989. var conv2, current, conv, tmp, prev,
  15990. converters = {},
  15991. // Work with a copy of dataTypes in case we need to modify it for conversion
  15992. dataTypes = s.dataTypes.slice();
  15993. // Create converters map with lowercased keys
  15994. if ( dataTypes[ 1 ] ) {
  15995. for ( conv in s.converters ) {
  15996. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15997. }
  15998. }
  15999. current = dataTypes.shift();
  16000. // Convert to each sequential dataType
  16001. while ( current ) {
  16002. if ( s.responseFields[ current ] ) {
  16003. jqXHR[ s.responseFields[ current ] ] = response;
  16004. }
  16005. // Apply the dataFilter if provided
  16006. if ( !prev && isSuccess && s.dataFilter ) {
  16007. response = s.dataFilter( response, s.dataType );
  16008. }
  16009. prev = current;
  16010. current = dataTypes.shift();
  16011. if ( current ) {
  16012. // There's only work to do if current dataType is non-auto
  16013. if ( current === "*" ) {
  16014. current = prev;
  16015. // Convert response if prev dataType is non-auto and differs from current
  16016. } else if ( prev !== "*" && prev !== current ) {
  16017. // Seek a direct converter
  16018. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16019. // If none found, seek a pair
  16020. if ( !conv ) {
  16021. for ( conv2 in converters ) {
  16022. // If conv2 outputs current
  16023. tmp = conv2.split( " " );
  16024. if ( tmp[ 1 ] === current ) {
  16025. // If prev can be converted to accepted input
  16026. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16027. converters[ "* " + tmp[ 0 ] ];
  16028. if ( conv ) {
  16029. // Condense equivalence converters
  16030. if ( conv === true ) {
  16031. conv = converters[ conv2 ];
  16032. // Otherwise, insert the intermediate dataType
  16033. } else if ( converters[ conv2 ] !== true ) {
  16034. current = tmp[ 0 ];
  16035. dataTypes.unshift( tmp[ 1 ] );
  16036. }
  16037. break;
  16038. }
  16039. }
  16040. }
  16041. }
  16042. // Apply converter (if not an equivalence)
  16043. if ( conv !== true ) {
  16044. // Unless errors are allowed to bubble, catch and return them
  16045. if ( conv && s.throws ) {
  16046. response = conv( response );
  16047. } else {
  16048. try {
  16049. response = conv( response );
  16050. } catch ( e ) {
  16051. return {
  16052. state: "parsererror",
  16053. error: conv ? e : "No conversion from " + prev + " to " + current
  16054. };
  16055. }
  16056. }
  16057. }
  16058. }
  16059. }
  16060. }
  16061. return { state: "success", data: response };
  16062. }
  16063. jQuery.extend( {
  16064. // Counter for holding the number of active queries
  16065. active: 0,
  16066. // Last-Modified header cache for next request
  16067. lastModified: {},
  16068. etag: {},
  16069. ajaxSettings: {
  16070. url: location.href,
  16071. type: "GET",
  16072. isLocal: rlocalProtocol.test( location.protocol ),
  16073. global: true,
  16074. processData: true,
  16075. async: true,
  16076. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16077. /*
  16078. timeout: 0,
  16079. data: null,
  16080. dataType: null,
  16081. username: null,
  16082. password: null,
  16083. cache: null,
  16084. throws: false,
  16085. traditional: false,
  16086. headers: {},
  16087. */
  16088. accepts: {
  16089. "*": allTypes,
  16090. text: "text/plain",
  16091. html: "text/html",
  16092. xml: "application/xml, text/xml",
  16093. json: "application/json, text/javascript"
  16094. },
  16095. contents: {
  16096. xml: /\bxml\b/,
  16097. html: /\bhtml/,
  16098. json: /\bjson\b/
  16099. },
  16100. responseFields: {
  16101. xml: "responseXML",
  16102. text: "responseText",
  16103. json: "responseJSON"
  16104. },
  16105. // Data converters
  16106. // Keys separate source (or catchall "*") and destination types with a single space
  16107. converters: {
  16108. // Convert anything to text
  16109. "* text": String,
  16110. // Text to html (true = no transformation)
  16111. "text html": true,
  16112. // Evaluate text as a json expression
  16113. "text json": JSON.parse,
  16114. // Parse text as xml
  16115. "text xml": jQuery.parseXML
  16116. },
  16117. // For options that shouldn't be deep extended:
  16118. // you can add your own custom options here if
  16119. // and when you create one that shouldn't be
  16120. // deep extended (see ajaxExtend)
  16121. flatOptions: {
  16122. url: true,
  16123. context: true
  16124. }
  16125. },
  16126. // Creates a full fledged settings object into target
  16127. // with both ajaxSettings and settings fields.
  16128. // If target is omitted, writes into ajaxSettings.
  16129. ajaxSetup: function( target, settings ) {
  16130. return settings ?
  16131. // Building a settings object
  16132. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16133. // Extending ajaxSettings
  16134. ajaxExtend( jQuery.ajaxSettings, target );
  16135. },
  16136. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16137. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16138. // Main method
  16139. ajax: function( url, options ) {
  16140. // If url is an object, simulate pre-1.5 signature
  16141. if ( typeof url === "object" ) {
  16142. options = url;
  16143. url = undefined;
  16144. }
  16145. // Force options to be an object
  16146. options = options || {};
  16147. var transport,
  16148. // URL without anti-cache param
  16149. cacheURL,
  16150. // Response headers
  16151. responseHeadersString,
  16152. responseHeaders,
  16153. // timeout handle
  16154. timeoutTimer,
  16155. // Url cleanup var
  16156. urlAnchor,
  16157. // Request state (becomes false upon send and true upon completion)
  16158. completed,
  16159. // To know if global events are to be dispatched
  16160. fireGlobals,
  16161. // Loop variable
  16162. i,
  16163. // uncached part of the url
  16164. uncached,
  16165. // Create the final options object
  16166. s = jQuery.ajaxSetup( {}, options ),
  16167. // Callbacks context
  16168. callbackContext = s.context || s,
  16169. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16170. globalEventContext = s.context &&
  16171. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16172. jQuery( callbackContext ) :
  16173. jQuery.event,
  16174. // Deferreds
  16175. deferred = jQuery.Deferred(),
  16176. completeDeferred = jQuery.Callbacks( "once memory" ),
  16177. // Status-dependent callbacks
  16178. statusCode = s.statusCode || {},
  16179. // Headers (they are sent all at once)
  16180. requestHeaders = {},
  16181. requestHeadersNames = {},
  16182. // Default abort message
  16183. strAbort = "canceled",
  16184. // Fake xhr
  16185. jqXHR = {
  16186. readyState: 0,
  16187. // Builds headers hashtable if needed
  16188. getResponseHeader: function( key ) {
  16189. var match;
  16190. if ( completed ) {
  16191. if ( !responseHeaders ) {
  16192. responseHeaders = {};
  16193. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16194. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16195. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16196. .concat( match[ 2 ] );
  16197. }
  16198. }
  16199. match = responseHeaders[ key.toLowerCase() + " " ];
  16200. }
  16201. return match == null ? null : match.join( ", " );
  16202. },
  16203. // Raw string
  16204. getAllResponseHeaders: function() {
  16205. return completed ? responseHeadersString : null;
  16206. },
  16207. // Caches the header
  16208. setRequestHeader: function( name, value ) {
  16209. if ( completed == null ) {
  16210. name = requestHeadersNames[ name.toLowerCase() ] =
  16211. requestHeadersNames[ name.toLowerCase() ] || name;
  16212. requestHeaders[ name ] = value;
  16213. }
  16214. return this;
  16215. },
  16216. // Overrides response content-type header
  16217. overrideMimeType: function( type ) {
  16218. if ( completed == null ) {
  16219. s.mimeType = type;
  16220. }
  16221. return this;
  16222. },
  16223. // Status-dependent callbacks
  16224. statusCode: function( map ) {
  16225. var code;
  16226. if ( map ) {
  16227. if ( completed ) {
  16228. // Execute the appropriate callbacks
  16229. jqXHR.always( map[ jqXHR.status ] );
  16230. } else {
  16231. // Lazy-add the new callbacks in a way that preserves old ones
  16232. for ( code in map ) {
  16233. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16234. }
  16235. }
  16236. }
  16237. return this;
  16238. },
  16239. // Cancel the request
  16240. abort: function( statusText ) {
  16241. var finalText = statusText || strAbort;
  16242. if ( transport ) {
  16243. transport.abort( finalText );
  16244. }
  16245. done( 0, finalText );
  16246. return this;
  16247. }
  16248. };
  16249. // Attach deferreds
  16250. deferred.promise( jqXHR );
  16251. // Add protocol if not provided (prefilters might expect it)
  16252. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16253. // We also use the url parameter if available
  16254. s.url = ( ( url || s.url || location.href ) + "" )
  16255. .replace( rprotocol, location.protocol + "//" );
  16256. // Alias method option to type as per ticket #12004
  16257. s.type = options.method || options.type || s.method || s.type;
  16258. // Extract dataTypes list
  16259. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16260. // A cross-domain request is in order when the origin doesn't match the current origin.
  16261. if ( s.crossDomain == null ) {
  16262. urlAnchor = document.createElement( "a" );
  16263. // Support: IE <=8 - 11, Edge 12 - 15
  16264. // IE throws exception on accessing the href property if url is malformed,
  16265. // e.g. http://example.com:80x/
  16266. try {
  16267. urlAnchor.href = s.url;
  16268. // Support: IE <=8 - 11 only
  16269. // Anchor's host property isn't correctly set when s.url is relative
  16270. urlAnchor.href = urlAnchor.href;
  16271. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16272. urlAnchor.protocol + "//" + urlAnchor.host;
  16273. } catch ( e ) {
  16274. // If there is an error parsing the URL, assume it is crossDomain,
  16275. // it can be rejected by the transport if it is invalid
  16276. s.crossDomain = true;
  16277. }
  16278. }
  16279. // Convert data if not already a string
  16280. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16281. s.data = jQuery.param( s.data, s.traditional );
  16282. }
  16283. // Apply prefilters
  16284. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16285. // If request was aborted inside a prefilter, stop there
  16286. if ( completed ) {
  16287. return jqXHR;
  16288. }
  16289. // We can fire global events as of now if asked to
  16290. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16291. fireGlobals = jQuery.event && s.global;
  16292. // Watch for a new set of requests
  16293. if ( fireGlobals && jQuery.active++ === 0 ) {
  16294. jQuery.event.trigger( "ajaxStart" );
  16295. }
  16296. // Uppercase the type
  16297. s.type = s.type.toUpperCase();
  16298. // Determine if request has content
  16299. s.hasContent = !rnoContent.test( s.type );
  16300. // Save the URL in case we're toying with the If-Modified-Since
  16301. // and/or If-None-Match header later on
  16302. // Remove hash to simplify url manipulation
  16303. cacheURL = s.url.replace( rhash, "" );
  16304. // More options handling for requests with no content
  16305. if ( !s.hasContent ) {
  16306. // Remember the hash so we can put it back
  16307. uncached = s.url.slice( cacheURL.length );
  16308. // If data is available and should be processed, append data to url
  16309. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16310. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16311. // #9682: remove data so that it's not used in an eventual retry
  16312. delete s.data;
  16313. }
  16314. // Add or update anti-cache param if needed
  16315. if ( s.cache === false ) {
  16316. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16317. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16318. }
  16319. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16320. s.url = cacheURL + uncached;
  16321. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16322. } else if ( s.data && s.processData &&
  16323. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16324. s.data = s.data.replace( r20, "+" );
  16325. }
  16326. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16327. if ( s.ifModified ) {
  16328. if ( jQuery.lastModified[ cacheURL ] ) {
  16329. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16330. }
  16331. if ( jQuery.etag[ cacheURL ] ) {
  16332. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16333. }
  16334. }
  16335. // Set the correct header, if data is being sent
  16336. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16337. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16338. }
  16339. // Set the Accepts header for the server, depending on the dataType
  16340. jqXHR.setRequestHeader(
  16341. "Accept",
  16342. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16343. s.accepts[ s.dataTypes[ 0 ] ] +
  16344. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16345. s.accepts[ "*" ]
  16346. );
  16347. // Check for headers option
  16348. for ( i in s.headers ) {
  16349. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16350. }
  16351. // Allow custom headers/mimetypes and early abort
  16352. if ( s.beforeSend &&
  16353. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16354. // Abort if not done already and return
  16355. return jqXHR.abort();
  16356. }
  16357. // Aborting is no longer a cancellation
  16358. strAbort = "abort";
  16359. // Install callbacks on deferreds
  16360. completeDeferred.add( s.complete );
  16361. jqXHR.done( s.success );
  16362. jqXHR.fail( s.error );
  16363. // Get transport
  16364. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16365. // If no transport, we auto-abort
  16366. if ( !transport ) {
  16367. done( -1, "No Transport" );
  16368. } else {
  16369. jqXHR.readyState = 1;
  16370. // Send global event
  16371. if ( fireGlobals ) {
  16372. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16373. }
  16374. // If request was aborted inside ajaxSend, stop there
  16375. if ( completed ) {
  16376. return jqXHR;
  16377. }
  16378. // Timeout
  16379. if ( s.async && s.timeout > 0 ) {
  16380. timeoutTimer = window.setTimeout( function() {
  16381. jqXHR.abort( "timeout" );
  16382. }, s.timeout );
  16383. }
  16384. try {
  16385. completed = false;
  16386. transport.send( requestHeaders, done );
  16387. } catch ( e ) {
  16388. // Rethrow post-completion exceptions
  16389. if ( completed ) {
  16390. throw e;
  16391. }
  16392. // Propagate others as results
  16393. done( -1, e );
  16394. }
  16395. }
  16396. // Callback for when everything is done
  16397. function done( status, nativeStatusText, responses, headers ) {
  16398. var isSuccess, success, error, response, modified,
  16399. statusText = nativeStatusText;
  16400. // Ignore repeat invocations
  16401. if ( completed ) {
  16402. return;
  16403. }
  16404. completed = true;
  16405. // Clear timeout if it exists
  16406. if ( timeoutTimer ) {
  16407. window.clearTimeout( timeoutTimer );
  16408. }
  16409. // Dereference transport for early garbage collection
  16410. // (no matter how long the jqXHR object will be used)
  16411. transport = undefined;
  16412. // Cache response headers
  16413. responseHeadersString = headers || "";
  16414. // Set readyState
  16415. jqXHR.readyState = status > 0 ? 4 : 0;
  16416. // Determine if successful
  16417. isSuccess = status >= 200 && status < 300 || status === 304;
  16418. // Get response data
  16419. if ( responses ) {
  16420. response = ajaxHandleResponses( s, jqXHR, responses );
  16421. }
  16422. // Convert no matter what (that way responseXXX fields are always set)
  16423. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16424. // If successful, handle type chaining
  16425. if ( isSuccess ) {
  16426. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16427. if ( s.ifModified ) {
  16428. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16429. if ( modified ) {
  16430. jQuery.lastModified[ cacheURL ] = modified;
  16431. }
  16432. modified = jqXHR.getResponseHeader( "etag" );
  16433. if ( modified ) {
  16434. jQuery.etag[ cacheURL ] = modified;
  16435. }
  16436. }
  16437. // if no content
  16438. if ( status === 204 || s.type === "HEAD" ) {
  16439. statusText = "nocontent";
  16440. // if not modified
  16441. } else if ( status === 304 ) {
  16442. statusText = "notmodified";
  16443. // If we have data, let's convert it
  16444. } else {
  16445. statusText = response.state;
  16446. success = response.data;
  16447. error = response.error;
  16448. isSuccess = !error;
  16449. }
  16450. } else {
  16451. // Extract error from statusText and normalize for non-aborts
  16452. error = statusText;
  16453. if ( status || !statusText ) {
  16454. statusText = "error";
  16455. if ( status < 0 ) {
  16456. status = 0;
  16457. }
  16458. }
  16459. }
  16460. // Set data for the fake xhr object
  16461. jqXHR.status = status;
  16462. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16463. // Success/Error
  16464. if ( isSuccess ) {
  16465. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16466. } else {
  16467. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16468. }
  16469. // Status-dependent callbacks
  16470. jqXHR.statusCode( statusCode );
  16471. statusCode = undefined;
  16472. if ( fireGlobals ) {
  16473. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16474. [ jqXHR, s, isSuccess ? success : error ] );
  16475. }
  16476. // Complete
  16477. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16478. if ( fireGlobals ) {
  16479. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16480. // Handle the global AJAX counter
  16481. if ( !( --jQuery.active ) ) {
  16482. jQuery.event.trigger( "ajaxStop" );
  16483. }
  16484. }
  16485. }
  16486. return jqXHR;
  16487. },
  16488. getJSON: function( url, data, callback ) {
  16489. return jQuery.get( url, data, callback, "json" );
  16490. },
  16491. getScript: function( url, callback ) {
  16492. return jQuery.get( url, undefined, callback, "script" );
  16493. }
  16494. } );
  16495. jQuery.each( [ "get", "post" ], function( i, method ) {
  16496. jQuery[ method ] = function( url, data, callback, type ) {
  16497. // Shift arguments if data argument was omitted
  16498. if ( isFunction( data ) ) {
  16499. type = type || callback;
  16500. callback = data;
  16501. data = undefined;
  16502. }
  16503. // The url can be an options object (which then must have .url)
  16504. return jQuery.ajax( jQuery.extend( {
  16505. url: url,
  16506. type: method,
  16507. dataType: type,
  16508. data: data,
  16509. success: callback
  16510. }, jQuery.isPlainObject( url ) && url ) );
  16511. };
  16512. } );
  16513. jQuery._evalUrl = function( url, options ) {
  16514. return jQuery.ajax( {
  16515. url: url,
  16516. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16517. type: "GET",
  16518. dataType: "script",
  16519. cache: true,
  16520. async: false,
  16521. global: false,
  16522. // Only evaluate the response if it is successful (gh-4126)
  16523. // dataFilter is not invoked for failure responses, so using it instead
  16524. // of the default converter is kludgy but it works.
  16525. converters: {
  16526. "text script": function() {}
  16527. },
  16528. dataFilter: function( response ) {
  16529. jQuery.globalEval( response, options );
  16530. }
  16531. } );
  16532. };
  16533. jQuery.fn.extend( {
  16534. wrapAll: function( html ) {
  16535. var wrap;
  16536. if ( this[ 0 ] ) {
  16537. if ( isFunction( html ) ) {
  16538. html = html.call( this[ 0 ] );
  16539. }
  16540. // The elements to wrap the target around
  16541. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16542. if ( this[ 0 ].parentNode ) {
  16543. wrap.insertBefore( this[ 0 ] );
  16544. }
  16545. wrap.map( function() {
  16546. var elem = this;
  16547. while ( elem.firstElementChild ) {
  16548. elem = elem.firstElementChild;
  16549. }
  16550. return elem;
  16551. } ).append( this );
  16552. }
  16553. return this;
  16554. },
  16555. wrapInner: function( html ) {
  16556. if ( isFunction( html ) ) {
  16557. return this.each( function( i ) {
  16558. jQuery( this ).wrapInner( html.call( this, i ) );
  16559. } );
  16560. }
  16561. return this.each( function() {
  16562. var self = jQuery( this ),
  16563. contents = self.contents();
  16564. if ( contents.length ) {
  16565. contents.wrapAll( html );
  16566. } else {
  16567. self.append( html );
  16568. }
  16569. } );
  16570. },
  16571. wrap: function( html ) {
  16572. var htmlIsFunction = isFunction( html );
  16573. return this.each( function( i ) {
  16574. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16575. } );
  16576. },
  16577. unwrap: function( selector ) {
  16578. this.parent( selector ).not( "body" ).each( function() {
  16579. jQuery( this ).replaceWith( this.childNodes );
  16580. } );
  16581. return this;
  16582. }
  16583. } );
  16584. jQuery.expr.pseudos.hidden = function( elem ) {
  16585. return !jQuery.expr.pseudos.visible( elem );
  16586. };
  16587. jQuery.expr.pseudos.visible = function( elem ) {
  16588. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16589. };
  16590. jQuery.ajaxSettings.xhr = function() {
  16591. try {
  16592. return new window.XMLHttpRequest();
  16593. } catch ( e ) {}
  16594. };
  16595. var xhrSuccessStatus = {
  16596. // File protocol always yields status code 0, assume 200
  16597. 0: 200,
  16598. // Support: IE <=9 only
  16599. // #1450: sometimes IE returns 1223 when it should be 204
  16600. 1223: 204
  16601. },
  16602. xhrSupported = jQuery.ajaxSettings.xhr();
  16603. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16604. support.ajax = xhrSupported = !!xhrSupported;
  16605. jQuery.ajaxTransport( function( options ) {
  16606. var callback, errorCallback;
  16607. // Cross domain only allowed if supported through XMLHttpRequest
  16608. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16609. return {
  16610. send: function( headers, complete ) {
  16611. var i,
  16612. xhr = options.xhr();
  16613. xhr.open(
  16614. options.type,
  16615. options.url,
  16616. options.async,
  16617. options.username,
  16618. options.password
  16619. );
  16620. // Apply custom fields if provided
  16621. if ( options.xhrFields ) {
  16622. for ( i in options.xhrFields ) {
  16623. xhr[ i ] = options.xhrFields[ i ];
  16624. }
  16625. }
  16626. // Override mime type if needed
  16627. if ( options.mimeType && xhr.overrideMimeType ) {
  16628. xhr.overrideMimeType( options.mimeType );
  16629. }
  16630. // X-Requested-With header
  16631. // For cross-domain requests, seeing as conditions for a preflight are
  16632. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16633. // (it can always be set on a per-request basis or even using ajaxSetup)
  16634. // For same-domain requests, won't change header if already provided.
  16635. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16636. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16637. }
  16638. // Set headers
  16639. for ( i in headers ) {
  16640. xhr.setRequestHeader( i, headers[ i ] );
  16641. }
  16642. // Callback
  16643. callback = function( type ) {
  16644. return function() {
  16645. if ( callback ) {
  16646. callback = errorCallback = xhr.onload =
  16647. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16648. xhr.onreadystatechange = null;
  16649. if ( type === "abort" ) {
  16650. xhr.abort();
  16651. } else if ( type === "error" ) {
  16652. // Support: IE <=9 only
  16653. // On a manual native abort, IE9 throws
  16654. // errors on any property access that is not readyState
  16655. if ( typeof xhr.status !== "number" ) {
  16656. complete( 0, "error" );
  16657. } else {
  16658. complete(
  16659. // File: protocol always yields status 0; see #8605, #14207
  16660. xhr.status,
  16661. xhr.statusText
  16662. );
  16663. }
  16664. } else {
  16665. complete(
  16666. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16667. xhr.statusText,
  16668. // Support: IE <=9 only
  16669. // IE9 has no XHR2 but throws on binary (trac-11426)
  16670. // For XHR2 non-text, let the caller handle it (gh-2498)
  16671. ( xhr.responseType || "text" ) !== "text" ||
  16672. typeof xhr.responseText !== "string" ?
  16673. { binary: xhr.response } :
  16674. { text: xhr.responseText },
  16675. xhr.getAllResponseHeaders()
  16676. );
  16677. }
  16678. }
  16679. };
  16680. };
  16681. // Listen to events
  16682. xhr.onload = callback();
  16683. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16684. // Support: IE 9 only
  16685. // Use onreadystatechange to replace onabort
  16686. // to handle uncaught aborts
  16687. if ( xhr.onabort !== undefined ) {
  16688. xhr.onabort = errorCallback;
  16689. } else {
  16690. xhr.onreadystatechange = function() {
  16691. // Check readyState before timeout as it changes
  16692. if ( xhr.readyState === 4 ) {
  16693. // Allow onerror to be called first,
  16694. // but that will not handle a native abort
  16695. // Also, save errorCallback to a variable
  16696. // as xhr.onerror cannot be accessed
  16697. window.setTimeout( function() {
  16698. if ( callback ) {
  16699. errorCallback();
  16700. }
  16701. } );
  16702. }
  16703. };
  16704. }
  16705. // Create the abort callback
  16706. callback = callback( "abort" );
  16707. try {
  16708. // Do send the request (this may raise an exception)
  16709. xhr.send( options.hasContent && options.data || null );
  16710. } catch ( e ) {
  16711. // #14683: Only rethrow if this hasn't been notified as an error yet
  16712. if ( callback ) {
  16713. throw e;
  16714. }
  16715. }
  16716. },
  16717. abort: function() {
  16718. if ( callback ) {
  16719. callback();
  16720. }
  16721. }
  16722. };
  16723. }
  16724. } );
  16725. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16726. jQuery.ajaxPrefilter( function( s ) {
  16727. if ( s.crossDomain ) {
  16728. s.contents.script = false;
  16729. }
  16730. } );
  16731. // Install script dataType
  16732. jQuery.ajaxSetup( {
  16733. accepts: {
  16734. script: "text/javascript, application/javascript, " +
  16735. "application/ecmascript, application/x-ecmascript"
  16736. },
  16737. contents: {
  16738. script: /\b(?:java|ecma)script\b/
  16739. },
  16740. converters: {
  16741. "text script": function( text ) {
  16742. jQuery.globalEval( text );
  16743. return text;
  16744. }
  16745. }
  16746. } );
  16747. // Handle cache's special case and crossDomain
  16748. jQuery.ajaxPrefilter( "script", function( s ) {
  16749. if ( s.cache === undefined ) {
  16750. s.cache = false;
  16751. }
  16752. if ( s.crossDomain ) {
  16753. s.type = "GET";
  16754. }
  16755. } );
  16756. // Bind script tag hack transport
  16757. jQuery.ajaxTransport( "script", function( s ) {
  16758. // This transport only deals with cross domain or forced-by-attrs requests
  16759. if ( s.crossDomain || s.scriptAttrs ) {
  16760. var script, callback;
  16761. return {
  16762. send: function( _, complete ) {
  16763. script = jQuery( "<script>" )
  16764. .attr( s.scriptAttrs || {} )
  16765. .prop( { charset: s.scriptCharset, src: s.url } )
  16766. .on( "load error", callback = function( evt ) {
  16767. script.remove();
  16768. callback = null;
  16769. if ( evt ) {
  16770. complete( evt.type === "error" ? 404 : 200, evt.type );
  16771. }
  16772. } );
  16773. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16774. document.head.appendChild( script[ 0 ] );
  16775. },
  16776. abort: function() {
  16777. if ( callback ) {
  16778. callback();
  16779. }
  16780. }
  16781. };
  16782. }
  16783. } );
  16784. var oldCallbacks = [],
  16785. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16786. // Default jsonp settings
  16787. jQuery.ajaxSetup( {
  16788. jsonp: "callback",
  16789. jsonpCallback: function() {
  16790. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16791. this[ callback ] = true;
  16792. return callback;
  16793. }
  16794. } );
  16795. // Detect, normalize options and install callbacks for jsonp requests
  16796. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16797. var callbackName, overwritten, responseContainer,
  16798. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16799. "url" :
  16800. typeof s.data === "string" &&
  16801. ( s.contentType || "" )
  16802. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16803. rjsonp.test( s.data ) && "data"
  16804. );
  16805. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16806. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16807. // Get callback name, remembering preexisting value associated with it
  16808. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16809. s.jsonpCallback() :
  16810. s.jsonpCallback;
  16811. // Insert callback into url or form data
  16812. if ( jsonProp ) {
  16813. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16814. } else if ( s.jsonp !== false ) {
  16815. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16816. }
  16817. // Use data converter to retrieve json after script execution
  16818. s.converters[ "script json" ] = function() {
  16819. if ( !responseContainer ) {
  16820. jQuery.error( callbackName + " was not called" );
  16821. }
  16822. return responseContainer[ 0 ];
  16823. };
  16824. // Force json dataType
  16825. s.dataTypes[ 0 ] = "json";
  16826. // Install callback
  16827. overwritten = window[ callbackName ];
  16828. window[ callbackName ] = function() {
  16829. responseContainer = arguments;
  16830. };
  16831. // Clean-up function (fires after converters)
  16832. jqXHR.always( function() {
  16833. // If previous value didn't exist - remove it
  16834. if ( overwritten === undefined ) {
  16835. jQuery( window ).removeProp( callbackName );
  16836. // Otherwise restore preexisting value
  16837. } else {
  16838. window[ callbackName ] = overwritten;
  16839. }
  16840. // Save back as free
  16841. if ( s[ callbackName ] ) {
  16842. // Make sure that re-using the options doesn't screw things around
  16843. s.jsonpCallback = originalSettings.jsonpCallback;
  16844. // Save the callback name for future use
  16845. oldCallbacks.push( callbackName );
  16846. }
  16847. // Call if it was a function and we have a response
  16848. if ( responseContainer && isFunction( overwritten ) ) {
  16849. overwritten( responseContainer[ 0 ] );
  16850. }
  16851. responseContainer = overwritten = undefined;
  16852. } );
  16853. // Delegate to script
  16854. return "script";
  16855. }
  16856. } );
  16857. // Support: Safari 8 only
  16858. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16859. // collapse sibling forms: the second one becomes a child of the first one.
  16860. // Because of that, this security measure has to be disabled in Safari 8.
  16861. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16862. support.createHTMLDocument = ( function() {
  16863. var body = document.implementation.createHTMLDocument( "" ).body;
  16864. body.innerHTML = "<form></form><form></form>";
  16865. return body.childNodes.length === 2;
  16866. } )();
  16867. // Argument "data" should be string of html
  16868. // context (optional): If specified, the fragment will be created in this context,
  16869. // defaults to document
  16870. // keepScripts (optional): If true, will include scripts passed in the html string
  16871. jQuery.parseHTML = function( data, context, keepScripts ) {
  16872. if ( typeof data !== "string" ) {
  16873. return [];
  16874. }
  16875. if ( typeof context === "boolean" ) {
  16876. keepScripts = context;
  16877. context = false;
  16878. }
  16879. var base, parsed, scripts;
  16880. if ( !context ) {
  16881. // Stop scripts or inline event handlers from being executed immediately
  16882. // by using document.implementation
  16883. if ( support.createHTMLDocument ) {
  16884. context = document.implementation.createHTMLDocument( "" );
  16885. // Set the base href for the created document
  16886. // so any parsed elements with URLs
  16887. // are based on the document's URL (gh-2965)
  16888. base = context.createElement( "base" );
  16889. base.href = document.location.href;
  16890. context.head.appendChild( base );
  16891. } else {
  16892. context = document;
  16893. }
  16894. }
  16895. parsed = rsingleTag.exec( data );
  16896. scripts = !keepScripts && [];
  16897. // Single tag
  16898. if ( parsed ) {
  16899. return [ context.createElement( parsed[ 1 ] ) ];
  16900. }
  16901. parsed = buildFragment( [ data ], context, scripts );
  16902. if ( scripts && scripts.length ) {
  16903. jQuery( scripts ).remove();
  16904. }
  16905. return jQuery.merge( [], parsed.childNodes );
  16906. };
  16907. /**
  16908. * Load a url into a page
  16909. */
  16910. jQuery.fn.load = function( url, params, callback ) {
  16911. var selector, type, response,
  16912. self = this,
  16913. off = url.indexOf( " " );
  16914. if ( off > -1 ) {
  16915. selector = stripAndCollapse( url.slice( off ) );
  16916. url = url.slice( 0, off );
  16917. }
  16918. // If it's a function
  16919. if ( isFunction( params ) ) {
  16920. // We assume that it's the callback
  16921. callback = params;
  16922. params = undefined;
  16923. // Otherwise, build a param string
  16924. } else if ( params && typeof params === "object" ) {
  16925. type = "POST";
  16926. }
  16927. // If we have elements to modify, make the request
  16928. if ( self.length > 0 ) {
  16929. jQuery.ajax( {
  16930. url: url,
  16931. // If "type" variable is undefined, then "GET" method will be used.
  16932. // Make value of this field explicit since
  16933. // user can override it through ajaxSetup method
  16934. type: type || "GET",
  16935. dataType: "html",
  16936. data: params
  16937. } ).done( function( responseText ) {
  16938. // Save response for use in complete callback
  16939. response = arguments;
  16940. self.html( selector ?
  16941. // If a selector was specified, locate the right elements in a dummy div
  16942. // Exclude scripts to avoid IE 'Permission Denied' errors
  16943. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16944. // Otherwise use the full result
  16945. responseText );
  16946. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16947. // but they are ignored because response was set above.
  16948. // If it fails, this function gets "jqXHR", "status", "error"
  16949. } ).always( callback && function( jqXHR, status ) {
  16950. self.each( function() {
  16951. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16952. } );
  16953. } );
  16954. }
  16955. return this;
  16956. };
  16957. // Attach a bunch of functions for handling common AJAX events
  16958. jQuery.each( [
  16959. "ajaxStart",
  16960. "ajaxStop",
  16961. "ajaxComplete",
  16962. "ajaxError",
  16963. "ajaxSuccess",
  16964. "ajaxSend"
  16965. ], function( i, type ) {
  16966. jQuery.fn[ type ] = function( fn ) {
  16967. return this.on( type, fn );
  16968. };
  16969. } );
  16970. jQuery.expr.pseudos.animated = function( elem ) {
  16971. return jQuery.grep( jQuery.timers, function( fn ) {
  16972. return elem === fn.elem;
  16973. } ).length;
  16974. };
  16975. jQuery.offset = {
  16976. setOffset: function( elem, options, i ) {
  16977. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16978. position = jQuery.css( elem, "position" ),
  16979. curElem = jQuery( elem ),
  16980. props = {};
  16981. // Set position first, in-case top/left are set even on static elem
  16982. if ( position === "static" ) {
  16983. elem.style.position = "relative";
  16984. }
  16985. curOffset = curElem.offset();
  16986. curCSSTop = jQuery.css( elem, "top" );
  16987. curCSSLeft = jQuery.css( elem, "left" );
  16988. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16989. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16990. // Need to be able to calculate position if either
  16991. // top or left is auto and position is either absolute or fixed
  16992. if ( calculatePosition ) {
  16993. curPosition = curElem.position();
  16994. curTop = curPosition.top;
  16995. curLeft = curPosition.left;
  16996. } else {
  16997. curTop = parseFloat( curCSSTop ) || 0;
  16998. curLeft = parseFloat( curCSSLeft ) || 0;
  16999. }
  17000. if ( isFunction( options ) ) {
  17001. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17002. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17003. }
  17004. if ( options.top != null ) {
  17005. props.top = ( options.top - curOffset.top ) + curTop;
  17006. }
  17007. if ( options.left != null ) {
  17008. props.left = ( options.left - curOffset.left ) + curLeft;
  17009. }
  17010. if ( "using" in options ) {
  17011. options.using.call( elem, props );
  17012. } else {
  17013. curElem.css( props );
  17014. }
  17015. }
  17016. };
  17017. jQuery.fn.extend( {
  17018. // offset() relates an element's border box to the document origin
  17019. offset: function( options ) {
  17020. // Preserve chaining for setter
  17021. if ( arguments.length ) {
  17022. return options === undefined ?
  17023. this :
  17024. this.each( function( i ) {
  17025. jQuery.offset.setOffset( this, options, i );
  17026. } );
  17027. }
  17028. var rect, win,
  17029. elem = this[ 0 ];
  17030. if ( !elem ) {
  17031. return;
  17032. }
  17033. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17034. // Support: IE <=11 only
  17035. // Running getBoundingClientRect on a
  17036. // disconnected node in IE throws an error
  17037. if ( !elem.getClientRects().length ) {
  17038. return { top: 0, left: 0 };
  17039. }
  17040. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17041. rect = elem.getBoundingClientRect();
  17042. win = elem.ownerDocument.defaultView;
  17043. return {
  17044. top: rect.top + win.pageYOffset,
  17045. left: rect.left + win.pageXOffset
  17046. };
  17047. },
  17048. // position() relates an element's margin box to its offset parent's padding box
  17049. // This corresponds to the behavior of CSS absolute positioning
  17050. position: function() {
  17051. if ( !this[ 0 ] ) {
  17052. return;
  17053. }
  17054. var offsetParent, offset, doc,
  17055. elem = this[ 0 ],
  17056. parentOffset = { top: 0, left: 0 };
  17057. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17058. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17059. // Assume position:fixed implies availability of getBoundingClientRect
  17060. offset = elem.getBoundingClientRect();
  17061. } else {
  17062. offset = this.offset();
  17063. // Account for the *real* offset parent, which can be the document or its root element
  17064. // when a statically positioned element is identified
  17065. doc = elem.ownerDocument;
  17066. offsetParent = elem.offsetParent || doc.documentElement;
  17067. while ( offsetParent &&
  17068. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17069. jQuery.css( offsetParent, "position" ) === "static" ) {
  17070. offsetParent = offsetParent.parentNode;
  17071. }
  17072. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17073. // Incorporate borders into its offset, since they are outside its content origin
  17074. parentOffset = jQuery( offsetParent ).offset();
  17075. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17076. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17077. }
  17078. }
  17079. // Subtract parent offsets and element margins
  17080. return {
  17081. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17082. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17083. };
  17084. },
  17085. // This method will return documentElement in the following cases:
  17086. // 1) For the element inside the iframe without offsetParent, this method will return
  17087. // documentElement of the parent window
  17088. // 2) For the hidden or detached element
  17089. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17090. //
  17091. // but those exceptions were never presented as a real life use-cases
  17092. // and might be considered as more preferable results.
  17093. //
  17094. // This logic, however, is not guaranteed and can change at any point in the future
  17095. offsetParent: function() {
  17096. return this.map( function() {
  17097. var offsetParent = this.offsetParent;
  17098. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17099. offsetParent = offsetParent.offsetParent;
  17100. }
  17101. return offsetParent || documentElement;
  17102. } );
  17103. }
  17104. } );
  17105. // Create scrollLeft and scrollTop methods
  17106. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17107. var top = "pageYOffset" === prop;
  17108. jQuery.fn[ method ] = function( val ) {
  17109. return access( this, function( elem, method, val ) {
  17110. // Coalesce documents and windows
  17111. var win;
  17112. if ( isWindow( elem ) ) {
  17113. win = elem;
  17114. } else if ( elem.nodeType === 9 ) {
  17115. win = elem.defaultView;
  17116. }
  17117. if ( val === undefined ) {
  17118. return win ? win[ prop ] : elem[ method ];
  17119. }
  17120. if ( win ) {
  17121. win.scrollTo(
  17122. !top ? val : win.pageXOffset,
  17123. top ? val : win.pageYOffset
  17124. );
  17125. } else {
  17126. elem[ method ] = val;
  17127. }
  17128. }, method, val, arguments.length );
  17129. };
  17130. } );
  17131. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17132. // Add the top/left cssHooks using jQuery.fn.position
  17133. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17134. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17135. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17136. // rather than make the css module depend on the offset module, just check for it here
  17137. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17138. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17139. function( elem, computed ) {
  17140. if ( computed ) {
  17141. computed = curCSS( elem, prop );
  17142. // If curCSS returns percentage, fallback to offset
  17143. return rnumnonpx.test( computed ) ?
  17144. jQuery( elem ).position()[ prop ] + "px" :
  17145. computed;
  17146. }
  17147. }
  17148. );
  17149. } );
  17150. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17151. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17152. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17153. function( defaultExtra, funcName ) {
  17154. // Margin is only for outerHeight, outerWidth
  17155. jQuery.fn[ funcName ] = function( margin, value ) {
  17156. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17157. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17158. return access( this, function( elem, type, value ) {
  17159. var doc;
  17160. if ( isWindow( elem ) ) {
  17161. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17162. return funcName.indexOf( "outer" ) === 0 ?
  17163. elem[ "inner" + name ] :
  17164. elem.document.documentElement[ "client" + name ];
  17165. }
  17166. // Get document width or height
  17167. if ( elem.nodeType === 9 ) {
  17168. doc = elem.documentElement;
  17169. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17170. // whichever is greatest
  17171. return Math.max(
  17172. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17173. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17174. doc[ "client" + name ]
  17175. );
  17176. }
  17177. return value === undefined ?
  17178. // Get width or height on the element, requesting but not forcing parseFloat
  17179. jQuery.css( elem, type, extra ) :
  17180. // Set width or height on the element
  17181. jQuery.style( elem, type, value, extra );
  17182. }, type, chainable ? margin : undefined, chainable );
  17183. };
  17184. } );
  17185. } );
  17186. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17187. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17188. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17189. function( i, name ) {
  17190. // Handle event binding
  17191. jQuery.fn[ name ] = function( data, fn ) {
  17192. return arguments.length > 0 ?
  17193. this.on( name, null, data, fn ) :
  17194. this.trigger( name );
  17195. };
  17196. } );
  17197. jQuery.fn.extend( {
  17198. hover: function( fnOver, fnOut ) {
  17199. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17200. }
  17201. } );
  17202. jQuery.fn.extend( {
  17203. bind: function( types, data, fn ) {
  17204. return this.on( types, null, data, fn );
  17205. },
  17206. unbind: function( types, fn ) {
  17207. return this.off( types, null, fn );
  17208. },
  17209. delegate: function( selector, types, data, fn ) {
  17210. return this.on( types, selector, data, fn );
  17211. },
  17212. undelegate: function( selector, types, fn ) {
  17213. // ( namespace ) or ( selector, types [, fn] )
  17214. return arguments.length === 1 ?
  17215. this.off( selector, "**" ) :
  17216. this.off( types, selector || "**", fn );
  17217. }
  17218. } );
  17219. // Bind a function to a context, optionally partially applying any
  17220. // arguments.
  17221. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17222. // However, it is not slated for removal any time soon
  17223. jQuery.proxy = function( fn, context ) {
  17224. var tmp, args, proxy;
  17225. if ( typeof context === "string" ) {
  17226. tmp = fn[ context ];
  17227. context = fn;
  17228. fn = tmp;
  17229. }
  17230. // Quick check to determine if target is callable, in the spec
  17231. // this throws a TypeError, but we will just return undefined.
  17232. if ( !isFunction( fn ) ) {
  17233. return undefined;
  17234. }
  17235. // Simulated bind
  17236. args = slice.call( arguments, 2 );
  17237. proxy = function() {
  17238. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17239. };
  17240. // Set the guid of unique handler to the same of original handler, so it can be removed
  17241. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17242. return proxy;
  17243. };
  17244. jQuery.holdReady = function( hold ) {
  17245. if ( hold ) {
  17246. jQuery.readyWait++;
  17247. } else {
  17248. jQuery.ready( true );
  17249. }
  17250. };
  17251. jQuery.isArray = Array.isArray;
  17252. jQuery.parseJSON = JSON.parse;
  17253. jQuery.nodeName = nodeName;
  17254. jQuery.isFunction = isFunction;
  17255. jQuery.isWindow = isWindow;
  17256. jQuery.camelCase = camelCase;
  17257. jQuery.type = toType;
  17258. jQuery.now = Date.now;
  17259. jQuery.isNumeric = function( obj ) {
  17260. // As of jQuery 3.0, isNumeric is limited to
  17261. // strings and numbers (primitives or objects)
  17262. // that can be coerced to finite numbers (gh-2662)
  17263. var type = jQuery.type( obj );
  17264. return ( type === "number" || type === "string" ) &&
  17265. // parseFloat NaNs numeric-cast false positives ("")
  17266. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17267. // subtraction forces infinities to NaN
  17268. !isNaN( obj - parseFloat( obj ) );
  17269. };
  17270. // Register as a named AMD module, since jQuery can be concatenated with other
  17271. // files that may use define, but not via a proper concatenation script that
  17272. // understands anonymous AMD modules. A named AMD is safest and most robust
  17273. // way to register. Lowercase jquery is used because AMD module names are
  17274. // derived from file names, and jQuery is normally delivered in a lowercase
  17275. // file name. Do this after creating the global so that if an AMD module wants
  17276. // to call noConflict to hide this version of jQuery, it will work.
  17277. // Note that for maximum portability, libraries that are not jQuery should
  17278. // declare themselves as anonymous modules, and avoid setting a global if an
  17279. // AMD loader is present. jQuery is a special case. For more information, see
  17280. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17281. if ( true ) {
  17282. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17283. return jQuery;
  17284. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17285. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17286. }
  17287. var
  17288. // Map over jQuery in case of overwrite
  17289. _jQuery = window.jQuery,
  17290. // Map over the $ in case of overwrite
  17291. _$ = window.$;
  17292. jQuery.noConflict = function( deep ) {
  17293. if ( window.$ === jQuery ) {
  17294. window.$ = _$;
  17295. }
  17296. if ( deep && window.jQuery === jQuery ) {
  17297. window.jQuery = _jQuery;
  17298. }
  17299. return jQuery;
  17300. };
  17301. // Expose jQuery and $ identifiers, even in AMD
  17302. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17303. // and CommonJS for browser emulators (#13566)
  17304. if ( !noGlobal ) {
  17305. window.jQuery = window.$ = jQuery;
  17306. }
  17307. return jQuery;
  17308. } );
  17309. /***/ }),
  17310. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17311. /*!************************************************!*\
  17312. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17313. \************************************************/
  17314. /*! exports provided: default */
  17315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17316. "use strict";
  17317. __webpack_require__.r(__webpack_exports__);
  17318. var classCallCheck = function (instance, Constructor) {
  17319. if (!(instance instanceof Constructor)) {
  17320. throw new TypeError("Cannot call a class as a function");
  17321. }
  17322. };
  17323. var createClass = function () {
  17324. function defineProperties(target, props) {
  17325. for (var i = 0; i < props.length; i++) {
  17326. var descriptor = props[i];
  17327. descriptor.enumerable = descriptor.enumerable || false;
  17328. descriptor.configurable = true;
  17329. if ("value" in descriptor) descriptor.writable = true;
  17330. Object.defineProperty(target, descriptor.key, descriptor);
  17331. }
  17332. }
  17333. return function (Constructor, protoProps, staticProps) {
  17334. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17335. if (staticProps) defineProperties(Constructor, staticProps);
  17336. return Constructor;
  17337. };
  17338. }();
  17339. var _extends = Object.assign || function (target) {
  17340. for (var i = 1; i < arguments.length; i++) {
  17341. var source = arguments[i];
  17342. for (var key in source) {
  17343. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17344. target[key] = source[key];
  17345. }
  17346. }
  17347. }
  17348. return target;
  17349. };
  17350. var inherits = function (subClass, superClass) {
  17351. if (typeof superClass !== "function" && superClass !== null) {
  17352. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17353. }
  17354. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17355. constructor: {
  17356. value: subClass,
  17357. enumerable: false,
  17358. writable: true,
  17359. configurable: true
  17360. }
  17361. });
  17362. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17363. };
  17364. var possibleConstructorReturn = function (self, call) {
  17365. if (!self) {
  17366. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17367. }
  17368. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17369. };
  17370. var Connector = function () {
  17371. /**
  17372. * Create a new class instance.
  17373. */
  17374. function Connector(options) {
  17375. classCallCheck(this, Connector);
  17376. /**
  17377. * Default connector options.
  17378. */
  17379. this._defaultOptions = {
  17380. auth: {
  17381. headers: {}
  17382. },
  17383. authEndpoint: '/broadcasting/auth',
  17384. broadcaster: 'pusher',
  17385. csrfToken: null,
  17386. host: null,
  17387. key: null,
  17388. namespace: 'App.Events'
  17389. };
  17390. this.setOptions(options);
  17391. this.connect();
  17392. }
  17393. /**
  17394. * Merge the custom options with the defaults.
  17395. */
  17396. createClass(Connector, [{
  17397. key: 'setOptions',
  17398. value: function setOptions(options) {
  17399. this.options = _extends(this._defaultOptions, options);
  17400. if (this.csrfToken()) {
  17401. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17402. }
  17403. return options;
  17404. }
  17405. /**
  17406. * Extract the CSRF token from the page.
  17407. */
  17408. }, {
  17409. key: 'csrfToken',
  17410. value: function csrfToken() {
  17411. var selector = void 0;
  17412. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17413. return window['Laravel'].csrfToken;
  17414. } else if (this.options.csrfToken) {
  17415. return this.options.csrfToken;
  17416. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17417. return selector.getAttribute('content');
  17418. }
  17419. return null;
  17420. }
  17421. }]);
  17422. return Connector;
  17423. }();
  17424. /**
  17425. * This class represents a basic channel.
  17426. */
  17427. var Channel = function () {
  17428. function Channel() {
  17429. classCallCheck(this, Channel);
  17430. }
  17431. createClass(Channel, [{
  17432. key: 'listenForWhisper',
  17433. /**
  17434. * Listen for a whisper event on the channel instance.
  17435. */
  17436. value: function listenForWhisper(event, callback) {
  17437. return this.listen('.client-' + event, callback);
  17438. }
  17439. /**
  17440. * Listen for an event on the channel instance.
  17441. */
  17442. }, {
  17443. key: 'notification',
  17444. value: function notification(callback) {
  17445. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17446. }
  17447. /**
  17448. * Stop listening for a whispser event on the channel instance.
  17449. */
  17450. }, {
  17451. key: 'stopListeningForWhisper',
  17452. value: function stopListeningForWhisper(event) {
  17453. return this.stopListening('.client-' + event);
  17454. }
  17455. }]);
  17456. return Channel;
  17457. }();
  17458. /**
  17459. * Event name formatter
  17460. */
  17461. var EventFormatter = function () {
  17462. /**
  17463. * Create a new class instance.
  17464. */
  17465. function EventFormatter(namespace) {
  17466. classCallCheck(this, EventFormatter);
  17467. this.setNamespace(namespace);
  17468. }
  17469. /**
  17470. * Format the given event name.
  17471. */
  17472. createClass(EventFormatter, [{
  17473. key: 'format',
  17474. value: function format(event) {
  17475. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17476. return event.substr(1);
  17477. } else if (this.namespace) {
  17478. event = this.namespace + '.' + event;
  17479. }
  17480. return event.replace(/\./g, '\\');
  17481. }
  17482. /**
  17483. * Set the event namespace.
  17484. */
  17485. }, {
  17486. key: 'setNamespace',
  17487. value: function setNamespace(value) {
  17488. this.namespace = value;
  17489. }
  17490. }]);
  17491. return EventFormatter;
  17492. }();
  17493. /**
  17494. * This class represents a Pusher channel.
  17495. */
  17496. var PusherChannel = function (_Channel) {
  17497. inherits(PusherChannel, _Channel);
  17498. /**
  17499. * Create a new class instance.
  17500. */
  17501. function PusherChannel(pusher, name, options) {
  17502. classCallCheck(this, PusherChannel);
  17503. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17504. _this.name = name;
  17505. _this.pusher = pusher;
  17506. _this.options = options;
  17507. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17508. _this.subscribe();
  17509. return _this;
  17510. }
  17511. /**
  17512. * Subscribe to a Pusher channel.
  17513. */
  17514. createClass(PusherChannel, [{
  17515. key: 'subscribe',
  17516. value: function subscribe() {
  17517. this.subscription = this.pusher.subscribe(this.name);
  17518. }
  17519. /**
  17520. * Unsubscribe from a Pusher channel.
  17521. */
  17522. }, {
  17523. key: 'unsubscribe',
  17524. value: function unsubscribe() {
  17525. this.pusher.unsubscribe(this.name);
  17526. }
  17527. /**
  17528. * Listen for an event on the channel instance.
  17529. */
  17530. }, {
  17531. key: 'listen',
  17532. value: function listen(event, callback) {
  17533. this.on(this.eventFormatter.format(event), callback);
  17534. return this;
  17535. }
  17536. /**
  17537. * Stop listening for an event on the channel instance.
  17538. */
  17539. }, {
  17540. key: 'stopListening',
  17541. value: function stopListening(event) {
  17542. this.subscription.unbind(this.eventFormatter.format(event));
  17543. return this;
  17544. }
  17545. /**
  17546. * Bind a channel to an event.
  17547. */
  17548. }, {
  17549. key: 'on',
  17550. value: function on(event, callback) {
  17551. this.subscription.bind(event, callback);
  17552. return this;
  17553. }
  17554. }]);
  17555. return PusherChannel;
  17556. }(Channel);
  17557. /**
  17558. * This class represents a Pusher private channel.
  17559. */
  17560. var PusherPrivateChannel = function (_PusherChannel) {
  17561. inherits(PusherPrivateChannel, _PusherChannel);
  17562. function PusherPrivateChannel() {
  17563. classCallCheck(this, PusherPrivateChannel);
  17564. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17565. }
  17566. createClass(PusherPrivateChannel, [{
  17567. key: 'whisper',
  17568. /**
  17569. * Trigger client event on the channel.
  17570. */
  17571. value: function whisper(eventName, data) {
  17572. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17573. return this;
  17574. }
  17575. }]);
  17576. return PusherPrivateChannel;
  17577. }(PusherChannel);
  17578. /**
  17579. * This class represents a Pusher presence channel.
  17580. */
  17581. var PusherPresenceChannel = function (_PusherChannel) {
  17582. inherits(PusherPresenceChannel, _PusherChannel);
  17583. function PusherPresenceChannel() {
  17584. classCallCheck(this, PusherPresenceChannel);
  17585. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17586. }
  17587. createClass(PusherPresenceChannel, [{
  17588. key: 'here',
  17589. /**
  17590. * Register a callback to be called anytime the member list changes.
  17591. */
  17592. value: function here(callback) {
  17593. this.on('pusher:subscription_succeeded', function (data) {
  17594. callback(Object.keys(data.members).map(function (k) {
  17595. return data.members[k];
  17596. }));
  17597. });
  17598. return this;
  17599. }
  17600. /**
  17601. * Listen for someone joining the channel.
  17602. */
  17603. }, {
  17604. key: 'joining',
  17605. value: function joining(callback) {
  17606. this.on('pusher:member_added', function (member) {
  17607. callback(member.info);
  17608. });
  17609. return this;
  17610. }
  17611. /**
  17612. * Listen for someone leaving the channel.
  17613. */
  17614. }, {
  17615. key: 'leaving',
  17616. value: function leaving(callback) {
  17617. this.on('pusher:member_removed', function (member) {
  17618. callback(member.info);
  17619. });
  17620. return this;
  17621. }
  17622. /**
  17623. * Trigger client event on the channel.
  17624. */
  17625. }, {
  17626. key: 'whisper',
  17627. value: function whisper(eventName, data) {
  17628. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17629. return this;
  17630. }
  17631. }]);
  17632. return PusherPresenceChannel;
  17633. }(PusherChannel);
  17634. /**
  17635. * This class represents a Socket.io channel.
  17636. */
  17637. var SocketIoChannel = function (_Channel) {
  17638. inherits(SocketIoChannel, _Channel);
  17639. /**
  17640. * Create a new class instance.
  17641. */
  17642. function SocketIoChannel(socket, name, options) {
  17643. classCallCheck(this, SocketIoChannel);
  17644. /**
  17645. * The event callbacks applied to the channel.
  17646. */
  17647. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17648. _this.events = {};
  17649. _this.name = name;
  17650. _this.socket = socket;
  17651. _this.options = options;
  17652. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17653. _this.subscribe();
  17654. _this.configureReconnector();
  17655. return _this;
  17656. }
  17657. /**
  17658. * Subscribe to a Socket.io channel.
  17659. */
  17660. createClass(SocketIoChannel, [{
  17661. key: 'subscribe',
  17662. value: function subscribe() {
  17663. this.socket.emit('subscribe', {
  17664. channel: this.name,
  17665. auth: this.options.auth || {}
  17666. });
  17667. }
  17668. /**
  17669. * Unsubscribe from channel and ubind event callbacks.
  17670. */
  17671. }, {
  17672. key: 'unsubscribe',
  17673. value: function unsubscribe() {
  17674. this.unbind();
  17675. this.socket.emit('unsubscribe', {
  17676. channel: this.name,
  17677. auth: this.options.auth || {}
  17678. });
  17679. }
  17680. /**
  17681. * Listen for an event on the channel instance.
  17682. */
  17683. }, {
  17684. key: 'listen',
  17685. value: function listen(event, callback) {
  17686. this.on(this.eventFormatter.format(event), callback);
  17687. return this;
  17688. }
  17689. /**
  17690. * Stop listening for an event on the channel instance.
  17691. */
  17692. }, {
  17693. key: 'stopListening',
  17694. value: function stopListening(event) {
  17695. var name = this.eventFormatter.format(event);
  17696. this.socket.removeListener(name);
  17697. delete this.events[name];
  17698. return this;
  17699. }
  17700. /**
  17701. * Bind the channel's socket to an event and store the callback.
  17702. */
  17703. }, {
  17704. key: 'on',
  17705. value: function on(event, callback) {
  17706. var _this2 = this;
  17707. var listener = function listener(channel, data) {
  17708. if (_this2.name == channel) {
  17709. callback(data);
  17710. }
  17711. };
  17712. this.socket.on(event, listener);
  17713. this.bind(event, listener);
  17714. }
  17715. /**
  17716. * Attach a 'reconnect' listener and bind the event.
  17717. */
  17718. }, {
  17719. key: 'configureReconnector',
  17720. value: function configureReconnector() {
  17721. var _this3 = this;
  17722. var listener = function listener() {
  17723. _this3.subscribe();
  17724. };
  17725. this.socket.on('reconnect', listener);
  17726. this.bind('reconnect', listener);
  17727. }
  17728. /**
  17729. * Bind the channel's socket to an event and store the callback.
  17730. */
  17731. }, {
  17732. key: 'bind',
  17733. value: function bind(event, callback) {
  17734. this.events[event] = this.events[event] || [];
  17735. this.events[event].push(callback);
  17736. }
  17737. /**
  17738. * Unbind the channel's socket from all stored event callbacks.
  17739. */
  17740. }, {
  17741. key: 'unbind',
  17742. value: function unbind() {
  17743. var _this4 = this;
  17744. Object.keys(this.events).forEach(function (event) {
  17745. _this4.events[event].forEach(function (callback) {
  17746. _this4.socket.removeListener(event, callback);
  17747. });
  17748. delete _this4.events[event];
  17749. });
  17750. }
  17751. }]);
  17752. return SocketIoChannel;
  17753. }(Channel);
  17754. /**
  17755. * This class represents a Socket.io presence channel.
  17756. */
  17757. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17758. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17759. function SocketIoPrivateChannel() {
  17760. classCallCheck(this, SocketIoPrivateChannel);
  17761. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17762. }
  17763. createClass(SocketIoPrivateChannel, [{
  17764. key: 'whisper',
  17765. /**
  17766. * Trigger client event on the channel.
  17767. */
  17768. value: function whisper(eventName, data) {
  17769. this.socket.emit('client event', {
  17770. channel: this.name,
  17771. event: 'client-' + eventName,
  17772. data: data
  17773. });
  17774. return this;
  17775. }
  17776. }]);
  17777. return SocketIoPrivateChannel;
  17778. }(SocketIoChannel);
  17779. /**
  17780. * This class represents a Socket.io presence channel.
  17781. */
  17782. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17783. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17784. function SocketIoPresenceChannel() {
  17785. classCallCheck(this, SocketIoPresenceChannel);
  17786. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17787. }
  17788. createClass(SocketIoPresenceChannel, [{
  17789. key: 'here',
  17790. /**
  17791. * Register a callback to be called anytime the member list changes.
  17792. */
  17793. value: function here(callback) {
  17794. this.on('presence:subscribed', function (members) {
  17795. callback(members.map(function (m) {
  17796. return m.user_info;
  17797. }));
  17798. });
  17799. return this;
  17800. }
  17801. /**
  17802. * Listen for someone joining the channel.
  17803. */
  17804. }, {
  17805. key: 'joining',
  17806. value: function joining(callback) {
  17807. this.on('presence:joining', function (member) {
  17808. return callback(member.user_info);
  17809. });
  17810. return this;
  17811. }
  17812. /**
  17813. * Listen for someone leaving the channel.
  17814. */
  17815. }, {
  17816. key: 'leaving',
  17817. value: function leaving(callback) {
  17818. this.on('presence:leaving', function (member) {
  17819. return callback(member.user_info);
  17820. });
  17821. return this;
  17822. }
  17823. }]);
  17824. return SocketIoPresenceChannel;
  17825. }(SocketIoPrivateChannel);
  17826. /**
  17827. * This class represents a null channel.
  17828. */
  17829. var NullChannel = function (_Channel) {
  17830. inherits(NullChannel, _Channel);
  17831. function NullChannel() {
  17832. classCallCheck(this, NullChannel);
  17833. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17834. }
  17835. createClass(NullChannel, [{
  17836. key: 'subscribe',
  17837. /**
  17838. * Subscribe to a channel.
  17839. */
  17840. value: function subscribe() {}
  17841. //
  17842. /**
  17843. * Unsubscribe from a channel.
  17844. */
  17845. }, {
  17846. key: 'unsubscribe',
  17847. value: function unsubscribe() {}
  17848. //
  17849. /**
  17850. * Listen for an event on the channel instance.
  17851. */
  17852. }, {
  17853. key: 'listen',
  17854. value: function listen(event, callback) {
  17855. return this;
  17856. }
  17857. /**
  17858. * Stop listening for an event on the channel instance.
  17859. */
  17860. }, {
  17861. key: 'stopListening',
  17862. value: function stopListening(event) {
  17863. return this;
  17864. }
  17865. /**
  17866. * Bind a channel to an event.
  17867. */
  17868. }, {
  17869. key: 'on',
  17870. value: function on(event, callback) {
  17871. return this;
  17872. }
  17873. }]);
  17874. return NullChannel;
  17875. }(Channel);
  17876. /**
  17877. * This class represents a null private channel.
  17878. */
  17879. var NullPrivateChannel = function (_NullChannel) {
  17880. inherits(NullPrivateChannel, _NullChannel);
  17881. function NullPrivateChannel() {
  17882. classCallCheck(this, NullPrivateChannel);
  17883. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17884. }
  17885. createClass(NullPrivateChannel, [{
  17886. key: 'whisper',
  17887. /**
  17888. * Trigger client event on the channel.
  17889. */
  17890. value: function whisper(eventName, data) {
  17891. return this;
  17892. }
  17893. }]);
  17894. return NullPrivateChannel;
  17895. }(NullChannel);
  17896. /**
  17897. * This class represents a null presence channel.
  17898. */
  17899. var NullPresenceChannel = function (_NullChannel) {
  17900. inherits(NullPresenceChannel, _NullChannel);
  17901. function NullPresenceChannel() {
  17902. classCallCheck(this, NullPresenceChannel);
  17903. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17904. }
  17905. createClass(NullPresenceChannel, [{
  17906. key: 'here',
  17907. /**
  17908. * Register a callback to be called anytime the member list changes.
  17909. */
  17910. value: function here(callback) {
  17911. return this;
  17912. }
  17913. /**
  17914. * Listen for someone joining the channel.
  17915. */
  17916. }, {
  17917. key: 'joining',
  17918. value: function joining(callback) {
  17919. return this;
  17920. }
  17921. /**
  17922. * Listen for someone leaving the channel.
  17923. */
  17924. }, {
  17925. key: 'leaving',
  17926. value: function leaving(callback) {
  17927. return this;
  17928. }
  17929. /**
  17930. * Trigger client event on the channel.
  17931. */
  17932. }, {
  17933. key: 'whisper',
  17934. value: function whisper(eventName, data) {
  17935. return this;
  17936. }
  17937. }]);
  17938. return NullPresenceChannel;
  17939. }(NullChannel);
  17940. /**
  17941. * This class creates a connector to Pusher.
  17942. */
  17943. var PusherConnector = function (_Connector) {
  17944. inherits(PusherConnector, _Connector);
  17945. function PusherConnector() {
  17946. classCallCheck(this, PusherConnector);
  17947. /**
  17948. * All of the subscribed channel names.
  17949. */
  17950. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17951. _this.channels = {};
  17952. return _this;
  17953. }
  17954. /**
  17955. * Create a fresh Pusher connection.
  17956. */
  17957. createClass(PusherConnector, [{
  17958. key: 'connect',
  17959. value: function connect() {
  17960. if (typeof this.options.client !== 'undefined') {
  17961. this.pusher = this.options.client;
  17962. } else {
  17963. this.pusher = new Pusher(this.options.key, this.options);
  17964. }
  17965. }
  17966. /**
  17967. * Listen for an event on a channel instance.
  17968. */
  17969. }, {
  17970. key: 'listen',
  17971. value: function listen(name, event, callback) {
  17972. return this.channel(name).listen(event, callback);
  17973. }
  17974. /**
  17975. * Get a channel instance by name.
  17976. */
  17977. }, {
  17978. key: 'channel',
  17979. value: function channel(name) {
  17980. if (!this.channels[name]) {
  17981. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17982. }
  17983. return this.channels[name];
  17984. }
  17985. /**
  17986. * Get a private channel instance by name.
  17987. */
  17988. }, {
  17989. key: 'privateChannel',
  17990. value: function privateChannel(name) {
  17991. if (!this.channels['private-' + name]) {
  17992. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17993. }
  17994. return this.channels['private-' + name];
  17995. }
  17996. /**
  17997. * Get a presence channel instance by name.
  17998. */
  17999. }, {
  18000. key: 'presenceChannel',
  18001. value: function presenceChannel(name) {
  18002. if (!this.channels['presence-' + name]) {
  18003. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18004. }
  18005. return this.channels['presence-' + name];
  18006. }
  18007. /**
  18008. * Leave the given channel, as well as its private and presence variants.
  18009. */
  18010. }, {
  18011. key: 'leave',
  18012. value: function leave(name) {
  18013. var _this2 = this;
  18014. var channels = [name, 'private-' + name, 'presence-' + name];
  18015. channels.forEach(function (name, index) {
  18016. _this2.leaveChannel(name);
  18017. });
  18018. }
  18019. /**
  18020. * Leave the given channel.
  18021. */
  18022. }, {
  18023. key: 'leaveChannel',
  18024. value: function leaveChannel(name) {
  18025. if (this.channels[name]) {
  18026. this.channels[name].unsubscribe();
  18027. delete this.channels[name];
  18028. }
  18029. }
  18030. /**
  18031. * Get the socket ID for the connection.
  18032. */
  18033. }, {
  18034. key: 'socketId',
  18035. value: function socketId() {
  18036. return this.pusher.connection.socket_id;
  18037. }
  18038. /**
  18039. * Disconnect Pusher connection.
  18040. */
  18041. }, {
  18042. key: 'disconnect',
  18043. value: function disconnect() {
  18044. this.pusher.disconnect();
  18045. }
  18046. }]);
  18047. return PusherConnector;
  18048. }(Connector);
  18049. /**
  18050. * This class creates a connnector to a Socket.io server.
  18051. */
  18052. var SocketIoConnector = function (_Connector) {
  18053. inherits(SocketIoConnector, _Connector);
  18054. function SocketIoConnector() {
  18055. classCallCheck(this, SocketIoConnector);
  18056. /**
  18057. * All of the subscribed channel names.
  18058. */
  18059. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18060. _this.channels = {};
  18061. return _this;
  18062. }
  18063. /**
  18064. * Create a fresh Socket.io connection.
  18065. */
  18066. createClass(SocketIoConnector, [{
  18067. key: 'connect',
  18068. value: function connect() {
  18069. var io = this.getSocketIO();
  18070. this.socket = io(this.options.host, this.options);
  18071. return this.socket;
  18072. }
  18073. /**
  18074. * Get socket.io module from global scope or options.
  18075. */
  18076. }, {
  18077. key: 'getSocketIO',
  18078. value: function getSocketIO() {
  18079. if (typeof this.options.client !== 'undefined') {
  18080. return this.options.client;
  18081. }
  18082. if (typeof io !== 'undefined') {
  18083. return io;
  18084. }
  18085. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18086. }
  18087. /**
  18088. * Listen for an event on a channel instance.
  18089. */
  18090. }, {
  18091. key: 'listen',
  18092. value: function listen(name, event, callback) {
  18093. return this.channel(name).listen(event, callback);
  18094. }
  18095. /**
  18096. * Get a channel instance by name.
  18097. */
  18098. }, {
  18099. key: 'channel',
  18100. value: function channel(name) {
  18101. if (!this.channels[name]) {
  18102. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18103. }
  18104. return this.channels[name];
  18105. }
  18106. /**
  18107. * Get a private channel instance by name.
  18108. */
  18109. }, {
  18110. key: 'privateChannel',
  18111. value: function privateChannel(name) {
  18112. if (!this.channels['private-' + name]) {
  18113. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18114. }
  18115. return this.channels['private-' + name];
  18116. }
  18117. /**
  18118. * Get a presence channel instance by name.
  18119. */
  18120. }, {
  18121. key: 'presenceChannel',
  18122. value: function presenceChannel(name) {
  18123. if (!this.channels['presence-' + name]) {
  18124. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18125. }
  18126. return this.channels['presence-' + name];
  18127. }
  18128. /**
  18129. * Leave the given channel, as well as its private and presence variants.
  18130. */
  18131. }, {
  18132. key: 'leave',
  18133. value: function leave(name) {
  18134. var _this2 = this;
  18135. var channels = [name, 'private-' + name, 'presence-' + name];
  18136. channels.forEach(function (name) {
  18137. _this2.leaveChannel(name);
  18138. });
  18139. }
  18140. /**
  18141. * Leave the given channel.
  18142. */
  18143. }, {
  18144. key: 'leaveChannel',
  18145. value: function leaveChannel(name) {
  18146. if (this.channels[name]) {
  18147. this.channels[name].unsubscribe();
  18148. delete this.channels[name];
  18149. }
  18150. }
  18151. /**
  18152. * Get the socket ID for the connection.
  18153. */
  18154. }, {
  18155. key: 'socketId',
  18156. value: function socketId() {
  18157. return this.socket.id;
  18158. }
  18159. /**
  18160. * Disconnect Socketio connection.
  18161. */
  18162. }, {
  18163. key: 'disconnect',
  18164. value: function disconnect() {
  18165. this.socket.disconnect();
  18166. }
  18167. }]);
  18168. return SocketIoConnector;
  18169. }(Connector);
  18170. /**
  18171. * This class creates a null connector.
  18172. */
  18173. var NullConnector = function (_Connector) {
  18174. inherits(NullConnector, _Connector);
  18175. function NullConnector() {
  18176. classCallCheck(this, NullConnector);
  18177. /**
  18178. * All of the subscribed channel names.
  18179. */
  18180. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18181. _this.channels = {};
  18182. return _this;
  18183. }
  18184. /**
  18185. * Create a fresh connection.
  18186. */
  18187. createClass(NullConnector, [{
  18188. key: 'connect',
  18189. value: function connect() {}
  18190. //
  18191. /**
  18192. * Listen for an event on a channel instance.
  18193. */
  18194. }, {
  18195. key: 'listen',
  18196. value: function listen(name, event, callback) {
  18197. return new NullChannel();
  18198. }
  18199. /**
  18200. * Get a channel instance by name.
  18201. */
  18202. }, {
  18203. key: 'channel',
  18204. value: function channel(name) {
  18205. return new NullChannel();
  18206. }
  18207. /**
  18208. * Get a private channel instance by name.
  18209. */
  18210. }, {
  18211. key: 'privateChannel',
  18212. value: function privateChannel(name) {
  18213. return new NullPrivateChannel();
  18214. }
  18215. /**
  18216. * Get a presence channel instance by name.
  18217. */
  18218. }, {
  18219. key: 'presenceChannel',
  18220. value: function presenceChannel(name) {
  18221. return new NullPresenceChannel();
  18222. }
  18223. /**
  18224. * Leave the given channel, as well as its private and presence variants.
  18225. */
  18226. }, {
  18227. key: 'leave',
  18228. value: function leave(name) {}
  18229. //
  18230. /**
  18231. * Leave the given channel.
  18232. */
  18233. }, {
  18234. key: 'leaveChannel',
  18235. value: function leaveChannel(name) {}
  18236. //
  18237. /**
  18238. * Get the socket ID for the connection.
  18239. */
  18240. }, {
  18241. key: 'socketId',
  18242. value: function socketId() {
  18243. return 'fake-socket-id';
  18244. }
  18245. /**
  18246. * Disconnect the connection.
  18247. */
  18248. }, {
  18249. key: 'disconnect',
  18250. value: function disconnect() {
  18251. //
  18252. }
  18253. }]);
  18254. return NullConnector;
  18255. }(Connector);
  18256. /**
  18257. * This class is the primary API for interacting with broadcasting.
  18258. */
  18259. var Echo = function () {
  18260. /**
  18261. * Create a new class instance.
  18262. */
  18263. function Echo(options) {
  18264. classCallCheck(this, Echo);
  18265. this.options = options;
  18266. this.connect();
  18267. if (!this.options.withoutInterceptors) {
  18268. this.registerInterceptors();
  18269. }
  18270. }
  18271. /**
  18272. * Get a channel instance by name.
  18273. */
  18274. createClass(Echo, [{
  18275. key: 'channel',
  18276. value: function channel(_channel) {
  18277. return this.connector.channel(_channel);
  18278. }
  18279. /**
  18280. * Create a new connection.
  18281. */
  18282. }, {
  18283. key: 'connect',
  18284. value: function connect() {
  18285. if (this.options.broadcaster == 'pusher') {
  18286. this.connector = new PusherConnector(this.options);
  18287. } else if (this.options.broadcaster == 'socket.io') {
  18288. this.connector = new SocketIoConnector(this.options);
  18289. } else if (this.options.broadcaster == 'null') {
  18290. this.connector = new NullConnector(this.options);
  18291. } else if (typeof this.options.broadcaster == 'function') {
  18292. this.connector = new this.options.broadcaster(this.options);
  18293. }
  18294. }
  18295. /**
  18296. * Disconnect from the Echo server.
  18297. */
  18298. }, {
  18299. key: 'disconnect',
  18300. value: function disconnect() {
  18301. this.connector.disconnect();
  18302. }
  18303. /**
  18304. * Get a presence channel instance by name.
  18305. */
  18306. }, {
  18307. key: 'join',
  18308. value: function join(channel) {
  18309. return this.connector.presenceChannel(channel);
  18310. }
  18311. /**
  18312. * Leave the given channel, as well as its private and presence variants.
  18313. */
  18314. }, {
  18315. key: 'leave',
  18316. value: function leave(channel) {
  18317. this.connector.leave(channel);
  18318. }
  18319. /**
  18320. * Leave the given channel.
  18321. */
  18322. }, {
  18323. key: 'leaveChannel',
  18324. value: function leaveChannel(channel) {
  18325. this.connector.leaveChannel(channel);
  18326. }
  18327. /**
  18328. * Listen for an event on a channel instance.
  18329. */
  18330. }, {
  18331. key: 'listen',
  18332. value: function listen(channel, event, callback) {
  18333. return this.connector.listen(channel, event, callback);
  18334. }
  18335. /**
  18336. * Get a private channel instance by name.
  18337. */
  18338. }, {
  18339. key: 'private',
  18340. value: function _private(channel) {
  18341. return this.connector.privateChannel(channel);
  18342. }
  18343. /**
  18344. * Get the Socket ID for the connection.
  18345. */
  18346. }, {
  18347. key: 'socketId',
  18348. value: function socketId() {
  18349. return this.connector.socketId();
  18350. }
  18351. /**
  18352. * Register 3rd party request interceptiors. These are used to automatically
  18353. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18354. */
  18355. }, {
  18356. key: 'registerInterceptors',
  18357. value: function registerInterceptors() {
  18358. if (typeof Vue === 'function' && Vue.http) {
  18359. this.registerVueRequestInterceptor();
  18360. }
  18361. if (typeof axios === 'function') {
  18362. this.registerAxiosRequestInterceptor();
  18363. }
  18364. if (typeof jQuery === 'function') {
  18365. this.registerjQueryAjaxSetup();
  18366. }
  18367. }
  18368. /**
  18369. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18370. */
  18371. }, {
  18372. key: 'registerVueRequestInterceptor',
  18373. value: function registerVueRequestInterceptor() {
  18374. var _this = this;
  18375. Vue.http.interceptors.push(function (request, next) {
  18376. if (_this.socketId()) {
  18377. request.headers.set('X-Socket-ID', _this.socketId());
  18378. }
  18379. next();
  18380. });
  18381. }
  18382. /**
  18383. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18384. */
  18385. }, {
  18386. key: 'registerAxiosRequestInterceptor',
  18387. value: function registerAxiosRequestInterceptor() {
  18388. var _this2 = this;
  18389. axios.interceptors.request.use(function (config) {
  18390. if (_this2.socketId()) {
  18391. config.headers['X-Socket-Id'] = _this2.socketId();
  18392. }
  18393. return config;
  18394. });
  18395. }
  18396. /**
  18397. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18398. */
  18399. }, {
  18400. key: 'registerjQueryAjaxSetup',
  18401. value: function registerjQueryAjaxSetup() {
  18402. var _this3 = this;
  18403. if (typeof jQuery.ajax != 'undefined') {
  18404. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18405. if (_this3.socketId()) {
  18406. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18407. }
  18408. });
  18409. }
  18410. }
  18411. }]);
  18412. return Echo;
  18413. }();
  18414. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18415. /***/ }),
  18416. /***/ "./node_modules/lodash/lodash.js":
  18417. /*!***************************************!*\
  18418. !*** ./node_modules/lodash/lodash.js ***!
  18419. \***************************************/
  18420. /*! no static exports found */
  18421. /***/ (function(module, exports, __webpack_require__) {
  18422. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18423. * @license
  18424. * Lodash <https://lodash.com/>
  18425. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18426. * Released under MIT license <https://lodash.com/license>
  18427. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18428. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18429. */
  18430. ;(function() {
  18431. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18432. var undefined;
  18433. /** Used as the semantic version number. */
  18434. var VERSION = '4.17.15';
  18435. /** Used as the size to enable large array optimizations. */
  18436. var LARGE_ARRAY_SIZE = 200;
  18437. /** Error message constants. */
  18438. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18439. FUNC_ERROR_TEXT = 'Expected a function';
  18440. /** Used to stand-in for `undefined` hash values. */
  18441. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18442. /** Used as the maximum memoize cache size. */
  18443. var MAX_MEMOIZE_SIZE = 500;
  18444. /** Used as the internal argument placeholder. */
  18445. var PLACEHOLDER = '__lodash_placeholder__';
  18446. /** Used to compose bitmasks for cloning. */
  18447. var CLONE_DEEP_FLAG = 1,
  18448. CLONE_FLAT_FLAG = 2,
  18449. CLONE_SYMBOLS_FLAG = 4;
  18450. /** Used to compose bitmasks for value comparisons. */
  18451. var COMPARE_PARTIAL_FLAG = 1,
  18452. COMPARE_UNORDERED_FLAG = 2;
  18453. /** Used to compose bitmasks for function metadata. */
  18454. var WRAP_BIND_FLAG = 1,
  18455. WRAP_BIND_KEY_FLAG = 2,
  18456. WRAP_CURRY_BOUND_FLAG = 4,
  18457. WRAP_CURRY_FLAG = 8,
  18458. WRAP_CURRY_RIGHT_FLAG = 16,
  18459. WRAP_PARTIAL_FLAG = 32,
  18460. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18461. WRAP_ARY_FLAG = 128,
  18462. WRAP_REARG_FLAG = 256,
  18463. WRAP_FLIP_FLAG = 512;
  18464. /** Used as default options for `_.truncate`. */
  18465. var DEFAULT_TRUNC_LENGTH = 30,
  18466. DEFAULT_TRUNC_OMISSION = '...';
  18467. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18468. var HOT_COUNT = 800,
  18469. HOT_SPAN = 16;
  18470. /** Used to indicate the type of lazy iteratees. */
  18471. var LAZY_FILTER_FLAG = 1,
  18472. LAZY_MAP_FLAG = 2,
  18473. LAZY_WHILE_FLAG = 3;
  18474. /** Used as references for various `Number` constants. */
  18475. var INFINITY = 1 / 0,
  18476. MAX_SAFE_INTEGER = 9007199254740991,
  18477. MAX_INTEGER = 1.7976931348623157e+308,
  18478. NAN = 0 / 0;
  18479. /** Used as references for the maximum length and index of an array. */
  18480. var MAX_ARRAY_LENGTH = 4294967295,
  18481. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18482. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18483. /** Used to associate wrap methods with their bit flags. */
  18484. var wrapFlags = [
  18485. ['ary', WRAP_ARY_FLAG],
  18486. ['bind', WRAP_BIND_FLAG],
  18487. ['bindKey', WRAP_BIND_KEY_FLAG],
  18488. ['curry', WRAP_CURRY_FLAG],
  18489. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18490. ['flip', WRAP_FLIP_FLAG],
  18491. ['partial', WRAP_PARTIAL_FLAG],
  18492. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18493. ['rearg', WRAP_REARG_FLAG]
  18494. ];
  18495. /** `Object#toString` result references. */
  18496. var argsTag = '[object Arguments]',
  18497. arrayTag = '[object Array]',
  18498. asyncTag = '[object AsyncFunction]',
  18499. boolTag = '[object Boolean]',
  18500. dateTag = '[object Date]',
  18501. domExcTag = '[object DOMException]',
  18502. errorTag = '[object Error]',
  18503. funcTag = '[object Function]',
  18504. genTag = '[object GeneratorFunction]',
  18505. mapTag = '[object Map]',
  18506. numberTag = '[object Number]',
  18507. nullTag = '[object Null]',
  18508. objectTag = '[object Object]',
  18509. promiseTag = '[object Promise]',
  18510. proxyTag = '[object Proxy]',
  18511. regexpTag = '[object RegExp]',
  18512. setTag = '[object Set]',
  18513. stringTag = '[object String]',
  18514. symbolTag = '[object Symbol]',
  18515. undefinedTag = '[object Undefined]',
  18516. weakMapTag = '[object WeakMap]',
  18517. weakSetTag = '[object WeakSet]';
  18518. var arrayBufferTag = '[object ArrayBuffer]',
  18519. dataViewTag = '[object DataView]',
  18520. float32Tag = '[object Float32Array]',
  18521. float64Tag = '[object Float64Array]',
  18522. int8Tag = '[object Int8Array]',
  18523. int16Tag = '[object Int16Array]',
  18524. int32Tag = '[object Int32Array]',
  18525. uint8Tag = '[object Uint8Array]',
  18526. uint8ClampedTag = '[object Uint8ClampedArray]',
  18527. uint16Tag = '[object Uint16Array]',
  18528. uint32Tag = '[object Uint32Array]';
  18529. /** Used to match empty string literals in compiled template source. */
  18530. var reEmptyStringLeading = /\b__p \+= '';/g,
  18531. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18532. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18533. /** Used to match HTML entities and HTML characters. */
  18534. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18535. reUnescapedHtml = /[&<>"']/g,
  18536. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18537. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18538. /** Used to match template delimiters. */
  18539. var reEscape = /<%-([\s\S]+?)%>/g,
  18540. reEvaluate = /<%([\s\S]+?)%>/g,
  18541. reInterpolate = /<%=([\s\S]+?)%>/g;
  18542. /** Used to match property names within property paths. */
  18543. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18544. reIsPlainProp = /^\w*$/,
  18545. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18546. /**
  18547. * Used to match `RegExp`
  18548. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18549. */
  18550. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18551. reHasRegExpChar = RegExp(reRegExpChar.source);
  18552. /** Used to match leading and trailing whitespace. */
  18553. var reTrim = /^\s+|\s+$/g,
  18554. reTrimStart = /^\s+/,
  18555. reTrimEnd = /\s+$/;
  18556. /** Used to match wrap detail comments. */
  18557. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18558. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18559. reSplitDetails = /,? & /;
  18560. /** Used to match words composed of alphanumeric characters. */
  18561. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18562. /** Used to match backslashes in property paths. */
  18563. var reEscapeChar = /\\(\\)?/g;
  18564. /**
  18565. * Used to match
  18566. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18567. */
  18568. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18569. /** Used to match `RegExp` flags from their coerced string values. */
  18570. var reFlags = /\w*$/;
  18571. /** Used to detect bad signed hexadecimal string values. */
  18572. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18573. /** Used to detect binary string values. */
  18574. var reIsBinary = /^0b[01]+$/i;
  18575. /** Used to detect host constructors (Safari). */
  18576. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18577. /** Used to detect octal string values. */
  18578. var reIsOctal = /^0o[0-7]+$/i;
  18579. /** Used to detect unsigned integer values. */
  18580. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18581. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18582. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18583. /** Used to ensure capturing order of template delimiters. */
  18584. var reNoMatch = /($^)/;
  18585. /** Used to match unescaped characters in compiled string literals. */
  18586. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18587. /** Used to compose unicode character classes. */
  18588. var rsAstralRange = '\\ud800-\\udfff',
  18589. rsComboMarksRange = '\\u0300-\\u036f',
  18590. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18591. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18592. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18593. rsDingbatRange = '\\u2700-\\u27bf',
  18594. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18595. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18596. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18597. rsPunctuationRange = '\\u2000-\\u206f',
  18598. 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',
  18599. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18600. rsVarRange = '\\ufe0e\\ufe0f',
  18601. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18602. /** Used to compose unicode capture groups. */
  18603. var rsApos = "['\u2019]",
  18604. rsAstral = '[' + rsAstralRange + ']',
  18605. rsBreak = '[' + rsBreakRange + ']',
  18606. rsCombo = '[' + rsComboRange + ']',
  18607. rsDigits = '\\d+',
  18608. rsDingbat = '[' + rsDingbatRange + ']',
  18609. rsLower = '[' + rsLowerRange + ']',
  18610. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18611. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18612. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18613. rsNonAstral = '[^' + rsAstralRange + ']',
  18614. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18615. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18616. rsUpper = '[' + rsUpperRange + ']',
  18617. rsZWJ = '\\u200d';
  18618. /** Used to compose unicode regexes. */
  18619. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18620. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18621. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18622. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18623. reOptMod = rsModifier + '?',
  18624. rsOptVar = '[' + rsVarRange + ']?',
  18625. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18626. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18627. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18628. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18629. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18630. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18631. /** Used to match apostrophes. */
  18632. var reApos = RegExp(rsApos, 'g');
  18633. /**
  18634. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18635. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18636. */
  18637. var reComboMark = RegExp(rsCombo, 'g');
  18638. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18639. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18640. /** Used to match complex or compound words. */
  18641. var reUnicodeWord = RegExp([
  18642. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18643. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18644. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18645. rsUpper + '+' + rsOptContrUpper,
  18646. rsOrdUpper,
  18647. rsOrdLower,
  18648. rsDigits,
  18649. rsEmoji
  18650. ].join('|'), 'g');
  18651. /** 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/). */
  18652. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18653. /** Used to detect strings that need a more robust regexp to match words. */
  18654. 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 ]/;
  18655. /** Used to assign default `context` object properties. */
  18656. var contextProps = [
  18657. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18658. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18659. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18660. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18661. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18662. ];
  18663. /** Used to make template sourceURLs easier to identify. */
  18664. var templateCounter = -1;
  18665. /** Used to identify `toStringTag` values of typed arrays. */
  18666. var typedArrayTags = {};
  18667. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18668. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18669. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18670. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18671. typedArrayTags[uint32Tag] = true;
  18672. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18673. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18674. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18675. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18676. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18677. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18678. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18679. typedArrayTags[weakMapTag] = false;
  18680. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18681. var cloneableTags = {};
  18682. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18683. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18684. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18685. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18686. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18687. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18688. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18689. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18690. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18691. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18692. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18693. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18694. cloneableTags[weakMapTag] = false;
  18695. /** Used to map Latin Unicode letters to basic Latin letters. */
  18696. var deburredLetters = {
  18697. // Latin-1 Supplement block.
  18698. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18699. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18700. '\xc7': 'C', '\xe7': 'c',
  18701. '\xd0': 'D', '\xf0': 'd',
  18702. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18703. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18704. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18705. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18706. '\xd1': 'N', '\xf1': 'n',
  18707. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18708. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18709. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18710. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18711. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18712. '\xc6': 'Ae', '\xe6': 'ae',
  18713. '\xde': 'Th', '\xfe': 'th',
  18714. '\xdf': 'ss',
  18715. // Latin Extended-A block.
  18716. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18717. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18718. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18719. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18720. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18721. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18722. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18723. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18724. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18725. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18726. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18727. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18728. '\u0134': 'J', '\u0135': 'j',
  18729. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18730. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18731. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18732. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18733. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18734. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18735. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18736. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18737. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18738. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18739. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18740. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18741. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18742. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18743. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18744. '\u0174': 'W', '\u0175': 'w',
  18745. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18746. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18747. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18748. '\u0132': 'IJ', '\u0133': 'ij',
  18749. '\u0152': 'Oe', '\u0153': 'oe',
  18750. '\u0149': "'n", '\u017f': 's'
  18751. };
  18752. /** Used to map characters to HTML entities. */
  18753. var htmlEscapes = {
  18754. '&': '&amp;',
  18755. '<': '&lt;',
  18756. '>': '&gt;',
  18757. '"': '&quot;',
  18758. "'": '&#39;'
  18759. };
  18760. /** Used to map HTML entities to characters. */
  18761. var htmlUnescapes = {
  18762. '&amp;': '&',
  18763. '&lt;': '<',
  18764. '&gt;': '>',
  18765. '&quot;': '"',
  18766. '&#39;': "'"
  18767. };
  18768. /** Used to escape characters for inclusion in compiled string literals. */
  18769. var stringEscapes = {
  18770. '\\': '\\',
  18771. "'": "'",
  18772. '\n': 'n',
  18773. '\r': 'r',
  18774. '\u2028': 'u2028',
  18775. '\u2029': 'u2029'
  18776. };
  18777. /** Built-in method references without a dependency on `root`. */
  18778. var freeParseFloat = parseFloat,
  18779. freeParseInt = parseInt;
  18780. /** Detect free variable `global` from Node.js. */
  18781. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18782. /** Detect free variable `self`. */
  18783. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18784. /** Used as a reference to the global object. */
  18785. var root = freeGlobal || freeSelf || Function('return this')();
  18786. /** Detect free variable `exports`. */
  18787. var freeExports = true && exports && !exports.nodeType && exports;
  18788. /** Detect free variable `module`. */
  18789. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18790. /** Detect the popular CommonJS extension `module.exports`. */
  18791. var moduleExports = freeModule && freeModule.exports === freeExports;
  18792. /** Detect free variable `process` from Node.js. */
  18793. var freeProcess = moduleExports && freeGlobal.process;
  18794. /** Used to access faster Node.js helpers. */
  18795. var nodeUtil = (function() {
  18796. try {
  18797. // Use `util.types` for Node.js 10+.
  18798. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18799. if (types) {
  18800. return types;
  18801. }
  18802. // Legacy `process.binding('util')` for Node.js < 10.
  18803. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18804. } catch (e) {}
  18805. }());
  18806. /* Node.js helper references. */
  18807. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18808. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18809. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18810. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18811. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18812. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18813. /*--------------------------------------------------------------------------*/
  18814. /**
  18815. * A faster alternative to `Function#apply`, this function invokes `func`
  18816. * with the `this` binding of `thisArg` and the arguments of `args`.
  18817. *
  18818. * @private
  18819. * @param {Function} func The function to invoke.
  18820. * @param {*} thisArg The `this` binding of `func`.
  18821. * @param {Array} args The arguments to invoke `func` with.
  18822. * @returns {*} Returns the result of `func`.
  18823. */
  18824. function apply(func, thisArg, args) {
  18825. switch (args.length) {
  18826. case 0: return func.call(thisArg);
  18827. case 1: return func.call(thisArg, args[0]);
  18828. case 2: return func.call(thisArg, args[0], args[1]);
  18829. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18830. }
  18831. return func.apply(thisArg, args);
  18832. }
  18833. /**
  18834. * A specialized version of `baseAggregator` for arrays.
  18835. *
  18836. * @private
  18837. * @param {Array} [array] The array to iterate over.
  18838. * @param {Function} setter The function to set `accumulator` values.
  18839. * @param {Function} iteratee The iteratee to transform keys.
  18840. * @param {Object} accumulator The initial aggregated object.
  18841. * @returns {Function} Returns `accumulator`.
  18842. */
  18843. function arrayAggregator(array, setter, iteratee, accumulator) {
  18844. var index = -1,
  18845. length = array == null ? 0 : array.length;
  18846. while (++index < length) {
  18847. var value = array[index];
  18848. setter(accumulator, value, iteratee(value), array);
  18849. }
  18850. return accumulator;
  18851. }
  18852. /**
  18853. * A specialized version of `_.forEach` for arrays without support for
  18854. * iteratee shorthands.
  18855. *
  18856. * @private
  18857. * @param {Array} [array] The array to iterate over.
  18858. * @param {Function} iteratee The function invoked per iteration.
  18859. * @returns {Array} Returns `array`.
  18860. */
  18861. function arrayEach(array, iteratee) {
  18862. var index = -1,
  18863. length = array == null ? 0 : array.length;
  18864. while (++index < length) {
  18865. if (iteratee(array[index], index, array) === false) {
  18866. break;
  18867. }
  18868. }
  18869. return array;
  18870. }
  18871. /**
  18872. * A specialized version of `_.forEachRight` for arrays without support for
  18873. * iteratee shorthands.
  18874. *
  18875. * @private
  18876. * @param {Array} [array] The array to iterate over.
  18877. * @param {Function} iteratee The function invoked per iteration.
  18878. * @returns {Array} Returns `array`.
  18879. */
  18880. function arrayEachRight(array, iteratee) {
  18881. var length = array == null ? 0 : array.length;
  18882. while (length--) {
  18883. if (iteratee(array[length], length, array) === false) {
  18884. break;
  18885. }
  18886. }
  18887. return array;
  18888. }
  18889. /**
  18890. * A specialized version of `_.every` for arrays without support for
  18891. * iteratee shorthands.
  18892. *
  18893. * @private
  18894. * @param {Array} [array] The array to iterate over.
  18895. * @param {Function} predicate The function invoked per iteration.
  18896. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18897. * else `false`.
  18898. */
  18899. function arrayEvery(array, predicate) {
  18900. var index = -1,
  18901. length = array == null ? 0 : array.length;
  18902. while (++index < length) {
  18903. if (!predicate(array[index], index, array)) {
  18904. return false;
  18905. }
  18906. }
  18907. return true;
  18908. }
  18909. /**
  18910. * A specialized version of `_.filter` for arrays without support for
  18911. * iteratee shorthands.
  18912. *
  18913. * @private
  18914. * @param {Array} [array] The array to iterate over.
  18915. * @param {Function} predicate The function invoked per iteration.
  18916. * @returns {Array} Returns the new filtered array.
  18917. */
  18918. function arrayFilter(array, predicate) {
  18919. var index = -1,
  18920. length = array == null ? 0 : array.length,
  18921. resIndex = 0,
  18922. result = [];
  18923. while (++index < length) {
  18924. var value = array[index];
  18925. if (predicate(value, index, array)) {
  18926. result[resIndex++] = value;
  18927. }
  18928. }
  18929. return result;
  18930. }
  18931. /**
  18932. * A specialized version of `_.includes` for arrays without support for
  18933. * specifying an index to search from.
  18934. *
  18935. * @private
  18936. * @param {Array} [array] The array to inspect.
  18937. * @param {*} target The value to search for.
  18938. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18939. */
  18940. function arrayIncludes(array, value) {
  18941. var length = array == null ? 0 : array.length;
  18942. return !!length && baseIndexOf(array, value, 0) > -1;
  18943. }
  18944. /**
  18945. * This function is like `arrayIncludes` except that it accepts a comparator.
  18946. *
  18947. * @private
  18948. * @param {Array} [array] The array to inspect.
  18949. * @param {*} target The value to search for.
  18950. * @param {Function} comparator The comparator invoked per element.
  18951. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18952. */
  18953. function arrayIncludesWith(array, value, comparator) {
  18954. var index = -1,
  18955. length = array == null ? 0 : array.length;
  18956. while (++index < length) {
  18957. if (comparator(value, array[index])) {
  18958. return true;
  18959. }
  18960. }
  18961. return false;
  18962. }
  18963. /**
  18964. * A specialized version of `_.map` for arrays without support for iteratee
  18965. * shorthands.
  18966. *
  18967. * @private
  18968. * @param {Array} [array] The array to iterate over.
  18969. * @param {Function} iteratee The function invoked per iteration.
  18970. * @returns {Array} Returns the new mapped array.
  18971. */
  18972. function arrayMap(array, iteratee) {
  18973. var index = -1,
  18974. length = array == null ? 0 : array.length,
  18975. result = Array(length);
  18976. while (++index < length) {
  18977. result[index] = iteratee(array[index], index, array);
  18978. }
  18979. return result;
  18980. }
  18981. /**
  18982. * Appends the elements of `values` to `array`.
  18983. *
  18984. * @private
  18985. * @param {Array} array The array to modify.
  18986. * @param {Array} values The values to append.
  18987. * @returns {Array} Returns `array`.
  18988. */
  18989. function arrayPush(array, values) {
  18990. var index = -1,
  18991. length = values.length,
  18992. offset = array.length;
  18993. while (++index < length) {
  18994. array[offset + index] = values[index];
  18995. }
  18996. return array;
  18997. }
  18998. /**
  18999. * A specialized version of `_.reduce` for arrays without support for
  19000. * iteratee shorthands.
  19001. *
  19002. * @private
  19003. * @param {Array} [array] The array to iterate over.
  19004. * @param {Function} iteratee The function invoked per iteration.
  19005. * @param {*} [accumulator] The initial value.
  19006. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19007. * the initial value.
  19008. * @returns {*} Returns the accumulated value.
  19009. */
  19010. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19011. var index = -1,
  19012. length = array == null ? 0 : array.length;
  19013. if (initAccum && length) {
  19014. accumulator = array[++index];
  19015. }
  19016. while (++index < length) {
  19017. accumulator = iteratee(accumulator, array[index], index, array);
  19018. }
  19019. return accumulator;
  19020. }
  19021. /**
  19022. * A specialized version of `_.reduceRight` for arrays without support for
  19023. * iteratee shorthands.
  19024. *
  19025. * @private
  19026. * @param {Array} [array] The array to iterate over.
  19027. * @param {Function} iteratee The function invoked per iteration.
  19028. * @param {*} [accumulator] The initial value.
  19029. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19030. * the initial value.
  19031. * @returns {*} Returns the accumulated value.
  19032. */
  19033. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19034. var length = array == null ? 0 : array.length;
  19035. if (initAccum && length) {
  19036. accumulator = array[--length];
  19037. }
  19038. while (length--) {
  19039. accumulator = iteratee(accumulator, array[length], length, array);
  19040. }
  19041. return accumulator;
  19042. }
  19043. /**
  19044. * A specialized version of `_.some` for arrays without support for iteratee
  19045. * shorthands.
  19046. *
  19047. * @private
  19048. * @param {Array} [array] The array to iterate over.
  19049. * @param {Function} predicate The function invoked per iteration.
  19050. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19051. * else `false`.
  19052. */
  19053. function arraySome(array, predicate) {
  19054. var index = -1,
  19055. length = array == null ? 0 : array.length;
  19056. while (++index < length) {
  19057. if (predicate(array[index], index, array)) {
  19058. return true;
  19059. }
  19060. }
  19061. return false;
  19062. }
  19063. /**
  19064. * Gets the size of an ASCII `string`.
  19065. *
  19066. * @private
  19067. * @param {string} string The string inspect.
  19068. * @returns {number} Returns the string size.
  19069. */
  19070. var asciiSize = baseProperty('length');
  19071. /**
  19072. * Converts an ASCII `string` to an array.
  19073. *
  19074. * @private
  19075. * @param {string} string The string to convert.
  19076. * @returns {Array} Returns the converted array.
  19077. */
  19078. function asciiToArray(string) {
  19079. return string.split('');
  19080. }
  19081. /**
  19082. * Splits an ASCII `string` into an array of its words.
  19083. *
  19084. * @private
  19085. * @param {string} The string to inspect.
  19086. * @returns {Array} Returns the words of `string`.
  19087. */
  19088. function asciiWords(string) {
  19089. return string.match(reAsciiWord) || [];
  19090. }
  19091. /**
  19092. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19093. * without support for iteratee shorthands, which iterates over `collection`
  19094. * using `eachFunc`.
  19095. *
  19096. * @private
  19097. * @param {Array|Object} collection The collection to inspect.
  19098. * @param {Function} predicate The function invoked per iteration.
  19099. * @param {Function} eachFunc The function to iterate over `collection`.
  19100. * @returns {*} Returns the found element or its key, else `undefined`.
  19101. */
  19102. function baseFindKey(collection, predicate, eachFunc) {
  19103. var result;
  19104. eachFunc(collection, function(value, key, collection) {
  19105. if (predicate(value, key, collection)) {
  19106. result = key;
  19107. return false;
  19108. }
  19109. });
  19110. return result;
  19111. }
  19112. /**
  19113. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19114. * support for iteratee shorthands.
  19115. *
  19116. * @private
  19117. * @param {Array} array The array to inspect.
  19118. * @param {Function} predicate The function invoked per iteration.
  19119. * @param {number} fromIndex The index to search from.
  19120. * @param {boolean} [fromRight] Specify iterating from right to left.
  19121. * @returns {number} Returns the index of the matched value, else `-1`.
  19122. */
  19123. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19124. var length = array.length,
  19125. index = fromIndex + (fromRight ? 1 : -1);
  19126. while ((fromRight ? index-- : ++index < length)) {
  19127. if (predicate(array[index], index, array)) {
  19128. return index;
  19129. }
  19130. }
  19131. return -1;
  19132. }
  19133. /**
  19134. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19135. *
  19136. * @private
  19137. * @param {Array} array The array to inspect.
  19138. * @param {*} value The value to search for.
  19139. * @param {number} fromIndex The index to search from.
  19140. * @returns {number} Returns the index of the matched value, else `-1`.
  19141. */
  19142. function baseIndexOf(array, value, fromIndex) {
  19143. return value === value
  19144. ? strictIndexOf(array, value, fromIndex)
  19145. : baseFindIndex(array, baseIsNaN, fromIndex);
  19146. }
  19147. /**
  19148. * This function is like `baseIndexOf` except that it accepts a comparator.
  19149. *
  19150. * @private
  19151. * @param {Array} array The array to inspect.
  19152. * @param {*} value The value to search for.
  19153. * @param {number} fromIndex The index to search from.
  19154. * @param {Function} comparator The comparator invoked per element.
  19155. * @returns {number} Returns the index of the matched value, else `-1`.
  19156. */
  19157. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19158. var index = fromIndex - 1,
  19159. length = array.length;
  19160. while (++index < length) {
  19161. if (comparator(array[index], value)) {
  19162. return index;
  19163. }
  19164. }
  19165. return -1;
  19166. }
  19167. /**
  19168. * The base implementation of `_.isNaN` without support for number objects.
  19169. *
  19170. * @private
  19171. * @param {*} value The value to check.
  19172. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19173. */
  19174. function baseIsNaN(value) {
  19175. return value !== value;
  19176. }
  19177. /**
  19178. * The base implementation of `_.mean` and `_.meanBy` without support for
  19179. * iteratee shorthands.
  19180. *
  19181. * @private
  19182. * @param {Array} array The array to iterate over.
  19183. * @param {Function} iteratee The function invoked per iteration.
  19184. * @returns {number} Returns the mean.
  19185. */
  19186. function baseMean(array, iteratee) {
  19187. var length = array == null ? 0 : array.length;
  19188. return length ? (baseSum(array, iteratee) / length) : NAN;
  19189. }
  19190. /**
  19191. * The base implementation of `_.property` without support for deep paths.
  19192. *
  19193. * @private
  19194. * @param {string} key The key of the property to get.
  19195. * @returns {Function} Returns the new accessor function.
  19196. */
  19197. function baseProperty(key) {
  19198. return function(object) {
  19199. return object == null ? undefined : object[key];
  19200. };
  19201. }
  19202. /**
  19203. * The base implementation of `_.propertyOf` without support for deep paths.
  19204. *
  19205. * @private
  19206. * @param {Object} object The object to query.
  19207. * @returns {Function} Returns the new accessor function.
  19208. */
  19209. function basePropertyOf(object) {
  19210. return function(key) {
  19211. return object == null ? undefined : object[key];
  19212. };
  19213. }
  19214. /**
  19215. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19216. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19217. *
  19218. * @private
  19219. * @param {Array|Object} collection The collection to iterate over.
  19220. * @param {Function} iteratee The function invoked per iteration.
  19221. * @param {*} accumulator The initial value.
  19222. * @param {boolean} initAccum Specify using the first or last element of
  19223. * `collection` as the initial value.
  19224. * @param {Function} eachFunc The function to iterate over `collection`.
  19225. * @returns {*} Returns the accumulated value.
  19226. */
  19227. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19228. eachFunc(collection, function(value, index, collection) {
  19229. accumulator = initAccum
  19230. ? (initAccum = false, value)
  19231. : iteratee(accumulator, value, index, collection);
  19232. });
  19233. return accumulator;
  19234. }
  19235. /**
  19236. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19237. * sort order of `array` and replaces criteria objects with their corresponding
  19238. * values.
  19239. *
  19240. * @private
  19241. * @param {Array} array The array to sort.
  19242. * @param {Function} comparer The function to define sort order.
  19243. * @returns {Array} Returns `array`.
  19244. */
  19245. function baseSortBy(array, comparer) {
  19246. var length = array.length;
  19247. array.sort(comparer);
  19248. while (length--) {
  19249. array[length] = array[length].value;
  19250. }
  19251. return array;
  19252. }
  19253. /**
  19254. * The base implementation of `_.sum` and `_.sumBy` without support for
  19255. * iteratee shorthands.
  19256. *
  19257. * @private
  19258. * @param {Array} array The array to iterate over.
  19259. * @param {Function} iteratee The function invoked per iteration.
  19260. * @returns {number} Returns the sum.
  19261. */
  19262. function baseSum(array, iteratee) {
  19263. var result,
  19264. index = -1,
  19265. length = array.length;
  19266. while (++index < length) {
  19267. var current = iteratee(array[index]);
  19268. if (current !== undefined) {
  19269. result = result === undefined ? current : (result + current);
  19270. }
  19271. }
  19272. return result;
  19273. }
  19274. /**
  19275. * The base implementation of `_.times` without support for iteratee shorthands
  19276. * or max array length checks.
  19277. *
  19278. * @private
  19279. * @param {number} n The number of times to invoke `iteratee`.
  19280. * @param {Function} iteratee The function invoked per iteration.
  19281. * @returns {Array} Returns the array of results.
  19282. */
  19283. function baseTimes(n, iteratee) {
  19284. var index = -1,
  19285. result = Array(n);
  19286. while (++index < n) {
  19287. result[index] = iteratee(index);
  19288. }
  19289. return result;
  19290. }
  19291. /**
  19292. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19293. * of key-value pairs for `object` corresponding to the property names of `props`.
  19294. *
  19295. * @private
  19296. * @param {Object} object The object to query.
  19297. * @param {Array} props The property names to get values for.
  19298. * @returns {Object} Returns the key-value pairs.
  19299. */
  19300. function baseToPairs(object, props) {
  19301. return arrayMap(props, function(key) {
  19302. return [key, object[key]];
  19303. });
  19304. }
  19305. /**
  19306. * The base implementation of `_.unary` without support for storing metadata.
  19307. *
  19308. * @private
  19309. * @param {Function} func The function to cap arguments for.
  19310. * @returns {Function} Returns the new capped function.
  19311. */
  19312. function baseUnary(func) {
  19313. return function(value) {
  19314. return func(value);
  19315. };
  19316. }
  19317. /**
  19318. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19319. * array of `object` property values corresponding to the property names
  19320. * of `props`.
  19321. *
  19322. * @private
  19323. * @param {Object} object The object to query.
  19324. * @param {Array} props The property names to get values for.
  19325. * @returns {Object} Returns the array of property values.
  19326. */
  19327. function baseValues(object, props) {
  19328. return arrayMap(props, function(key) {
  19329. return object[key];
  19330. });
  19331. }
  19332. /**
  19333. * Checks if a `cache` value for `key` exists.
  19334. *
  19335. * @private
  19336. * @param {Object} cache The cache to query.
  19337. * @param {string} key The key of the entry to check.
  19338. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19339. */
  19340. function cacheHas(cache, key) {
  19341. return cache.has(key);
  19342. }
  19343. /**
  19344. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19345. * that is not found in the character symbols.
  19346. *
  19347. * @private
  19348. * @param {Array} strSymbols The string symbols to inspect.
  19349. * @param {Array} chrSymbols The character symbols to find.
  19350. * @returns {number} Returns the index of the first unmatched string symbol.
  19351. */
  19352. function charsStartIndex(strSymbols, chrSymbols) {
  19353. var index = -1,
  19354. length = strSymbols.length;
  19355. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19356. return index;
  19357. }
  19358. /**
  19359. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19360. * that is not found in the character symbols.
  19361. *
  19362. * @private
  19363. * @param {Array} strSymbols The string symbols to inspect.
  19364. * @param {Array} chrSymbols The character symbols to find.
  19365. * @returns {number} Returns the index of the last unmatched string symbol.
  19366. */
  19367. function charsEndIndex(strSymbols, chrSymbols) {
  19368. var index = strSymbols.length;
  19369. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19370. return index;
  19371. }
  19372. /**
  19373. * Gets the number of `placeholder` occurrences in `array`.
  19374. *
  19375. * @private
  19376. * @param {Array} array The array to inspect.
  19377. * @param {*} placeholder The placeholder to search for.
  19378. * @returns {number} Returns the placeholder count.
  19379. */
  19380. function countHolders(array, placeholder) {
  19381. var length = array.length,
  19382. result = 0;
  19383. while (length--) {
  19384. if (array[length] === placeholder) {
  19385. ++result;
  19386. }
  19387. }
  19388. return result;
  19389. }
  19390. /**
  19391. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19392. * letters to basic Latin letters.
  19393. *
  19394. * @private
  19395. * @param {string} letter The matched letter to deburr.
  19396. * @returns {string} Returns the deburred letter.
  19397. */
  19398. var deburrLetter = basePropertyOf(deburredLetters);
  19399. /**
  19400. * Used by `_.escape` to convert characters to HTML entities.
  19401. *
  19402. * @private
  19403. * @param {string} chr The matched character to escape.
  19404. * @returns {string} Returns the escaped character.
  19405. */
  19406. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19407. /**
  19408. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19409. *
  19410. * @private
  19411. * @param {string} chr The matched character to escape.
  19412. * @returns {string} Returns the escaped character.
  19413. */
  19414. function escapeStringChar(chr) {
  19415. return '\\' + stringEscapes[chr];
  19416. }
  19417. /**
  19418. * Gets the value at `key` of `object`.
  19419. *
  19420. * @private
  19421. * @param {Object} [object] The object to query.
  19422. * @param {string} key The key of the property to get.
  19423. * @returns {*} Returns the property value.
  19424. */
  19425. function getValue(object, key) {
  19426. return object == null ? undefined : object[key];
  19427. }
  19428. /**
  19429. * Checks if `string` contains Unicode symbols.
  19430. *
  19431. * @private
  19432. * @param {string} string The string to inspect.
  19433. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19434. */
  19435. function hasUnicode(string) {
  19436. return reHasUnicode.test(string);
  19437. }
  19438. /**
  19439. * Checks if `string` contains a word composed of Unicode symbols.
  19440. *
  19441. * @private
  19442. * @param {string} string The string to inspect.
  19443. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19444. */
  19445. function hasUnicodeWord(string) {
  19446. return reHasUnicodeWord.test(string);
  19447. }
  19448. /**
  19449. * Converts `iterator` to an array.
  19450. *
  19451. * @private
  19452. * @param {Object} iterator The iterator to convert.
  19453. * @returns {Array} Returns the converted array.
  19454. */
  19455. function iteratorToArray(iterator) {
  19456. var data,
  19457. result = [];
  19458. while (!(data = iterator.next()).done) {
  19459. result.push(data.value);
  19460. }
  19461. return result;
  19462. }
  19463. /**
  19464. * Converts `map` to its key-value pairs.
  19465. *
  19466. * @private
  19467. * @param {Object} map The map to convert.
  19468. * @returns {Array} Returns the key-value pairs.
  19469. */
  19470. function mapToArray(map) {
  19471. var index = -1,
  19472. result = Array(map.size);
  19473. map.forEach(function(value, key) {
  19474. result[++index] = [key, value];
  19475. });
  19476. return result;
  19477. }
  19478. /**
  19479. * Creates a unary function that invokes `func` with its argument transformed.
  19480. *
  19481. * @private
  19482. * @param {Function} func The function to wrap.
  19483. * @param {Function} transform The argument transform.
  19484. * @returns {Function} Returns the new function.
  19485. */
  19486. function overArg(func, transform) {
  19487. return function(arg) {
  19488. return func(transform(arg));
  19489. };
  19490. }
  19491. /**
  19492. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19493. * and returns an array of their indexes.
  19494. *
  19495. * @private
  19496. * @param {Array} array The array to modify.
  19497. * @param {*} placeholder The placeholder to replace.
  19498. * @returns {Array} Returns the new array of placeholder indexes.
  19499. */
  19500. function replaceHolders(array, placeholder) {
  19501. var index = -1,
  19502. length = array.length,
  19503. resIndex = 0,
  19504. result = [];
  19505. while (++index < length) {
  19506. var value = array[index];
  19507. if (value === placeholder || value === PLACEHOLDER) {
  19508. array[index] = PLACEHOLDER;
  19509. result[resIndex++] = index;
  19510. }
  19511. }
  19512. return result;
  19513. }
  19514. /**
  19515. * Converts `set` to an array of its values.
  19516. *
  19517. * @private
  19518. * @param {Object} set The set to convert.
  19519. * @returns {Array} Returns the values.
  19520. */
  19521. function setToArray(set) {
  19522. var index = -1,
  19523. result = Array(set.size);
  19524. set.forEach(function(value) {
  19525. result[++index] = value;
  19526. });
  19527. return result;
  19528. }
  19529. /**
  19530. * Converts `set` to its value-value pairs.
  19531. *
  19532. * @private
  19533. * @param {Object} set The set to convert.
  19534. * @returns {Array} Returns the value-value pairs.
  19535. */
  19536. function setToPairs(set) {
  19537. var index = -1,
  19538. result = Array(set.size);
  19539. set.forEach(function(value) {
  19540. result[++index] = [value, value];
  19541. });
  19542. return result;
  19543. }
  19544. /**
  19545. * A specialized version of `_.indexOf` which performs strict equality
  19546. * comparisons of values, i.e. `===`.
  19547. *
  19548. * @private
  19549. * @param {Array} array The array to inspect.
  19550. * @param {*} value The value to search for.
  19551. * @param {number} fromIndex The index to search from.
  19552. * @returns {number} Returns the index of the matched value, else `-1`.
  19553. */
  19554. function strictIndexOf(array, value, fromIndex) {
  19555. var index = fromIndex - 1,
  19556. length = array.length;
  19557. while (++index < length) {
  19558. if (array[index] === value) {
  19559. return index;
  19560. }
  19561. }
  19562. return -1;
  19563. }
  19564. /**
  19565. * A specialized version of `_.lastIndexOf` which performs strict equality
  19566. * comparisons of values, i.e. `===`.
  19567. *
  19568. * @private
  19569. * @param {Array} array The array to inspect.
  19570. * @param {*} value The value to search for.
  19571. * @param {number} fromIndex The index to search from.
  19572. * @returns {number} Returns the index of the matched value, else `-1`.
  19573. */
  19574. function strictLastIndexOf(array, value, fromIndex) {
  19575. var index = fromIndex + 1;
  19576. while (index--) {
  19577. if (array[index] === value) {
  19578. return index;
  19579. }
  19580. }
  19581. return index;
  19582. }
  19583. /**
  19584. * Gets the number of symbols in `string`.
  19585. *
  19586. * @private
  19587. * @param {string} string The string to inspect.
  19588. * @returns {number} Returns the string size.
  19589. */
  19590. function stringSize(string) {
  19591. return hasUnicode(string)
  19592. ? unicodeSize(string)
  19593. : asciiSize(string);
  19594. }
  19595. /**
  19596. * Converts `string` to an array.
  19597. *
  19598. * @private
  19599. * @param {string} string The string to convert.
  19600. * @returns {Array} Returns the converted array.
  19601. */
  19602. function stringToArray(string) {
  19603. return hasUnicode(string)
  19604. ? unicodeToArray(string)
  19605. : asciiToArray(string);
  19606. }
  19607. /**
  19608. * Used by `_.unescape` to convert HTML entities to characters.
  19609. *
  19610. * @private
  19611. * @param {string} chr The matched character to unescape.
  19612. * @returns {string} Returns the unescaped character.
  19613. */
  19614. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19615. /**
  19616. * Gets the size of a Unicode `string`.
  19617. *
  19618. * @private
  19619. * @param {string} string The string inspect.
  19620. * @returns {number} Returns the string size.
  19621. */
  19622. function unicodeSize(string) {
  19623. var result = reUnicode.lastIndex = 0;
  19624. while (reUnicode.test(string)) {
  19625. ++result;
  19626. }
  19627. return result;
  19628. }
  19629. /**
  19630. * Converts a Unicode `string` to an array.
  19631. *
  19632. * @private
  19633. * @param {string} string The string to convert.
  19634. * @returns {Array} Returns the converted array.
  19635. */
  19636. function unicodeToArray(string) {
  19637. return string.match(reUnicode) || [];
  19638. }
  19639. /**
  19640. * Splits a Unicode `string` into an array of its words.
  19641. *
  19642. * @private
  19643. * @param {string} The string to inspect.
  19644. * @returns {Array} Returns the words of `string`.
  19645. */
  19646. function unicodeWords(string) {
  19647. return string.match(reUnicodeWord) || [];
  19648. }
  19649. /*--------------------------------------------------------------------------*/
  19650. /**
  19651. * Create a new pristine `lodash` function using the `context` object.
  19652. *
  19653. * @static
  19654. * @memberOf _
  19655. * @since 1.1.0
  19656. * @category Util
  19657. * @param {Object} [context=root] The context object.
  19658. * @returns {Function} Returns a new `lodash` function.
  19659. * @example
  19660. *
  19661. * _.mixin({ 'foo': _.constant('foo') });
  19662. *
  19663. * var lodash = _.runInContext();
  19664. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19665. *
  19666. * _.isFunction(_.foo);
  19667. * // => true
  19668. * _.isFunction(_.bar);
  19669. * // => false
  19670. *
  19671. * lodash.isFunction(lodash.foo);
  19672. * // => false
  19673. * lodash.isFunction(lodash.bar);
  19674. * // => true
  19675. *
  19676. * // Create a suped-up `defer` in Node.js.
  19677. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19678. */
  19679. var runInContext = (function runInContext(context) {
  19680. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19681. /** Built-in constructor references. */
  19682. var Array = context.Array,
  19683. Date = context.Date,
  19684. Error = context.Error,
  19685. Function = context.Function,
  19686. Math = context.Math,
  19687. Object = context.Object,
  19688. RegExp = context.RegExp,
  19689. String = context.String,
  19690. TypeError = context.TypeError;
  19691. /** Used for built-in method references. */
  19692. var arrayProto = Array.prototype,
  19693. funcProto = Function.prototype,
  19694. objectProto = Object.prototype;
  19695. /** Used to detect overreaching core-js shims. */
  19696. var coreJsData = context['__core-js_shared__'];
  19697. /** Used to resolve the decompiled source of functions. */
  19698. var funcToString = funcProto.toString;
  19699. /** Used to check objects for own properties. */
  19700. var hasOwnProperty = objectProto.hasOwnProperty;
  19701. /** Used to generate unique IDs. */
  19702. var idCounter = 0;
  19703. /** Used to detect methods masquerading as native. */
  19704. var maskSrcKey = (function() {
  19705. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19706. return uid ? ('Symbol(src)_1.' + uid) : '';
  19707. }());
  19708. /**
  19709. * Used to resolve the
  19710. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19711. * of values.
  19712. */
  19713. var nativeObjectToString = objectProto.toString;
  19714. /** Used to infer the `Object` constructor. */
  19715. var objectCtorString = funcToString.call(Object);
  19716. /** Used to restore the original `_` reference in `_.noConflict`. */
  19717. var oldDash = root._;
  19718. /** Used to detect if a method is native. */
  19719. var reIsNative = RegExp('^' +
  19720. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19721. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19722. );
  19723. /** Built-in value references. */
  19724. var Buffer = moduleExports ? context.Buffer : undefined,
  19725. Symbol = context.Symbol,
  19726. Uint8Array = context.Uint8Array,
  19727. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19728. getPrototype = overArg(Object.getPrototypeOf, Object),
  19729. objectCreate = Object.create,
  19730. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19731. splice = arrayProto.splice,
  19732. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19733. symIterator = Symbol ? Symbol.iterator : undefined,
  19734. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19735. var defineProperty = (function() {
  19736. try {
  19737. var func = getNative(Object, 'defineProperty');
  19738. func({}, '', {});
  19739. return func;
  19740. } catch (e) {}
  19741. }());
  19742. /** Mocked built-ins. */
  19743. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19744. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19745. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19746. /* Built-in method references for those with the same name as other `lodash` methods. */
  19747. var nativeCeil = Math.ceil,
  19748. nativeFloor = Math.floor,
  19749. nativeGetSymbols = Object.getOwnPropertySymbols,
  19750. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19751. nativeIsFinite = context.isFinite,
  19752. nativeJoin = arrayProto.join,
  19753. nativeKeys = overArg(Object.keys, Object),
  19754. nativeMax = Math.max,
  19755. nativeMin = Math.min,
  19756. nativeNow = Date.now,
  19757. nativeParseInt = context.parseInt,
  19758. nativeRandom = Math.random,
  19759. nativeReverse = arrayProto.reverse;
  19760. /* Built-in method references that are verified to be native. */
  19761. var DataView = getNative(context, 'DataView'),
  19762. Map = getNative(context, 'Map'),
  19763. Promise = getNative(context, 'Promise'),
  19764. Set = getNative(context, 'Set'),
  19765. WeakMap = getNative(context, 'WeakMap'),
  19766. nativeCreate = getNative(Object, 'create');
  19767. /** Used to store function metadata. */
  19768. var metaMap = WeakMap && new WeakMap;
  19769. /** Used to lookup unminified function names. */
  19770. var realNames = {};
  19771. /** Used to detect maps, sets, and weakmaps. */
  19772. var dataViewCtorString = toSource(DataView),
  19773. mapCtorString = toSource(Map),
  19774. promiseCtorString = toSource(Promise),
  19775. setCtorString = toSource(Set),
  19776. weakMapCtorString = toSource(WeakMap);
  19777. /** Used to convert symbols to primitives and strings. */
  19778. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19779. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19780. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19781. /*------------------------------------------------------------------------*/
  19782. /**
  19783. * Creates a `lodash` object which wraps `value` to enable implicit method
  19784. * chain sequences. Methods that operate on and return arrays, collections,
  19785. * and functions can be chained together. Methods that retrieve a single value
  19786. * or may return a primitive value will automatically end the chain sequence
  19787. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19788. * with `_#value`.
  19789. *
  19790. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19791. * enabled using `_.chain`.
  19792. *
  19793. * The execution of chained methods is lazy, that is, it's deferred until
  19794. * `_#value` is implicitly or explicitly called.
  19795. *
  19796. * Lazy evaluation allows several methods to support shortcut fusion.
  19797. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19798. * the creation of intermediate arrays and can greatly reduce the number of
  19799. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19800. * fusion if the section is applied to an array and iteratees accept only
  19801. * one argument. The heuristic for whether a section qualifies for shortcut
  19802. * fusion is subject to change.
  19803. *
  19804. * Chaining is supported in custom builds as long as the `_#value` method is
  19805. * directly or indirectly included in the build.
  19806. *
  19807. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19808. *
  19809. * The wrapper `Array` methods are:
  19810. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19811. *
  19812. * The wrapper `String` methods are:
  19813. * `replace` and `split`
  19814. *
  19815. * The wrapper methods that support shortcut fusion are:
  19816. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19817. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19818. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19819. *
  19820. * The chainable wrapper methods are:
  19821. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19822. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19823. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19824. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19825. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19826. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19827. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19828. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19829. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19830. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19831. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19832. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19833. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19834. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19835. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19836. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19837. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19838. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19839. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19840. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19841. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19842. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19843. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19844. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19845. *
  19846. * The wrapper methods that are **not** chainable by default are:
  19847. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19848. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19849. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19850. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19851. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19852. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19853. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19854. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19855. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19856. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19857. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19858. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19859. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19860. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19861. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19862. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19863. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19864. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19865. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19866. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19867. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19868. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19869. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19870. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19871. * `upperFirst`, `value`, and `words`
  19872. *
  19873. * @name _
  19874. * @constructor
  19875. * @category Seq
  19876. * @param {*} value The value to wrap in a `lodash` instance.
  19877. * @returns {Object} Returns the new `lodash` wrapper instance.
  19878. * @example
  19879. *
  19880. * function square(n) {
  19881. * return n * n;
  19882. * }
  19883. *
  19884. * var wrapped = _([1, 2, 3]);
  19885. *
  19886. * // Returns an unwrapped value.
  19887. * wrapped.reduce(_.add);
  19888. * // => 6
  19889. *
  19890. * // Returns a wrapped value.
  19891. * var squares = wrapped.map(square);
  19892. *
  19893. * _.isArray(squares);
  19894. * // => false
  19895. *
  19896. * _.isArray(squares.value());
  19897. * // => true
  19898. */
  19899. function lodash(value) {
  19900. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19901. if (value instanceof LodashWrapper) {
  19902. return value;
  19903. }
  19904. if (hasOwnProperty.call(value, '__wrapped__')) {
  19905. return wrapperClone(value);
  19906. }
  19907. }
  19908. return new LodashWrapper(value);
  19909. }
  19910. /**
  19911. * The base implementation of `_.create` without support for assigning
  19912. * properties to the created object.
  19913. *
  19914. * @private
  19915. * @param {Object} proto The object to inherit from.
  19916. * @returns {Object} Returns the new object.
  19917. */
  19918. var baseCreate = (function() {
  19919. function object() {}
  19920. return function(proto) {
  19921. if (!isObject(proto)) {
  19922. return {};
  19923. }
  19924. if (objectCreate) {
  19925. return objectCreate(proto);
  19926. }
  19927. object.prototype = proto;
  19928. var result = new object;
  19929. object.prototype = undefined;
  19930. return result;
  19931. };
  19932. }());
  19933. /**
  19934. * The function whose prototype chain sequence wrappers inherit from.
  19935. *
  19936. * @private
  19937. */
  19938. function baseLodash() {
  19939. // No operation performed.
  19940. }
  19941. /**
  19942. * The base constructor for creating `lodash` wrapper objects.
  19943. *
  19944. * @private
  19945. * @param {*} value The value to wrap.
  19946. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19947. */
  19948. function LodashWrapper(value, chainAll) {
  19949. this.__wrapped__ = value;
  19950. this.__actions__ = [];
  19951. this.__chain__ = !!chainAll;
  19952. this.__index__ = 0;
  19953. this.__values__ = undefined;
  19954. }
  19955. /**
  19956. * By default, the template delimiters used by lodash are like those in
  19957. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19958. * following template settings to use alternative delimiters.
  19959. *
  19960. * @static
  19961. * @memberOf _
  19962. * @type {Object}
  19963. */
  19964. lodash.templateSettings = {
  19965. /**
  19966. * Used to detect `data` property values to be HTML-escaped.
  19967. *
  19968. * @memberOf _.templateSettings
  19969. * @type {RegExp}
  19970. */
  19971. 'escape': reEscape,
  19972. /**
  19973. * Used to detect code to be evaluated.
  19974. *
  19975. * @memberOf _.templateSettings
  19976. * @type {RegExp}
  19977. */
  19978. 'evaluate': reEvaluate,
  19979. /**
  19980. * Used to detect `data` property values to inject.
  19981. *
  19982. * @memberOf _.templateSettings
  19983. * @type {RegExp}
  19984. */
  19985. 'interpolate': reInterpolate,
  19986. /**
  19987. * Used to reference the data object in the template text.
  19988. *
  19989. * @memberOf _.templateSettings
  19990. * @type {string}
  19991. */
  19992. 'variable': '',
  19993. /**
  19994. * Used to import variables into the compiled template.
  19995. *
  19996. * @memberOf _.templateSettings
  19997. * @type {Object}
  19998. */
  19999. 'imports': {
  20000. /**
  20001. * A reference to the `lodash` function.
  20002. *
  20003. * @memberOf _.templateSettings.imports
  20004. * @type {Function}
  20005. */
  20006. '_': lodash
  20007. }
  20008. };
  20009. // Ensure wrappers are instances of `baseLodash`.
  20010. lodash.prototype = baseLodash.prototype;
  20011. lodash.prototype.constructor = lodash;
  20012. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20013. LodashWrapper.prototype.constructor = LodashWrapper;
  20014. /*------------------------------------------------------------------------*/
  20015. /**
  20016. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20017. *
  20018. * @private
  20019. * @constructor
  20020. * @param {*} value The value to wrap.
  20021. */
  20022. function LazyWrapper(value) {
  20023. this.__wrapped__ = value;
  20024. this.__actions__ = [];
  20025. this.__dir__ = 1;
  20026. this.__filtered__ = false;
  20027. this.__iteratees__ = [];
  20028. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20029. this.__views__ = [];
  20030. }
  20031. /**
  20032. * Creates a clone of the lazy wrapper object.
  20033. *
  20034. * @private
  20035. * @name clone
  20036. * @memberOf LazyWrapper
  20037. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20038. */
  20039. function lazyClone() {
  20040. var result = new LazyWrapper(this.__wrapped__);
  20041. result.__actions__ = copyArray(this.__actions__);
  20042. result.__dir__ = this.__dir__;
  20043. result.__filtered__ = this.__filtered__;
  20044. result.__iteratees__ = copyArray(this.__iteratees__);
  20045. result.__takeCount__ = this.__takeCount__;
  20046. result.__views__ = copyArray(this.__views__);
  20047. return result;
  20048. }
  20049. /**
  20050. * Reverses the direction of lazy iteration.
  20051. *
  20052. * @private
  20053. * @name reverse
  20054. * @memberOf LazyWrapper
  20055. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20056. */
  20057. function lazyReverse() {
  20058. if (this.__filtered__) {
  20059. var result = new LazyWrapper(this);
  20060. result.__dir__ = -1;
  20061. result.__filtered__ = true;
  20062. } else {
  20063. result = this.clone();
  20064. result.__dir__ *= -1;
  20065. }
  20066. return result;
  20067. }
  20068. /**
  20069. * Extracts the unwrapped value from its lazy wrapper.
  20070. *
  20071. * @private
  20072. * @name value
  20073. * @memberOf LazyWrapper
  20074. * @returns {*} Returns the unwrapped value.
  20075. */
  20076. function lazyValue() {
  20077. var array = this.__wrapped__.value(),
  20078. dir = this.__dir__,
  20079. isArr = isArray(array),
  20080. isRight = dir < 0,
  20081. arrLength = isArr ? array.length : 0,
  20082. view = getView(0, arrLength, this.__views__),
  20083. start = view.start,
  20084. end = view.end,
  20085. length = end - start,
  20086. index = isRight ? end : (start - 1),
  20087. iteratees = this.__iteratees__,
  20088. iterLength = iteratees.length,
  20089. resIndex = 0,
  20090. takeCount = nativeMin(length, this.__takeCount__);
  20091. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20092. return baseWrapperValue(array, this.__actions__);
  20093. }
  20094. var result = [];
  20095. outer:
  20096. while (length-- && resIndex < takeCount) {
  20097. index += dir;
  20098. var iterIndex = -1,
  20099. value = array[index];
  20100. while (++iterIndex < iterLength) {
  20101. var data = iteratees[iterIndex],
  20102. iteratee = data.iteratee,
  20103. type = data.type,
  20104. computed = iteratee(value);
  20105. if (type == LAZY_MAP_FLAG) {
  20106. value = computed;
  20107. } else if (!computed) {
  20108. if (type == LAZY_FILTER_FLAG) {
  20109. continue outer;
  20110. } else {
  20111. break outer;
  20112. }
  20113. }
  20114. }
  20115. result[resIndex++] = value;
  20116. }
  20117. return result;
  20118. }
  20119. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20120. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20121. LazyWrapper.prototype.constructor = LazyWrapper;
  20122. /*------------------------------------------------------------------------*/
  20123. /**
  20124. * Creates a hash object.
  20125. *
  20126. * @private
  20127. * @constructor
  20128. * @param {Array} [entries] The key-value pairs to cache.
  20129. */
  20130. function Hash(entries) {
  20131. var index = -1,
  20132. length = entries == null ? 0 : entries.length;
  20133. this.clear();
  20134. while (++index < length) {
  20135. var entry = entries[index];
  20136. this.set(entry[0], entry[1]);
  20137. }
  20138. }
  20139. /**
  20140. * Removes all key-value entries from the hash.
  20141. *
  20142. * @private
  20143. * @name clear
  20144. * @memberOf Hash
  20145. */
  20146. function hashClear() {
  20147. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20148. this.size = 0;
  20149. }
  20150. /**
  20151. * Removes `key` and its value from the hash.
  20152. *
  20153. * @private
  20154. * @name delete
  20155. * @memberOf Hash
  20156. * @param {Object} hash The hash to modify.
  20157. * @param {string} key The key of the value to remove.
  20158. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20159. */
  20160. function hashDelete(key) {
  20161. var result = this.has(key) && delete this.__data__[key];
  20162. this.size -= result ? 1 : 0;
  20163. return result;
  20164. }
  20165. /**
  20166. * Gets the hash value for `key`.
  20167. *
  20168. * @private
  20169. * @name get
  20170. * @memberOf Hash
  20171. * @param {string} key The key of the value to get.
  20172. * @returns {*} Returns the entry value.
  20173. */
  20174. function hashGet(key) {
  20175. var data = this.__data__;
  20176. if (nativeCreate) {
  20177. var result = data[key];
  20178. return result === HASH_UNDEFINED ? undefined : result;
  20179. }
  20180. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20181. }
  20182. /**
  20183. * Checks if a hash value for `key` exists.
  20184. *
  20185. * @private
  20186. * @name has
  20187. * @memberOf Hash
  20188. * @param {string} key The key of the entry to check.
  20189. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20190. */
  20191. function hashHas(key) {
  20192. var data = this.__data__;
  20193. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20194. }
  20195. /**
  20196. * Sets the hash `key` to `value`.
  20197. *
  20198. * @private
  20199. * @name set
  20200. * @memberOf Hash
  20201. * @param {string} key The key of the value to set.
  20202. * @param {*} value The value to set.
  20203. * @returns {Object} Returns the hash instance.
  20204. */
  20205. function hashSet(key, value) {
  20206. var data = this.__data__;
  20207. this.size += this.has(key) ? 0 : 1;
  20208. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20209. return this;
  20210. }
  20211. // Add methods to `Hash`.
  20212. Hash.prototype.clear = hashClear;
  20213. Hash.prototype['delete'] = hashDelete;
  20214. Hash.prototype.get = hashGet;
  20215. Hash.prototype.has = hashHas;
  20216. Hash.prototype.set = hashSet;
  20217. /*------------------------------------------------------------------------*/
  20218. /**
  20219. * Creates an list cache object.
  20220. *
  20221. * @private
  20222. * @constructor
  20223. * @param {Array} [entries] The key-value pairs to cache.
  20224. */
  20225. function ListCache(entries) {
  20226. var index = -1,
  20227. length = entries == null ? 0 : entries.length;
  20228. this.clear();
  20229. while (++index < length) {
  20230. var entry = entries[index];
  20231. this.set(entry[0], entry[1]);
  20232. }
  20233. }
  20234. /**
  20235. * Removes all key-value entries from the list cache.
  20236. *
  20237. * @private
  20238. * @name clear
  20239. * @memberOf ListCache
  20240. */
  20241. function listCacheClear() {
  20242. this.__data__ = [];
  20243. this.size = 0;
  20244. }
  20245. /**
  20246. * Removes `key` and its value from the list cache.
  20247. *
  20248. * @private
  20249. * @name delete
  20250. * @memberOf ListCache
  20251. * @param {string} key The key of the value to remove.
  20252. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20253. */
  20254. function listCacheDelete(key) {
  20255. var data = this.__data__,
  20256. index = assocIndexOf(data, key);
  20257. if (index < 0) {
  20258. return false;
  20259. }
  20260. var lastIndex = data.length - 1;
  20261. if (index == lastIndex) {
  20262. data.pop();
  20263. } else {
  20264. splice.call(data, index, 1);
  20265. }
  20266. --this.size;
  20267. return true;
  20268. }
  20269. /**
  20270. * Gets the list cache value for `key`.
  20271. *
  20272. * @private
  20273. * @name get
  20274. * @memberOf ListCache
  20275. * @param {string} key The key of the value to get.
  20276. * @returns {*} Returns the entry value.
  20277. */
  20278. function listCacheGet(key) {
  20279. var data = this.__data__,
  20280. index = assocIndexOf(data, key);
  20281. return index < 0 ? undefined : data[index][1];
  20282. }
  20283. /**
  20284. * Checks if a list cache value for `key` exists.
  20285. *
  20286. * @private
  20287. * @name has
  20288. * @memberOf ListCache
  20289. * @param {string} key The key of the entry to check.
  20290. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20291. */
  20292. function listCacheHas(key) {
  20293. return assocIndexOf(this.__data__, key) > -1;
  20294. }
  20295. /**
  20296. * Sets the list cache `key` to `value`.
  20297. *
  20298. * @private
  20299. * @name set
  20300. * @memberOf ListCache
  20301. * @param {string} key The key of the value to set.
  20302. * @param {*} value The value to set.
  20303. * @returns {Object} Returns the list cache instance.
  20304. */
  20305. function listCacheSet(key, value) {
  20306. var data = this.__data__,
  20307. index = assocIndexOf(data, key);
  20308. if (index < 0) {
  20309. ++this.size;
  20310. data.push([key, value]);
  20311. } else {
  20312. data[index][1] = value;
  20313. }
  20314. return this;
  20315. }
  20316. // Add methods to `ListCache`.
  20317. ListCache.prototype.clear = listCacheClear;
  20318. ListCache.prototype['delete'] = listCacheDelete;
  20319. ListCache.prototype.get = listCacheGet;
  20320. ListCache.prototype.has = listCacheHas;
  20321. ListCache.prototype.set = listCacheSet;
  20322. /*------------------------------------------------------------------------*/
  20323. /**
  20324. * Creates a map cache object to store key-value pairs.
  20325. *
  20326. * @private
  20327. * @constructor
  20328. * @param {Array} [entries] The key-value pairs to cache.
  20329. */
  20330. function MapCache(entries) {
  20331. var index = -1,
  20332. length = entries == null ? 0 : entries.length;
  20333. this.clear();
  20334. while (++index < length) {
  20335. var entry = entries[index];
  20336. this.set(entry[0], entry[1]);
  20337. }
  20338. }
  20339. /**
  20340. * Removes all key-value entries from the map.
  20341. *
  20342. * @private
  20343. * @name clear
  20344. * @memberOf MapCache
  20345. */
  20346. function mapCacheClear() {
  20347. this.size = 0;
  20348. this.__data__ = {
  20349. 'hash': new Hash,
  20350. 'map': new (Map || ListCache),
  20351. 'string': new Hash
  20352. };
  20353. }
  20354. /**
  20355. * Removes `key` and its value from the map.
  20356. *
  20357. * @private
  20358. * @name delete
  20359. * @memberOf MapCache
  20360. * @param {string} key The key of the value to remove.
  20361. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20362. */
  20363. function mapCacheDelete(key) {
  20364. var result = getMapData(this, key)['delete'](key);
  20365. this.size -= result ? 1 : 0;
  20366. return result;
  20367. }
  20368. /**
  20369. * Gets the map value for `key`.
  20370. *
  20371. * @private
  20372. * @name get
  20373. * @memberOf MapCache
  20374. * @param {string} key The key of the value to get.
  20375. * @returns {*} Returns the entry value.
  20376. */
  20377. function mapCacheGet(key) {
  20378. return getMapData(this, key).get(key);
  20379. }
  20380. /**
  20381. * Checks if a map value for `key` exists.
  20382. *
  20383. * @private
  20384. * @name has
  20385. * @memberOf MapCache
  20386. * @param {string} key The key of the entry to check.
  20387. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20388. */
  20389. function mapCacheHas(key) {
  20390. return getMapData(this, key).has(key);
  20391. }
  20392. /**
  20393. * Sets the map `key` to `value`.
  20394. *
  20395. * @private
  20396. * @name set
  20397. * @memberOf MapCache
  20398. * @param {string} key The key of the value to set.
  20399. * @param {*} value The value to set.
  20400. * @returns {Object} Returns the map cache instance.
  20401. */
  20402. function mapCacheSet(key, value) {
  20403. var data = getMapData(this, key),
  20404. size = data.size;
  20405. data.set(key, value);
  20406. this.size += data.size == size ? 0 : 1;
  20407. return this;
  20408. }
  20409. // Add methods to `MapCache`.
  20410. MapCache.prototype.clear = mapCacheClear;
  20411. MapCache.prototype['delete'] = mapCacheDelete;
  20412. MapCache.prototype.get = mapCacheGet;
  20413. MapCache.prototype.has = mapCacheHas;
  20414. MapCache.prototype.set = mapCacheSet;
  20415. /*------------------------------------------------------------------------*/
  20416. /**
  20417. *
  20418. * Creates an array cache object to store unique values.
  20419. *
  20420. * @private
  20421. * @constructor
  20422. * @param {Array} [values] The values to cache.
  20423. */
  20424. function SetCache(values) {
  20425. var index = -1,
  20426. length = values == null ? 0 : values.length;
  20427. this.__data__ = new MapCache;
  20428. while (++index < length) {
  20429. this.add(values[index]);
  20430. }
  20431. }
  20432. /**
  20433. * Adds `value` to the array cache.
  20434. *
  20435. * @private
  20436. * @name add
  20437. * @memberOf SetCache
  20438. * @alias push
  20439. * @param {*} value The value to cache.
  20440. * @returns {Object} Returns the cache instance.
  20441. */
  20442. function setCacheAdd(value) {
  20443. this.__data__.set(value, HASH_UNDEFINED);
  20444. return this;
  20445. }
  20446. /**
  20447. * Checks if `value` is in the array cache.
  20448. *
  20449. * @private
  20450. * @name has
  20451. * @memberOf SetCache
  20452. * @param {*} value The value to search for.
  20453. * @returns {number} Returns `true` if `value` is found, else `false`.
  20454. */
  20455. function setCacheHas(value) {
  20456. return this.__data__.has(value);
  20457. }
  20458. // Add methods to `SetCache`.
  20459. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20460. SetCache.prototype.has = setCacheHas;
  20461. /*------------------------------------------------------------------------*/
  20462. /**
  20463. * Creates a stack cache object to store key-value pairs.
  20464. *
  20465. * @private
  20466. * @constructor
  20467. * @param {Array} [entries] The key-value pairs to cache.
  20468. */
  20469. function Stack(entries) {
  20470. var data = this.__data__ = new ListCache(entries);
  20471. this.size = data.size;
  20472. }
  20473. /**
  20474. * Removes all key-value entries from the stack.
  20475. *
  20476. * @private
  20477. * @name clear
  20478. * @memberOf Stack
  20479. */
  20480. function stackClear() {
  20481. this.__data__ = new ListCache;
  20482. this.size = 0;
  20483. }
  20484. /**
  20485. * Removes `key` and its value from the stack.
  20486. *
  20487. * @private
  20488. * @name delete
  20489. * @memberOf Stack
  20490. * @param {string} key The key of the value to remove.
  20491. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20492. */
  20493. function stackDelete(key) {
  20494. var data = this.__data__,
  20495. result = data['delete'](key);
  20496. this.size = data.size;
  20497. return result;
  20498. }
  20499. /**
  20500. * Gets the stack value for `key`.
  20501. *
  20502. * @private
  20503. * @name get
  20504. * @memberOf Stack
  20505. * @param {string} key The key of the value to get.
  20506. * @returns {*} Returns the entry value.
  20507. */
  20508. function stackGet(key) {
  20509. return this.__data__.get(key);
  20510. }
  20511. /**
  20512. * Checks if a stack value for `key` exists.
  20513. *
  20514. * @private
  20515. * @name has
  20516. * @memberOf Stack
  20517. * @param {string} key The key of the entry to check.
  20518. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20519. */
  20520. function stackHas(key) {
  20521. return this.__data__.has(key);
  20522. }
  20523. /**
  20524. * Sets the stack `key` to `value`.
  20525. *
  20526. * @private
  20527. * @name set
  20528. * @memberOf Stack
  20529. * @param {string} key The key of the value to set.
  20530. * @param {*} value The value to set.
  20531. * @returns {Object} Returns the stack cache instance.
  20532. */
  20533. function stackSet(key, value) {
  20534. var data = this.__data__;
  20535. if (data instanceof ListCache) {
  20536. var pairs = data.__data__;
  20537. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20538. pairs.push([key, value]);
  20539. this.size = ++data.size;
  20540. return this;
  20541. }
  20542. data = this.__data__ = new MapCache(pairs);
  20543. }
  20544. data.set(key, value);
  20545. this.size = data.size;
  20546. return this;
  20547. }
  20548. // Add methods to `Stack`.
  20549. Stack.prototype.clear = stackClear;
  20550. Stack.prototype['delete'] = stackDelete;
  20551. Stack.prototype.get = stackGet;
  20552. Stack.prototype.has = stackHas;
  20553. Stack.prototype.set = stackSet;
  20554. /*------------------------------------------------------------------------*/
  20555. /**
  20556. * Creates an array of the enumerable property names of the array-like `value`.
  20557. *
  20558. * @private
  20559. * @param {*} value The value to query.
  20560. * @param {boolean} inherited Specify returning inherited property names.
  20561. * @returns {Array} Returns the array of property names.
  20562. */
  20563. function arrayLikeKeys(value, inherited) {
  20564. var isArr = isArray(value),
  20565. isArg = !isArr && isArguments(value),
  20566. isBuff = !isArr && !isArg && isBuffer(value),
  20567. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20568. skipIndexes = isArr || isArg || isBuff || isType,
  20569. result = skipIndexes ? baseTimes(value.length, String) : [],
  20570. length = result.length;
  20571. for (var key in value) {
  20572. if ((inherited || hasOwnProperty.call(value, key)) &&
  20573. !(skipIndexes && (
  20574. // Safari 9 has enumerable `arguments.length` in strict mode.
  20575. key == 'length' ||
  20576. // Node.js 0.10 has enumerable non-index properties on buffers.
  20577. (isBuff && (key == 'offset' || key == 'parent')) ||
  20578. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20579. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20580. // Skip index properties.
  20581. isIndex(key, length)
  20582. ))) {
  20583. result.push(key);
  20584. }
  20585. }
  20586. return result;
  20587. }
  20588. /**
  20589. * A specialized version of `_.sample` for arrays.
  20590. *
  20591. * @private
  20592. * @param {Array} array The array to sample.
  20593. * @returns {*} Returns the random element.
  20594. */
  20595. function arraySample(array) {
  20596. var length = array.length;
  20597. return length ? array[baseRandom(0, length - 1)] : undefined;
  20598. }
  20599. /**
  20600. * A specialized version of `_.sampleSize` for arrays.
  20601. *
  20602. * @private
  20603. * @param {Array} array The array to sample.
  20604. * @param {number} n The number of elements to sample.
  20605. * @returns {Array} Returns the random elements.
  20606. */
  20607. function arraySampleSize(array, n) {
  20608. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20609. }
  20610. /**
  20611. * A specialized version of `_.shuffle` for arrays.
  20612. *
  20613. * @private
  20614. * @param {Array} array The array to shuffle.
  20615. * @returns {Array} Returns the new shuffled array.
  20616. */
  20617. function arrayShuffle(array) {
  20618. return shuffleSelf(copyArray(array));
  20619. }
  20620. /**
  20621. * This function is like `assignValue` except that it doesn't assign
  20622. * `undefined` values.
  20623. *
  20624. * @private
  20625. * @param {Object} object The object to modify.
  20626. * @param {string} key The key of the property to assign.
  20627. * @param {*} value The value to assign.
  20628. */
  20629. function assignMergeValue(object, key, value) {
  20630. if ((value !== undefined && !eq(object[key], value)) ||
  20631. (value === undefined && !(key in object))) {
  20632. baseAssignValue(object, key, value);
  20633. }
  20634. }
  20635. /**
  20636. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20637. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20638. * for equality comparisons.
  20639. *
  20640. * @private
  20641. * @param {Object} object The object to modify.
  20642. * @param {string} key The key of the property to assign.
  20643. * @param {*} value The value to assign.
  20644. */
  20645. function assignValue(object, key, value) {
  20646. var objValue = object[key];
  20647. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20648. (value === undefined && !(key in object))) {
  20649. baseAssignValue(object, key, value);
  20650. }
  20651. }
  20652. /**
  20653. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20654. *
  20655. * @private
  20656. * @param {Array} array The array to inspect.
  20657. * @param {*} key The key to search for.
  20658. * @returns {number} Returns the index of the matched value, else `-1`.
  20659. */
  20660. function assocIndexOf(array, key) {
  20661. var length = array.length;
  20662. while (length--) {
  20663. if (eq(array[length][0], key)) {
  20664. return length;
  20665. }
  20666. }
  20667. return -1;
  20668. }
  20669. /**
  20670. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20671. * by `iteratee` and values set by `setter`.
  20672. *
  20673. * @private
  20674. * @param {Array|Object} collection The collection to iterate over.
  20675. * @param {Function} setter The function to set `accumulator` values.
  20676. * @param {Function} iteratee The iteratee to transform keys.
  20677. * @param {Object} accumulator The initial aggregated object.
  20678. * @returns {Function} Returns `accumulator`.
  20679. */
  20680. function baseAggregator(collection, setter, iteratee, accumulator) {
  20681. baseEach(collection, function(value, key, collection) {
  20682. setter(accumulator, value, iteratee(value), collection);
  20683. });
  20684. return accumulator;
  20685. }
  20686. /**
  20687. * The base implementation of `_.assign` without support for multiple sources
  20688. * or `customizer` functions.
  20689. *
  20690. * @private
  20691. * @param {Object} object The destination object.
  20692. * @param {Object} source The source object.
  20693. * @returns {Object} Returns `object`.
  20694. */
  20695. function baseAssign(object, source) {
  20696. return object && copyObject(source, keys(source), object);
  20697. }
  20698. /**
  20699. * The base implementation of `_.assignIn` without support for multiple sources
  20700. * or `customizer` functions.
  20701. *
  20702. * @private
  20703. * @param {Object} object The destination object.
  20704. * @param {Object} source The source object.
  20705. * @returns {Object} Returns `object`.
  20706. */
  20707. function baseAssignIn(object, source) {
  20708. return object && copyObject(source, keysIn(source), object);
  20709. }
  20710. /**
  20711. * The base implementation of `assignValue` and `assignMergeValue` without
  20712. * value checks.
  20713. *
  20714. * @private
  20715. * @param {Object} object The object to modify.
  20716. * @param {string} key The key of the property to assign.
  20717. * @param {*} value The value to assign.
  20718. */
  20719. function baseAssignValue(object, key, value) {
  20720. if (key == '__proto__' && defineProperty) {
  20721. defineProperty(object, key, {
  20722. 'configurable': true,
  20723. 'enumerable': true,
  20724. 'value': value,
  20725. 'writable': true
  20726. });
  20727. } else {
  20728. object[key] = value;
  20729. }
  20730. }
  20731. /**
  20732. * The base implementation of `_.at` without support for individual paths.
  20733. *
  20734. * @private
  20735. * @param {Object} object The object to iterate over.
  20736. * @param {string[]} paths The property paths to pick.
  20737. * @returns {Array} Returns the picked elements.
  20738. */
  20739. function baseAt(object, paths) {
  20740. var index = -1,
  20741. length = paths.length,
  20742. result = Array(length),
  20743. skip = object == null;
  20744. while (++index < length) {
  20745. result[index] = skip ? undefined : get(object, paths[index]);
  20746. }
  20747. return result;
  20748. }
  20749. /**
  20750. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20751. *
  20752. * @private
  20753. * @param {number} number The number to clamp.
  20754. * @param {number} [lower] The lower bound.
  20755. * @param {number} upper The upper bound.
  20756. * @returns {number} Returns the clamped number.
  20757. */
  20758. function baseClamp(number, lower, upper) {
  20759. if (number === number) {
  20760. if (upper !== undefined) {
  20761. number = number <= upper ? number : upper;
  20762. }
  20763. if (lower !== undefined) {
  20764. number = number >= lower ? number : lower;
  20765. }
  20766. }
  20767. return number;
  20768. }
  20769. /**
  20770. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20771. * traversed objects.
  20772. *
  20773. * @private
  20774. * @param {*} value The value to clone.
  20775. * @param {boolean} bitmask The bitmask flags.
  20776. * 1 - Deep clone
  20777. * 2 - Flatten inherited properties
  20778. * 4 - Clone symbols
  20779. * @param {Function} [customizer] The function to customize cloning.
  20780. * @param {string} [key] The key of `value`.
  20781. * @param {Object} [object] The parent object of `value`.
  20782. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20783. * @returns {*} Returns the cloned value.
  20784. */
  20785. function baseClone(value, bitmask, customizer, key, object, stack) {
  20786. var result,
  20787. isDeep = bitmask & CLONE_DEEP_FLAG,
  20788. isFlat = bitmask & CLONE_FLAT_FLAG,
  20789. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20790. if (customizer) {
  20791. result = object ? customizer(value, key, object, stack) : customizer(value);
  20792. }
  20793. if (result !== undefined) {
  20794. return result;
  20795. }
  20796. if (!isObject(value)) {
  20797. return value;
  20798. }
  20799. var isArr = isArray(value);
  20800. if (isArr) {
  20801. result = initCloneArray(value);
  20802. if (!isDeep) {
  20803. return copyArray(value, result);
  20804. }
  20805. } else {
  20806. var tag = getTag(value),
  20807. isFunc = tag == funcTag || tag == genTag;
  20808. if (isBuffer(value)) {
  20809. return cloneBuffer(value, isDeep);
  20810. }
  20811. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20812. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20813. if (!isDeep) {
  20814. return isFlat
  20815. ? copySymbolsIn(value, baseAssignIn(result, value))
  20816. : copySymbols(value, baseAssign(result, value));
  20817. }
  20818. } else {
  20819. if (!cloneableTags[tag]) {
  20820. return object ? value : {};
  20821. }
  20822. result = initCloneByTag(value, tag, isDeep);
  20823. }
  20824. }
  20825. // Check for circular references and return its corresponding clone.
  20826. stack || (stack = new Stack);
  20827. var stacked = stack.get(value);
  20828. if (stacked) {
  20829. return stacked;
  20830. }
  20831. stack.set(value, result);
  20832. if (isSet(value)) {
  20833. value.forEach(function(subValue) {
  20834. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20835. });
  20836. } else if (isMap(value)) {
  20837. value.forEach(function(subValue, key) {
  20838. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20839. });
  20840. }
  20841. var keysFunc = isFull
  20842. ? (isFlat ? getAllKeysIn : getAllKeys)
  20843. : (isFlat ? keysIn : keys);
  20844. var props = isArr ? undefined : keysFunc(value);
  20845. arrayEach(props || value, function(subValue, key) {
  20846. if (props) {
  20847. key = subValue;
  20848. subValue = value[key];
  20849. }
  20850. // Recursively populate clone (susceptible to call stack limits).
  20851. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20852. });
  20853. return result;
  20854. }
  20855. /**
  20856. * The base implementation of `_.conforms` which doesn't clone `source`.
  20857. *
  20858. * @private
  20859. * @param {Object} source The object of property predicates to conform to.
  20860. * @returns {Function} Returns the new spec function.
  20861. */
  20862. function baseConforms(source) {
  20863. var props = keys(source);
  20864. return function(object) {
  20865. return baseConformsTo(object, source, props);
  20866. };
  20867. }
  20868. /**
  20869. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20870. *
  20871. * @private
  20872. * @param {Object} object The object to inspect.
  20873. * @param {Object} source The object of property predicates to conform to.
  20874. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20875. */
  20876. function baseConformsTo(object, source, props) {
  20877. var length = props.length;
  20878. if (object == null) {
  20879. return !length;
  20880. }
  20881. object = Object(object);
  20882. while (length--) {
  20883. var key = props[length],
  20884. predicate = source[key],
  20885. value = object[key];
  20886. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20887. return false;
  20888. }
  20889. }
  20890. return true;
  20891. }
  20892. /**
  20893. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20894. * to provide to `func`.
  20895. *
  20896. * @private
  20897. * @param {Function} func The function to delay.
  20898. * @param {number} wait The number of milliseconds to delay invocation.
  20899. * @param {Array} args The arguments to provide to `func`.
  20900. * @returns {number|Object} Returns the timer id or timeout object.
  20901. */
  20902. function baseDelay(func, wait, args) {
  20903. if (typeof func != 'function') {
  20904. throw new TypeError(FUNC_ERROR_TEXT);
  20905. }
  20906. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20907. }
  20908. /**
  20909. * The base implementation of methods like `_.difference` without support
  20910. * for excluding multiple arrays or iteratee shorthands.
  20911. *
  20912. * @private
  20913. * @param {Array} array The array to inspect.
  20914. * @param {Array} values The values to exclude.
  20915. * @param {Function} [iteratee] The iteratee invoked per element.
  20916. * @param {Function} [comparator] The comparator invoked per element.
  20917. * @returns {Array} Returns the new array of filtered values.
  20918. */
  20919. function baseDifference(array, values, iteratee, comparator) {
  20920. var index = -1,
  20921. includes = arrayIncludes,
  20922. isCommon = true,
  20923. length = array.length,
  20924. result = [],
  20925. valuesLength = values.length;
  20926. if (!length) {
  20927. return result;
  20928. }
  20929. if (iteratee) {
  20930. values = arrayMap(values, baseUnary(iteratee));
  20931. }
  20932. if (comparator) {
  20933. includes = arrayIncludesWith;
  20934. isCommon = false;
  20935. }
  20936. else if (values.length >= LARGE_ARRAY_SIZE) {
  20937. includes = cacheHas;
  20938. isCommon = false;
  20939. values = new SetCache(values);
  20940. }
  20941. outer:
  20942. while (++index < length) {
  20943. var value = array[index],
  20944. computed = iteratee == null ? value : iteratee(value);
  20945. value = (comparator || value !== 0) ? value : 0;
  20946. if (isCommon && computed === computed) {
  20947. var valuesIndex = valuesLength;
  20948. while (valuesIndex--) {
  20949. if (values[valuesIndex] === computed) {
  20950. continue outer;
  20951. }
  20952. }
  20953. result.push(value);
  20954. }
  20955. else if (!includes(values, computed, comparator)) {
  20956. result.push(value);
  20957. }
  20958. }
  20959. return result;
  20960. }
  20961. /**
  20962. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20963. *
  20964. * @private
  20965. * @param {Array|Object} collection The collection to iterate over.
  20966. * @param {Function} iteratee The function invoked per iteration.
  20967. * @returns {Array|Object} Returns `collection`.
  20968. */
  20969. var baseEach = createBaseEach(baseForOwn);
  20970. /**
  20971. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20972. *
  20973. * @private
  20974. * @param {Array|Object} collection The collection to iterate over.
  20975. * @param {Function} iteratee The function invoked per iteration.
  20976. * @returns {Array|Object} Returns `collection`.
  20977. */
  20978. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20979. /**
  20980. * The base implementation of `_.every` without support for iteratee shorthands.
  20981. *
  20982. * @private
  20983. * @param {Array|Object} collection The collection to iterate over.
  20984. * @param {Function} predicate The function invoked per iteration.
  20985. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20986. * else `false`
  20987. */
  20988. function baseEvery(collection, predicate) {
  20989. var result = true;
  20990. baseEach(collection, function(value, index, collection) {
  20991. result = !!predicate(value, index, collection);
  20992. return result;
  20993. });
  20994. return result;
  20995. }
  20996. /**
  20997. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20998. * `comparator` to determine the extremum value.
  20999. *
  21000. * @private
  21001. * @param {Array} array The array to iterate over.
  21002. * @param {Function} iteratee The iteratee invoked per iteration.
  21003. * @param {Function} comparator The comparator used to compare values.
  21004. * @returns {*} Returns the extremum value.
  21005. */
  21006. function baseExtremum(array, iteratee, comparator) {
  21007. var index = -1,
  21008. length = array.length;
  21009. while (++index < length) {
  21010. var value = array[index],
  21011. current = iteratee(value);
  21012. if (current != null && (computed === undefined
  21013. ? (current === current && !isSymbol(current))
  21014. : comparator(current, computed)
  21015. )) {
  21016. var computed = current,
  21017. result = value;
  21018. }
  21019. }
  21020. return result;
  21021. }
  21022. /**
  21023. * The base implementation of `_.fill` without an iteratee call guard.
  21024. *
  21025. * @private
  21026. * @param {Array} array The array to fill.
  21027. * @param {*} value The value to fill `array` with.
  21028. * @param {number} [start=0] The start position.
  21029. * @param {number} [end=array.length] The end position.
  21030. * @returns {Array} Returns `array`.
  21031. */
  21032. function baseFill(array, value, start, end) {
  21033. var length = array.length;
  21034. start = toInteger(start);
  21035. if (start < 0) {
  21036. start = -start > length ? 0 : (length + start);
  21037. }
  21038. end = (end === undefined || end > length) ? length : toInteger(end);
  21039. if (end < 0) {
  21040. end += length;
  21041. }
  21042. end = start > end ? 0 : toLength(end);
  21043. while (start < end) {
  21044. array[start++] = value;
  21045. }
  21046. return array;
  21047. }
  21048. /**
  21049. * The base implementation of `_.filter` without support for iteratee shorthands.
  21050. *
  21051. * @private
  21052. * @param {Array|Object} collection The collection to iterate over.
  21053. * @param {Function} predicate The function invoked per iteration.
  21054. * @returns {Array} Returns the new filtered array.
  21055. */
  21056. function baseFilter(collection, predicate) {
  21057. var result = [];
  21058. baseEach(collection, function(value, index, collection) {
  21059. if (predicate(value, index, collection)) {
  21060. result.push(value);
  21061. }
  21062. });
  21063. return result;
  21064. }
  21065. /**
  21066. * The base implementation of `_.flatten` with support for restricting flattening.
  21067. *
  21068. * @private
  21069. * @param {Array} array The array to flatten.
  21070. * @param {number} depth The maximum recursion depth.
  21071. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21072. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21073. * @param {Array} [result=[]] The initial result value.
  21074. * @returns {Array} Returns the new flattened array.
  21075. */
  21076. function baseFlatten(array, depth, predicate, isStrict, result) {
  21077. var index = -1,
  21078. length = array.length;
  21079. predicate || (predicate = isFlattenable);
  21080. result || (result = []);
  21081. while (++index < length) {
  21082. var value = array[index];
  21083. if (depth > 0 && predicate(value)) {
  21084. if (depth > 1) {
  21085. // Recursively flatten arrays (susceptible to call stack limits).
  21086. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21087. } else {
  21088. arrayPush(result, value);
  21089. }
  21090. } else if (!isStrict) {
  21091. result[result.length] = value;
  21092. }
  21093. }
  21094. return result;
  21095. }
  21096. /**
  21097. * The base implementation of `baseForOwn` which iterates over `object`
  21098. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21099. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21100. *
  21101. * @private
  21102. * @param {Object} object The object to iterate over.
  21103. * @param {Function} iteratee The function invoked per iteration.
  21104. * @param {Function} keysFunc The function to get the keys of `object`.
  21105. * @returns {Object} Returns `object`.
  21106. */
  21107. var baseFor = createBaseFor();
  21108. /**
  21109. * This function is like `baseFor` except that it iterates over properties
  21110. * in the opposite order.
  21111. *
  21112. * @private
  21113. * @param {Object} object The object to iterate over.
  21114. * @param {Function} iteratee The function invoked per iteration.
  21115. * @param {Function} keysFunc The function to get the keys of `object`.
  21116. * @returns {Object} Returns `object`.
  21117. */
  21118. var baseForRight = createBaseFor(true);
  21119. /**
  21120. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21121. *
  21122. * @private
  21123. * @param {Object} object The object to iterate over.
  21124. * @param {Function} iteratee The function invoked per iteration.
  21125. * @returns {Object} Returns `object`.
  21126. */
  21127. function baseForOwn(object, iteratee) {
  21128. return object && baseFor(object, iteratee, keys);
  21129. }
  21130. /**
  21131. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21132. *
  21133. * @private
  21134. * @param {Object} object The object to iterate over.
  21135. * @param {Function} iteratee The function invoked per iteration.
  21136. * @returns {Object} Returns `object`.
  21137. */
  21138. function baseForOwnRight(object, iteratee) {
  21139. return object && baseForRight(object, iteratee, keys);
  21140. }
  21141. /**
  21142. * The base implementation of `_.functions` which creates an array of
  21143. * `object` function property names filtered from `props`.
  21144. *
  21145. * @private
  21146. * @param {Object} object The object to inspect.
  21147. * @param {Array} props The property names to filter.
  21148. * @returns {Array} Returns the function names.
  21149. */
  21150. function baseFunctions(object, props) {
  21151. return arrayFilter(props, function(key) {
  21152. return isFunction(object[key]);
  21153. });
  21154. }
  21155. /**
  21156. * The base implementation of `_.get` without support for default values.
  21157. *
  21158. * @private
  21159. * @param {Object} object The object to query.
  21160. * @param {Array|string} path The path of the property to get.
  21161. * @returns {*} Returns the resolved value.
  21162. */
  21163. function baseGet(object, path) {
  21164. path = castPath(path, object);
  21165. var index = 0,
  21166. length = path.length;
  21167. while (object != null && index < length) {
  21168. object = object[toKey(path[index++])];
  21169. }
  21170. return (index && index == length) ? object : undefined;
  21171. }
  21172. /**
  21173. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21174. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21175. * symbols of `object`.
  21176. *
  21177. * @private
  21178. * @param {Object} object The object to query.
  21179. * @param {Function} keysFunc The function to get the keys of `object`.
  21180. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21181. * @returns {Array} Returns the array of property names and symbols.
  21182. */
  21183. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21184. var result = keysFunc(object);
  21185. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21186. }
  21187. /**
  21188. * The base implementation of `getTag` without fallbacks for buggy environments.
  21189. *
  21190. * @private
  21191. * @param {*} value The value to query.
  21192. * @returns {string} Returns the `toStringTag`.
  21193. */
  21194. function baseGetTag(value) {
  21195. if (value == null) {
  21196. return value === undefined ? undefinedTag : nullTag;
  21197. }
  21198. return (symToStringTag && symToStringTag in Object(value))
  21199. ? getRawTag(value)
  21200. : objectToString(value);
  21201. }
  21202. /**
  21203. * The base implementation of `_.gt` which doesn't coerce arguments.
  21204. *
  21205. * @private
  21206. * @param {*} value The value to compare.
  21207. * @param {*} other The other value to compare.
  21208. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21209. * else `false`.
  21210. */
  21211. function baseGt(value, other) {
  21212. return value > other;
  21213. }
  21214. /**
  21215. * The base implementation of `_.has` without support for deep paths.
  21216. *
  21217. * @private
  21218. * @param {Object} [object] The object to query.
  21219. * @param {Array|string} key The key to check.
  21220. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21221. */
  21222. function baseHas(object, key) {
  21223. return object != null && hasOwnProperty.call(object, key);
  21224. }
  21225. /**
  21226. * The base implementation of `_.hasIn` without support for deep paths.
  21227. *
  21228. * @private
  21229. * @param {Object} [object] The object to query.
  21230. * @param {Array|string} key The key to check.
  21231. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21232. */
  21233. function baseHasIn(object, key) {
  21234. return object != null && key in Object(object);
  21235. }
  21236. /**
  21237. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21238. *
  21239. * @private
  21240. * @param {number} number The number to check.
  21241. * @param {number} start The start of the range.
  21242. * @param {number} end The end of the range.
  21243. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21244. */
  21245. function baseInRange(number, start, end) {
  21246. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21247. }
  21248. /**
  21249. * The base implementation of methods like `_.intersection`, without support
  21250. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21251. *
  21252. * @private
  21253. * @param {Array} arrays The arrays to inspect.
  21254. * @param {Function} [iteratee] The iteratee invoked per element.
  21255. * @param {Function} [comparator] The comparator invoked per element.
  21256. * @returns {Array} Returns the new array of shared values.
  21257. */
  21258. function baseIntersection(arrays, iteratee, comparator) {
  21259. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21260. length = arrays[0].length,
  21261. othLength = arrays.length,
  21262. othIndex = othLength,
  21263. caches = Array(othLength),
  21264. maxLength = Infinity,
  21265. result = [];
  21266. while (othIndex--) {
  21267. var array = arrays[othIndex];
  21268. if (othIndex && iteratee) {
  21269. array = arrayMap(array, baseUnary(iteratee));
  21270. }
  21271. maxLength = nativeMin(array.length, maxLength);
  21272. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21273. ? new SetCache(othIndex && array)
  21274. : undefined;
  21275. }
  21276. array = arrays[0];
  21277. var index = -1,
  21278. seen = caches[0];
  21279. outer:
  21280. while (++index < length && result.length < maxLength) {
  21281. var value = array[index],
  21282. computed = iteratee ? iteratee(value) : value;
  21283. value = (comparator || value !== 0) ? value : 0;
  21284. if (!(seen
  21285. ? cacheHas(seen, computed)
  21286. : includes(result, computed, comparator)
  21287. )) {
  21288. othIndex = othLength;
  21289. while (--othIndex) {
  21290. var cache = caches[othIndex];
  21291. if (!(cache
  21292. ? cacheHas(cache, computed)
  21293. : includes(arrays[othIndex], computed, comparator))
  21294. ) {
  21295. continue outer;
  21296. }
  21297. }
  21298. if (seen) {
  21299. seen.push(computed);
  21300. }
  21301. result.push(value);
  21302. }
  21303. }
  21304. return result;
  21305. }
  21306. /**
  21307. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21308. * `object` with values transformed by `iteratee` and set by `setter`.
  21309. *
  21310. * @private
  21311. * @param {Object} object The object to iterate over.
  21312. * @param {Function} setter The function to set `accumulator` values.
  21313. * @param {Function} iteratee The iteratee to transform values.
  21314. * @param {Object} accumulator The initial inverted object.
  21315. * @returns {Function} Returns `accumulator`.
  21316. */
  21317. function baseInverter(object, setter, iteratee, accumulator) {
  21318. baseForOwn(object, function(value, key, object) {
  21319. setter(accumulator, iteratee(value), key, object);
  21320. });
  21321. return accumulator;
  21322. }
  21323. /**
  21324. * The base implementation of `_.invoke` without support for individual
  21325. * method arguments.
  21326. *
  21327. * @private
  21328. * @param {Object} object The object to query.
  21329. * @param {Array|string} path The path of the method to invoke.
  21330. * @param {Array} args The arguments to invoke the method with.
  21331. * @returns {*} Returns the result of the invoked method.
  21332. */
  21333. function baseInvoke(object, path, args) {
  21334. path = castPath(path, object);
  21335. object = parent(object, path);
  21336. var func = object == null ? object : object[toKey(last(path))];
  21337. return func == null ? undefined : apply(func, object, args);
  21338. }
  21339. /**
  21340. * The base implementation of `_.isArguments`.
  21341. *
  21342. * @private
  21343. * @param {*} value The value to check.
  21344. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21345. */
  21346. function baseIsArguments(value) {
  21347. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21348. }
  21349. /**
  21350. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21351. *
  21352. * @private
  21353. * @param {*} value The value to check.
  21354. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21355. */
  21356. function baseIsArrayBuffer(value) {
  21357. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21358. }
  21359. /**
  21360. * The base implementation of `_.isDate` without Node.js optimizations.
  21361. *
  21362. * @private
  21363. * @param {*} value The value to check.
  21364. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21365. */
  21366. function baseIsDate(value) {
  21367. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21368. }
  21369. /**
  21370. * The base implementation of `_.isEqual` which supports partial comparisons
  21371. * and tracks traversed objects.
  21372. *
  21373. * @private
  21374. * @param {*} value The value to compare.
  21375. * @param {*} other The other value to compare.
  21376. * @param {boolean} bitmask The bitmask flags.
  21377. * 1 - Unordered comparison
  21378. * 2 - Partial comparison
  21379. * @param {Function} [customizer] The function to customize comparisons.
  21380. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21381. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21382. */
  21383. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21384. if (value === other) {
  21385. return true;
  21386. }
  21387. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21388. return value !== value && other !== other;
  21389. }
  21390. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21391. }
  21392. /**
  21393. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21394. * deep comparisons and tracks traversed objects enabling objects with circular
  21395. * references to be compared.
  21396. *
  21397. * @private
  21398. * @param {Object} object The object to compare.
  21399. * @param {Object} other The other object to compare.
  21400. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21401. * @param {Function} customizer The function to customize comparisons.
  21402. * @param {Function} equalFunc The function to determine equivalents of values.
  21403. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21404. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21405. */
  21406. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21407. var objIsArr = isArray(object),
  21408. othIsArr = isArray(other),
  21409. objTag = objIsArr ? arrayTag : getTag(object),
  21410. othTag = othIsArr ? arrayTag : getTag(other);
  21411. objTag = objTag == argsTag ? objectTag : objTag;
  21412. othTag = othTag == argsTag ? objectTag : othTag;
  21413. var objIsObj = objTag == objectTag,
  21414. othIsObj = othTag == objectTag,
  21415. isSameTag = objTag == othTag;
  21416. if (isSameTag && isBuffer(object)) {
  21417. if (!isBuffer(other)) {
  21418. return false;
  21419. }
  21420. objIsArr = true;
  21421. objIsObj = false;
  21422. }
  21423. if (isSameTag && !objIsObj) {
  21424. stack || (stack = new Stack);
  21425. return (objIsArr || isTypedArray(object))
  21426. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21427. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21428. }
  21429. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21430. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21431. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21432. if (objIsWrapped || othIsWrapped) {
  21433. var objUnwrapped = objIsWrapped ? object.value() : object,
  21434. othUnwrapped = othIsWrapped ? other.value() : other;
  21435. stack || (stack = new Stack);
  21436. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21437. }
  21438. }
  21439. if (!isSameTag) {
  21440. return false;
  21441. }
  21442. stack || (stack = new Stack);
  21443. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21444. }
  21445. /**
  21446. * The base implementation of `_.isMap` without Node.js optimizations.
  21447. *
  21448. * @private
  21449. * @param {*} value The value to check.
  21450. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21451. */
  21452. function baseIsMap(value) {
  21453. return isObjectLike(value) && getTag(value) == mapTag;
  21454. }
  21455. /**
  21456. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21457. *
  21458. * @private
  21459. * @param {Object} object The object to inspect.
  21460. * @param {Object} source The object of property values to match.
  21461. * @param {Array} matchData The property names, values, and compare flags to match.
  21462. * @param {Function} [customizer] The function to customize comparisons.
  21463. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21464. */
  21465. function baseIsMatch(object, source, matchData, customizer) {
  21466. var index = matchData.length,
  21467. length = index,
  21468. noCustomizer = !customizer;
  21469. if (object == null) {
  21470. return !length;
  21471. }
  21472. object = Object(object);
  21473. while (index--) {
  21474. var data = matchData[index];
  21475. if ((noCustomizer && data[2])
  21476. ? data[1] !== object[data[0]]
  21477. : !(data[0] in object)
  21478. ) {
  21479. return false;
  21480. }
  21481. }
  21482. while (++index < length) {
  21483. data = matchData[index];
  21484. var key = data[0],
  21485. objValue = object[key],
  21486. srcValue = data[1];
  21487. if (noCustomizer && data[2]) {
  21488. if (objValue === undefined && !(key in object)) {
  21489. return false;
  21490. }
  21491. } else {
  21492. var stack = new Stack;
  21493. if (customizer) {
  21494. var result = customizer(objValue, srcValue, key, object, source, stack);
  21495. }
  21496. if (!(result === undefined
  21497. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21498. : result
  21499. )) {
  21500. return false;
  21501. }
  21502. }
  21503. }
  21504. return true;
  21505. }
  21506. /**
  21507. * The base implementation of `_.isNative` without bad shim checks.
  21508. *
  21509. * @private
  21510. * @param {*} value The value to check.
  21511. * @returns {boolean} Returns `true` if `value` is a native function,
  21512. * else `false`.
  21513. */
  21514. function baseIsNative(value) {
  21515. if (!isObject(value) || isMasked(value)) {
  21516. return false;
  21517. }
  21518. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21519. return pattern.test(toSource(value));
  21520. }
  21521. /**
  21522. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21523. *
  21524. * @private
  21525. * @param {*} value The value to check.
  21526. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21527. */
  21528. function baseIsRegExp(value) {
  21529. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21530. }
  21531. /**
  21532. * The base implementation of `_.isSet` without Node.js optimizations.
  21533. *
  21534. * @private
  21535. * @param {*} value The value to check.
  21536. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21537. */
  21538. function baseIsSet(value) {
  21539. return isObjectLike(value) && getTag(value) == setTag;
  21540. }
  21541. /**
  21542. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21543. *
  21544. * @private
  21545. * @param {*} value The value to check.
  21546. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21547. */
  21548. function baseIsTypedArray(value) {
  21549. return isObjectLike(value) &&
  21550. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21551. }
  21552. /**
  21553. * The base implementation of `_.iteratee`.
  21554. *
  21555. * @private
  21556. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21557. * @returns {Function} Returns the iteratee.
  21558. */
  21559. function baseIteratee(value) {
  21560. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21561. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21562. if (typeof value == 'function') {
  21563. return value;
  21564. }
  21565. if (value == null) {
  21566. return identity;
  21567. }
  21568. if (typeof value == 'object') {
  21569. return isArray(value)
  21570. ? baseMatchesProperty(value[0], value[1])
  21571. : baseMatches(value);
  21572. }
  21573. return property(value);
  21574. }
  21575. /**
  21576. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21577. *
  21578. * @private
  21579. * @param {Object} object The object to query.
  21580. * @returns {Array} Returns the array of property names.
  21581. */
  21582. function baseKeys(object) {
  21583. if (!isPrototype(object)) {
  21584. return nativeKeys(object);
  21585. }
  21586. var result = [];
  21587. for (var key in Object(object)) {
  21588. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21589. result.push(key);
  21590. }
  21591. }
  21592. return result;
  21593. }
  21594. /**
  21595. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21596. *
  21597. * @private
  21598. * @param {Object} object The object to query.
  21599. * @returns {Array} Returns the array of property names.
  21600. */
  21601. function baseKeysIn(object) {
  21602. if (!isObject(object)) {
  21603. return nativeKeysIn(object);
  21604. }
  21605. var isProto = isPrototype(object),
  21606. result = [];
  21607. for (var key in object) {
  21608. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21609. result.push(key);
  21610. }
  21611. }
  21612. return result;
  21613. }
  21614. /**
  21615. * The base implementation of `_.lt` which doesn't coerce arguments.
  21616. *
  21617. * @private
  21618. * @param {*} value The value to compare.
  21619. * @param {*} other The other value to compare.
  21620. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21621. * else `false`.
  21622. */
  21623. function baseLt(value, other) {
  21624. return value < other;
  21625. }
  21626. /**
  21627. * The base implementation of `_.map` without support for iteratee shorthands.
  21628. *
  21629. * @private
  21630. * @param {Array|Object} collection The collection to iterate over.
  21631. * @param {Function} iteratee The function invoked per iteration.
  21632. * @returns {Array} Returns the new mapped array.
  21633. */
  21634. function baseMap(collection, iteratee) {
  21635. var index = -1,
  21636. result = isArrayLike(collection) ? Array(collection.length) : [];
  21637. baseEach(collection, function(value, key, collection) {
  21638. result[++index] = iteratee(value, key, collection);
  21639. });
  21640. return result;
  21641. }
  21642. /**
  21643. * The base implementation of `_.matches` which doesn't clone `source`.
  21644. *
  21645. * @private
  21646. * @param {Object} source The object of property values to match.
  21647. * @returns {Function} Returns the new spec function.
  21648. */
  21649. function baseMatches(source) {
  21650. var matchData = getMatchData(source);
  21651. if (matchData.length == 1 && matchData[0][2]) {
  21652. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21653. }
  21654. return function(object) {
  21655. return object === source || baseIsMatch(object, source, matchData);
  21656. };
  21657. }
  21658. /**
  21659. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21660. *
  21661. * @private
  21662. * @param {string} path The path of the property to get.
  21663. * @param {*} srcValue The value to match.
  21664. * @returns {Function} Returns the new spec function.
  21665. */
  21666. function baseMatchesProperty(path, srcValue) {
  21667. if (isKey(path) && isStrictComparable(srcValue)) {
  21668. return matchesStrictComparable(toKey(path), srcValue);
  21669. }
  21670. return function(object) {
  21671. var objValue = get(object, path);
  21672. return (objValue === undefined && objValue === srcValue)
  21673. ? hasIn(object, path)
  21674. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21675. };
  21676. }
  21677. /**
  21678. * The base implementation of `_.merge` without support for multiple sources.
  21679. *
  21680. * @private
  21681. * @param {Object} object The destination object.
  21682. * @param {Object} source The source object.
  21683. * @param {number} srcIndex The index of `source`.
  21684. * @param {Function} [customizer] The function to customize merged values.
  21685. * @param {Object} [stack] Tracks traversed source values and their merged
  21686. * counterparts.
  21687. */
  21688. function baseMerge(object, source, srcIndex, customizer, stack) {
  21689. if (object === source) {
  21690. return;
  21691. }
  21692. baseFor(source, function(srcValue, key) {
  21693. stack || (stack = new Stack);
  21694. if (isObject(srcValue)) {
  21695. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21696. }
  21697. else {
  21698. var newValue = customizer
  21699. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21700. : undefined;
  21701. if (newValue === undefined) {
  21702. newValue = srcValue;
  21703. }
  21704. assignMergeValue(object, key, newValue);
  21705. }
  21706. }, keysIn);
  21707. }
  21708. /**
  21709. * A specialized version of `baseMerge` for arrays and objects which performs
  21710. * deep merges and tracks traversed objects enabling objects with circular
  21711. * references to be merged.
  21712. *
  21713. * @private
  21714. * @param {Object} object The destination object.
  21715. * @param {Object} source The source object.
  21716. * @param {string} key The key of the value to merge.
  21717. * @param {number} srcIndex The index of `source`.
  21718. * @param {Function} mergeFunc The function to merge values.
  21719. * @param {Function} [customizer] The function to customize assigned values.
  21720. * @param {Object} [stack] Tracks traversed source values and their merged
  21721. * counterparts.
  21722. */
  21723. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21724. var objValue = safeGet(object, key),
  21725. srcValue = safeGet(source, key),
  21726. stacked = stack.get(srcValue);
  21727. if (stacked) {
  21728. assignMergeValue(object, key, stacked);
  21729. return;
  21730. }
  21731. var newValue = customizer
  21732. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21733. : undefined;
  21734. var isCommon = newValue === undefined;
  21735. if (isCommon) {
  21736. var isArr = isArray(srcValue),
  21737. isBuff = !isArr && isBuffer(srcValue),
  21738. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21739. newValue = srcValue;
  21740. if (isArr || isBuff || isTyped) {
  21741. if (isArray(objValue)) {
  21742. newValue = objValue;
  21743. }
  21744. else if (isArrayLikeObject(objValue)) {
  21745. newValue = copyArray(objValue);
  21746. }
  21747. else if (isBuff) {
  21748. isCommon = false;
  21749. newValue = cloneBuffer(srcValue, true);
  21750. }
  21751. else if (isTyped) {
  21752. isCommon = false;
  21753. newValue = cloneTypedArray(srcValue, true);
  21754. }
  21755. else {
  21756. newValue = [];
  21757. }
  21758. }
  21759. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21760. newValue = objValue;
  21761. if (isArguments(objValue)) {
  21762. newValue = toPlainObject(objValue);
  21763. }
  21764. else if (!isObject(objValue) || isFunction(objValue)) {
  21765. newValue = initCloneObject(srcValue);
  21766. }
  21767. }
  21768. else {
  21769. isCommon = false;
  21770. }
  21771. }
  21772. if (isCommon) {
  21773. // Recursively merge objects and arrays (susceptible to call stack limits).
  21774. stack.set(srcValue, newValue);
  21775. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21776. stack['delete'](srcValue);
  21777. }
  21778. assignMergeValue(object, key, newValue);
  21779. }
  21780. /**
  21781. * The base implementation of `_.nth` which doesn't coerce arguments.
  21782. *
  21783. * @private
  21784. * @param {Array} array The array to query.
  21785. * @param {number} n The index of the element to return.
  21786. * @returns {*} Returns the nth element of `array`.
  21787. */
  21788. function baseNth(array, n) {
  21789. var length = array.length;
  21790. if (!length) {
  21791. return;
  21792. }
  21793. n += n < 0 ? length : 0;
  21794. return isIndex(n, length) ? array[n] : undefined;
  21795. }
  21796. /**
  21797. * The base implementation of `_.orderBy` without param guards.
  21798. *
  21799. * @private
  21800. * @param {Array|Object} collection The collection to iterate over.
  21801. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21802. * @param {string[]} orders The sort orders of `iteratees`.
  21803. * @returns {Array} Returns the new sorted array.
  21804. */
  21805. function baseOrderBy(collection, iteratees, orders) {
  21806. var index = -1;
  21807. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21808. var result = baseMap(collection, function(value, key, collection) {
  21809. var criteria = arrayMap(iteratees, function(iteratee) {
  21810. return iteratee(value);
  21811. });
  21812. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21813. });
  21814. return baseSortBy(result, function(object, other) {
  21815. return compareMultiple(object, other, orders);
  21816. });
  21817. }
  21818. /**
  21819. * The base implementation of `_.pick` without support for individual
  21820. * property identifiers.
  21821. *
  21822. * @private
  21823. * @param {Object} object The source object.
  21824. * @param {string[]} paths The property paths to pick.
  21825. * @returns {Object} Returns the new object.
  21826. */
  21827. function basePick(object, paths) {
  21828. return basePickBy(object, paths, function(value, path) {
  21829. return hasIn(object, path);
  21830. });
  21831. }
  21832. /**
  21833. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21834. *
  21835. * @private
  21836. * @param {Object} object The source object.
  21837. * @param {string[]} paths The property paths to pick.
  21838. * @param {Function} predicate The function invoked per property.
  21839. * @returns {Object} Returns the new object.
  21840. */
  21841. function basePickBy(object, paths, predicate) {
  21842. var index = -1,
  21843. length = paths.length,
  21844. result = {};
  21845. while (++index < length) {
  21846. var path = paths[index],
  21847. value = baseGet(object, path);
  21848. if (predicate(value, path)) {
  21849. baseSet(result, castPath(path, object), value);
  21850. }
  21851. }
  21852. return result;
  21853. }
  21854. /**
  21855. * A specialized version of `baseProperty` which supports deep paths.
  21856. *
  21857. * @private
  21858. * @param {Array|string} path The path of the property to get.
  21859. * @returns {Function} Returns the new accessor function.
  21860. */
  21861. function basePropertyDeep(path) {
  21862. return function(object) {
  21863. return baseGet(object, path);
  21864. };
  21865. }
  21866. /**
  21867. * The base implementation of `_.pullAllBy` without support for iteratee
  21868. * shorthands.
  21869. *
  21870. * @private
  21871. * @param {Array} array The array to modify.
  21872. * @param {Array} values The values to remove.
  21873. * @param {Function} [iteratee] The iteratee invoked per element.
  21874. * @param {Function} [comparator] The comparator invoked per element.
  21875. * @returns {Array} Returns `array`.
  21876. */
  21877. function basePullAll(array, values, iteratee, comparator) {
  21878. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21879. index = -1,
  21880. length = values.length,
  21881. seen = array;
  21882. if (array === values) {
  21883. values = copyArray(values);
  21884. }
  21885. if (iteratee) {
  21886. seen = arrayMap(array, baseUnary(iteratee));
  21887. }
  21888. while (++index < length) {
  21889. var fromIndex = 0,
  21890. value = values[index],
  21891. computed = iteratee ? iteratee(value) : value;
  21892. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21893. if (seen !== array) {
  21894. splice.call(seen, fromIndex, 1);
  21895. }
  21896. splice.call(array, fromIndex, 1);
  21897. }
  21898. }
  21899. return array;
  21900. }
  21901. /**
  21902. * The base implementation of `_.pullAt` without support for individual
  21903. * indexes or capturing the removed elements.
  21904. *
  21905. * @private
  21906. * @param {Array} array The array to modify.
  21907. * @param {number[]} indexes The indexes of elements to remove.
  21908. * @returns {Array} Returns `array`.
  21909. */
  21910. function basePullAt(array, indexes) {
  21911. var length = array ? indexes.length : 0,
  21912. lastIndex = length - 1;
  21913. while (length--) {
  21914. var index = indexes[length];
  21915. if (length == lastIndex || index !== previous) {
  21916. var previous = index;
  21917. if (isIndex(index)) {
  21918. splice.call(array, index, 1);
  21919. } else {
  21920. baseUnset(array, index);
  21921. }
  21922. }
  21923. }
  21924. return array;
  21925. }
  21926. /**
  21927. * The base implementation of `_.random` without support for returning
  21928. * floating-point numbers.
  21929. *
  21930. * @private
  21931. * @param {number} lower The lower bound.
  21932. * @param {number} upper The upper bound.
  21933. * @returns {number} Returns the random number.
  21934. */
  21935. function baseRandom(lower, upper) {
  21936. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21937. }
  21938. /**
  21939. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21940. * coerce arguments.
  21941. *
  21942. * @private
  21943. * @param {number} start The start of the range.
  21944. * @param {number} end The end of the range.
  21945. * @param {number} step The value to increment or decrement by.
  21946. * @param {boolean} [fromRight] Specify iterating from right to left.
  21947. * @returns {Array} Returns the range of numbers.
  21948. */
  21949. function baseRange(start, end, step, fromRight) {
  21950. var index = -1,
  21951. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21952. result = Array(length);
  21953. while (length--) {
  21954. result[fromRight ? length : ++index] = start;
  21955. start += step;
  21956. }
  21957. return result;
  21958. }
  21959. /**
  21960. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21961. *
  21962. * @private
  21963. * @param {string} string The string to repeat.
  21964. * @param {number} n The number of times to repeat the string.
  21965. * @returns {string} Returns the repeated string.
  21966. */
  21967. function baseRepeat(string, n) {
  21968. var result = '';
  21969. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21970. return result;
  21971. }
  21972. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21973. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21974. do {
  21975. if (n % 2) {
  21976. result += string;
  21977. }
  21978. n = nativeFloor(n / 2);
  21979. if (n) {
  21980. string += string;
  21981. }
  21982. } while (n);
  21983. return result;
  21984. }
  21985. /**
  21986. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21987. *
  21988. * @private
  21989. * @param {Function} func The function to apply a rest parameter to.
  21990. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21991. * @returns {Function} Returns the new function.
  21992. */
  21993. function baseRest(func, start) {
  21994. return setToString(overRest(func, start, identity), func + '');
  21995. }
  21996. /**
  21997. * The base implementation of `_.sample`.
  21998. *
  21999. * @private
  22000. * @param {Array|Object} collection The collection to sample.
  22001. * @returns {*} Returns the random element.
  22002. */
  22003. function baseSample(collection) {
  22004. return arraySample(values(collection));
  22005. }
  22006. /**
  22007. * The base implementation of `_.sampleSize` without param guards.
  22008. *
  22009. * @private
  22010. * @param {Array|Object} collection The collection to sample.
  22011. * @param {number} n The number of elements to sample.
  22012. * @returns {Array} Returns the random elements.
  22013. */
  22014. function baseSampleSize(collection, n) {
  22015. var array = values(collection);
  22016. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22017. }
  22018. /**
  22019. * The base implementation of `_.set`.
  22020. *
  22021. * @private
  22022. * @param {Object} object The object to modify.
  22023. * @param {Array|string} path The path of the property to set.
  22024. * @param {*} value The value to set.
  22025. * @param {Function} [customizer] The function to customize path creation.
  22026. * @returns {Object} Returns `object`.
  22027. */
  22028. function baseSet(object, path, value, customizer) {
  22029. if (!isObject(object)) {
  22030. return object;
  22031. }
  22032. path = castPath(path, object);
  22033. var index = -1,
  22034. length = path.length,
  22035. lastIndex = length - 1,
  22036. nested = object;
  22037. while (nested != null && ++index < length) {
  22038. var key = toKey(path[index]),
  22039. newValue = value;
  22040. if (index != lastIndex) {
  22041. var objValue = nested[key];
  22042. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22043. if (newValue === undefined) {
  22044. newValue = isObject(objValue)
  22045. ? objValue
  22046. : (isIndex(path[index + 1]) ? [] : {});
  22047. }
  22048. }
  22049. assignValue(nested, key, newValue);
  22050. nested = nested[key];
  22051. }
  22052. return object;
  22053. }
  22054. /**
  22055. * The base implementation of `setData` without support for hot loop shorting.
  22056. *
  22057. * @private
  22058. * @param {Function} func The function to associate metadata with.
  22059. * @param {*} data The metadata.
  22060. * @returns {Function} Returns `func`.
  22061. */
  22062. var baseSetData = !metaMap ? identity : function(func, data) {
  22063. metaMap.set(func, data);
  22064. return func;
  22065. };
  22066. /**
  22067. * The base implementation of `setToString` without support for hot loop shorting.
  22068. *
  22069. * @private
  22070. * @param {Function} func The function to modify.
  22071. * @param {Function} string The `toString` result.
  22072. * @returns {Function} Returns `func`.
  22073. */
  22074. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22075. return defineProperty(func, 'toString', {
  22076. 'configurable': true,
  22077. 'enumerable': false,
  22078. 'value': constant(string),
  22079. 'writable': true
  22080. });
  22081. };
  22082. /**
  22083. * The base implementation of `_.shuffle`.
  22084. *
  22085. * @private
  22086. * @param {Array|Object} collection The collection to shuffle.
  22087. * @returns {Array} Returns the new shuffled array.
  22088. */
  22089. function baseShuffle(collection) {
  22090. return shuffleSelf(values(collection));
  22091. }
  22092. /**
  22093. * The base implementation of `_.slice` without an iteratee call guard.
  22094. *
  22095. * @private
  22096. * @param {Array} array The array to slice.
  22097. * @param {number} [start=0] The start position.
  22098. * @param {number} [end=array.length] The end position.
  22099. * @returns {Array} Returns the slice of `array`.
  22100. */
  22101. function baseSlice(array, start, end) {
  22102. var index = -1,
  22103. length = array.length;
  22104. if (start < 0) {
  22105. start = -start > length ? 0 : (length + start);
  22106. }
  22107. end = end > length ? length : end;
  22108. if (end < 0) {
  22109. end += length;
  22110. }
  22111. length = start > end ? 0 : ((end - start) >>> 0);
  22112. start >>>= 0;
  22113. var result = Array(length);
  22114. while (++index < length) {
  22115. result[index] = array[index + start];
  22116. }
  22117. return result;
  22118. }
  22119. /**
  22120. * The base implementation of `_.some` without support for iteratee shorthands.
  22121. *
  22122. * @private
  22123. * @param {Array|Object} collection The collection to iterate over.
  22124. * @param {Function} predicate The function invoked per iteration.
  22125. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22126. * else `false`.
  22127. */
  22128. function baseSome(collection, predicate) {
  22129. var result;
  22130. baseEach(collection, function(value, index, collection) {
  22131. result = predicate(value, index, collection);
  22132. return !result;
  22133. });
  22134. return !!result;
  22135. }
  22136. /**
  22137. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22138. * performs a binary search of `array` to determine the index at which `value`
  22139. * should be inserted into `array` in order to maintain its sort order.
  22140. *
  22141. * @private
  22142. * @param {Array} array The sorted array to inspect.
  22143. * @param {*} value The value to evaluate.
  22144. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22145. * @returns {number} Returns the index at which `value` should be inserted
  22146. * into `array`.
  22147. */
  22148. function baseSortedIndex(array, value, retHighest) {
  22149. var low = 0,
  22150. high = array == null ? low : array.length;
  22151. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22152. while (low < high) {
  22153. var mid = (low + high) >>> 1,
  22154. computed = array[mid];
  22155. if (computed !== null && !isSymbol(computed) &&
  22156. (retHighest ? (computed <= value) : (computed < value))) {
  22157. low = mid + 1;
  22158. } else {
  22159. high = mid;
  22160. }
  22161. }
  22162. return high;
  22163. }
  22164. return baseSortedIndexBy(array, value, identity, retHighest);
  22165. }
  22166. /**
  22167. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22168. * which invokes `iteratee` for `value` and each element of `array` to compute
  22169. * their sort ranking. The iteratee is invoked with one argument; (value).
  22170. *
  22171. * @private
  22172. * @param {Array} array The sorted array to inspect.
  22173. * @param {*} value The value to evaluate.
  22174. * @param {Function} iteratee The iteratee invoked per element.
  22175. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22176. * @returns {number} Returns the index at which `value` should be inserted
  22177. * into `array`.
  22178. */
  22179. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22180. value = iteratee(value);
  22181. var low = 0,
  22182. high = array == null ? 0 : array.length,
  22183. valIsNaN = value !== value,
  22184. valIsNull = value === null,
  22185. valIsSymbol = isSymbol(value),
  22186. valIsUndefined = value === undefined;
  22187. while (low < high) {
  22188. var mid = nativeFloor((low + high) / 2),
  22189. computed = iteratee(array[mid]),
  22190. othIsDefined = computed !== undefined,
  22191. othIsNull = computed === null,
  22192. othIsReflexive = computed === computed,
  22193. othIsSymbol = isSymbol(computed);
  22194. if (valIsNaN) {
  22195. var setLow = retHighest || othIsReflexive;
  22196. } else if (valIsUndefined) {
  22197. setLow = othIsReflexive && (retHighest || othIsDefined);
  22198. } else if (valIsNull) {
  22199. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22200. } else if (valIsSymbol) {
  22201. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22202. } else if (othIsNull || othIsSymbol) {
  22203. setLow = false;
  22204. } else {
  22205. setLow = retHighest ? (computed <= value) : (computed < value);
  22206. }
  22207. if (setLow) {
  22208. low = mid + 1;
  22209. } else {
  22210. high = mid;
  22211. }
  22212. }
  22213. return nativeMin(high, MAX_ARRAY_INDEX);
  22214. }
  22215. /**
  22216. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22217. * support for iteratee shorthands.
  22218. *
  22219. * @private
  22220. * @param {Array} array The array to inspect.
  22221. * @param {Function} [iteratee] The iteratee invoked per element.
  22222. * @returns {Array} Returns the new duplicate free array.
  22223. */
  22224. function baseSortedUniq(array, iteratee) {
  22225. var index = -1,
  22226. length = array.length,
  22227. resIndex = 0,
  22228. result = [];
  22229. while (++index < length) {
  22230. var value = array[index],
  22231. computed = iteratee ? iteratee(value) : value;
  22232. if (!index || !eq(computed, seen)) {
  22233. var seen = computed;
  22234. result[resIndex++] = value === 0 ? 0 : value;
  22235. }
  22236. }
  22237. return result;
  22238. }
  22239. /**
  22240. * The base implementation of `_.toNumber` which doesn't ensure correct
  22241. * conversions of binary, hexadecimal, or octal string values.
  22242. *
  22243. * @private
  22244. * @param {*} value The value to process.
  22245. * @returns {number} Returns the number.
  22246. */
  22247. function baseToNumber(value) {
  22248. if (typeof value == 'number') {
  22249. return value;
  22250. }
  22251. if (isSymbol(value)) {
  22252. return NAN;
  22253. }
  22254. return +value;
  22255. }
  22256. /**
  22257. * The base implementation of `_.toString` which doesn't convert nullish
  22258. * values to empty strings.
  22259. *
  22260. * @private
  22261. * @param {*} value The value to process.
  22262. * @returns {string} Returns the string.
  22263. */
  22264. function baseToString(value) {
  22265. // Exit early for strings to avoid a performance hit in some environments.
  22266. if (typeof value == 'string') {
  22267. return value;
  22268. }
  22269. if (isArray(value)) {
  22270. // Recursively convert values (susceptible to call stack limits).
  22271. return arrayMap(value, baseToString) + '';
  22272. }
  22273. if (isSymbol(value)) {
  22274. return symbolToString ? symbolToString.call(value) : '';
  22275. }
  22276. var result = (value + '');
  22277. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22278. }
  22279. /**
  22280. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22281. *
  22282. * @private
  22283. * @param {Array} array The array to inspect.
  22284. * @param {Function} [iteratee] The iteratee invoked per element.
  22285. * @param {Function} [comparator] The comparator invoked per element.
  22286. * @returns {Array} Returns the new duplicate free array.
  22287. */
  22288. function baseUniq(array, iteratee, comparator) {
  22289. var index = -1,
  22290. includes = arrayIncludes,
  22291. length = array.length,
  22292. isCommon = true,
  22293. result = [],
  22294. seen = result;
  22295. if (comparator) {
  22296. isCommon = false;
  22297. includes = arrayIncludesWith;
  22298. }
  22299. else if (length >= LARGE_ARRAY_SIZE) {
  22300. var set = iteratee ? null : createSet(array);
  22301. if (set) {
  22302. return setToArray(set);
  22303. }
  22304. isCommon = false;
  22305. includes = cacheHas;
  22306. seen = new SetCache;
  22307. }
  22308. else {
  22309. seen = iteratee ? [] : result;
  22310. }
  22311. outer:
  22312. while (++index < length) {
  22313. var value = array[index],
  22314. computed = iteratee ? iteratee(value) : value;
  22315. value = (comparator || value !== 0) ? value : 0;
  22316. if (isCommon && computed === computed) {
  22317. var seenIndex = seen.length;
  22318. while (seenIndex--) {
  22319. if (seen[seenIndex] === computed) {
  22320. continue outer;
  22321. }
  22322. }
  22323. if (iteratee) {
  22324. seen.push(computed);
  22325. }
  22326. result.push(value);
  22327. }
  22328. else if (!includes(seen, computed, comparator)) {
  22329. if (seen !== result) {
  22330. seen.push(computed);
  22331. }
  22332. result.push(value);
  22333. }
  22334. }
  22335. return result;
  22336. }
  22337. /**
  22338. * The base implementation of `_.unset`.
  22339. *
  22340. * @private
  22341. * @param {Object} object The object to modify.
  22342. * @param {Array|string} path The property path to unset.
  22343. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22344. */
  22345. function baseUnset(object, path) {
  22346. path = castPath(path, object);
  22347. object = parent(object, path);
  22348. return object == null || delete object[toKey(last(path))];
  22349. }
  22350. /**
  22351. * The base implementation of `_.update`.
  22352. *
  22353. * @private
  22354. * @param {Object} object The object to modify.
  22355. * @param {Array|string} path The path of the property to update.
  22356. * @param {Function} updater The function to produce the updated value.
  22357. * @param {Function} [customizer] The function to customize path creation.
  22358. * @returns {Object} Returns `object`.
  22359. */
  22360. function baseUpdate(object, path, updater, customizer) {
  22361. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22362. }
  22363. /**
  22364. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22365. * without support for iteratee shorthands.
  22366. *
  22367. * @private
  22368. * @param {Array} array The array to query.
  22369. * @param {Function} predicate The function invoked per iteration.
  22370. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22371. * @param {boolean} [fromRight] Specify iterating from right to left.
  22372. * @returns {Array} Returns the slice of `array`.
  22373. */
  22374. function baseWhile(array, predicate, isDrop, fromRight) {
  22375. var length = array.length,
  22376. index = fromRight ? length : -1;
  22377. while ((fromRight ? index-- : ++index < length) &&
  22378. predicate(array[index], index, array)) {}
  22379. return isDrop
  22380. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22381. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22382. }
  22383. /**
  22384. * The base implementation of `wrapperValue` which returns the result of
  22385. * performing a sequence of actions on the unwrapped `value`, where each
  22386. * successive action is supplied the return value of the previous.
  22387. *
  22388. * @private
  22389. * @param {*} value The unwrapped value.
  22390. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22391. * @returns {*} Returns the resolved value.
  22392. */
  22393. function baseWrapperValue(value, actions) {
  22394. var result = value;
  22395. if (result instanceof LazyWrapper) {
  22396. result = result.value();
  22397. }
  22398. return arrayReduce(actions, function(result, action) {
  22399. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22400. }, result);
  22401. }
  22402. /**
  22403. * The base implementation of methods like `_.xor`, without support for
  22404. * iteratee shorthands, that accepts an array of arrays to inspect.
  22405. *
  22406. * @private
  22407. * @param {Array} arrays The arrays to inspect.
  22408. * @param {Function} [iteratee] The iteratee invoked per element.
  22409. * @param {Function} [comparator] The comparator invoked per element.
  22410. * @returns {Array} Returns the new array of values.
  22411. */
  22412. function baseXor(arrays, iteratee, comparator) {
  22413. var length = arrays.length;
  22414. if (length < 2) {
  22415. return length ? baseUniq(arrays[0]) : [];
  22416. }
  22417. var index = -1,
  22418. result = Array(length);
  22419. while (++index < length) {
  22420. var array = arrays[index],
  22421. othIndex = -1;
  22422. while (++othIndex < length) {
  22423. if (othIndex != index) {
  22424. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22425. }
  22426. }
  22427. }
  22428. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22429. }
  22430. /**
  22431. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22432. *
  22433. * @private
  22434. * @param {Array} props The property identifiers.
  22435. * @param {Array} values The property values.
  22436. * @param {Function} assignFunc The function to assign values.
  22437. * @returns {Object} Returns the new object.
  22438. */
  22439. function baseZipObject(props, values, assignFunc) {
  22440. var index = -1,
  22441. length = props.length,
  22442. valsLength = values.length,
  22443. result = {};
  22444. while (++index < length) {
  22445. var value = index < valsLength ? values[index] : undefined;
  22446. assignFunc(result, props[index], value);
  22447. }
  22448. return result;
  22449. }
  22450. /**
  22451. * Casts `value` to an empty array if it's not an array like object.
  22452. *
  22453. * @private
  22454. * @param {*} value The value to inspect.
  22455. * @returns {Array|Object} Returns the cast array-like object.
  22456. */
  22457. function castArrayLikeObject(value) {
  22458. return isArrayLikeObject(value) ? value : [];
  22459. }
  22460. /**
  22461. * Casts `value` to `identity` if it's not a function.
  22462. *
  22463. * @private
  22464. * @param {*} value The value to inspect.
  22465. * @returns {Function} Returns cast function.
  22466. */
  22467. function castFunction(value) {
  22468. return typeof value == 'function' ? value : identity;
  22469. }
  22470. /**
  22471. * Casts `value` to a path array if it's not one.
  22472. *
  22473. * @private
  22474. * @param {*} value The value to inspect.
  22475. * @param {Object} [object] The object to query keys on.
  22476. * @returns {Array} Returns the cast property path array.
  22477. */
  22478. function castPath(value, object) {
  22479. if (isArray(value)) {
  22480. return value;
  22481. }
  22482. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22483. }
  22484. /**
  22485. * A `baseRest` alias which can be replaced with `identity` by module
  22486. * replacement plugins.
  22487. *
  22488. * @private
  22489. * @type {Function}
  22490. * @param {Function} func The function to apply a rest parameter to.
  22491. * @returns {Function} Returns the new function.
  22492. */
  22493. var castRest = baseRest;
  22494. /**
  22495. * Casts `array` to a slice if it's needed.
  22496. *
  22497. * @private
  22498. * @param {Array} array The array to inspect.
  22499. * @param {number} start The start position.
  22500. * @param {number} [end=array.length] The end position.
  22501. * @returns {Array} Returns the cast slice.
  22502. */
  22503. function castSlice(array, start, end) {
  22504. var length = array.length;
  22505. end = end === undefined ? length : end;
  22506. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22507. }
  22508. /**
  22509. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22510. *
  22511. * @private
  22512. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22513. */
  22514. var clearTimeout = ctxClearTimeout || function(id) {
  22515. return root.clearTimeout(id);
  22516. };
  22517. /**
  22518. * Creates a clone of `buffer`.
  22519. *
  22520. * @private
  22521. * @param {Buffer} buffer The buffer to clone.
  22522. * @param {boolean} [isDeep] Specify a deep clone.
  22523. * @returns {Buffer} Returns the cloned buffer.
  22524. */
  22525. function cloneBuffer(buffer, isDeep) {
  22526. if (isDeep) {
  22527. return buffer.slice();
  22528. }
  22529. var length = buffer.length,
  22530. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22531. buffer.copy(result);
  22532. return result;
  22533. }
  22534. /**
  22535. * Creates a clone of `arrayBuffer`.
  22536. *
  22537. * @private
  22538. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22539. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22540. */
  22541. function cloneArrayBuffer(arrayBuffer) {
  22542. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22543. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22544. return result;
  22545. }
  22546. /**
  22547. * Creates a clone of `dataView`.
  22548. *
  22549. * @private
  22550. * @param {Object} dataView The data view to clone.
  22551. * @param {boolean} [isDeep] Specify a deep clone.
  22552. * @returns {Object} Returns the cloned data view.
  22553. */
  22554. function cloneDataView(dataView, isDeep) {
  22555. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22556. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22557. }
  22558. /**
  22559. * Creates a clone of `regexp`.
  22560. *
  22561. * @private
  22562. * @param {Object} regexp The regexp to clone.
  22563. * @returns {Object} Returns the cloned regexp.
  22564. */
  22565. function cloneRegExp(regexp) {
  22566. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22567. result.lastIndex = regexp.lastIndex;
  22568. return result;
  22569. }
  22570. /**
  22571. * Creates a clone of the `symbol` object.
  22572. *
  22573. * @private
  22574. * @param {Object} symbol The symbol object to clone.
  22575. * @returns {Object} Returns the cloned symbol object.
  22576. */
  22577. function cloneSymbol(symbol) {
  22578. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22579. }
  22580. /**
  22581. * Creates a clone of `typedArray`.
  22582. *
  22583. * @private
  22584. * @param {Object} typedArray The typed array to clone.
  22585. * @param {boolean} [isDeep] Specify a deep clone.
  22586. * @returns {Object} Returns the cloned typed array.
  22587. */
  22588. function cloneTypedArray(typedArray, isDeep) {
  22589. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22590. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22591. }
  22592. /**
  22593. * Compares values to sort them in ascending order.
  22594. *
  22595. * @private
  22596. * @param {*} value The value to compare.
  22597. * @param {*} other The other value to compare.
  22598. * @returns {number} Returns the sort order indicator for `value`.
  22599. */
  22600. function compareAscending(value, other) {
  22601. if (value !== other) {
  22602. var valIsDefined = value !== undefined,
  22603. valIsNull = value === null,
  22604. valIsReflexive = value === value,
  22605. valIsSymbol = isSymbol(value);
  22606. var othIsDefined = other !== undefined,
  22607. othIsNull = other === null,
  22608. othIsReflexive = other === other,
  22609. othIsSymbol = isSymbol(other);
  22610. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22611. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22612. (valIsNull && othIsDefined && othIsReflexive) ||
  22613. (!valIsDefined && othIsReflexive) ||
  22614. !valIsReflexive) {
  22615. return 1;
  22616. }
  22617. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22618. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22619. (othIsNull && valIsDefined && valIsReflexive) ||
  22620. (!othIsDefined && valIsReflexive) ||
  22621. !othIsReflexive) {
  22622. return -1;
  22623. }
  22624. }
  22625. return 0;
  22626. }
  22627. /**
  22628. * Used by `_.orderBy` to compare multiple properties of a value to another
  22629. * and stable sort them.
  22630. *
  22631. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22632. * specify an order of "desc" for descending or "asc" for ascending sort order
  22633. * of corresponding values.
  22634. *
  22635. * @private
  22636. * @param {Object} object The object to compare.
  22637. * @param {Object} other The other object to compare.
  22638. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22639. * @returns {number} Returns the sort order indicator for `object`.
  22640. */
  22641. function compareMultiple(object, other, orders) {
  22642. var index = -1,
  22643. objCriteria = object.criteria,
  22644. othCriteria = other.criteria,
  22645. length = objCriteria.length,
  22646. ordersLength = orders.length;
  22647. while (++index < length) {
  22648. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22649. if (result) {
  22650. if (index >= ordersLength) {
  22651. return result;
  22652. }
  22653. var order = orders[index];
  22654. return result * (order == 'desc' ? -1 : 1);
  22655. }
  22656. }
  22657. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22658. // that causes it, under certain circumstances, to provide the same value for
  22659. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22660. // for more details.
  22661. //
  22662. // This also ensures a stable sort in V8 and other engines.
  22663. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22664. return object.index - other.index;
  22665. }
  22666. /**
  22667. * Creates an array that is the composition of partially applied arguments,
  22668. * placeholders, and provided arguments into a single array of arguments.
  22669. *
  22670. * @private
  22671. * @param {Array} args The provided arguments.
  22672. * @param {Array} partials The arguments to prepend to those provided.
  22673. * @param {Array} holders The `partials` placeholder indexes.
  22674. * @params {boolean} [isCurried] Specify composing for a curried function.
  22675. * @returns {Array} Returns the new array of composed arguments.
  22676. */
  22677. function composeArgs(args, partials, holders, isCurried) {
  22678. var argsIndex = -1,
  22679. argsLength = args.length,
  22680. holdersLength = holders.length,
  22681. leftIndex = -1,
  22682. leftLength = partials.length,
  22683. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22684. result = Array(leftLength + rangeLength),
  22685. isUncurried = !isCurried;
  22686. while (++leftIndex < leftLength) {
  22687. result[leftIndex] = partials[leftIndex];
  22688. }
  22689. while (++argsIndex < holdersLength) {
  22690. if (isUncurried || argsIndex < argsLength) {
  22691. result[holders[argsIndex]] = args[argsIndex];
  22692. }
  22693. }
  22694. while (rangeLength--) {
  22695. result[leftIndex++] = args[argsIndex++];
  22696. }
  22697. return result;
  22698. }
  22699. /**
  22700. * This function is like `composeArgs` except that the arguments composition
  22701. * is tailored for `_.partialRight`.
  22702. *
  22703. * @private
  22704. * @param {Array} args The provided arguments.
  22705. * @param {Array} partials The arguments to append to those provided.
  22706. * @param {Array} holders The `partials` placeholder indexes.
  22707. * @params {boolean} [isCurried] Specify composing for a curried function.
  22708. * @returns {Array} Returns the new array of composed arguments.
  22709. */
  22710. function composeArgsRight(args, partials, holders, isCurried) {
  22711. var argsIndex = -1,
  22712. argsLength = args.length,
  22713. holdersIndex = -1,
  22714. holdersLength = holders.length,
  22715. rightIndex = -1,
  22716. rightLength = partials.length,
  22717. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22718. result = Array(rangeLength + rightLength),
  22719. isUncurried = !isCurried;
  22720. while (++argsIndex < rangeLength) {
  22721. result[argsIndex] = args[argsIndex];
  22722. }
  22723. var offset = argsIndex;
  22724. while (++rightIndex < rightLength) {
  22725. result[offset + rightIndex] = partials[rightIndex];
  22726. }
  22727. while (++holdersIndex < holdersLength) {
  22728. if (isUncurried || argsIndex < argsLength) {
  22729. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22730. }
  22731. }
  22732. return result;
  22733. }
  22734. /**
  22735. * Copies the values of `source` to `array`.
  22736. *
  22737. * @private
  22738. * @param {Array} source The array to copy values from.
  22739. * @param {Array} [array=[]] The array to copy values to.
  22740. * @returns {Array} Returns `array`.
  22741. */
  22742. function copyArray(source, array) {
  22743. var index = -1,
  22744. length = source.length;
  22745. array || (array = Array(length));
  22746. while (++index < length) {
  22747. array[index] = source[index];
  22748. }
  22749. return array;
  22750. }
  22751. /**
  22752. * Copies properties of `source` to `object`.
  22753. *
  22754. * @private
  22755. * @param {Object} source The object to copy properties from.
  22756. * @param {Array} props The property identifiers to copy.
  22757. * @param {Object} [object={}] The object to copy properties to.
  22758. * @param {Function} [customizer] The function to customize copied values.
  22759. * @returns {Object} Returns `object`.
  22760. */
  22761. function copyObject(source, props, object, customizer) {
  22762. var isNew = !object;
  22763. object || (object = {});
  22764. var index = -1,
  22765. length = props.length;
  22766. while (++index < length) {
  22767. var key = props[index];
  22768. var newValue = customizer
  22769. ? customizer(object[key], source[key], key, object, source)
  22770. : undefined;
  22771. if (newValue === undefined) {
  22772. newValue = source[key];
  22773. }
  22774. if (isNew) {
  22775. baseAssignValue(object, key, newValue);
  22776. } else {
  22777. assignValue(object, key, newValue);
  22778. }
  22779. }
  22780. return object;
  22781. }
  22782. /**
  22783. * Copies own symbols of `source` to `object`.
  22784. *
  22785. * @private
  22786. * @param {Object} source The object to copy symbols from.
  22787. * @param {Object} [object={}] The object to copy symbols to.
  22788. * @returns {Object} Returns `object`.
  22789. */
  22790. function copySymbols(source, object) {
  22791. return copyObject(source, getSymbols(source), object);
  22792. }
  22793. /**
  22794. * Copies own and inherited symbols of `source` to `object`.
  22795. *
  22796. * @private
  22797. * @param {Object} source The object to copy symbols from.
  22798. * @param {Object} [object={}] The object to copy symbols to.
  22799. * @returns {Object} Returns `object`.
  22800. */
  22801. function copySymbolsIn(source, object) {
  22802. return copyObject(source, getSymbolsIn(source), object);
  22803. }
  22804. /**
  22805. * Creates a function like `_.groupBy`.
  22806. *
  22807. * @private
  22808. * @param {Function} setter The function to set accumulator values.
  22809. * @param {Function} [initializer] The accumulator object initializer.
  22810. * @returns {Function} Returns the new aggregator function.
  22811. */
  22812. function createAggregator(setter, initializer) {
  22813. return function(collection, iteratee) {
  22814. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22815. accumulator = initializer ? initializer() : {};
  22816. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22817. };
  22818. }
  22819. /**
  22820. * Creates a function like `_.assign`.
  22821. *
  22822. * @private
  22823. * @param {Function} assigner The function to assign values.
  22824. * @returns {Function} Returns the new assigner function.
  22825. */
  22826. function createAssigner(assigner) {
  22827. return baseRest(function(object, sources) {
  22828. var index = -1,
  22829. length = sources.length,
  22830. customizer = length > 1 ? sources[length - 1] : undefined,
  22831. guard = length > 2 ? sources[2] : undefined;
  22832. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22833. ? (length--, customizer)
  22834. : undefined;
  22835. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22836. customizer = length < 3 ? undefined : customizer;
  22837. length = 1;
  22838. }
  22839. object = Object(object);
  22840. while (++index < length) {
  22841. var source = sources[index];
  22842. if (source) {
  22843. assigner(object, source, index, customizer);
  22844. }
  22845. }
  22846. return object;
  22847. });
  22848. }
  22849. /**
  22850. * Creates a `baseEach` or `baseEachRight` function.
  22851. *
  22852. * @private
  22853. * @param {Function} eachFunc The function to iterate over a collection.
  22854. * @param {boolean} [fromRight] Specify iterating from right to left.
  22855. * @returns {Function} Returns the new base function.
  22856. */
  22857. function createBaseEach(eachFunc, fromRight) {
  22858. return function(collection, iteratee) {
  22859. if (collection == null) {
  22860. return collection;
  22861. }
  22862. if (!isArrayLike(collection)) {
  22863. return eachFunc(collection, iteratee);
  22864. }
  22865. var length = collection.length,
  22866. index = fromRight ? length : -1,
  22867. iterable = Object(collection);
  22868. while ((fromRight ? index-- : ++index < length)) {
  22869. if (iteratee(iterable[index], index, iterable) === false) {
  22870. break;
  22871. }
  22872. }
  22873. return collection;
  22874. };
  22875. }
  22876. /**
  22877. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22878. *
  22879. * @private
  22880. * @param {boolean} [fromRight] Specify iterating from right to left.
  22881. * @returns {Function} Returns the new base function.
  22882. */
  22883. function createBaseFor(fromRight) {
  22884. return function(object, iteratee, keysFunc) {
  22885. var index = -1,
  22886. iterable = Object(object),
  22887. props = keysFunc(object),
  22888. length = props.length;
  22889. while (length--) {
  22890. var key = props[fromRight ? length : ++index];
  22891. if (iteratee(iterable[key], key, iterable) === false) {
  22892. break;
  22893. }
  22894. }
  22895. return object;
  22896. };
  22897. }
  22898. /**
  22899. * Creates a function that wraps `func` to invoke it with the optional `this`
  22900. * binding of `thisArg`.
  22901. *
  22902. * @private
  22903. * @param {Function} func The function to wrap.
  22904. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22905. * @param {*} [thisArg] The `this` binding of `func`.
  22906. * @returns {Function} Returns the new wrapped function.
  22907. */
  22908. function createBind(func, bitmask, thisArg) {
  22909. var isBind = bitmask & WRAP_BIND_FLAG,
  22910. Ctor = createCtor(func);
  22911. function wrapper() {
  22912. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22913. return fn.apply(isBind ? thisArg : this, arguments);
  22914. }
  22915. return wrapper;
  22916. }
  22917. /**
  22918. * Creates a function like `_.lowerFirst`.
  22919. *
  22920. * @private
  22921. * @param {string} methodName The name of the `String` case method to use.
  22922. * @returns {Function} Returns the new case function.
  22923. */
  22924. function createCaseFirst(methodName) {
  22925. return function(string) {
  22926. string = toString(string);
  22927. var strSymbols = hasUnicode(string)
  22928. ? stringToArray(string)
  22929. : undefined;
  22930. var chr = strSymbols
  22931. ? strSymbols[0]
  22932. : string.charAt(0);
  22933. var trailing = strSymbols
  22934. ? castSlice(strSymbols, 1).join('')
  22935. : string.slice(1);
  22936. return chr[methodName]() + trailing;
  22937. };
  22938. }
  22939. /**
  22940. * Creates a function like `_.camelCase`.
  22941. *
  22942. * @private
  22943. * @param {Function} callback The function to combine each word.
  22944. * @returns {Function} Returns the new compounder function.
  22945. */
  22946. function createCompounder(callback) {
  22947. return function(string) {
  22948. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22949. };
  22950. }
  22951. /**
  22952. * Creates a function that produces an instance of `Ctor` regardless of
  22953. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22954. *
  22955. * @private
  22956. * @param {Function} Ctor The constructor to wrap.
  22957. * @returns {Function} Returns the new wrapped function.
  22958. */
  22959. function createCtor(Ctor) {
  22960. return function() {
  22961. // Use a `switch` statement to work with class constructors. See
  22962. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22963. // for more details.
  22964. var args = arguments;
  22965. switch (args.length) {
  22966. case 0: return new Ctor;
  22967. case 1: return new Ctor(args[0]);
  22968. case 2: return new Ctor(args[0], args[1]);
  22969. case 3: return new Ctor(args[0], args[1], args[2]);
  22970. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22971. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22972. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22973. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22974. }
  22975. var thisBinding = baseCreate(Ctor.prototype),
  22976. result = Ctor.apply(thisBinding, args);
  22977. // Mimic the constructor's `return` behavior.
  22978. // See https://es5.github.io/#x13.2.2 for more details.
  22979. return isObject(result) ? result : thisBinding;
  22980. };
  22981. }
  22982. /**
  22983. * Creates a function that wraps `func` to enable currying.
  22984. *
  22985. * @private
  22986. * @param {Function} func The function to wrap.
  22987. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22988. * @param {number} arity The arity of `func`.
  22989. * @returns {Function} Returns the new wrapped function.
  22990. */
  22991. function createCurry(func, bitmask, arity) {
  22992. var Ctor = createCtor(func);
  22993. function wrapper() {
  22994. var length = arguments.length,
  22995. args = Array(length),
  22996. index = length,
  22997. placeholder = getHolder(wrapper);
  22998. while (index--) {
  22999. args[index] = arguments[index];
  23000. }
  23001. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23002. ? []
  23003. : replaceHolders(args, placeholder);
  23004. length -= holders.length;
  23005. if (length < arity) {
  23006. return createRecurry(
  23007. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23008. args, holders, undefined, undefined, arity - length);
  23009. }
  23010. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23011. return apply(fn, this, args);
  23012. }
  23013. return wrapper;
  23014. }
  23015. /**
  23016. * Creates a `_.find` or `_.findLast` function.
  23017. *
  23018. * @private
  23019. * @param {Function} findIndexFunc The function to find the collection index.
  23020. * @returns {Function} Returns the new find function.
  23021. */
  23022. function createFind(findIndexFunc) {
  23023. return function(collection, predicate, fromIndex) {
  23024. var iterable = Object(collection);
  23025. if (!isArrayLike(collection)) {
  23026. var iteratee = getIteratee(predicate, 3);
  23027. collection = keys(collection);
  23028. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23029. }
  23030. var index = findIndexFunc(collection, predicate, fromIndex);
  23031. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23032. };
  23033. }
  23034. /**
  23035. * Creates a `_.flow` or `_.flowRight` function.
  23036. *
  23037. * @private
  23038. * @param {boolean} [fromRight] Specify iterating from right to left.
  23039. * @returns {Function} Returns the new flow function.
  23040. */
  23041. function createFlow(fromRight) {
  23042. return flatRest(function(funcs) {
  23043. var length = funcs.length,
  23044. index = length,
  23045. prereq = LodashWrapper.prototype.thru;
  23046. if (fromRight) {
  23047. funcs.reverse();
  23048. }
  23049. while (index--) {
  23050. var func = funcs[index];
  23051. if (typeof func != 'function') {
  23052. throw new TypeError(FUNC_ERROR_TEXT);
  23053. }
  23054. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23055. var wrapper = new LodashWrapper([], true);
  23056. }
  23057. }
  23058. index = wrapper ? index : length;
  23059. while (++index < length) {
  23060. func = funcs[index];
  23061. var funcName = getFuncName(func),
  23062. data = funcName == 'wrapper' ? getData(func) : undefined;
  23063. if (data && isLaziable(data[0]) &&
  23064. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23065. !data[4].length && data[9] == 1
  23066. ) {
  23067. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23068. } else {
  23069. wrapper = (func.length == 1 && isLaziable(func))
  23070. ? wrapper[funcName]()
  23071. : wrapper.thru(func);
  23072. }
  23073. }
  23074. return function() {
  23075. var args = arguments,
  23076. value = args[0];
  23077. if (wrapper && args.length == 1 && isArray(value)) {
  23078. return wrapper.plant(value).value();
  23079. }
  23080. var index = 0,
  23081. result = length ? funcs[index].apply(this, args) : value;
  23082. while (++index < length) {
  23083. result = funcs[index].call(this, result);
  23084. }
  23085. return result;
  23086. };
  23087. });
  23088. }
  23089. /**
  23090. * Creates a function that wraps `func` to invoke it with optional `this`
  23091. * binding of `thisArg`, partial application, and currying.
  23092. *
  23093. * @private
  23094. * @param {Function|string} func The function or method name to wrap.
  23095. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23096. * @param {*} [thisArg] The `this` binding of `func`.
  23097. * @param {Array} [partials] The arguments to prepend to those provided to
  23098. * the new function.
  23099. * @param {Array} [holders] The `partials` placeholder indexes.
  23100. * @param {Array} [partialsRight] The arguments to append to those provided
  23101. * to the new function.
  23102. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23103. * @param {Array} [argPos] The argument positions of the new function.
  23104. * @param {number} [ary] The arity cap of `func`.
  23105. * @param {number} [arity] The arity of `func`.
  23106. * @returns {Function} Returns the new wrapped function.
  23107. */
  23108. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23109. var isAry = bitmask & WRAP_ARY_FLAG,
  23110. isBind = bitmask & WRAP_BIND_FLAG,
  23111. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23112. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23113. isFlip = bitmask & WRAP_FLIP_FLAG,
  23114. Ctor = isBindKey ? undefined : createCtor(func);
  23115. function wrapper() {
  23116. var length = arguments.length,
  23117. args = Array(length),
  23118. index = length;
  23119. while (index--) {
  23120. args[index] = arguments[index];
  23121. }
  23122. if (isCurried) {
  23123. var placeholder = getHolder(wrapper),
  23124. holdersCount = countHolders(args, placeholder);
  23125. }
  23126. if (partials) {
  23127. args = composeArgs(args, partials, holders, isCurried);
  23128. }
  23129. if (partialsRight) {
  23130. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23131. }
  23132. length -= holdersCount;
  23133. if (isCurried && length < arity) {
  23134. var newHolders = replaceHolders(args, placeholder);
  23135. return createRecurry(
  23136. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23137. args, newHolders, argPos, ary, arity - length
  23138. );
  23139. }
  23140. var thisBinding = isBind ? thisArg : this,
  23141. fn = isBindKey ? thisBinding[func] : func;
  23142. length = args.length;
  23143. if (argPos) {
  23144. args = reorder(args, argPos);
  23145. } else if (isFlip && length > 1) {
  23146. args.reverse();
  23147. }
  23148. if (isAry && ary < length) {
  23149. args.length = ary;
  23150. }
  23151. if (this && this !== root && this instanceof wrapper) {
  23152. fn = Ctor || createCtor(fn);
  23153. }
  23154. return fn.apply(thisBinding, args);
  23155. }
  23156. return wrapper;
  23157. }
  23158. /**
  23159. * Creates a function like `_.invertBy`.
  23160. *
  23161. * @private
  23162. * @param {Function} setter The function to set accumulator values.
  23163. * @param {Function} toIteratee The function to resolve iteratees.
  23164. * @returns {Function} Returns the new inverter function.
  23165. */
  23166. function createInverter(setter, toIteratee) {
  23167. return function(object, iteratee) {
  23168. return baseInverter(object, setter, toIteratee(iteratee), {});
  23169. };
  23170. }
  23171. /**
  23172. * Creates a function that performs a mathematical operation on two values.
  23173. *
  23174. * @private
  23175. * @param {Function} operator The function to perform the operation.
  23176. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23177. * @returns {Function} Returns the new mathematical operation function.
  23178. */
  23179. function createMathOperation(operator, defaultValue) {
  23180. return function(value, other) {
  23181. var result;
  23182. if (value === undefined && other === undefined) {
  23183. return defaultValue;
  23184. }
  23185. if (value !== undefined) {
  23186. result = value;
  23187. }
  23188. if (other !== undefined) {
  23189. if (result === undefined) {
  23190. return other;
  23191. }
  23192. if (typeof value == 'string' || typeof other == 'string') {
  23193. value = baseToString(value);
  23194. other = baseToString(other);
  23195. } else {
  23196. value = baseToNumber(value);
  23197. other = baseToNumber(other);
  23198. }
  23199. result = operator(value, other);
  23200. }
  23201. return result;
  23202. };
  23203. }
  23204. /**
  23205. * Creates a function like `_.over`.
  23206. *
  23207. * @private
  23208. * @param {Function} arrayFunc The function to iterate over iteratees.
  23209. * @returns {Function} Returns the new over function.
  23210. */
  23211. function createOver(arrayFunc) {
  23212. return flatRest(function(iteratees) {
  23213. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23214. return baseRest(function(args) {
  23215. var thisArg = this;
  23216. return arrayFunc(iteratees, function(iteratee) {
  23217. return apply(iteratee, thisArg, args);
  23218. });
  23219. });
  23220. });
  23221. }
  23222. /**
  23223. * Creates the padding for `string` based on `length`. The `chars` string
  23224. * is truncated if the number of characters exceeds `length`.
  23225. *
  23226. * @private
  23227. * @param {number} length The padding length.
  23228. * @param {string} [chars=' '] The string used as padding.
  23229. * @returns {string} Returns the padding for `string`.
  23230. */
  23231. function createPadding(length, chars) {
  23232. chars = chars === undefined ? ' ' : baseToString(chars);
  23233. var charsLength = chars.length;
  23234. if (charsLength < 2) {
  23235. return charsLength ? baseRepeat(chars, length) : chars;
  23236. }
  23237. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23238. return hasUnicode(chars)
  23239. ? castSlice(stringToArray(result), 0, length).join('')
  23240. : result.slice(0, length);
  23241. }
  23242. /**
  23243. * Creates a function that wraps `func` to invoke it with the `this` binding
  23244. * of `thisArg` and `partials` prepended to the arguments it receives.
  23245. *
  23246. * @private
  23247. * @param {Function} func The function to wrap.
  23248. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23249. * @param {*} thisArg The `this` binding of `func`.
  23250. * @param {Array} partials The arguments to prepend to those provided to
  23251. * the new function.
  23252. * @returns {Function} Returns the new wrapped function.
  23253. */
  23254. function createPartial(func, bitmask, thisArg, partials) {
  23255. var isBind = bitmask & WRAP_BIND_FLAG,
  23256. Ctor = createCtor(func);
  23257. function wrapper() {
  23258. var argsIndex = -1,
  23259. argsLength = arguments.length,
  23260. leftIndex = -1,
  23261. leftLength = partials.length,
  23262. args = Array(leftLength + argsLength),
  23263. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23264. while (++leftIndex < leftLength) {
  23265. args[leftIndex] = partials[leftIndex];
  23266. }
  23267. while (argsLength--) {
  23268. args[leftIndex++] = arguments[++argsIndex];
  23269. }
  23270. return apply(fn, isBind ? thisArg : this, args);
  23271. }
  23272. return wrapper;
  23273. }
  23274. /**
  23275. * Creates a `_.range` or `_.rangeRight` function.
  23276. *
  23277. * @private
  23278. * @param {boolean} [fromRight] Specify iterating from right to left.
  23279. * @returns {Function} Returns the new range function.
  23280. */
  23281. function createRange(fromRight) {
  23282. return function(start, end, step) {
  23283. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23284. end = step = undefined;
  23285. }
  23286. // Ensure the sign of `-0` is preserved.
  23287. start = toFinite(start);
  23288. if (end === undefined) {
  23289. end = start;
  23290. start = 0;
  23291. } else {
  23292. end = toFinite(end);
  23293. }
  23294. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23295. return baseRange(start, end, step, fromRight);
  23296. };
  23297. }
  23298. /**
  23299. * Creates a function that performs a relational operation on two values.
  23300. *
  23301. * @private
  23302. * @param {Function} operator The function to perform the operation.
  23303. * @returns {Function} Returns the new relational operation function.
  23304. */
  23305. function createRelationalOperation(operator) {
  23306. return function(value, other) {
  23307. if (!(typeof value == 'string' && typeof other == 'string')) {
  23308. value = toNumber(value);
  23309. other = toNumber(other);
  23310. }
  23311. return operator(value, other);
  23312. };
  23313. }
  23314. /**
  23315. * Creates a function that wraps `func` to continue currying.
  23316. *
  23317. * @private
  23318. * @param {Function} func The function to wrap.
  23319. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23320. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23321. * @param {*} placeholder The placeholder value.
  23322. * @param {*} [thisArg] The `this` binding of `func`.
  23323. * @param {Array} [partials] The arguments to prepend to those provided to
  23324. * the new function.
  23325. * @param {Array} [holders] The `partials` placeholder indexes.
  23326. * @param {Array} [argPos] The argument positions of the new function.
  23327. * @param {number} [ary] The arity cap of `func`.
  23328. * @param {number} [arity] The arity of `func`.
  23329. * @returns {Function} Returns the new wrapped function.
  23330. */
  23331. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23332. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23333. newHolders = isCurry ? holders : undefined,
  23334. newHoldersRight = isCurry ? undefined : holders,
  23335. newPartials = isCurry ? partials : undefined,
  23336. newPartialsRight = isCurry ? undefined : partials;
  23337. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23338. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23339. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23340. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23341. }
  23342. var newData = [
  23343. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23344. newHoldersRight, argPos, ary, arity
  23345. ];
  23346. var result = wrapFunc.apply(undefined, newData);
  23347. if (isLaziable(func)) {
  23348. setData(result, newData);
  23349. }
  23350. result.placeholder = placeholder;
  23351. return setWrapToString(result, func, bitmask);
  23352. }
  23353. /**
  23354. * Creates a function like `_.round`.
  23355. *
  23356. * @private
  23357. * @param {string} methodName The name of the `Math` method to use when rounding.
  23358. * @returns {Function} Returns the new round function.
  23359. */
  23360. function createRound(methodName) {
  23361. var func = Math[methodName];
  23362. return function(number, precision) {
  23363. number = toNumber(number);
  23364. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23365. if (precision && nativeIsFinite(number)) {
  23366. // Shift with exponential notation to avoid floating-point issues.
  23367. // See [MDN](https://mdn.io/round#Examples) for more details.
  23368. var pair = (toString(number) + 'e').split('e'),
  23369. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23370. pair = (toString(value) + 'e').split('e');
  23371. return +(pair[0] + 'e' + (+pair[1] - precision));
  23372. }
  23373. return func(number);
  23374. };
  23375. }
  23376. /**
  23377. * Creates a set object of `values`.
  23378. *
  23379. * @private
  23380. * @param {Array} values The values to add to the set.
  23381. * @returns {Object} Returns the new set.
  23382. */
  23383. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23384. return new Set(values);
  23385. };
  23386. /**
  23387. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23388. *
  23389. * @private
  23390. * @param {Function} keysFunc The function to get the keys of a given object.
  23391. * @returns {Function} Returns the new pairs function.
  23392. */
  23393. function createToPairs(keysFunc) {
  23394. return function(object) {
  23395. var tag = getTag(object);
  23396. if (tag == mapTag) {
  23397. return mapToArray(object);
  23398. }
  23399. if (tag == setTag) {
  23400. return setToPairs(object);
  23401. }
  23402. return baseToPairs(object, keysFunc(object));
  23403. };
  23404. }
  23405. /**
  23406. * Creates a function that either curries or invokes `func` with optional
  23407. * `this` binding and partially applied arguments.
  23408. *
  23409. * @private
  23410. * @param {Function|string} func The function or method name to wrap.
  23411. * @param {number} bitmask The bitmask flags.
  23412. * 1 - `_.bind`
  23413. * 2 - `_.bindKey`
  23414. * 4 - `_.curry` or `_.curryRight` of a bound function
  23415. * 8 - `_.curry`
  23416. * 16 - `_.curryRight`
  23417. * 32 - `_.partial`
  23418. * 64 - `_.partialRight`
  23419. * 128 - `_.rearg`
  23420. * 256 - `_.ary`
  23421. * 512 - `_.flip`
  23422. * @param {*} [thisArg] The `this` binding of `func`.
  23423. * @param {Array} [partials] The arguments to be partially applied.
  23424. * @param {Array} [holders] The `partials` placeholder indexes.
  23425. * @param {Array} [argPos] The argument positions of the new function.
  23426. * @param {number} [ary] The arity cap of `func`.
  23427. * @param {number} [arity] The arity of `func`.
  23428. * @returns {Function} Returns the new wrapped function.
  23429. */
  23430. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23431. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23432. if (!isBindKey && typeof func != 'function') {
  23433. throw new TypeError(FUNC_ERROR_TEXT);
  23434. }
  23435. var length = partials ? partials.length : 0;
  23436. if (!length) {
  23437. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23438. partials = holders = undefined;
  23439. }
  23440. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23441. arity = arity === undefined ? arity : toInteger(arity);
  23442. length -= holders ? holders.length : 0;
  23443. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23444. var partialsRight = partials,
  23445. holdersRight = holders;
  23446. partials = holders = undefined;
  23447. }
  23448. var data = isBindKey ? undefined : getData(func);
  23449. var newData = [
  23450. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23451. argPos, ary, arity
  23452. ];
  23453. if (data) {
  23454. mergeData(newData, data);
  23455. }
  23456. func = newData[0];
  23457. bitmask = newData[1];
  23458. thisArg = newData[2];
  23459. partials = newData[3];
  23460. holders = newData[4];
  23461. arity = newData[9] = newData[9] === undefined
  23462. ? (isBindKey ? 0 : func.length)
  23463. : nativeMax(newData[9] - length, 0);
  23464. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23465. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23466. }
  23467. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23468. var result = createBind(func, bitmask, thisArg);
  23469. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23470. result = createCurry(func, bitmask, arity);
  23471. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23472. result = createPartial(func, bitmask, thisArg, partials);
  23473. } else {
  23474. result = createHybrid.apply(undefined, newData);
  23475. }
  23476. var setter = data ? baseSetData : setData;
  23477. return setWrapToString(setter(result, newData), func, bitmask);
  23478. }
  23479. /**
  23480. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23481. * of source objects to the destination object for all destination properties
  23482. * that resolve to `undefined`.
  23483. *
  23484. * @private
  23485. * @param {*} objValue The destination value.
  23486. * @param {*} srcValue The source value.
  23487. * @param {string} key The key of the property to assign.
  23488. * @param {Object} object The parent object of `objValue`.
  23489. * @returns {*} Returns the value to assign.
  23490. */
  23491. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23492. if (objValue === undefined ||
  23493. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23494. return srcValue;
  23495. }
  23496. return objValue;
  23497. }
  23498. /**
  23499. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23500. * objects into destination objects that are passed thru.
  23501. *
  23502. * @private
  23503. * @param {*} objValue The destination value.
  23504. * @param {*} srcValue The source value.
  23505. * @param {string} key The key of the property to merge.
  23506. * @param {Object} object The parent object of `objValue`.
  23507. * @param {Object} source The parent object of `srcValue`.
  23508. * @param {Object} [stack] Tracks traversed source values and their merged
  23509. * counterparts.
  23510. * @returns {*} Returns the value to assign.
  23511. */
  23512. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23513. if (isObject(objValue) && isObject(srcValue)) {
  23514. // Recursively merge objects and arrays (susceptible to call stack limits).
  23515. stack.set(srcValue, objValue);
  23516. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23517. stack['delete'](srcValue);
  23518. }
  23519. return objValue;
  23520. }
  23521. /**
  23522. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23523. * objects.
  23524. *
  23525. * @private
  23526. * @param {*} value The value to inspect.
  23527. * @param {string} key The key of the property to inspect.
  23528. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23529. */
  23530. function customOmitClone(value) {
  23531. return isPlainObject(value) ? undefined : value;
  23532. }
  23533. /**
  23534. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23535. * partial deep comparisons.
  23536. *
  23537. * @private
  23538. * @param {Array} array The array to compare.
  23539. * @param {Array} other The other array to compare.
  23540. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23541. * @param {Function} customizer The function to customize comparisons.
  23542. * @param {Function} equalFunc The function to determine equivalents of values.
  23543. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23544. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23545. */
  23546. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23547. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23548. arrLength = array.length,
  23549. othLength = other.length;
  23550. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23551. return false;
  23552. }
  23553. // Assume cyclic values are equal.
  23554. var stacked = stack.get(array);
  23555. if (stacked && stack.get(other)) {
  23556. return stacked == other;
  23557. }
  23558. var index = -1,
  23559. result = true,
  23560. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23561. stack.set(array, other);
  23562. stack.set(other, array);
  23563. // Ignore non-index properties.
  23564. while (++index < arrLength) {
  23565. var arrValue = array[index],
  23566. othValue = other[index];
  23567. if (customizer) {
  23568. var compared = isPartial
  23569. ? customizer(othValue, arrValue, index, other, array, stack)
  23570. : customizer(arrValue, othValue, index, array, other, stack);
  23571. }
  23572. if (compared !== undefined) {
  23573. if (compared) {
  23574. continue;
  23575. }
  23576. result = false;
  23577. break;
  23578. }
  23579. // Recursively compare arrays (susceptible to call stack limits).
  23580. if (seen) {
  23581. if (!arraySome(other, function(othValue, othIndex) {
  23582. if (!cacheHas(seen, othIndex) &&
  23583. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23584. return seen.push(othIndex);
  23585. }
  23586. })) {
  23587. result = false;
  23588. break;
  23589. }
  23590. } else if (!(
  23591. arrValue === othValue ||
  23592. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23593. )) {
  23594. result = false;
  23595. break;
  23596. }
  23597. }
  23598. stack['delete'](array);
  23599. stack['delete'](other);
  23600. return result;
  23601. }
  23602. /**
  23603. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23604. * the same `toStringTag`.
  23605. *
  23606. * **Note:** This function only supports comparing values with tags of
  23607. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23608. *
  23609. * @private
  23610. * @param {Object} object The object to compare.
  23611. * @param {Object} other The other object to compare.
  23612. * @param {string} tag The `toStringTag` of the objects to compare.
  23613. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23614. * @param {Function} customizer The function to customize comparisons.
  23615. * @param {Function} equalFunc The function to determine equivalents of values.
  23616. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23617. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23618. */
  23619. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23620. switch (tag) {
  23621. case dataViewTag:
  23622. if ((object.byteLength != other.byteLength) ||
  23623. (object.byteOffset != other.byteOffset)) {
  23624. return false;
  23625. }
  23626. object = object.buffer;
  23627. other = other.buffer;
  23628. case arrayBufferTag:
  23629. if ((object.byteLength != other.byteLength) ||
  23630. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23631. return false;
  23632. }
  23633. return true;
  23634. case boolTag:
  23635. case dateTag:
  23636. case numberTag:
  23637. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23638. // Invalid dates are coerced to `NaN`.
  23639. return eq(+object, +other);
  23640. case errorTag:
  23641. return object.name == other.name && object.message == other.message;
  23642. case regexpTag:
  23643. case stringTag:
  23644. // Coerce regexes to strings and treat strings, primitives and objects,
  23645. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23646. // for more details.
  23647. return object == (other + '');
  23648. case mapTag:
  23649. var convert = mapToArray;
  23650. case setTag:
  23651. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23652. convert || (convert = setToArray);
  23653. if (object.size != other.size && !isPartial) {
  23654. return false;
  23655. }
  23656. // Assume cyclic values are equal.
  23657. var stacked = stack.get(object);
  23658. if (stacked) {
  23659. return stacked == other;
  23660. }
  23661. bitmask |= COMPARE_UNORDERED_FLAG;
  23662. // Recursively compare objects (susceptible to call stack limits).
  23663. stack.set(object, other);
  23664. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23665. stack['delete'](object);
  23666. return result;
  23667. case symbolTag:
  23668. if (symbolValueOf) {
  23669. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23670. }
  23671. }
  23672. return false;
  23673. }
  23674. /**
  23675. * A specialized version of `baseIsEqualDeep` for objects with support for
  23676. * partial deep comparisons.
  23677. *
  23678. * @private
  23679. * @param {Object} object The object to compare.
  23680. * @param {Object} other The other object to compare.
  23681. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23682. * @param {Function} customizer The function to customize comparisons.
  23683. * @param {Function} equalFunc The function to determine equivalents of values.
  23684. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23685. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23686. */
  23687. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23688. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23689. objProps = getAllKeys(object),
  23690. objLength = objProps.length,
  23691. othProps = getAllKeys(other),
  23692. othLength = othProps.length;
  23693. if (objLength != othLength && !isPartial) {
  23694. return false;
  23695. }
  23696. var index = objLength;
  23697. while (index--) {
  23698. var key = objProps[index];
  23699. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23700. return false;
  23701. }
  23702. }
  23703. // Assume cyclic values are equal.
  23704. var stacked = stack.get(object);
  23705. if (stacked && stack.get(other)) {
  23706. return stacked == other;
  23707. }
  23708. var result = true;
  23709. stack.set(object, other);
  23710. stack.set(other, object);
  23711. var skipCtor = isPartial;
  23712. while (++index < objLength) {
  23713. key = objProps[index];
  23714. var objValue = object[key],
  23715. othValue = other[key];
  23716. if (customizer) {
  23717. var compared = isPartial
  23718. ? customizer(othValue, objValue, key, other, object, stack)
  23719. : customizer(objValue, othValue, key, object, other, stack);
  23720. }
  23721. // Recursively compare objects (susceptible to call stack limits).
  23722. if (!(compared === undefined
  23723. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23724. : compared
  23725. )) {
  23726. result = false;
  23727. break;
  23728. }
  23729. skipCtor || (skipCtor = key == 'constructor');
  23730. }
  23731. if (result && !skipCtor) {
  23732. var objCtor = object.constructor,
  23733. othCtor = other.constructor;
  23734. // Non `Object` object instances with different constructors are not equal.
  23735. if (objCtor != othCtor &&
  23736. ('constructor' in object && 'constructor' in other) &&
  23737. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23738. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23739. result = false;
  23740. }
  23741. }
  23742. stack['delete'](object);
  23743. stack['delete'](other);
  23744. return result;
  23745. }
  23746. /**
  23747. * A specialized version of `baseRest` which flattens the rest array.
  23748. *
  23749. * @private
  23750. * @param {Function} func The function to apply a rest parameter to.
  23751. * @returns {Function} Returns the new function.
  23752. */
  23753. function flatRest(func) {
  23754. return setToString(overRest(func, undefined, flatten), func + '');
  23755. }
  23756. /**
  23757. * Creates an array of own enumerable property names and symbols of `object`.
  23758. *
  23759. * @private
  23760. * @param {Object} object The object to query.
  23761. * @returns {Array} Returns the array of property names and symbols.
  23762. */
  23763. function getAllKeys(object) {
  23764. return baseGetAllKeys(object, keys, getSymbols);
  23765. }
  23766. /**
  23767. * Creates an array of own and inherited enumerable property names and
  23768. * symbols of `object`.
  23769. *
  23770. * @private
  23771. * @param {Object} object The object to query.
  23772. * @returns {Array} Returns the array of property names and symbols.
  23773. */
  23774. function getAllKeysIn(object) {
  23775. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23776. }
  23777. /**
  23778. * Gets metadata for `func`.
  23779. *
  23780. * @private
  23781. * @param {Function} func The function to query.
  23782. * @returns {*} Returns the metadata for `func`.
  23783. */
  23784. var getData = !metaMap ? noop : function(func) {
  23785. return metaMap.get(func);
  23786. };
  23787. /**
  23788. * Gets the name of `func`.
  23789. *
  23790. * @private
  23791. * @param {Function} func The function to query.
  23792. * @returns {string} Returns the function name.
  23793. */
  23794. function getFuncName(func) {
  23795. var result = (func.name + ''),
  23796. array = realNames[result],
  23797. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23798. while (length--) {
  23799. var data = array[length],
  23800. otherFunc = data.func;
  23801. if (otherFunc == null || otherFunc == func) {
  23802. return data.name;
  23803. }
  23804. }
  23805. return result;
  23806. }
  23807. /**
  23808. * Gets the argument placeholder value for `func`.
  23809. *
  23810. * @private
  23811. * @param {Function} func The function to inspect.
  23812. * @returns {*} Returns the placeholder value.
  23813. */
  23814. function getHolder(func) {
  23815. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23816. return object.placeholder;
  23817. }
  23818. /**
  23819. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23820. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23821. * If arguments are provided, the chosen function is invoked with them and
  23822. * its result is returned.
  23823. *
  23824. * @private
  23825. * @param {*} [value] The value to convert to an iteratee.
  23826. * @param {number} [arity] The arity of the created iteratee.
  23827. * @returns {Function} Returns the chosen function or its result.
  23828. */
  23829. function getIteratee() {
  23830. var result = lodash.iteratee || iteratee;
  23831. result = result === iteratee ? baseIteratee : result;
  23832. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23833. }
  23834. /**
  23835. * Gets the data for `map`.
  23836. *
  23837. * @private
  23838. * @param {Object} map The map to query.
  23839. * @param {string} key The reference key.
  23840. * @returns {*} Returns the map data.
  23841. */
  23842. function getMapData(map, key) {
  23843. var data = map.__data__;
  23844. return isKeyable(key)
  23845. ? data[typeof key == 'string' ? 'string' : 'hash']
  23846. : data.map;
  23847. }
  23848. /**
  23849. * Gets the property names, values, and compare flags of `object`.
  23850. *
  23851. * @private
  23852. * @param {Object} object The object to query.
  23853. * @returns {Array} Returns the match data of `object`.
  23854. */
  23855. function getMatchData(object) {
  23856. var result = keys(object),
  23857. length = result.length;
  23858. while (length--) {
  23859. var key = result[length],
  23860. value = object[key];
  23861. result[length] = [key, value, isStrictComparable(value)];
  23862. }
  23863. return result;
  23864. }
  23865. /**
  23866. * Gets the native function at `key` of `object`.
  23867. *
  23868. * @private
  23869. * @param {Object} object The object to query.
  23870. * @param {string} key The key of the method to get.
  23871. * @returns {*} Returns the function if it's native, else `undefined`.
  23872. */
  23873. function getNative(object, key) {
  23874. var value = getValue(object, key);
  23875. return baseIsNative(value) ? value : undefined;
  23876. }
  23877. /**
  23878. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23879. *
  23880. * @private
  23881. * @param {*} value The value to query.
  23882. * @returns {string} Returns the raw `toStringTag`.
  23883. */
  23884. function getRawTag(value) {
  23885. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23886. tag = value[symToStringTag];
  23887. try {
  23888. value[symToStringTag] = undefined;
  23889. var unmasked = true;
  23890. } catch (e) {}
  23891. var result = nativeObjectToString.call(value);
  23892. if (unmasked) {
  23893. if (isOwn) {
  23894. value[symToStringTag] = tag;
  23895. } else {
  23896. delete value[symToStringTag];
  23897. }
  23898. }
  23899. return result;
  23900. }
  23901. /**
  23902. * Creates an array of the own enumerable symbols of `object`.
  23903. *
  23904. * @private
  23905. * @param {Object} object The object to query.
  23906. * @returns {Array} Returns the array of symbols.
  23907. */
  23908. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23909. if (object == null) {
  23910. return [];
  23911. }
  23912. object = Object(object);
  23913. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23914. return propertyIsEnumerable.call(object, symbol);
  23915. });
  23916. };
  23917. /**
  23918. * Creates an array of the own and inherited enumerable symbols of `object`.
  23919. *
  23920. * @private
  23921. * @param {Object} object The object to query.
  23922. * @returns {Array} Returns the array of symbols.
  23923. */
  23924. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23925. var result = [];
  23926. while (object) {
  23927. arrayPush(result, getSymbols(object));
  23928. object = getPrototype(object);
  23929. }
  23930. return result;
  23931. };
  23932. /**
  23933. * Gets the `toStringTag` of `value`.
  23934. *
  23935. * @private
  23936. * @param {*} value The value to query.
  23937. * @returns {string} Returns the `toStringTag`.
  23938. */
  23939. var getTag = baseGetTag;
  23940. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23941. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23942. (Map && getTag(new Map) != mapTag) ||
  23943. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23944. (Set && getTag(new Set) != setTag) ||
  23945. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23946. getTag = function(value) {
  23947. var result = baseGetTag(value),
  23948. Ctor = result == objectTag ? value.constructor : undefined,
  23949. ctorString = Ctor ? toSource(Ctor) : '';
  23950. if (ctorString) {
  23951. switch (ctorString) {
  23952. case dataViewCtorString: return dataViewTag;
  23953. case mapCtorString: return mapTag;
  23954. case promiseCtorString: return promiseTag;
  23955. case setCtorString: return setTag;
  23956. case weakMapCtorString: return weakMapTag;
  23957. }
  23958. }
  23959. return result;
  23960. };
  23961. }
  23962. /**
  23963. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23964. *
  23965. * @private
  23966. * @param {number} start The start of the view.
  23967. * @param {number} end The end of the view.
  23968. * @param {Array} transforms The transformations to apply to the view.
  23969. * @returns {Object} Returns an object containing the `start` and `end`
  23970. * positions of the view.
  23971. */
  23972. function getView(start, end, transforms) {
  23973. var index = -1,
  23974. length = transforms.length;
  23975. while (++index < length) {
  23976. var data = transforms[index],
  23977. size = data.size;
  23978. switch (data.type) {
  23979. case 'drop': start += size; break;
  23980. case 'dropRight': end -= size; break;
  23981. case 'take': end = nativeMin(end, start + size); break;
  23982. case 'takeRight': start = nativeMax(start, end - size); break;
  23983. }
  23984. }
  23985. return { 'start': start, 'end': end };
  23986. }
  23987. /**
  23988. * Extracts wrapper details from the `source` body comment.
  23989. *
  23990. * @private
  23991. * @param {string} source The source to inspect.
  23992. * @returns {Array} Returns the wrapper details.
  23993. */
  23994. function getWrapDetails(source) {
  23995. var match = source.match(reWrapDetails);
  23996. return match ? match[1].split(reSplitDetails) : [];
  23997. }
  23998. /**
  23999. * Checks if `path` exists on `object`.
  24000. *
  24001. * @private
  24002. * @param {Object} object The object to query.
  24003. * @param {Array|string} path The path to check.
  24004. * @param {Function} hasFunc The function to check properties.
  24005. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24006. */
  24007. function hasPath(object, path, hasFunc) {
  24008. path = castPath(path, object);
  24009. var index = -1,
  24010. length = path.length,
  24011. result = false;
  24012. while (++index < length) {
  24013. var key = toKey(path[index]);
  24014. if (!(result = object != null && hasFunc(object, key))) {
  24015. break;
  24016. }
  24017. object = object[key];
  24018. }
  24019. if (result || ++index != length) {
  24020. return result;
  24021. }
  24022. length = object == null ? 0 : object.length;
  24023. return !!length && isLength(length) && isIndex(key, length) &&
  24024. (isArray(object) || isArguments(object));
  24025. }
  24026. /**
  24027. * Initializes an array clone.
  24028. *
  24029. * @private
  24030. * @param {Array} array The array to clone.
  24031. * @returns {Array} Returns the initialized clone.
  24032. */
  24033. function initCloneArray(array) {
  24034. var length = array.length,
  24035. result = new array.constructor(length);
  24036. // Add properties assigned by `RegExp#exec`.
  24037. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24038. result.index = array.index;
  24039. result.input = array.input;
  24040. }
  24041. return result;
  24042. }
  24043. /**
  24044. * Initializes an object clone.
  24045. *
  24046. * @private
  24047. * @param {Object} object The object to clone.
  24048. * @returns {Object} Returns the initialized clone.
  24049. */
  24050. function initCloneObject(object) {
  24051. return (typeof object.constructor == 'function' && !isPrototype(object))
  24052. ? baseCreate(getPrototype(object))
  24053. : {};
  24054. }
  24055. /**
  24056. * Initializes an object clone based on its `toStringTag`.
  24057. *
  24058. * **Note:** This function only supports cloning values with tags of
  24059. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24060. *
  24061. * @private
  24062. * @param {Object} object The object to clone.
  24063. * @param {string} tag The `toStringTag` of the object to clone.
  24064. * @param {boolean} [isDeep] Specify a deep clone.
  24065. * @returns {Object} Returns the initialized clone.
  24066. */
  24067. function initCloneByTag(object, tag, isDeep) {
  24068. var Ctor = object.constructor;
  24069. switch (tag) {
  24070. case arrayBufferTag:
  24071. return cloneArrayBuffer(object);
  24072. case boolTag:
  24073. case dateTag:
  24074. return new Ctor(+object);
  24075. case dataViewTag:
  24076. return cloneDataView(object, isDeep);
  24077. case float32Tag: case float64Tag:
  24078. case int8Tag: case int16Tag: case int32Tag:
  24079. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24080. return cloneTypedArray(object, isDeep);
  24081. case mapTag:
  24082. return new Ctor;
  24083. case numberTag:
  24084. case stringTag:
  24085. return new Ctor(object);
  24086. case regexpTag:
  24087. return cloneRegExp(object);
  24088. case setTag:
  24089. return new Ctor;
  24090. case symbolTag:
  24091. return cloneSymbol(object);
  24092. }
  24093. }
  24094. /**
  24095. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24096. *
  24097. * @private
  24098. * @param {string} source The source to modify.
  24099. * @returns {Array} details The details to insert.
  24100. * @returns {string} Returns the modified source.
  24101. */
  24102. function insertWrapDetails(source, details) {
  24103. var length = details.length;
  24104. if (!length) {
  24105. return source;
  24106. }
  24107. var lastIndex = length - 1;
  24108. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24109. details = details.join(length > 2 ? ', ' : ' ');
  24110. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24111. }
  24112. /**
  24113. * Checks if `value` is a flattenable `arguments` object or array.
  24114. *
  24115. * @private
  24116. * @param {*} value The value to check.
  24117. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24118. */
  24119. function isFlattenable(value) {
  24120. return isArray(value) || isArguments(value) ||
  24121. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24122. }
  24123. /**
  24124. * Checks if `value` is a valid array-like index.
  24125. *
  24126. * @private
  24127. * @param {*} value The value to check.
  24128. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24129. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24130. */
  24131. function isIndex(value, length) {
  24132. var type = typeof value;
  24133. length = length == null ? MAX_SAFE_INTEGER : length;
  24134. return !!length &&
  24135. (type == 'number' ||
  24136. (type != 'symbol' && reIsUint.test(value))) &&
  24137. (value > -1 && value % 1 == 0 && value < length);
  24138. }
  24139. /**
  24140. * Checks if the given arguments are from an iteratee call.
  24141. *
  24142. * @private
  24143. * @param {*} value The potential iteratee value argument.
  24144. * @param {*} index The potential iteratee index or key argument.
  24145. * @param {*} object The potential iteratee object argument.
  24146. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24147. * else `false`.
  24148. */
  24149. function isIterateeCall(value, index, object) {
  24150. if (!isObject(object)) {
  24151. return false;
  24152. }
  24153. var type = typeof index;
  24154. if (type == 'number'
  24155. ? (isArrayLike(object) && isIndex(index, object.length))
  24156. : (type == 'string' && index in object)
  24157. ) {
  24158. return eq(object[index], value);
  24159. }
  24160. return false;
  24161. }
  24162. /**
  24163. * Checks if `value` is a property name and not a property path.
  24164. *
  24165. * @private
  24166. * @param {*} value The value to check.
  24167. * @param {Object} [object] The object to query keys on.
  24168. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24169. */
  24170. function isKey(value, object) {
  24171. if (isArray(value)) {
  24172. return false;
  24173. }
  24174. var type = typeof value;
  24175. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24176. value == null || isSymbol(value)) {
  24177. return true;
  24178. }
  24179. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24180. (object != null && value in Object(object));
  24181. }
  24182. /**
  24183. * Checks if `value` is suitable for use as unique object key.
  24184. *
  24185. * @private
  24186. * @param {*} value The value to check.
  24187. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24188. */
  24189. function isKeyable(value) {
  24190. var type = typeof value;
  24191. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24192. ? (value !== '__proto__')
  24193. : (value === null);
  24194. }
  24195. /**
  24196. * Checks if `func` has a lazy counterpart.
  24197. *
  24198. * @private
  24199. * @param {Function} func The function to check.
  24200. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24201. * else `false`.
  24202. */
  24203. function isLaziable(func) {
  24204. var funcName = getFuncName(func),
  24205. other = lodash[funcName];
  24206. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24207. return false;
  24208. }
  24209. if (func === other) {
  24210. return true;
  24211. }
  24212. var data = getData(other);
  24213. return !!data && func === data[0];
  24214. }
  24215. /**
  24216. * Checks if `func` has its source masked.
  24217. *
  24218. * @private
  24219. * @param {Function} func The function to check.
  24220. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24221. */
  24222. function isMasked(func) {
  24223. return !!maskSrcKey && (maskSrcKey in func);
  24224. }
  24225. /**
  24226. * Checks if `func` is capable of being masked.
  24227. *
  24228. * @private
  24229. * @param {*} value The value to check.
  24230. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24231. */
  24232. var isMaskable = coreJsData ? isFunction : stubFalse;
  24233. /**
  24234. * Checks if `value` is likely a prototype object.
  24235. *
  24236. * @private
  24237. * @param {*} value The value to check.
  24238. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24239. */
  24240. function isPrototype(value) {
  24241. var Ctor = value && value.constructor,
  24242. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24243. return value === proto;
  24244. }
  24245. /**
  24246. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24247. *
  24248. * @private
  24249. * @param {*} value The value to check.
  24250. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24251. * equality comparisons, else `false`.
  24252. */
  24253. function isStrictComparable(value) {
  24254. return value === value && !isObject(value);
  24255. }
  24256. /**
  24257. * A specialized version of `matchesProperty` for source values suitable
  24258. * for strict equality comparisons, i.e. `===`.
  24259. *
  24260. * @private
  24261. * @param {string} key The key of the property to get.
  24262. * @param {*} srcValue The value to match.
  24263. * @returns {Function} Returns the new spec function.
  24264. */
  24265. function matchesStrictComparable(key, srcValue) {
  24266. return function(object) {
  24267. if (object == null) {
  24268. return false;
  24269. }
  24270. return object[key] === srcValue &&
  24271. (srcValue !== undefined || (key in Object(object)));
  24272. };
  24273. }
  24274. /**
  24275. * A specialized version of `_.memoize` which clears the memoized function's
  24276. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24277. *
  24278. * @private
  24279. * @param {Function} func The function to have its output memoized.
  24280. * @returns {Function} Returns the new memoized function.
  24281. */
  24282. function memoizeCapped(func) {
  24283. var result = memoize(func, function(key) {
  24284. if (cache.size === MAX_MEMOIZE_SIZE) {
  24285. cache.clear();
  24286. }
  24287. return key;
  24288. });
  24289. var cache = result.cache;
  24290. return result;
  24291. }
  24292. /**
  24293. * Merges the function metadata of `source` into `data`.
  24294. *
  24295. * Merging metadata reduces the number of wrappers used to invoke a function.
  24296. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24297. * may be applied regardless of execution order. Methods like `_.ary` and
  24298. * `_.rearg` modify function arguments, making the order in which they are
  24299. * executed important, preventing the merging of metadata. However, we make
  24300. * an exception for a safe combined case where curried functions have `_.ary`
  24301. * and or `_.rearg` applied.
  24302. *
  24303. * @private
  24304. * @param {Array} data The destination metadata.
  24305. * @param {Array} source The source metadata.
  24306. * @returns {Array} Returns `data`.
  24307. */
  24308. function mergeData(data, source) {
  24309. var bitmask = data[1],
  24310. srcBitmask = source[1],
  24311. newBitmask = bitmask | srcBitmask,
  24312. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24313. var isCombo =
  24314. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24315. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24316. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24317. // Exit early if metadata can't be merged.
  24318. if (!(isCommon || isCombo)) {
  24319. return data;
  24320. }
  24321. // Use source `thisArg` if available.
  24322. if (srcBitmask & WRAP_BIND_FLAG) {
  24323. data[2] = source[2];
  24324. // Set when currying a bound function.
  24325. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24326. }
  24327. // Compose partial arguments.
  24328. var value = source[3];
  24329. if (value) {
  24330. var partials = data[3];
  24331. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24332. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24333. }
  24334. // Compose partial right arguments.
  24335. value = source[5];
  24336. if (value) {
  24337. partials = data[5];
  24338. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24339. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24340. }
  24341. // Use source `argPos` if available.
  24342. value = source[7];
  24343. if (value) {
  24344. data[7] = value;
  24345. }
  24346. // Use source `ary` if it's smaller.
  24347. if (srcBitmask & WRAP_ARY_FLAG) {
  24348. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24349. }
  24350. // Use source `arity` if one is not provided.
  24351. if (data[9] == null) {
  24352. data[9] = source[9];
  24353. }
  24354. // Use source `func` and merge bitmasks.
  24355. data[0] = source[0];
  24356. data[1] = newBitmask;
  24357. return data;
  24358. }
  24359. /**
  24360. * This function is like
  24361. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24362. * except that it includes inherited enumerable properties.
  24363. *
  24364. * @private
  24365. * @param {Object} object The object to query.
  24366. * @returns {Array} Returns the array of property names.
  24367. */
  24368. function nativeKeysIn(object) {
  24369. var result = [];
  24370. if (object != null) {
  24371. for (var key in Object(object)) {
  24372. result.push(key);
  24373. }
  24374. }
  24375. return result;
  24376. }
  24377. /**
  24378. * Converts `value` to a string using `Object.prototype.toString`.
  24379. *
  24380. * @private
  24381. * @param {*} value The value to convert.
  24382. * @returns {string} Returns the converted string.
  24383. */
  24384. function objectToString(value) {
  24385. return nativeObjectToString.call(value);
  24386. }
  24387. /**
  24388. * A specialized version of `baseRest` which transforms the rest array.
  24389. *
  24390. * @private
  24391. * @param {Function} func The function to apply a rest parameter to.
  24392. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24393. * @param {Function} transform The rest array transform.
  24394. * @returns {Function} Returns the new function.
  24395. */
  24396. function overRest(func, start, transform) {
  24397. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24398. return function() {
  24399. var args = arguments,
  24400. index = -1,
  24401. length = nativeMax(args.length - start, 0),
  24402. array = Array(length);
  24403. while (++index < length) {
  24404. array[index] = args[start + index];
  24405. }
  24406. index = -1;
  24407. var otherArgs = Array(start + 1);
  24408. while (++index < start) {
  24409. otherArgs[index] = args[index];
  24410. }
  24411. otherArgs[start] = transform(array);
  24412. return apply(func, this, otherArgs);
  24413. };
  24414. }
  24415. /**
  24416. * Gets the parent value at `path` of `object`.
  24417. *
  24418. * @private
  24419. * @param {Object} object The object to query.
  24420. * @param {Array} path The path to get the parent value of.
  24421. * @returns {*} Returns the parent value.
  24422. */
  24423. function parent(object, path) {
  24424. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24425. }
  24426. /**
  24427. * Reorder `array` according to the specified indexes where the element at
  24428. * the first index is assigned as the first element, the element at
  24429. * the second index is assigned as the second element, and so on.
  24430. *
  24431. * @private
  24432. * @param {Array} array The array to reorder.
  24433. * @param {Array} indexes The arranged array indexes.
  24434. * @returns {Array} Returns `array`.
  24435. */
  24436. function reorder(array, indexes) {
  24437. var arrLength = array.length,
  24438. length = nativeMin(indexes.length, arrLength),
  24439. oldArray = copyArray(array);
  24440. while (length--) {
  24441. var index = indexes[length];
  24442. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24443. }
  24444. return array;
  24445. }
  24446. /**
  24447. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24448. *
  24449. * @private
  24450. * @param {Object} object The object to query.
  24451. * @param {string} key The key of the property to get.
  24452. * @returns {*} Returns the property value.
  24453. */
  24454. function safeGet(object, key) {
  24455. if (key === 'constructor' && typeof object[key] === 'function') {
  24456. return;
  24457. }
  24458. if (key == '__proto__') {
  24459. return;
  24460. }
  24461. return object[key];
  24462. }
  24463. /**
  24464. * Sets metadata for `func`.
  24465. *
  24466. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24467. * period of time, it will trip its breaker and transition to an identity
  24468. * function to avoid garbage collection pauses in V8. See
  24469. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24470. * for more details.
  24471. *
  24472. * @private
  24473. * @param {Function} func The function to associate metadata with.
  24474. * @param {*} data The metadata.
  24475. * @returns {Function} Returns `func`.
  24476. */
  24477. var setData = shortOut(baseSetData);
  24478. /**
  24479. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24480. *
  24481. * @private
  24482. * @param {Function} func The function to delay.
  24483. * @param {number} wait The number of milliseconds to delay invocation.
  24484. * @returns {number|Object} Returns the timer id or timeout object.
  24485. */
  24486. var setTimeout = ctxSetTimeout || function(func, wait) {
  24487. return root.setTimeout(func, wait);
  24488. };
  24489. /**
  24490. * Sets the `toString` method of `func` to return `string`.
  24491. *
  24492. * @private
  24493. * @param {Function} func The function to modify.
  24494. * @param {Function} string The `toString` result.
  24495. * @returns {Function} Returns `func`.
  24496. */
  24497. var setToString = shortOut(baseSetToString);
  24498. /**
  24499. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24500. * with wrapper details in a comment at the top of the source body.
  24501. *
  24502. * @private
  24503. * @param {Function} wrapper The function to modify.
  24504. * @param {Function} reference The reference function.
  24505. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24506. * @returns {Function} Returns `wrapper`.
  24507. */
  24508. function setWrapToString(wrapper, reference, bitmask) {
  24509. var source = (reference + '');
  24510. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24511. }
  24512. /**
  24513. * Creates a function that'll short out and invoke `identity` instead
  24514. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24515. * milliseconds.
  24516. *
  24517. * @private
  24518. * @param {Function} func The function to restrict.
  24519. * @returns {Function} Returns the new shortable function.
  24520. */
  24521. function shortOut(func) {
  24522. var count = 0,
  24523. lastCalled = 0;
  24524. return function() {
  24525. var stamp = nativeNow(),
  24526. remaining = HOT_SPAN - (stamp - lastCalled);
  24527. lastCalled = stamp;
  24528. if (remaining > 0) {
  24529. if (++count >= HOT_COUNT) {
  24530. return arguments[0];
  24531. }
  24532. } else {
  24533. count = 0;
  24534. }
  24535. return func.apply(undefined, arguments);
  24536. };
  24537. }
  24538. /**
  24539. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24540. *
  24541. * @private
  24542. * @param {Array} array The array to shuffle.
  24543. * @param {number} [size=array.length] The size of `array`.
  24544. * @returns {Array} Returns `array`.
  24545. */
  24546. function shuffleSelf(array, size) {
  24547. var index = -1,
  24548. length = array.length,
  24549. lastIndex = length - 1;
  24550. size = size === undefined ? length : size;
  24551. while (++index < size) {
  24552. var rand = baseRandom(index, lastIndex),
  24553. value = array[rand];
  24554. array[rand] = array[index];
  24555. array[index] = value;
  24556. }
  24557. array.length = size;
  24558. return array;
  24559. }
  24560. /**
  24561. * Converts `string` to a property path array.
  24562. *
  24563. * @private
  24564. * @param {string} string The string to convert.
  24565. * @returns {Array} Returns the property path array.
  24566. */
  24567. var stringToPath = memoizeCapped(function(string) {
  24568. var result = [];
  24569. if (string.charCodeAt(0) === 46 /* . */) {
  24570. result.push('');
  24571. }
  24572. string.replace(rePropName, function(match, number, quote, subString) {
  24573. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24574. });
  24575. return result;
  24576. });
  24577. /**
  24578. * Converts `value` to a string key if it's not a string or symbol.
  24579. *
  24580. * @private
  24581. * @param {*} value The value to inspect.
  24582. * @returns {string|symbol} Returns the key.
  24583. */
  24584. function toKey(value) {
  24585. if (typeof value == 'string' || isSymbol(value)) {
  24586. return value;
  24587. }
  24588. var result = (value + '');
  24589. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24590. }
  24591. /**
  24592. * Converts `func` to its source code.
  24593. *
  24594. * @private
  24595. * @param {Function} func The function to convert.
  24596. * @returns {string} Returns the source code.
  24597. */
  24598. function toSource(func) {
  24599. if (func != null) {
  24600. try {
  24601. return funcToString.call(func);
  24602. } catch (e) {}
  24603. try {
  24604. return (func + '');
  24605. } catch (e) {}
  24606. }
  24607. return '';
  24608. }
  24609. /**
  24610. * Updates wrapper `details` based on `bitmask` flags.
  24611. *
  24612. * @private
  24613. * @returns {Array} details The details to modify.
  24614. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24615. * @returns {Array} Returns `details`.
  24616. */
  24617. function updateWrapDetails(details, bitmask) {
  24618. arrayEach(wrapFlags, function(pair) {
  24619. var value = '_.' + pair[0];
  24620. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24621. details.push(value);
  24622. }
  24623. });
  24624. return details.sort();
  24625. }
  24626. /**
  24627. * Creates a clone of `wrapper`.
  24628. *
  24629. * @private
  24630. * @param {Object} wrapper The wrapper to clone.
  24631. * @returns {Object} Returns the cloned wrapper.
  24632. */
  24633. function wrapperClone(wrapper) {
  24634. if (wrapper instanceof LazyWrapper) {
  24635. return wrapper.clone();
  24636. }
  24637. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24638. result.__actions__ = copyArray(wrapper.__actions__);
  24639. result.__index__ = wrapper.__index__;
  24640. result.__values__ = wrapper.__values__;
  24641. return result;
  24642. }
  24643. /*------------------------------------------------------------------------*/
  24644. /**
  24645. * Creates an array of elements split into groups the length of `size`.
  24646. * If `array` can't be split evenly, the final chunk will be the remaining
  24647. * elements.
  24648. *
  24649. * @static
  24650. * @memberOf _
  24651. * @since 3.0.0
  24652. * @category Array
  24653. * @param {Array} array The array to process.
  24654. * @param {number} [size=1] The length of each chunk
  24655. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24656. * @returns {Array} Returns the new array of chunks.
  24657. * @example
  24658. *
  24659. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24660. * // => [['a', 'b'], ['c', 'd']]
  24661. *
  24662. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24663. * // => [['a', 'b', 'c'], ['d']]
  24664. */
  24665. function chunk(array, size, guard) {
  24666. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24667. size = 1;
  24668. } else {
  24669. size = nativeMax(toInteger(size), 0);
  24670. }
  24671. var length = array == null ? 0 : array.length;
  24672. if (!length || size < 1) {
  24673. return [];
  24674. }
  24675. var index = 0,
  24676. resIndex = 0,
  24677. result = Array(nativeCeil(length / size));
  24678. while (index < length) {
  24679. result[resIndex++] = baseSlice(array, index, (index += size));
  24680. }
  24681. return result;
  24682. }
  24683. /**
  24684. * Creates an array with all falsey values removed. The values `false`, `null`,
  24685. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24686. *
  24687. * @static
  24688. * @memberOf _
  24689. * @since 0.1.0
  24690. * @category Array
  24691. * @param {Array} array The array to compact.
  24692. * @returns {Array} Returns the new array of filtered values.
  24693. * @example
  24694. *
  24695. * _.compact([0, 1, false, 2, '', 3]);
  24696. * // => [1, 2, 3]
  24697. */
  24698. function compact(array) {
  24699. var index = -1,
  24700. length = array == null ? 0 : array.length,
  24701. resIndex = 0,
  24702. result = [];
  24703. while (++index < length) {
  24704. var value = array[index];
  24705. if (value) {
  24706. result[resIndex++] = value;
  24707. }
  24708. }
  24709. return result;
  24710. }
  24711. /**
  24712. * Creates a new array concatenating `array` with any additional arrays
  24713. * and/or values.
  24714. *
  24715. * @static
  24716. * @memberOf _
  24717. * @since 4.0.0
  24718. * @category Array
  24719. * @param {Array} array The array to concatenate.
  24720. * @param {...*} [values] The values to concatenate.
  24721. * @returns {Array} Returns the new concatenated array.
  24722. * @example
  24723. *
  24724. * var array = [1];
  24725. * var other = _.concat(array, 2, [3], [[4]]);
  24726. *
  24727. * console.log(other);
  24728. * // => [1, 2, 3, [4]]
  24729. *
  24730. * console.log(array);
  24731. * // => [1]
  24732. */
  24733. function concat() {
  24734. var length = arguments.length;
  24735. if (!length) {
  24736. return [];
  24737. }
  24738. var args = Array(length - 1),
  24739. array = arguments[0],
  24740. index = length;
  24741. while (index--) {
  24742. args[index - 1] = arguments[index];
  24743. }
  24744. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24745. }
  24746. /**
  24747. * Creates an array of `array` values not included in the other given arrays
  24748. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24749. * for equality comparisons. The order and references of result values are
  24750. * determined by the first array.
  24751. *
  24752. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24753. *
  24754. * @static
  24755. * @memberOf _
  24756. * @since 0.1.0
  24757. * @category Array
  24758. * @param {Array} array The array to inspect.
  24759. * @param {...Array} [values] The values to exclude.
  24760. * @returns {Array} Returns the new array of filtered values.
  24761. * @see _.without, _.xor
  24762. * @example
  24763. *
  24764. * _.difference([2, 1], [2, 3]);
  24765. * // => [1]
  24766. */
  24767. var difference = baseRest(function(array, values) {
  24768. return isArrayLikeObject(array)
  24769. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24770. : [];
  24771. });
  24772. /**
  24773. * This method is like `_.difference` except that it accepts `iteratee` which
  24774. * is invoked for each element of `array` and `values` to generate the criterion
  24775. * by which they're compared. The order and references of result values are
  24776. * determined by the first array. The iteratee is invoked with one argument:
  24777. * (value).
  24778. *
  24779. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24780. *
  24781. * @static
  24782. * @memberOf _
  24783. * @since 4.0.0
  24784. * @category Array
  24785. * @param {Array} array The array to inspect.
  24786. * @param {...Array} [values] The values to exclude.
  24787. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24788. * @returns {Array} Returns the new array of filtered values.
  24789. * @example
  24790. *
  24791. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24792. * // => [1.2]
  24793. *
  24794. * // The `_.property` iteratee shorthand.
  24795. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24796. * // => [{ 'x': 2 }]
  24797. */
  24798. var differenceBy = baseRest(function(array, values) {
  24799. var iteratee = last(values);
  24800. if (isArrayLikeObject(iteratee)) {
  24801. iteratee = undefined;
  24802. }
  24803. return isArrayLikeObject(array)
  24804. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24805. : [];
  24806. });
  24807. /**
  24808. * This method is like `_.difference` except that it accepts `comparator`
  24809. * which is invoked to compare elements of `array` to `values`. The order and
  24810. * references of result values are determined by the first array. The comparator
  24811. * is invoked with two arguments: (arrVal, othVal).
  24812. *
  24813. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24814. *
  24815. * @static
  24816. * @memberOf _
  24817. * @since 4.0.0
  24818. * @category Array
  24819. * @param {Array} array The array to inspect.
  24820. * @param {...Array} [values] The values to exclude.
  24821. * @param {Function} [comparator] The comparator invoked per element.
  24822. * @returns {Array} Returns the new array of filtered values.
  24823. * @example
  24824. *
  24825. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24826. *
  24827. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24828. * // => [{ 'x': 2, 'y': 1 }]
  24829. */
  24830. var differenceWith = baseRest(function(array, values) {
  24831. var comparator = last(values);
  24832. if (isArrayLikeObject(comparator)) {
  24833. comparator = undefined;
  24834. }
  24835. return isArrayLikeObject(array)
  24836. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24837. : [];
  24838. });
  24839. /**
  24840. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24841. *
  24842. * @static
  24843. * @memberOf _
  24844. * @since 0.5.0
  24845. * @category Array
  24846. * @param {Array} array The array to query.
  24847. * @param {number} [n=1] The number of elements to drop.
  24848. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24849. * @returns {Array} Returns the slice of `array`.
  24850. * @example
  24851. *
  24852. * _.drop([1, 2, 3]);
  24853. * // => [2, 3]
  24854. *
  24855. * _.drop([1, 2, 3], 2);
  24856. * // => [3]
  24857. *
  24858. * _.drop([1, 2, 3], 5);
  24859. * // => []
  24860. *
  24861. * _.drop([1, 2, 3], 0);
  24862. * // => [1, 2, 3]
  24863. */
  24864. function drop(array, n, guard) {
  24865. var length = array == null ? 0 : array.length;
  24866. if (!length) {
  24867. return [];
  24868. }
  24869. n = (guard || n === undefined) ? 1 : toInteger(n);
  24870. return baseSlice(array, n < 0 ? 0 : n, length);
  24871. }
  24872. /**
  24873. * Creates a slice of `array` with `n` elements dropped from the end.
  24874. *
  24875. * @static
  24876. * @memberOf _
  24877. * @since 3.0.0
  24878. * @category Array
  24879. * @param {Array} array The array to query.
  24880. * @param {number} [n=1] The number of elements to drop.
  24881. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24882. * @returns {Array} Returns the slice of `array`.
  24883. * @example
  24884. *
  24885. * _.dropRight([1, 2, 3]);
  24886. * // => [1, 2]
  24887. *
  24888. * _.dropRight([1, 2, 3], 2);
  24889. * // => [1]
  24890. *
  24891. * _.dropRight([1, 2, 3], 5);
  24892. * // => []
  24893. *
  24894. * _.dropRight([1, 2, 3], 0);
  24895. * // => [1, 2, 3]
  24896. */
  24897. function dropRight(array, n, guard) {
  24898. var length = array == null ? 0 : array.length;
  24899. if (!length) {
  24900. return [];
  24901. }
  24902. n = (guard || n === undefined) ? 1 : toInteger(n);
  24903. n = length - n;
  24904. return baseSlice(array, 0, n < 0 ? 0 : n);
  24905. }
  24906. /**
  24907. * Creates a slice of `array` excluding elements dropped from the end.
  24908. * Elements are dropped until `predicate` returns falsey. The predicate is
  24909. * invoked with three arguments: (value, index, array).
  24910. *
  24911. * @static
  24912. * @memberOf _
  24913. * @since 3.0.0
  24914. * @category Array
  24915. * @param {Array} array The array to query.
  24916. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24917. * @returns {Array} Returns the slice of `array`.
  24918. * @example
  24919. *
  24920. * var users = [
  24921. * { 'user': 'barney', 'active': true },
  24922. * { 'user': 'fred', 'active': false },
  24923. * { 'user': 'pebbles', 'active': false }
  24924. * ];
  24925. *
  24926. * _.dropRightWhile(users, function(o) { return !o.active; });
  24927. * // => objects for ['barney']
  24928. *
  24929. * // The `_.matches` iteratee shorthand.
  24930. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24931. * // => objects for ['barney', 'fred']
  24932. *
  24933. * // The `_.matchesProperty` iteratee shorthand.
  24934. * _.dropRightWhile(users, ['active', false]);
  24935. * // => objects for ['barney']
  24936. *
  24937. * // The `_.property` iteratee shorthand.
  24938. * _.dropRightWhile(users, 'active');
  24939. * // => objects for ['barney', 'fred', 'pebbles']
  24940. */
  24941. function dropRightWhile(array, predicate) {
  24942. return (array && array.length)
  24943. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24944. : [];
  24945. }
  24946. /**
  24947. * Creates a slice of `array` excluding elements dropped from the beginning.
  24948. * Elements are dropped until `predicate` returns falsey. The predicate is
  24949. * invoked with three arguments: (value, index, array).
  24950. *
  24951. * @static
  24952. * @memberOf _
  24953. * @since 3.0.0
  24954. * @category Array
  24955. * @param {Array} array The array to query.
  24956. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24957. * @returns {Array} Returns the slice of `array`.
  24958. * @example
  24959. *
  24960. * var users = [
  24961. * { 'user': 'barney', 'active': false },
  24962. * { 'user': 'fred', 'active': false },
  24963. * { 'user': 'pebbles', 'active': true }
  24964. * ];
  24965. *
  24966. * _.dropWhile(users, function(o) { return !o.active; });
  24967. * // => objects for ['pebbles']
  24968. *
  24969. * // The `_.matches` iteratee shorthand.
  24970. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24971. * // => objects for ['fred', 'pebbles']
  24972. *
  24973. * // The `_.matchesProperty` iteratee shorthand.
  24974. * _.dropWhile(users, ['active', false]);
  24975. * // => objects for ['pebbles']
  24976. *
  24977. * // The `_.property` iteratee shorthand.
  24978. * _.dropWhile(users, 'active');
  24979. * // => objects for ['barney', 'fred', 'pebbles']
  24980. */
  24981. function dropWhile(array, predicate) {
  24982. return (array && array.length)
  24983. ? baseWhile(array, getIteratee(predicate, 3), true)
  24984. : [];
  24985. }
  24986. /**
  24987. * Fills elements of `array` with `value` from `start` up to, but not
  24988. * including, `end`.
  24989. *
  24990. * **Note:** This method mutates `array`.
  24991. *
  24992. * @static
  24993. * @memberOf _
  24994. * @since 3.2.0
  24995. * @category Array
  24996. * @param {Array} array The array to fill.
  24997. * @param {*} value The value to fill `array` with.
  24998. * @param {number} [start=0] The start position.
  24999. * @param {number} [end=array.length] The end position.
  25000. * @returns {Array} Returns `array`.
  25001. * @example
  25002. *
  25003. * var array = [1, 2, 3];
  25004. *
  25005. * _.fill(array, 'a');
  25006. * console.log(array);
  25007. * // => ['a', 'a', 'a']
  25008. *
  25009. * _.fill(Array(3), 2);
  25010. * // => [2, 2, 2]
  25011. *
  25012. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25013. * // => [4, '*', '*', 10]
  25014. */
  25015. function fill(array, value, start, end) {
  25016. var length = array == null ? 0 : array.length;
  25017. if (!length) {
  25018. return [];
  25019. }
  25020. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25021. start = 0;
  25022. end = length;
  25023. }
  25024. return baseFill(array, value, start, end);
  25025. }
  25026. /**
  25027. * This method is like `_.find` except that it returns the index of the first
  25028. * element `predicate` returns truthy for instead of the element itself.
  25029. *
  25030. * @static
  25031. * @memberOf _
  25032. * @since 1.1.0
  25033. * @category Array
  25034. * @param {Array} array The array to inspect.
  25035. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25036. * @param {number} [fromIndex=0] The index to search from.
  25037. * @returns {number} Returns the index of the found element, else `-1`.
  25038. * @example
  25039. *
  25040. * var users = [
  25041. * { 'user': 'barney', 'active': false },
  25042. * { 'user': 'fred', 'active': false },
  25043. * { 'user': 'pebbles', 'active': true }
  25044. * ];
  25045. *
  25046. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25047. * // => 0
  25048. *
  25049. * // The `_.matches` iteratee shorthand.
  25050. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25051. * // => 1
  25052. *
  25053. * // The `_.matchesProperty` iteratee shorthand.
  25054. * _.findIndex(users, ['active', false]);
  25055. * // => 0
  25056. *
  25057. * // The `_.property` iteratee shorthand.
  25058. * _.findIndex(users, 'active');
  25059. * // => 2
  25060. */
  25061. function findIndex(array, predicate, fromIndex) {
  25062. var length = array == null ? 0 : array.length;
  25063. if (!length) {
  25064. return -1;
  25065. }
  25066. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25067. if (index < 0) {
  25068. index = nativeMax(length + index, 0);
  25069. }
  25070. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25071. }
  25072. /**
  25073. * This method is like `_.findIndex` except that it iterates over elements
  25074. * of `collection` from right to left.
  25075. *
  25076. * @static
  25077. * @memberOf _
  25078. * @since 2.0.0
  25079. * @category Array
  25080. * @param {Array} array The array to inspect.
  25081. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25082. * @param {number} [fromIndex=array.length-1] The index to search from.
  25083. * @returns {number} Returns the index of the found element, else `-1`.
  25084. * @example
  25085. *
  25086. * var users = [
  25087. * { 'user': 'barney', 'active': true },
  25088. * { 'user': 'fred', 'active': false },
  25089. * { 'user': 'pebbles', 'active': false }
  25090. * ];
  25091. *
  25092. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25093. * // => 2
  25094. *
  25095. * // The `_.matches` iteratee shorthand.
  25096. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25097. * // => 0
  25098. *
  25099. * // The `_.matchesProperty` iteratee shorthand.
  25100. * _.findLastIndex(users, ['active', false]);
  25101. * // => 2
  25102. *
  25103. * // The `_.property` iteratee shorthand.
  25104. * _.findLastIndex(users, 'active');
  25105. * // => 0
  25106. */
  25107. function findLastIndex(array, predicate, fromIndex) {
  25108. var length = array == null ? 0 : array.length;
  25109. if (!length) {
  25110. return -1;
  25111. }
  25112. var index = length - 1;
  25113. if (fromIndex !== undefined) {
  25114. index = toInteger(fromIndex);
  25115. index = fromIndex < 0
  25116. ? nativeMax(length + index, 0)
  25117. : nativeMin(index, length - 1);
  25118. }
  25119. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25120. }
  25121. /**
  25122. * Flattens `array` a single level deep.
  25123. *
  25124. * @static
  25125. * @memberOf _
  25126. * @since 0.1.0
  25127. * @category Array
  25128. * @param {Array} array The array to flatten.
  25129. * @returns {Array} Returns the new flattened array.
  25130. * @example
  25131. *
  25132. * _.flatten([1, [2, [3, [4]], 5]]);
  25133. * // => [1, 2, [3, [4]], 5]
  25134. */
  25135. function flatten(array) {
  25136. var length = array == null ? 0 : array.length;
  25137. return length ? baseFlatten(array, 1) : [];
  25138. }
  25139. /**
  25140. * Recursively flattens `array`.
  25141. *
  25142. * @static
  25143. * @memberOf _
  25144. * @since 3.0.0
  25145. * @category Array
  25146. * @param {Array} array The array to flatten.
  25147. * @returns {Array} Returns the new flattened array.
  25148. * @example
  25149. *
  25150. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25151. * // => [1, 2, 3, 4, 5]
  25152. */
  25153. function flattenDeep(array) {
  25154. var length = array == null ? 0 : array.length;
  25155. return length ? baseFlatten(array, INFINITY) : [];
  25156. }
  25157. /**
  25158. * Recursively flatten `array` up to `depth` times.
  25159. *
  25160. * @static
  25161. * @memberOf _
  25162. * @since 4.4.0
  25163. * @category Array
  25164. * @param {Array} array The array to flatten.
  25165. * @param {number} [depth=1] The maximum recursion depth.
  25166. * @returns {Array} Returns the new flattened array.
  25167. * @example
  25168. *
  25169. * var array = [1, [2, [3, [4]], 5]];
  25170. *
  25171. * _.flattenDepth(array, 1);
  25172. * // => [1, 2, [3, [4]], 5]
  25173. *
  25174. * _.flattenDepth(array, 2);
  25175. * // => [1, 2, 3, [4], 5]
  25176. */
  25177. function flattenDepth(array, depth) {
  25178. var length = array == null ? 0 : array.length;
  25179. if (!length) {
  25180. return [];
  25181. }
  25182. depth = depth === undefined ? 1 : toInteger(depth);
  25183. return baseFlatten(array, depth);
  25184. }
  25185. /**
  25186. * The inverse of `_.toPairs`; this method returns an object composed
  25187. * from key-value `pairs`.
  25188. *
  25189. * @static
  25190. * @memberOf _
  25191. * @since 4.0.0
  25192. * @category Array
  25193. * @param {Array} pairs The key-value pairs.
  25194. * @returns {Object} Returns the new object.
  25195. * @example
  25196. *
  25197. * _.fromPairs([['a', 1], ['b', 2]]);
  25198. * // => { 'a': 1, 'b': 2 }
  25199. */
  25200. function fromPairs(pairs) {
  25201. var index = -1,
  25202. length = pairs == null ? 0 : pairs.length,
  25203. result = {};
  25204. while (++index < length) {
  25205. var pair = pairs[index];
  25206. result[pair[0]] = pair[1];
  25207. }
  25208. return result;
  25209. }
  25210. /**
  25211. * Gets the first element of `array`.
  25212. *
  25213. * @static
  25214. * @memberOf _
  25215. * @since 0.1.0
  25216. * @alias first
  25217. * @category Array
  25218. * @param {Array} array The array to query.
  25219. * @returns {*} Returns the first element of `array`.
  25220. * @example
  25221. *
  25222. * _.head([1, 2, 3]);
  25223. * // => 1
  25224. *
  25225. * _.head([]);
  25226. * // => undefined
  25227. */
  25228. function head(array) {
  25229. return (array && array.length) ? array[0] : undefined;
  25230. }
  25231. /**
  25232. * Gets the index at which the first occurrence of `value` is found in `array`
  25233. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25234. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25235. * offset from the end of `array`.
  25236. *
  25237. * @static
  25238. * @memberOf _
  25239. * @since 0.1.0
  25240. * @category Array
  25241. * @param {Array} array The array to inspect.
  25242. * @param {*} value The value to search for.
  25243. * @param {number} [fromIndex=0] The index to search from.
  25244. * @returns {number} Returns the index of the matched value, else `-1`.
  25245. * @example
  25246. *
  25247. * _.indexOf([1, 2, 1, 2], 2);
  25248. * // => 1
  25249. *
  25250. * // Search from the `fromIndex`.
  25251. * _.indexOf([1, 2, 1, 2], 2, 2);
  25252. * // => 3
  25253. */
  25254. function indexOf(array, value, fromIndex) {
  25255. var length = array == null ? 0 : array.length;
  25256. if (!length) {
  25257. return -1;
  25258. }
  25259. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25260. if (index < 0) {
  25261. index = nativeMax(length + index, 0);
  25262. }
  25263. return baseIndexOf(array, value, index);
  25264. }
  25265. /**
  25266. * Gets all but the last element of `array`.
  25267. *
  25268. * @static
  25269. * @memberOf _
  25270. * @since 0.1.0
  25271. * @category Array
  25272. * @param {Array} array The array to query.
  25273. * @returns {Array} Returns the slice of `array`.
  25274. * @example
  25275. *
  25276. * _.initial([1, 2, 3]);
  25277. * // => [1, 2]
  25278. */
  25279. function initial(array) {
  25280. var length = array == null ? 0 : array.length;
  25281. return length ? baseSlice(array, 0, -1) : [];
  25282. }
  25283. /**
  25284. * Creates an array of unique values that are included in all given arrays
  25285. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25286. * for equality comparisons. The order and references of result values are
  25287. * determined by the first array.
  25288. *
  25289. * @static
  25290. * @memberOf _
  25291. * @since 0.1.0
  25292. * @category Array
  25293. * @param {...Array} [arrays] The arrays to inspect.
  25294. * @returns {Array} Returns the new array of intersecting values.
  25295. * @example
  25296. *
  25297. * _.intersection([2, 1], [2, 3]);
  25298. * // => [2]
  25299. */
  25300. var intersection = baseRest(function(arrays) {
  25301. var mapped = arrayMap(arrays, castArrayLikeObject);
  25302. return (mapped.length && mapped[0] === arrays[0])
  25303. ? baseIntersection(mapped)
  25304. : [];
  25305. });
  25306. /**
  25307. * This method is like `_.intersection` except that it accepts `iteratee`
  25308. * which is invoked for each element of each `arrays` to generate the criterion
  25309. * by which they're compared. The order and references of result values are
  25310. * determined by the first array. The iteratee is invoked with one argument:
  25311. * (value).
  25312. *
  25313. * @static
  25314. * @memberOf _
  25315. * @since 4.0.0
  25316. * @category Array
  25317. * @param {...Array} [arrays] The arrays to inspect.
  25318. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25319. * @returns {Array} Returns the new array of intersecting values.
  25320. * @example
  25321. *
  25322. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25323. * // => [2.1]
  25324. *
  25325. * // The `_.property` iteratee shorthand.
  25326. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25327. * // => [{ 'x': 1 }]
  25328. */
  25329. var intersectionBy = baseRest(function(arrays) {
  25330. var iteratee = last(arrays),
  25331. mapped = arrayMap(arrays, castArrayLikeObject);
  25332. if (iteratee === last(mapped)) {
  25333. iteratee = undefined;
  25334. } else {
  25335. mapped.pop();
  25336. }
  25337. return (mapped.length && mapped[0] === arrays[0])
  25338. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25339. : [];
  25340. });
  25341. /**
  25342. * This method is like `_.intersection` except that it accepts `comparator`
  25343. * which is invoked to compare elements of `arrays`. The order and references
  25344. * of result values are determined by the first array. The comparator is
  25345. * invoked with two arguments: (arrVal, othVal).
  25346. *
  25347. * @static
  25348. * @memberOf _
  25349. * @since 4.0.0
  25350. * @category Array
  25351. * @param {...Array} [arrays] The arrays to inspect.
  25352. * @param {Function} [comparator] The comparator invoked per element.
  25353. * @returns {Array} Returns the new array of intersecting values.
  25354. * @example
  25355. *
  25356. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25357. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25358. *
  25359. * _.intersectionWith(objects, others, _.isEqual);
  25360. * // => [{ 'x': 1, 'y': 2 }]
  25361. */
  25362. var intersectionWith = baseRest(function(arrays) {
  25363. var comparator = last(arrays),
  25364. mapped = arrayMap(arrays, castArrayLikeObject);
  25365. comparator = typeof comparator == 'function' ? comparator : undefined;
  25366. if (comparator) {
  25367. mapped.pop();
  25368. }
  25369. return (mapped.length && mapped[0] === arrays[0])
  25370. ? baseIntersection(mapped, undefined, comparator)
  25371. : [];
  25372. });
  25373. /**
  25374. * Converts all elements in `array` into a string separated by `separator`.
  25375. *
  25376. * @static
  25377. * @memberOf _
  25378. * @since 4.0.0
  25379. * @category Array
  25380. * @param {Array} array The array to convert.
  25381. * @param {string} [separator=','] The element separator.
  25382. * @returns {string} Returns the joined string.
  25383. * @example
  25384. *
  25385. * _.join(['a', 'b', 'c'], '~');
  25386. * // => 'a~b~c'
  25387. */
  25388. function join(array, separator) {
  25389. return array == null ? '' : nativeJoin.call(array, separator);
  25390. }
  25391. /**
  25392. * Gets the last element of `array`.
  25393. *
  25394. * @static
  25395. * @memberOf _
  25396. * @since 0.1.0
  25397. * @category Array
  25398. * @param {Array} array The array to query.
  25399. * @returns {*} Returns the last element of `array`.
  25400. * @example
  25401. *
  25402. * _.last([1, 2, 3]);
  25403. * // => 3
  25404. */
  25405. function last(array) {
  25406. var length = array == null ? 0 : array.length;
  25407. return length ? array[length - 1] : undefined;
  25408. }
  25409. /**
  25410. * This method is like `_.indexOf` except that it iterates over elements of
  25411. * `array` from right to left.
  25412. *
  25413. * @static
  25414. * @memberOf _
  25415. * @since 0.1.0
  25416. * @category Array
  25417. * @param {Array} array The array to inspect.
  25418. * @param {*} value The value to search for.
  25419. * @param {number} [fromIndex=array.length-1] The index to search from.
  25420. * @returns {number} Returns the index of the matched value, else `-1`.
  25421. * @example
  25422. *
  25423. * _.lastIndexOf([1, 2, 1, 2], 2);
  25424. * // => 3
  25425. *
  25426. * // Search from the `fromIndex`.
  25427. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25428. * // => 1
  25429. */
  25430. function lastIndexOf(array, value, fromIndex) {
  25431. var length = array == null ? 0 : array.length;
  25432. if (!length) {
  25433. return -1;
  25434. }
  25435. var index = length;
  25436. if (fromIndex !== undefined) {
  25437. index = toInteger(fromIndex);
  25438. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25439. }
  25440. return value === value
  25441. ? strictLastIndexOf(array, value, index)
  25442. : baseFindIndex(array, baseIsNaN, index, true);
  25443. }
  25444. /**
  25445. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25446. * element from the end is returned.
  25447. *
  25448. * @static
  25449. * @memberOf _
  25450. * @since 4.11.0
  25451. * @category Array
  25452. * @param {Array} array The array to query.
  25453. * @param {number} [n=0] The index of the element to return.
  25454. * @returns {*} Returns the nth element of `array`.
  25455. * @example
  25456. *
  25457. * var array = ['a', 'b', 'c', 'd'];
  25458. *
  25459. * _.nth(array, 1);
  25460. * // => 'b'
  25461. *
  25462. * _.nth(array, -2);
  25463. * // => 'c';
  25464. */
  25465. function nth(array, n) {
  25466. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25467. }
  25468. /**
  25469. * Removes all given values from `array` using
  25470. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25471. * for equality comparisons.
  25472. *
  25473. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25474. * to remove elements from an array by predicate.
  25475. *
  25476. * @static
  25477. * @memberOf _
  25478. * @since 2.0.0
  25479. * @category Array
  25480. * @param {Array} array The array to modify.
  25481. * @param {...*} [values] The values to remove.
  25482. * @returns {Array} Returns `array`.
  25483. * @example
  25484. *
  25485. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25486. *
  25487. * _.pull(array, 'a', 'c');
  25488. * console.log(array);
  25489. * // => ['b', 'b']
  25490. */
  25491. var pull = baseRest(pullAll);
  25492. /**
  25493. * This method is like `_.pull` except that it accepts an array of values to remove.
  25494. *
  25495. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25496. *
  25497. * @static
  25498. * @memberOf _
  25499. * @since 4.0.0
  25500. * @category Array
  25501. * @param {Array} array The array to modify.
  25502. * @param {Array} values The values to remove.
  25503. * @returns {Array} Returns `array`.
  25504. * @example
  25505. *
  25506. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25507. *
  25508. * _.pullAll(array, ['a', 'c']);
  25509. * console.log(array);
  25510. * // => ['b', 'b']
  25511. */
  25512. function pullAll(array, values) {
  25513. return (array && array.length && values && values.length)
  25514. ? basePullAll(array, values)
  25515. : array;
  25516. }
  25517. /**
  25518. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25519. * invoked for each element of `array` and `values` to generate the criterion
  25520. * by which they're compared. The iteratee is invoked with one argument: (value).
  25521. *
  25522. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25523. *
  25524. * @static
  25525. * @memberOf _
  25526. * @since 4.0.0
  25527. * @category Array
  25528. * @param {Array} array The array to modify.
  25529. * @param {Array} values The values to remove.
  25530. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25531. * @returns {Array} Returns `array`.
  25532. * @example
  25533. *
  25534. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25535. *
  25536. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25537. * console.log(array);
  25538. * // => [{ 'x': 2 }]
  25539. */
  25540. function pullAllBy(array, values, iteratee) {
  25541. return (array && array.length && values && values.length)
  25542. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25543. : array;
  25544. }
  25545. /**
  25546. * This method is like `_.pullAll` except that it accepts `comparator` which
  25547. * is invoked to compare elements of `array` to `values`. The comparator is
  25548. * invoked with two arguments: (arrVal, othVal).
  25549. *
  25550. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25551. *
  25552. * @static
  25553. * @memberOf _
  25554. * @since 4.6.0
  25555. * @category Array
  25556. * @param {Array} array The array to modify.
  25557. * @param {Array} values The values to remove.
  25558. * @param {Function} [comparator] The comparator invoked per element.
  25559. * @returns {Array} Returns `array`.
  25560. * @example
  25561. *
  25562. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25563. *
  25564. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25565. * console.log(array);
  25566. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25567. */
  25568. function pullAllWith(array, values, comparator) {
  25569. return (array && array.length && values && values.length)
  25570. ? basePullAll(array, values, undefined, comparator)
  25571. : array;
  25572. }
  25573. /**
  25574. * Removes elements from `array` corresponding to `indexes` and returns an
  25575. * array of removed elements.
  25576. *
  25577. * **Note:** Unlike `_.at`, this method mutates `array`.
  25578. *
  25579. * @static
  25580. * @memberOf _
  25581. * @since 3.0.0
  25582. * @category Array
  25583. * @param {Array} array The array to modify.
  25584. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25585. * @returns {Array} Returns the new array of removed elements.
  25586. * @example
  25587. *
  25588. * var array = ['a', 'b', 'c', 'd'];
  25589. * var pulled = _.pullAt(array, [1, 3]);
  25590. *
  25591. * console.log(array);
  25592. * // => ['a', 'c']
  25593. *
  25594. * console.log(pulled);
  25595. * // => ['b', 'd']
  25596. */
  25597. var pullAt = flatRest(function(array, indexes) {
  25598. var length = array == null ? 0 : array.length,
  25599. result = baseAt(array, indexes);
  25600. basePullAt(array, arrayMap(indexes, function(index) {
  25601. return isIndex(index, length) ? +index : index;
  25602. }).sort(compareAscending));
  25603. return result;
  25604. });
  25605. /**
  25606. * Removes all elements from `array` that `predicate` returns truthy for
  25607. * and returns an array of the removed elements. The predicate is invoked
  25608. * with three arguments: (value, index, array).
  25609. *
  25610. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25611. * to pull elements from an array by value.
  25612. *
  25613. * @static
  25614. * @memberOf _
  25615. * @since 2.0.0
  25616. * @category Array
  25617. * @param {Array} array The array to modify.
  25618. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25619. * @returns {Array} Returns the new array of removed elements.
  25620. * @example
  25621. *
  25622. * var array = [1, 2, 3, 4];
  25623. * var evens = _.remove(array, function(n) {
  25624. * return n % 2 == 0;
  25625. * });
  25626. *
  25627. * console.log(array);
  25628. * // => [1, 3]
  25629. *
  25630. * console.log(evens);
  25631. * // => [2, 4]
  25632. */
  25633. function remove(array, predicate) {
  25634. var result = [];
  25635. if (!(array && array.length)) {
  25636. return result;
  25637. }
  25638. var index = -1,
  25639. indexes = [],
  25640. length = array.length;
  25641. predicate = getIteratee(predicate, 3);
  25642. while (++index < length) {
  25643. var value = array[index];
  25644. if (predicate(value, index, array)) {
  25645. result.push(value);
  25646. indexes.push(index);
  25647. }
  25648. }
  25649. basePullAt(array, indexes);
  25650. return result;
  25651. }
  25652. /**
  25653. * Reverses `array` so that the first element becomes the last, the second
  25654. * element becomes the second to last, and so on.
  25655. *
  25656. * **Note:** This method mutates `array` and is based on
  25657. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25658. *
  25659. * @static
  25660. * @memberOf _
  25661. * @since 4.0.0
  25662. * @category Array
  25663. * @param {Array} array The array to modify.
  25664. * @returns {Array} Returns `array`.
  25665. * @example
  25666. *
  25667. * var array = [1, 2, 3];
  25668. *
  25669. * _.reverse(array);
  25670. * // => [3, 2, 1]
  25671. *
  25672. * console.log(array);
  25673. * // => [3, 2, 1]
  25674. */
  25675. function reverse(array) {
  25676. return array == null ? array : nativeReverse.call(array);
  25677. }
  25678. /**
  25679. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25680. *
  25681. * **Note:** This method is used instead of
  25682. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25683. * returned.
  25684. *
  25685. * @static
  25686. * @memberOf _
  25687. * @since 3.0.0
  25688. * @category Array
  25689. * @param {Array} array The array to slice.
  25690. * @param {number} [start=0] The start position.
  25691. * @param {number} [end=array.length] The end position.
  25692. * @returns {Array} Returns the slice of `array`.
  25693. */
  25694. function slice(array, start, end) {
  25695. var length = array == null ? 0 : array.length;
  25696. if (!length) {
  25697. return [];
  25698. }
  25699. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25700. start = 0;
  25701. end = length;
  25702. }
  25703. else {
  25704. start = start == null ? 0 : toInteger(start);
  25705. end = end === undefined ? length : toInteger(end);
  25706. }
  25707. return baseSlice(array, start, end);
  25708. }
  25709. /**
  25710. * Uses a binary search to determine the lowest index at which `value`
  25711. * should be inserted into `array` in order to maintain its sort order.
  25712. *
  25713. * @static
  25714. * @memberOf _
  25715. * @since 0.1.0
  25716. * @category Array
  25717. * @param {Array} array The sorted array to inspect.
  25718. * @param {*} value The value to evaluate.
  25719. * @returns {number} Returns the index at which `value` should be inserted
  25720. * into `array`.
  25721. * @example
  25722. *
  25723. * _.sortedIndex([30, 50], 40);
  25724. * // => 1
  25725. */
  25726. function sortedIndex(array, value) {
  25727. return baseSortedIndex(array, value);
  25728. }
  25729. /**
  25730. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25731. * which is invoked for `value` and each element of `array` to compute their
  25732. * sort ranking. The iteratee is invoked with one argument: (value).
  25733. *
  25734. * @static
  25735. * @memberOf _
  25736. * @since 4.0.0
  25737. * @category Array
  25738. * @param {Array} array The sorted array to inspect.
  25739. * @param {*} value The value to evaluate.
  25740. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25741. * @returns {number} Returns the index at which `value` should be inserted
  25742. * into `array`.
  25743. * @example
  25744. *
  25745. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25746. *
  25747. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25748. * // => 0
  25749. *
  25750. * // The `_.property` iteratee shorthand.
  25751. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25752. * // => 0
  25753. */
  25754. function sortedIndexBy(array, value, iteratee) {
  25755. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25756. }
  25757. /**
  25758. * This method is like `_.indexOf` except that it performs a binary
  25759. * search on a sorted `array`.
  25760. *
  25761. * @static
  25762. * @memberOf _
  25763. * @since 4.0.0
  25764. * @category Array
  25765. * @param {Array} array The array to inspect.
  25766. * @param {*} value The value to search for.
  25767. * @returns {number} Returns the index of the matched value, else `-1`.
  25768. * @example
  25769. *
  25770. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25771. * // => 1
  25772. */
  25773. function sortedIndexOf(array, value) {
  25774. var length = array == null ? 0 : array.length;
  25775. if (length) {
  25776. var index = baseSortedIndex(array, value);
  25777. if (index < length && eq(array[index], value)) {
  25778. return index;
  25779. }
  25780. }
  25781. return -1;
  25782. }
  25783. /**
  25784. * This method is like `_.sortedIndex` except that it returns the highest
  25785. * index at which `value` should be inserted into `array` in order to
  25786. * maintain its sort order.
  25787. *
  25788. * @static
  25789. * @memberOf _
  25790. * @since 3.0.0
  25791. * @category Array
  25792. * @param {Array} array The sorted array to inspect.
  25793. * @param {*} value The value to evaluate.
  25794. * @returns {number} Returns the index at which `value` should be inserted
  25795. * into `array`.
  25796. * @example
  25797. *
  25798. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25799. * // => 4
  25800. */
  25801. function sortedLastIndex(array, value) {
  25802. return baseSortedIndex(array, value, true);
  25803. }
  25804. /**
  25805. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25806. * which is invoked for `value` and each element of `array` to compute their
  25807. * sort ranking. The iteratee is invoked with one argument: (value).
  25808. *
  25809. * @static
  25810. * @memberOf _
  25811. * @since 4.0.0
  25812. * @category Array
  25813. * @param {Array} array The sorted array to inspect.
  25814. * @param {*} value The value to evaluate.
  25815. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25816. * @returns {number} Returns the index at which `value` should be inserted
  25817. * into `array`.
  25818. * @example
  25819. *
  25820. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25821. *
  25822. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25823. * // => 1
  25824. *
  25825. * // The `_.property` iteratee shorthand.
  25826. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25827. * // => 1
  25828. */
  25829. function sortedLastIndexBy(array, value, iteratee) {
  25830. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25831. }
  25832. /**
  25833. * This method is like `_.lastIndexOf` except that it performs a binary
  25834. * search on a sorted `array`.
  25835. *
  25836. * @static
  25837. * @memberOf _
  25838. * @since 4.0.0
  25839. * @category Array
  25840. * @param {Array} array The array to inspect.
  25841. * @param {*} value The value to search for.
  25842. * @returns {number} Returns the index of the matched value, else `-1`.
  25843. * @example
  25844. *
  25845. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25846. * // => 3
  25847. */
  25848. function sortedLastIndexOf(array, value) {
  25849. var length = array == null ? 0 : array.length;
  25850. if (length) {
  25851. var index = baseSortedIndex(array, value, true) - 1;
  25852. if (eq(array[index], value)) {
  25853. return index;
  25854. }
  25855. }
  25856. return -1;
  25857. }
  25858. /**
  25859. * This method is like `_.uniq` except that it's designed and optimized
  25860. * for sorted arrays.
  25861. *
  25862. * @static
  25863. * @memberOf _
  25864. * @since 4.0.0
  25865. * @category Array
  25866. * @param {Array} array The array to inspect.
  25867. * @returns {Array} Returns the new duplicate free array.
  25868. * @example
  25869. *
  25870. * _.sortedUniq([1, 1, 2]);
  25871. * // => [1, 2]
  25872. */
  25873. function sortedUniq(array) {
  25874. return (array && array.length)
  25875. ? baseSortedUniq(array)
  25876. : [];
  25877. }
  25878. /**
  25879. * This method is like `_.uniqBy` except that it's designed and optimized
  25880. * for sorted arrays.
  25881. *
  25882. * @static
  25883. * @memberOf _
  25884. * @since 4.0.0
  25885. * @category Array
  25886. * @param {Array} array The array to inspect.
  25887. * @param {Function} [iteratee] The iteratee invoked per element.
  25888. * @returns {Array} Returns the new duplicate free array.
  25889. * @example
  25890. *
  25891. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25892. * // => [1.1, 2.3]
  25893. */
  25894. function sortedUniqBy(array, iteratee) {
  25895. return (array && array.length)
  25896. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25897. : [];
  25898. }
  25899. /**
  25900. * Gets all but the first element of `array`.
  25901. *
  25902. * @static
  25903. * @memberOf _
  25904. * @since 4.0.0
  25905. * @category Array
  25906. * @param {Array} array The array to query.
  25907. * @returns {Array} Returns the slice of `array`.
  25908. * @example
  25909. *
  25910. * _.tail([1, 2, 3]);
  25911. * // => [2, 3]
  25912. */
  25913. function tail(array) {
  25914. var length = array == null ? 0 : array.length;
  25915. return length ? baseSlice(array, 1, length) : [];
  25916. }
  25917. /**
  25918. * Creates a slice of `array` with `n` elements taken from the beginning.
  25919. *
  25920. * @static
  25921. * @memberOf _
  25922. * @since 0.1.0
  25923. * @category Array
  25924. * @param {Array} array The array to query.
  25925. * @param {number} [n=1] The number of elements to take.
  25926. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25927. * @returns {Array} Returns the slice of `array`.
  25928. * @example
  25929. *
  25930. * _.take([1, 2, 3]);
  25931. * // => [1]
  25932. *
  25933. * _.take([1, 2, 3], 2);
  25934. * // => [1, 2]
  25935. *
  25936. * _.take([1, 2, 3], 5);
  25937. * // => [1, 2, 3]
  25938. *
  25939. * _.take([1, 2, 3], 0);
  25940. * // => []
  25941. */
  25942. function take(array, n, guard) {
  25943. if (!(array && array.length)) {
  25944. return [];
  25945. }
  25946. n = (guard || n === undefined) ? 1 : toInteger(n);
  25947. return baseSlice(array, 0, n < 0 ? 0 : n);
  25948. }
  25949. /**
  25950. * Creates a slice of `array` with `n` elements taken from the end.
  25951. *
  25952. * @static
  25953. * @memberOf _
  25954. * @since 3.0.0
  25955. * @category Array
  25956. * @param {Array} array The array to query.
  25957. * @param {number} [n=1] The number of elements to take.
  25958. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25959. * @returns {Array} Returns the slice of `array`.
  25960. * @example
  25961. *
  25962. * _.takeRight([1, 2, 3]);
  25963. * // => [3]
  25964. *
  25965. * _.takeRight([1, 2, 3], 2);
  25966. * // => [2, 3]
  25967. *
  25968. * _.takeRight([1, 2, 3], 5);
  25969. * // => [1, 2, 3]
  25970. *
  25971. * _.takeRight([1, 2, 3], 0);
  25972. * // => []
  25973. */
  25974. function takeRight(array, n, guard) {
  25975. var length = array == null ? 0 : array.length;
  25976. if (!length) {
  25977. return [];
  25978. }
  25979. n = (guard || n === undefined) ? 1 : toInteger(n);
  25980. n = length - n;
  25981. return baseSlice(array, n < 0 ? 0 : n, length);
  25982. }
  25983. /**
  25984. * Creates a slice of `array` with elements taken from the end. Elements are
  25985. * taken until `predicate` returns falsey. The predicate is invoked with
  25986. * three arguments: (value, index, array).
  25987. *
  25988. * @static
  25989. * @memberOf _
  25990. * @since 3.0.0
  25991. * @category Array
  25992. * @param {Array} array The array to query.
  25993. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25994. * @returns {Array} Returns the slice of `array`.
  25995. * @example
  25996. *
  25997. * var users = [
  25998. * { 'user': 'barney', 'active': true },
  25999. * { 'user': 'fred', 'active': false },
  26000. * { 'user': 'pebbles', 'active': false }
  26001. * ];
  26002. *
  26003. * _.takeRightWhile(users, function(o) { return !o.active; });
  26004. * // => objects for ['fred', 'pebbles']
  26005. *
  26006. * // The `_.matches` iteratee shorthand.
  26007. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26008. * // => objects for ['pebbles']
  26009. *
  26010. * // The `_.matchesProperty` iteratee shorthand.
  26011. * _.takeRightWhile(users, ['active', false]);
  26012. * // => objects for ['fred', 'pebbles']
  26013. *
  26014. * // The `_.property` iteratee shorthand.
  26015. * _.takeRightWhile(users, 'active');
  26016. * // => []
  26017. */
  26018. function takeRightWhile(array, predicate) {
  26019. return (array && array.length)
  26020. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26021. : [];
  26022. }
  26023. /**
  26024. * Creates a slice of `array` with elements taken from the beginning. Elements
  26025. * are taken until `predicate` returns falsey. The predicate is invoked with
  26026. * three arguments: (value, index, array).
  26027. *
  26028. * @static
  26029. * @memberOf _
  26030. * @since 3.0.0
  26031. * @category Array
  26032. * @param {Array} array The array to query.
  26033. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26034. * @returns {Array} Returns the slice of `array`.
  26035. * @example
  26036. *
  26037. * var users = [
  26038. * { 'user': 'barney', 'active': false },
  26039. * { 'user': 'fred', 'active': false },
  26040. * { 'user': 'pebbles', 'active': true }
  26041. * ];
  26042. *
  26043. * _.takeWhile(users, function(o) { return !o.active; });
  26044. * // => objects for ['barney', 'fred']
  26045. *
  26046. * // The `_.matches` iteratee shorthand.
  26047. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26048. * // => objects for ['barney']
  26049. *
  26050. * // The `_.matchesProperty` iteratee shorthand.
  26051. * _.takeWhile(users, ['active', false]);
  26052. * // => objects for ['barney', 'fred']
  26053. *
  26054. * // The `_.property` iteratee shorthand.
  26055. * _.takeWhile(users, 'active');
  26056. * // => []
  26057. */
  26058. function takeWhile(array, predicate) {
  26059. return (array && array.length)
  26060. ? baseWhile(array, getIteratee(predicate, 3))
  26061. : [];
  26062. }
  26063. /**
  26064. * Creates an array of unique values, in order, from all given arrays using
  26065. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26066. * for equality comparisons.
  26067. *
  26068. * @static
  26069. * @memberOf _
  26070. * @since 0.1.0
  26071. * @category Array
  26072. * @param {...Array} [arrays] The arrays to inspect.
  26073. * @returns {Array} Returns the new array of combined values.
  26074. * @example
  26075. *
  26076. * _.union([2], [1, 2]);
  26077. * // => [2, 1]
  26078. */
  26079. var union = baseRest(function(arrays) {
  26080. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26081. });
  26082. /**
  26083. * This method is like `_.union` except that it accepts `iteratee` which is
  26084. * invoked for each element of each `arrays` to generate the criterion by
  26085. * which uniqueness is computed. Result values are chosen from the first
  26086. * array in which the value occurs. The iteratee is invoked with one argument:
  26087. * (value).
  26088. *
  26089. * @static
  26090. * @memberOf _
  26091. * @since 4.0.0
  26092. * @category Array
  26093. * @param {...Array} [arrays] The arrays to inspect.
  26094. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26095. * @returns {Array} Returns the new array of combined values.
  26096. * @example
  26097. *
  26098. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26099. * // => [2.1, 1.2]
  26100. *
  26101. * // The `_.property` iteratee shorthand.
  26102. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26103. * // => [{ 'x': 1 }, { 'x': 2 }]
  26104. */
  26105. var unionBy = baseRest(function(arrays) {
  26106. var iteratee = last(arrays);
  26107. if (isArrayLikeObject(iteratee)) {
  26108. iteratee = undefined;
  26109. }
  26110. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26111. });
  26112. /**
  26113. * This method is like `_.union` except that it accepts `comparator` which
  26114. * is invoked to compare elements of `arrays`. Result values are chosen from
  26115. * the first array in which the value occurs. The comparator is invoked
  26116. * with two arguments: (arrVal, othVal).
  26117. *
  26118. * @static
  26119. * @memberOf _
  26120. * @since 4.0.0
  26121. * @category Array
  26122. * @param {...Array} [arrays] The arrays to inspect.
  26123. * @param {Function} [comparator] The comparator invoked per element.
  26124. * @returns {Array} Returns the new array of combined values.
  26125. * @example
  26126. *
  26127. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26128. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26129. *
  26130. * _.unionWith(objects, others, _.isEqual);
  26131. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26132. */
  26133. var unionWith = baseRest(function(arrays) {
  26134. var comparator = last(arrays);
  26135. comparator = typeof comparator == 'function' ? comparator : undefined;
  26136. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26137. });
  26138. /**
  26139. * Creates a duplicate-free version of an array, using
  26140. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26141. * for equality comparisons, in which only the first occurrence of each element
  26142. * is kept. The order of result values is determined by the order they occur
  26143. * in the array.
  26144. *
  26145. * @static
  26146. * @memberOf _
  26147. * @since 0.1.0
  26148. * @category Array
  26149. * @param {Array} array The array to inspect.
  26150. * @returns {Array} Returns the new duplicate free array.
  26151. * @example
  26152. *
  26153. * _.uniq([2, 1, 2]);
  26154. * // => [2, 1]
  26155. */
  26156. function uniq(array) {
  26157. return (array && array.length) ? baseUniq(array) : [];
  26158. }
  26159. /**
  26160. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26161. * invoked for each element in `array` to generate the criterion by which
  26162. * uniqueness is computed. The order of result values is determined by the
  26163. * order they occur in the array. The iteratee is invoked with one argument:
  26164. * (value).
  26165. *
  26166. * @static
  26167. * @memberOf _
  26168. * @since 4.0.0
  26169. * @category Array
  26170. * @param {Array} array The array to inspect.
  26171. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26172. * @returns {Array} Returns the new duplicate free array.
  26173. * @example
  26174. *
  26175. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26176. * // => [2.1, 1.2]
  26177. *
  26178. * // The `_.property` iteratee shorthand.
  26179. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26180. * // => [{ 'x': 1 }, { 'x': 2 }]
  26181. */
  26182. function uniqBy(array, iteratee) {
  26183. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26184. }
  26185. /**
  26186. * This method is like `_.uniq` except that it accepts `comparator` which
  26187. * is invoked to compare elements of `array`. The order of result values is
  26188. * determined by the order they occur in the array.The comparator is invoked
  26189. * with two arguments: (arrVal, othVal).
  26190. *
  26191. * @static
  26192. * @memberOf _
  26193. * @since 4.0.0
  26194. * @category Array
  26195. * @param {Array} array The array to inspect.
  26196. * @param {Function} [comparator] The comparator invoked per element.
  26197. * @returns {Array} Returns the new duplicate free array.
  26198. * @example
  26199. *
  26200. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26201. *
  26202. * _.uniqWith(objects, _.isEqual);
  26203. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26204. */
  26205. function uniqWith(array, comparator) {
  26206. comparator = typeof comparator == 'function' ? comparator : undefined;
  26207. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26208. }
  26209. /**
  26210. * This method is like `_.zip` except that it accepts an array of grouped
  26211. * elements and creates an array regrouping the elements to their pre-zip
  26212. * configuration.
  26213. *
  26214. * @static
  26215. * @memberOf _
  26216. * @since 1.2.0
  26217. * @category Array
  26218. * @param {Array} array The array of grouped elements to process.
  26219. * @returns {Array} Returns the new array of regrouped elements.
  26220. * @example
  26221. *
  26222. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26223. * // => [['a', 1, true], ['b', 2, false]]
  26224. *
  26225. * _.unzip(zipped);
  26226. * // => [['a', 'b'], [1, 2], [true, false]]
  26227. */
  26228. function unzip(array) {
  26229. if (!(array && array.length)) {
  26230. return [];
  26231. }
  26232. var length = 0;
  26233. array = arrayFilter(array, function(group) {
  26234. if (isArrayLikeObject(group)) {
  26235. length = nativeMax(group.length, length);
  26236. return true;
  26237. }
  26238. });
  26239. return baseTimes(length, function(index) {
  26240. return arrayMap(array, baseProperty(index));
  26241. });
  26242. }
  26243. /**
  26244. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26245. * how regrouped values should be combined. The iteratee is invoked with the
  26246. * elements of each group: (...group).
  26247. *
  26248. * @static
  26249. * @memberOf _
  26250. * @since 3.8.0
  26251. * @category Array
  26252. * @param {Array} array The array of grouped elements to process.
  26253. * @param {Function} [iteratee=_.identity] The function to combine
  26254. * regrouped values.
  26255. * @returns {Array} Returns the new array of regrouped elements.
  26256. * @example
  26257. *
  26258. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26259. * // => [[1, 10, 100], [2, 20, 200]]
  26260. *
  26261. * _.unzipWith(zipped, _.add);
  26262. * // => [3, 30, 300]
  26263. */
  26264. function unzipWith(array, iteratee) {
  26265. if (!(array && array.length)) {
  26266. return [];
  26267. }
  26268. var result = unzip(array);
  26269. if (iteratee == null) {
  26270. return result;
  26271. }
  26272. return arrayMap(result, function(group) {
  26273. return apply(iteratee, undefined, group);
  26274. });
  26275. }
  26276. /**
  26277. * Creates an array excluding all given values using
  26278. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26279. * for equality comparisons.
  26280. *
  26281. * **Note:** Unlike `_.pull`, this method returns a new array.
  26282. *
  26283. * @static
  26284. * @memberOf _
  26285. * @since 0.1.0
  26286. * @category Array
  26287. * @param {Array} array The array to inspect.
  26288. * @param {...*} [values] The values to exclude.
  26289. * @returns {Array} Returns the new array of filtered values.
  26290. * @see _.difference, _.xor
  26291. * @example
  26292. *
  26293. * _.without([2, 1, 2, 3], 1, 2);
  26294. * // => [3]
  26295. */
  26296. var without = baseRest(function(array, values) {
  26297. return isArrayLikeObject(array)
  26298. ? baseDifference(array, values)
  26299. : [];
  26300. });
  26301. /**
  26302. * Creates an array of unique values that is the
  26303. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26304. * of the given arrays. The order of result values is determined by the order
  26305. * they occur in the arrays.
  26306. *
  26307. * @static
  26308. * @memberOf _
  26309. * @since 2.4.0
  26310. * @category Array
  26311. * @param {...Array} [arrays] The arrays to inspect.
  26312. * @returns {Array} Returns the new array of filtered values.
  26313. * @see _.difference, _.without
  26314. * @example
  26315. *
  26316. * _.xor([2, 1], [2, 3]);
  26317. * // => [1, 3]
  26318. */
  26319. var xor = baseRest(function(arrays) {
  26320. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26321. });
  26322. /**
  26323. * This method is like `_.xor` except that it accepts `iteratee` which is
  26324. * invoked for each element of each `arrays` to generate the criterion by
  26325. * which by which they're compared. The order of result values is determined
  26326. * by the order they occur in the arrays. The iteratee is invoked with one
  26327. * argument: (value).
  26328. *
  26329. * @static
  26330. * @memberOf _
  26331. * @since 4.0.0
  26332. * @category Array
  26333. * @param {...Array} [arrays] The arrays to inspect.
  26334. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26335. * @returns {Array} Returns the new array of filtered values.
  26336. * @example
  26337. *
  26338. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26339. * // => [1.2, 3.4]
  26340. *
  26341. * // The `_.property` iteratee shorthand.
  26342. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26343. * // => [{ 'x': 2 }]
  26344. */
  26345. var xorBy = baseRest(function(arrays) {
  26346. var iteratee = last(arrays);
  26347. if (isArrayLikeObject(iteratee)) {
  26348. iteratee = undefined;
  26349. }
  26350. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26351. });
  26352. /**
  26353. * This method is like `_.xor` except that it accepts `comparator` which is
  26354. * invoked to compare elements of `arrays`. The order of result values is
  26355. * determined by the order they occur in the arrays. The comparator is invoked
  26356. * with two arguments: (arrVal, othVal).
  26357. *
  26358. * @static
  26359. * @memberOf _
  26360. * @since 4.0.0
  26361. * @category Array
  26362. * @param {...Array} [arrays] The arrays to inspect.
  26363. * @param {Function} [comparator] The comparator invoked per element.
  26364. * @returns {Array} Returns the new array of filtered values.
  26365. * @example
  26366. *
  26367. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26368. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26369. *
  26370. * _.xorWith(objects, others, _.isEqual);
  26371. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26372. */
  26373. var xorWith = baseRest(function(arrays) {
  26374. var comparator = last(arrays);
  26375. comparator = typeof comparator == 'function' ? comparator : undefined;
  26376. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26377. });
  26378. /**
  26379. * Creates an array of grouped elements, the first of which contains the
  26380. * first elements of the given arrays, the second of which contains the
  26381. * second elements of the given arrays, and so on.
  26382. *
  26383. * @static
  26384. * @memberOf _
  26385. * @since 0.1.0
  26386. * @category Array
  26387. * @param {...Array} [arrays] The arrays to process.
  26388. * @returns {Array} Returns the new array of grouped elements.
  26389. * @example
  26390. *
  26391. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26392. * // => [['a', 1, true], ['b', 2, false]]
  26393. */
  26394. var zip = baseRest(unzip);
  26395. /**
  26396. * This method is like `_.fromPairs` except that it accepts two arrays,
  26397. * one of property identifiers and one of corresponding values.
  26398. *
  26399. * @static
  26400. * @memberOf _
  26401. * @since 0.4.0
  26402. * @category Array
  26403. * @param {Array} [props=[]] The property identifiers.
  26404. * @param {Array} [values=[]] The property values.
  26405. * @returns {Object} Returns the new object.
  26406. * @example
  26407. *
  26408. * _.zipObject(['a', 'b'], [1, 2]);
  26409. * // => { 'a': 1, 'b': 2 }
  26410. */
  26411. function zipObject(props, values) {
  26412. return baseZipObject(props || [], values || [], assignValue);
  26413. }
  26414. /**
  26415. * This method is like `_.zipObject` except that it supports property paths.
  26416. *
  26417. * @static
  26418. * @memberOf _
  26419. * @since 4.1.0
  26420. * @category Array
  26421. * @param {Array} [props=[]] The property identifiers.
  26422. * @param {Array} [values=[]] The property values.
  26423. * @returns {Object} Returns the new object.
  26424. * @example
  26425. *
  26426. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26427. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26428. */
  26429. function zipObjectDeep(props, values) {
  26430. return baseZipObject(props || [], values || [], baseSet);
  26431. }
  26432. /**
  26433. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26434. * how grouped values should be combined. The iteratee is invoked with the
  26435. * elements of each group: (...group).
  26436. *
  26437. * @static
  26438. * @memberOf _
  26439. * @since 3.8.0
  26440. * @category Array
  26441. * @param {...Array} [arrays] The arrays to process.
  26442. * @param {Function} [iteratee=_.identity] The function to combine
  26443. * grouped values.
  26444. * @returns {Array} Returns the new array of grouped elements.
  26445. * @example
  26446. *
  26447. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26448. * return a + b + c;
  26449. * });
  26450. * // => [111, 222]
  26451. */
  26452. var zipWith = baseRest(function(arrays) {
  26453. var length = arrays.length,
  26454. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26455. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26456. return unzipWith(arrays, iteratee);
  26457. });
  26458. /*------------------------------------------------------------------------*/
  26459. /**
  26460. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26461. * chain sequences enabled. The result of such sequences must be unwrapped
  26462. * with `_#value`.
  26463. *
  26464. * @static
  26465. * @memberOf _
  26466. * @since 1.3.0
  26467. * @category Seq
  26468. * @param {*} value The value to wrap.
  26469. * @returns {Object} Returns the new `lodash` wrapper instance.
  26470. * @example
  26471. *
  26472. * var users = [
  26473. * { 'user': 'barney', 'age': 36 },
  26474. * { 'user': 'fred', 'age': 40 },
  26475. * { 'user': 'pebbles', 'age': 1 }
  26476. * ];
  26477. *
  26478. * var youngest = _
  26479. * .chain(users)
  26480. * .sortBy('age')
  26481. * .map(function(o) {
  26482. * return o.user + ' is ' + o.age;
  26483. * })
  26484. * .head()
  26485. * .value();
  26486. * // => 'pebbles is 1'
  26487. */
  26488. function chain(value) {
  26489. var result = lodash(value);
  26490. result.__chain__ = true;
  26491. return result;
  26492. }
  26493. /**
  26494. * This method invokes `interceptor` and returns `value`. The interceptor
  26495. * is invoked with one argument; (value). The purpose of this method is to
  26496. * "tap into" a method chain sequence in order to modify intermediate results.
  26497. *
  26498. * @static
  26499. * @memberOf _
  26500. * @since 0.1.0
  26501. * @category Seq
  26502. * @param {*} value The value to provide to `interceptor`.
  26503. * @param {Function} interceptor The function to invoke.
  26504. * @returns {*} Returns `value`.
  26505. * @example
  26506. *
  26507. * _([1, 2, 3])
  26508. * .tap(function(array) {
  26509. * // Mutate input array.
  26510. * array.pop();
  26511. * })
  26512. * .reverse()
  26513. * .value();
  26514. * // => [2, 1]
  26515. */
  26516. function tap(value, interceptor) {
  26517. interceptor(value);
  26518. return value;
  26519. }
  26520. /**
  26521. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26522. * The purpose of this method is to "pass thru" values replacing intermediate
  26523. * results in a method chain sequence.
  26524. *
  26525. * @static
  26526. * @memberOf _
  26527. * @since 3.0.0
  26528. * @category Seq
  26529. * @param {*} value The value to provide to `interceptor`.
  26530. * @param {Function} interceptor The function to invoke.
  26531. * @returns {*} Returns the result of `interceptor`.
  26532. * @example
  26533. *
  26534. * _(' abc ')
  26535. * .chain()
  26536. * .trim()
  26537. * .thru(function(value) {
  26538. * return [value];
  26539. * })
  26540. * .value();
  26541. * // => ['abc']
  26542. */
  26543. function thru(value, interceptor) {
  26544. return interceptor(value);
  26545. }
  26546. /**
  26547. * This method is the wrapper version of `_.at`.
  26548. *
  26549. * @name at
  26550. * @memberOf _
  26551. * @since 1.0.0
  26552. * @category Seq
  26553. * @param {...(string|string[])} [paths] The property paths to pick.
  26554. * @returns {Object} Returns the new `lodash` wrapper instance.
  26555. * @example
  26556. *
  26557. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26558. *
  26559. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26560. * // => [3, 4]
  26561. */
  26562. var wrapperAt = flatRest(function(paths) {
  26563. var length = paths.length,
  26564. start = length ? paths[0] : 0,
  26565. value = this.__wrapped__,
  26566. interceptor = function(object) { return baseAt(object, paths); };
  26567. if (length > 1 || this.__actions__.length ||
  26568. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26569. return this.thru(interceptor);
  26570. }
  26571. value = value.slice(start, +start + (length ? 1 : 0));
  26572. value.__actions__.push({
  26573. 'func': thru,
  26574. 'args': [interceptor],
  26575. 'thisArg': undefined
  26576. });
  26577. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26578. if (length && !array.length) {
  26579. array.push(undefined);
  26580. }
  26581. return array;
  26582. });
  26583. });
  26584. /**
  26585. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26586. *
  26587. * @name chain
  26588. * @memberOf _
  26589. * @since 0.1.0
  26590. * @category Seq
  26591. * @returns {Object} Returns the new `lodash` wrapper instance.
  26592. * @example
  26593. *
  26594. * var users = [
  26595. * { 'user': 'barney', 'age': 36 },
  26596. * { 'user': 'fred', 'age': 40 }
  26597. * ];
  26598. *
  26599. * // A sequence without explicit chaining.
  26600. * _(users).head();
  26601. * // => { 'user': 'barney', 'age': 36 }
  26602. *
  26603. * // A sequence with explicit chaining.
  26604. * _(users)
  26605. * .chain()
  26606. * .head()
  26607. * .pick('user')
  26608. * .value();
  26609. * // => { 'user': 'barney' }
  26610. */
  26611. function wrapperChain() {
  26612. return chain(this);
  26613. }
  26614. /**
  26615. * Executes the chain sequence and returns the wrapped result.
  26616. *
  26617. * @name commit
  26618. * @memberOf _
  26619. * @since 3.2.0
  26620. * @category Seq
  26621. * @returns {Object} Returns the new `lodash` wrapper instance.
  26622. * @example
  26623. *
  26624. * var array = [1, 2];
  26625. * var wrapped = _(array).push(3);
  26626. *
  26627. * console.log(array);
  26628. * // => [1, 2]
  26629. *
  26630. * wrapped = wrapped.commit();
  26631. * console.log(array);
  26632. * // => [1, 2, 3]
  26633. *
  26634. * wrapped.last();
  26635. * // => 3
  26636. *
  26637. * console.log(array);
  26638. * // => [1, 2, 3]
  26639. */
  26640. function wrapperCommit() {
  26641. return new LodashWrapper(this.value(), this.__chain__);
  26642. }
  26643. /**
  26644. * Gets the next value on a wrapped object following the
  26645. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26646. *
  26647. * @name next
  26648. * @memberOf _
  26649. * @since 4.0.0
  26650. * @category Seq
  26651. * @returns {Object} Returns the next iterator value.
  26652. * @example
  26653. *
  26654. * var wrapped = _([1, 2]);
  26655. *
  26656. * wrapped.next();
  26657. * // => { 'done': false, 'value': 1 }
  26658. *
  26659. * wrapped.next();
  26660. * // => { 'done': false, 'value': 2 }
  26661. *
  26662. * wrapped.next();
  26663. * // => { 'done': true, 'value': undefined }
  26664. */
  26665. function wrapperNext() {
  26666. if (this.__values__ === undefined) {
  26667. this.__values__ = toArray(this.value());
  26668. }
  26669. var done = this.__index__ >= this.__values__.length,
  26670. value = done ? undefined : this.__values__[this.__index__++];
  26671. return { 'done': done, 'value': value };
  26672. }
  26673. /**
  26674. * Enables the wrapper to be iterable.
  26675. *
  26676. * @name Symbol.iterator
  26677. * @memberOf _
  26678. * @since 4.0.0
  26679. * @category Seq
  26680. * @returns {Object} Returns the wrapper object.
  26681. * @example
  26682. *
  26683. * var wrapped = _([1, 2]);
  26684. *
  26685. * wrapped[Symbol.iterator]() === wrapped;
  26686. * // => true
  26687. *
  26688. * Array.from(wrapped);
  26689. * // => [1, 2]
  26690. */
  26691. function wrapperToIterator() {
  26692. return this;
  26693. }
  26694. /**
  26695. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26696. *
  26697. * @name plant
  26698. * @memberOf _
  26699. * @since 3.2.0
  26700. * @category Seq
  26701. * @param {*} value The value to plant.
  26702. * @returns {Object} Returns the new `lodash` wrapper instance.
  26703. * @example
  26704. *
  26705. * function square(n) {
  26706. * return n * n;
  26707. * }
  26708. *
  26709. * var wrapped = _([1, 2]).map(square);
  26710. * var other = wrapped.plant([3, 4]);
  26711. *
  26712. * other.value();
  26713. * // => [9, 16]
  26714. *
  26715. * wrapped.value();
  26716. * // => [1, 4]
  26717. */
  26718. function wrapperPlant(value) {
  26719. var result,
  26720. parent = this;
  26721. while (parent instanceof baseLodash) {
  26722. var clone = wrapperClone(parent);
  26723. clone.__index__ = 0;
  26724. clone.__values__ = undefined;
  26725. if (result) {
  26726. previous.__wrapped__ = clone;
  26727. } else {
  26728. result = clone;
  26729. }
  26730. var previous = clone;
  26731. parent = parent.__wrapped__;
  26732. }
  26733. previous.__wrapped__ = value;
  26734. return result;
  26735. }
  26736. /**
  26737. * This method is the wrapper version of `_.reverse`.
  26738. *
  26739. * **Note:** This method mutates the wrapped array.
  26740. *
  26741. * @name reverse
  26742. * @memberOf _
  26743. * @since 0.1.0
  26744. * @category Seq
  26745. * @returns {Object} Returns the new `lodash` wrapper instance.
  26746. * @example
  26747. *
  26748. * var array = [1, 2, 3];
  26749. *
  26750. * _(array).reverse().value()
  26751. * // => [3, 2, 1]
  26752. *
  26753. * console.log(array);
  26754. * // => [3, 2, 1]
  26755. */
  26756. function wrapperReverse() {
  26757. var value = this.__wrapped__;
  26758. if (value instanceof LazyWrapper) {
  26759. var wrapped = value;
  26760. if (this.__actions__.length) {
  26761. wrapped = new LazyWrapper(this);
  26762. }
  26763. wrapped = wrapped.reverse();
  26764. wrapped.__actions__.push({
  26765. 'func': thru,
  26766. 'args': [reverse],
  26767. 'thisArg': undefined
  26768. });
  26769. return new LodashWrapper(wrapped, this.__chain__);
  26770. }
  26771. return this.thru(reverse);
  26772. }
  26773. /**
  26774. * Executes the chain sequence to resolve the unwrapped value.
  26775. *
  26776. * @name value
  26777. * @memberOf _
  26778. * @since 0.1.0
  26779. * @alias toJSON, valueOf
  26780. * @category Seq
  26781. * @returns {*} Returns the resolved unwrapped value.
  26782. * @example
  26783. *
  26784. * _([1, 2, 3]).value();
  26785. * // => [1, 2, 3]
  26786. */
  26787. function wrapperValue() {
  26788. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26789. }
  26790. /*------------------------------------------------------------------------*/
  26791. /**
  26792. * Creates an object composed of keys generated from the results of running
  26793. * each element of `collection` thru `iteratee`. The corresponding value of
  26794. * each key is the number of times the key was returned by `iteratee`. The
  26795. * iteratee is invoked with one argument: (value).
  26796. *
  26797. * @static
  26798. * @memberOf _
  26799. * @since 0.5.0
  26800. * @category Collection
  26801. * @param {Array|Object} collection The collection to iterate over.
  26802. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26803. * @returns {Object} Returns the composed aggregate object.
  26804. * @example
  26805. *
  26806. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26807. * // => { '4': 1, '6': 2 }
  26808. *
  26809. * // The `_.property` iteratee shorthand.
  26810. * _.countBy(['one', 'two', 'three'], 'length');
  26811. * // => { '3': 2, '5': 1 }
  26812. */
  26813. var countBy = createAggregator(function(result, value, key) {
  26814. if (hasOwnProperty.call(result, key)) {
  26815. ++result[key];
  26816. } else {
  26817. baseAssignValue(result, key, 1);
  26818. }
  26819. });
  26820. /**
  26821. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26822. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26823. * invoked with three arguments: (value, index|key, collection).
  26824. *
  26825. * **Note:** This method returns `true` for
  26826. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26827. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26828. * elements of empty collections.
  26829. *
  26830. * @static
  26831. * @memberOf _
  26832. * @since 0.1.0
  26833. * @category Collection
  26834. * @param {Array|Object} collection The collection to iterate over.
  26835. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26836. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26837. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26838. * else `false`.
  26839. * @example
  26840. *
  26841. * _.every([true, 1, null, 'yes'], Boolean);
  26842. * // => false
  26843. *
  26844. * var users = [
  26845. * { 'user': 'barney', 'age': 36, 'active': false },
  26846. * { 'user': 'fred', 'age': 40, 'active': false }
  26847. * ];
  26848. *
  26849. * // The `_.matches` iteratee shorthand.
  26850. * _.every(users, { 'user': 'barney', 'active': false });
  26851. * // => false
  26852. *
  26853. * // The `_.matchesProperty` iteratee shorthand.
  26854. * _.every(users, ['active', false]);
  26855. * // => true
  26856. *
  26857. * // The `_.property` iteratee shorthand.
  26858. * _.every(users, 'active');
  26859. * // => false
  26860. */
  26861. function every(collection, predicate, guard) {
  26862. var func = isArray(collection) ? arrayEvery : baseEvery;
  26863. if (guard && isIterateeCall(collection, predicate, guard)) {
  26864. predicate = undefined;
  26865. }
  26866. return func(collection, getIteratee(predicate, 3));
  26867. }
  26868. /**
  26869. * Iterates over elements of `collection`, returning an array of all elements
  26870. * `predicate` returns truthy for. The predicate is invoked with three
  26871. * arguments: (value, index|key, collection).
  26872. *
  26873. * **Note:** Unlike `_.remove`, this method returns a new array.
  26874. *
  26875. * @static
  26876. * @memberOf _
  26877. * @since 0.1.0
  26878. * @category Collection
  26879. * @param {Array|Object} collection The collection to iterate over.
  26880. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26881. * @returns {Array} Returns the new filtered array.
  26882. * @see _.reject
  26883. * @example
  26884. *
  26885. * var users = [
  26886. * { 'user': 'barney', 'age': 36, 'active': true },
  26887. * { 'user': 'fred', 'age': 40, 'active': false }
  26888. * ];
  26889. *
  26890. * _.filter(users, function(o) { return !o.active; });
  26891. * // => objects for ['fred']
  26892. *
  26893. * // The `_.matches` iteratee shorthand.
  26894. * _.filter(users, { 'age': 36, 'active': true });
  26895. * // => objects for ['barney']
  26896. *
  26897. * // The `_.matchesProperty` iteratee shorthand.
  26898. * _.filter(users, ['active', false]);
  26899. * // => objects for ['fred']
  26900. *
  26901. * // The `_.property` iteratee shorthand.
  26902. * _.filter(users, 'active');
  26903. * // => objects for ['barney']
  26904. */
  26905. function filter(collection, predicate) {
  26906. var func = isArray(collection) ? arrayFilter : baseFilter;
  26907. return func(collection, getIteratee(predicate, 3));
  26908. }
  26909. /**
  26910. * Iterates over elements of `collection`, returning the first element
  26911. * `predicate` returns truthy for. The predicate is invoked with three
  26912. * arguments: (value, index|key, collection).
  26913. *
  26914. * @static
  26915. * @memberOf _
  26916. * @since 0.1.0
  26917. * @category Collection
  26918. * @param {Array|Object} collection The collection to inspect.
  26919. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26920. * @param {number} [fromIndex=0] The index to search from.
  26921. * @returns {*} Returns the matched element, else `undefined`.
  26922. * @example
  26923. *
  26924. * var users = [
  26925. * { 'user': 'barney', 'age': 36, 'active': true },
  26926. * { 'user': 'fred', 'age': 40, 'active': false },
  26927. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26928. * ];
  26929. *
  26930. * _.find(users, function(o) { return o.age < 40; });
  26931. * // => object for 'barney'
  26932. *
  26933. * // The `_.matches` iteratee shorthand.
  26934. * _.find(users, { 'age': 1, 'active': true });
  26935. * // => object for 'pebbles'
  26936. *
  26937. * // The `_.matchesProperty` iteratee shorthand.
  26938. * _.find(users, ['active', false]);
  26939. * // => object for 'fred'
  26940. *
  26941. * // The `_.property` iteratee shorthand.
  26942. * _.find(users, 'active');
  26943. * // => object for 'barney'
  26944. */
  26945. var find = createFind(findIndex);
  26946. /**
  26947. * This method is like `_.find` except that it iterates over elements of
  26948. * `collection` from right to left.
  26949. *
  26950. * @static
  26951. * @memberOf _
  26952. * @since 2.0.0
  26953. * @category Collection
  26954. * @param {Array|Object} collection The collection to inspect.
  26955. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26956. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26957. * @returns {*} Returns the matched element, else `undefined`.
  26958. * @example
  26959. *
  26960. * _.findLast([1, 2, 3, 4], function(n) {
  26961. * return n % 2 == 1;
  26962. * });
  26963. * // => 3
  26964. */
  26965. var findLast = createFind(findLastIndex);
  26966. /**
  26967. * Creates a flattened array of values by running each element in `collection`
  26968. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26969. * with three arguments: (value, index|key, collection).
  26970. *
  26971. * @static
  26972. * @memberOf _
  26973. * @since 4.0.0
  26974. * @category Collection
  26975. * @param {Array|Object} collection The collection to iterate over.
  26976. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26977. * @returns {Array} Returns the new flattened array.
  26978. * @example
  26979. *
  26980. * function duplicate(n) {
  26981. * return [n, n];
  26982. * }
  26983. *
  26984. * _.flatMap([1, 2], duplicate);
  26985. * // => [1, 1, 2, 2]
  26986. */
  26987. function flatMap(collection, iteratee) {
  26988. return baseFlatten(map(collection, iteratee), 1);
  26989. }
  26990. /**
  26991. * This method is like `_.flatMap` except that it recursively flattens the
  26992. * mapped results.
  26993. *
  26994. * @static
  26995. * @memberOf _
  26996. * @since 4.7.0
  26997. * @category Collection
  26998. * @param {Array|Object} collection The collection to iterate over.
  26999. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27000. * @returns {Array} Returns the new flattened array.
  27001. * @example
  27002. *
  27003. * function duplicate(n) {
  27004. * return [[[n, n]]];
  27005. * }
  27006. *
  27007. * _.flatMapDeep([1, 2], duplicate);
  27008. * // => [1, 1, 2, 2]
  27009. */
  27010. function flatMapDeep(collection, iteratee) {
  27011. return baseFlatten(map(collection, iteratee), INFINITY);
  27012. }
  27013. /**
  27014. * This method is like `_.flatMap` except that it recursively flattens the
  27015. * mapped results up to `depth` times.
  27016. *
  27017. * @static
  27018. * @memberOf _
  27019. * @since 4.7.0
  27020. * @category Collection
  27021. * @param {Array|Object} collection The collection to iterate over.
  27022. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27023. * @param {number} [depth=1] The maximum recursion depth.
  27024. * @returns {Array} Returns the new flattened array.
  27025. * @example
  27026. *
  27027. * function duplicate(n) {
  27028. * return [[[n, n]]];
  27029. * }
  27030. *
  27031. * _.flatMapDepth([1, 2], duplicate, 2);
  27032. * // => [[1, 1], [2, 2]]
  27033. */
  27034. function flatMapDepth(collection, iteratee, depth) {
  27035. depth = depth === undefined ? 1 : toInteger(depth);
  27036. return baseFlatten(map(collection, iteratee), depth);
  27037. }
  27038. /**
  27039. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27040. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27041. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27042. *
  27043. * **Note:** As with other "Collections" methods, objects with a "length"
  27044. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27045. * or `_.forOwn` for object iteration.
  27046. *
  27047. * @static
  27048. * @memberOf _
  27049. * @since 0.1.0
  27050. * @alias each
  27051. * @category Collection
  27052. * @param {Array|Object} collection The collection to iterate over.
  27053. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27054. * @returns {Array|Object} Returns `collection`.
  27055. * @see _.forEachRight
  27056. * @example
  27057. *
  27058. * _.forEach([1, 2], function(value) {
  27059. * console.log(value);
  27060. * });
  27061. * // => Logs `1` then `2`.
  27062. *
  27063. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27064. * console.log(key);
  27065. * });
  27066. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27067. */
  27068. function forEach(collection, iteratee) {
  27069. var func = isArray(collection) ? arrayEach : baseEach;
  27070. return func(collection, getIteratee(iteratee, 3));
  27071. }
  27072. /**
  27073. * This method is like `_.forEach` except that it iterates over elements of
  27074. * `collection` from right to left.
  27075. *
  27076. * @static
  27077. * @memberOf _
  27078. * @since 2.0.0
  27079. * @alias eachRight
  27080. * @category Collection
  27081. * @param {Array|Object} collection The collection to iterate over.
  27082. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27083. * @returns {Array|Object} Returns `collection`.
  27084. * @see _.forEach
  27085. * @example
  27086. *
  27087. * _.forEachRight([1, 2], function(value) {
  27088. * console.log(value);
  27089. * });
  27090. * // => Logs `2` then `1`.
  27091. */
  27092. function forEachRight(collection, iteratee) {
  27093. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27094. return func(collection, getIteratee(iteratee, 3));
  27095. }
  27096. /**
  27097. * Creates an object composed of keys generated from the results of running
  27098. * each element of `collection` thru `iteratee`. The order of grouped values
  27099. * is determined by the order they occur in `collection`. The corresponding
  27100. * value of each key is an array of elements responsible for generating the
  27101. * key. The iteratee is invoked with one argument: (value).
  27102. *
  27103. * @static
  27104. * @memberOf _
  27105. * @since 0.1.0
  27106. * @category Collection
  27107. * @param {Array|Object} collection The collection to iterate over.
  27108. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27109. * @returns {Object} Returns the composed aggregate object.
  27110. * @example
  27111. *
  27112. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27113. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27114. *
  27115. * // The `_.property` iteratee shorthand.
  27116. * _.groupBy(['one', 'two', 'three'], 'length');
  27117. * // => { '3': ['one', 'two'], '5': ['three'] }
  27118. */
  27119. var groupBy = createAggregator(function(result, value, key) {
  27120. if (hasOwnProperty.call(result, key)) {
  27121. result[key].push(value);
  27122. } else {
  27123. baseAssignValue(result, key, [value]);
  27124. }
  27125. });
  27126. /**
  27127. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27128. * checked for a substring of `value`, otherwise
  27129. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27130. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27131. * the offset from the end of `collection`.
  27132. *
  27133. * @static
  27134. * @memberOf _
  27135. * @since 0.1.0
  27136. * @category Collection
  27137. * @param {Array|Object|string} collection The collection to inspect.
  27138. * @param {*} value The value to search for.
  27139. * @param {number} [fromIndex=0] The index to search from.
  27140. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27141. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27142. * @example
  27143. *
  27144. * _.includes([1, 2, 3], 1);
  27145. * // => true
  27146. *
  27147. * _.includes([1, 2, 3], 1, 2);
  27148. * // => false
  27149. *
  27150. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27151. * // => true
  27152. *
  27153. * _.includes('abcd', 'bc');
  27154. * // => true
  27155. */
  27156. function includes(collection, value, fromIndex, guard) {
  27157. collection = isArrayLike(collection) ? collection : values(collection);
  27158. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27159. var length = collection.length;
  27160. if (fromIndex < 0) {
  27161. fromIndex = nativeMax(length + fromIndex, 0);
  27162. }
  27163. return isString(collection)
  27164. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27165. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27166. }
  27167. /**
  27168. * Invokes the method at `path` of each element in `collection`, returning
  27169. * an array of the results of each invoked method. Any additional arguments
  27170. * are provided to each invoked method. If `path` is a function, it's invoked
  27171. * for, and `this` bound to, each element in `collection`.
  27172. *
  27173. * @static
  27174. * @memberOf _
  27175. * @since 4.0.0
  27176. * @category Collection
  27177. * @param {Array|Object} collection The collection to iterate over.
  27178. * @param {Array|Function|string} path The path of the method to invoke or
  27179. * the function invoked per iteration.
  27180. * @param {...*} [args] The arguments to invoke each method with.
  27181. * @returns {Array} Returns the array of results.
  27182. * @example
  27183. *
  27184. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27185. * // => [[1, 5, 7], [1, 2, 3]]
  27186. *
  27187. * _.invokeMap([123, 456], String.prototype.split, '');
  27188. * // => [['1', '2', '3'], ['4', '5', '6']]
  27189. */
  27190. var invokeMap = baseRest(function(collection, path, args) {
  27191. var index = -1,
  27192. isFunc = typeof path == 'function',
  27193. result = isArrayLike(collection) ? Array(collection.length) : [];
  27194. baseEach(collection, function(value) {
  27195. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27196. });
  27197. return result;
  27198. });
  27199. /**
  27200. * Creates an object composed of keys generated from the results of running
  27201. * each element of `collection` thru `iteratee`. The corresponding value of
  27202. * each key is the last element responsible for generating the key. The
  27203. * iteratee is invoked with one argument: (value).
  27204. *
  27205. * @static
  27206. * @memberOf _
  27207. * @since 4.0.0
  27208. * @category Collection
  27209. * @param {Array|Object} collection The collection to iterate over.
  27210. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27211. * @returns {Object} Returns the composed aggregate object.
  27212. * @example
  27213. *
  27214. * var array = [
  27215. * { 'dir': 'left', 'code': 97 },
  27216. * { 'dir': 'right', 'code': 100 }
  27217. * ];
  27218. *
  27219. * _.keyBy(array, function(o) {
  27220. * return String.fromCharCode(o.code);
  27221. * });
  27222. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27223. *
  27224. * _.keyBy(array, 'dir');
  27225. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27226. */
  27227. var keyBy = createAggregator(function(result, value, key) {
  27228. baseAssignValue(result, key, value);
  27229. });
  27230. /**
  27231. * Creates an array of values by running each element in `collection` thru
  27232. * `iteratee`. The iteratee is invoked with three arguments:
  27233. * (value, index|key, collection).
  27234. *
  27235. * Many lodash methods are guarded to work as iteratees for methods like
  27236. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27237. *
  27238. * The guarded methods are:
  27239. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27240. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27241. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27242. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27243. *
  27244. * @static
  27245. * @memberOf _
  27246. * @since 0.1.0
  27247. * @category Collection
  27248. * @param {Array|Object} collection The collection to iterate over.
  27249. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27250. * @returns {Array} Returns the new mapped array.
  27251. * @example
  27252. *
  27253. * function square(n) {
  27254. * return n * n;
  27255. * }
  27256. *
  27257. * _.map([4, 8], square);
  27258. * // => [16, 64]
  27259. *
  27260. * _.map({ 'a': 4, 'b': 8 }, square);
  27261. * // => [16, 64] (iteration order is not guaranteed)
  27262. *
  27263. * var users = [
  27264. * { 'user': 'barney' },
  27265. * { 'user': 'fred' }
  27266. * ];
  27267. *
  27268. * // The `_.property` iteratee shorthand.
  27269. * _.map(users, 'user');
  27270. * // => ['barney', 'fred']
  27271. */
  27272. function map(collection, iteratee) {
  27273. var func = isArray(collection) ? arrayMap : baseMap;
  27274. return func(collection, getIteratee(iteratee, 3));
  27275. }
  27276. /**
  27277. * This method is like `_.sortBy` except that it allows specifying the sort
  27278. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27279. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27280. * descending or "asc" for ascending sort order of corresponding values.
  27281. *
  27282. * @static
  27283. * @memberOf _
  27284. * @since 4.0.0
  27285. * @category Collection
  27286. * @param {Array|Object} collection The collection to iterate over.
  27287. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27288. * The iteratees to sort by.
  27289. * @param {string[]} [orders] The sort orders of `iteratees`.
  27290. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27291. * @returns {Array} Returns the new sorted array.
  27292. * @example
  27293. *
  27294. * var users = [
  27295. * { 'user': 'fred', 'age': 48 },
  27296. * { 'user': 'barney', 'age': 34 },
  27297. * { 'user': 'fred', 'age': 40 },
  27298. * { 'user': 'barney', 'age': 36 }
  27299. * ];
  27300. *
  27301. * // Sort by `user` in ascending order and by `age` in descending order.
  27302. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27303. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27304. */
  27305. function orderBy(collection, iteratees, orders, guard) {
  27306. if (collection == null) {
  27307. return [];
  27308. }
  27309. if (!isArray(iteratees)) {
  27310. iteratees = iteratees == null ? [] : [iteratees];
  27311. }
  27312. orders = guard ? undefined : orders;
  27313. if (!isArray(orders)) {
  27314. orders = orders == null ? [] : [orders];
  27315. }
  27316. return baseOrderBy(collection, iteratees, orders);
  27317. }
  27318. /**
  27319. * Creates an array of elements split into two groups, the first of which
  27320. * contains elements `predicate` returns truthy for, the second of which
  27321. * contains elements `predicate` returns falsey for. The predicate is
  27322. * invoked with one argument: (value).
  27323. *
  27324. * @static
  27325. * @memberOf _
  27326. * @since 3.0.0
  27327. * @category Collection
  27328. * @param {Array|Object} collection The collection to iterate over.
  27329. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27330. * @returns {Array} Returns the array of grouped elements.
  27331. * @example
  27332. *
  27333. * var users = [
  27334. * { 'user': 'barney', 'age': 36, 'active': false },
  27335. * { 'user': 'fred', 'age': 40, 'active': true },
  27336. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27337. * ];
  27338. *
  27339. * _.partition(users, function(o) { return o.active; });
  27340. * // => objects for [['fred'], ['barney', 'pebbles']]
  27341. *
  27342. * // The `_.matches` iteratee shorthand.
  27343. * _.partition(users, { 'age': 1, 'active': false });
  27344. * // => objects for [['pebbles'], ['barney', 'fred']]
  27345. *
  27346. * // The `_.matchesProperty` iteratee shorthand.
  27347. * _.partition(users, ['active', false]);
  27348. * // => objects for [['barney', 'pebbles'], ['fred']]
  27349. *
  27350. * // The `_.property` iteratee shorthand.
  27351. * _.partition(users, 'active');
  27352. * // => objects for [['fred'], ['barney', 'pebbles']]
  27353. */
  27354. var partition = createAggregator(function(result, value, key) {
  27355. result[key ? 0 : 1].push(value);
  27356. }, function() { return [[], []]; });
  27357. /**
  27358. * Reduces `collection` to a value which is the accumulated result of running
  27359. * each element in `collection` thru `iteratee`, where each successive
  27360. * invocation is supplied the return value of the previous. If `accumulator`
  27361. * is not given, the first element of `collection` is used as the initial
  27362. * value. The iteratee is invoked with four arguments:
  27363. * (accumulator, value, index|key, collection).
  27364. *
  27365. * Many lodash methods are guarded to work as iteratees for methods like
  27366. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27367. *
  27368. * The guarded methods are:
  27369. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27370. * and `sortBy`
  27371. *
  27372. * @static
  27373. * @memberOf _
  27374. * @since 0.1.0
  27375. * @category Collection
  27376. * @param {Array|Object} collection The collection to iterate over.
  27377. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27378. * @param {*} [accumulator] The initial value.
  27379. * @returns {*} Returns the accumulated value.
  27380. * @see _.reduceRight
  27381. * @example
  27382. *
  27383. * _.reduce([1, 2], function(sum, n) {
  27384. * return sum + n;
  27385. * }, 0);
  27386. * // => 3
  27387. *
  27388. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27389. * (result[value] || (result[value] = [])).push(key);
  27390. * return result;
  27391. * }, {});
  27392. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27393. */
  27394. function reduce(collection, iteratee, accumulator) {
  27395. var func = isArray(collection) ? arrayReduce : baseReduce,
  27396. initAccum = arguments.length < 3;
  27397. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27398. }
  27399. /**
  27400. * This method is like `_.reduce` except that it iterates over elements of
  27401. * `collection` from right to left.
  27402. *
  27403. * @static
  27404. * @memberOf _
  27405. * @since 0.1.0
  27406. * @category Collection
  27407. * @param {Array|Object} collection The collection to iterate over.
  27408. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27409. * @param {*} [accumulator] The initial value.
  27410. * @returns {*} Returns the accumulated value.
  27411. * @see _.reduce
  27412. * @example
  27413. *
  27414. * var array = [[0, 1], [2, 3], [4, 5]];
  27415. *
  27416. * _.reduceRight(array, function(flattened, other) {
  27417. * return flattened.concat(other);
  27418. * }, []);
  27419. * // => [4, 5, 2, 3, 0, 1]
  27420. */
  27421. function reduceRight(collection, iteratee, accumulator) {
  27422. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27423. initAccum = arguments.length < 3;
  27424. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27425. }
  27426. /**
  27427. * The opposite of `_.filter`; this method returns the elements of `collection`
  27428. * that `predicate` does **not** return truthy for.
  27429. *
  27430. * @static
  27431. * @memberOf _
  27432. * @since 0.1.0
  27433. * @category Collection
  27434. * @param {Array|Object} collection The collection to iterate over.
  27435. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27436. * @returns {Array} Returns the new filtered array.
  27437. * @see _.filter
  27438. * @example
  27439. *
  27440. * var users = [
  27441. * { 'user': 'barney', 'age': 36, 'active': false },
  27442. * { 'user': 'fred', 'age': 40, 'active': true }
  27443. * ];
  27444. *
  27445. * _.reject(users, function(o) { return !o.active; });
  27446. * // => objects for ['fred']
  27447. *
  27448. * // The `_.matches` iteratee shorthand.
  27449. * _.reject(users, { 'age': 40, 'active': true });
  27450. * // => objects for ['barney']
  27451. *
  27452. * // The `_.matchesProperty` iteratee shorthand.
  27453. * _.reject(users, ['active', false]);
  27454. * // => objects for ['fred']
  27455. *
  27456. * // The `_.property` iteratee shorthand.
  27457. * _.reject(users, 'active');
  27458. * // => objects for ['barney']
  27459. */
  27460. function reject(collection, predicate) {
  27461. var func = isArray(collection) ? arrayFilter : baseFilter;
  27462. return func(collection, negate(getIteratee(predicate, 3)));
  27463. }
  27464. /**
  27465. * Gets a random element from `collection`.
  27466. *
  27467. * @static
  27468. * @memberOf _
  27469. * @since 2.0.0
  27470. * @category Collection
  27471. * @param {Array|Object} collection The collection to sample.
  27472. * @returns {*} Returns the random element.
  27473. * @example
  27474. *
  27475. * _.sample([1, 2, 3, 4]);
  27476. * // => 2
  27477. */
  27478. function sample(collection) {
  27479. var func = isArray(collection) ? arraySample : baseSample;
  27480. return func(collection);
  27481. }
  27482. /**
  27483. * Gets `n` random elements at unique keys from `collection` up to the
  27484. * size of `collection`.
  27485. *
  27486. * @static
  27487. * @memberOf _
  27488. * @since 4.0.0
  27489. * @category Collection
  27490. * @param {Array|Object} collection The collection to sample.
  27491. * @param {number} [n=1] The number of elements to sample.
  27492. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27493. * @returns {Array} Returns the random elements.
  27494. * @example
  27495. *
  27496. * _.sampleSize([1, 2, 3], 2);
  27497. * // => [3, 1]
  27498. *
  27499. * _.sampleSize([1, 2, 3], 4);
  27500. * // => [2, 3, 1]
  27501. */
  27502. function sampleSize(collection, n, guard) {
  27503. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27504. n = 1;
  27505. } else {
  27506. n = toInteger(n);
  27507. }
  27508. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27509. return func(collection, n);
  27510. }
  27511. /**
  27512. * Creates an array of shuffled values, using a version of the
  27513. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27514. *
  27515. * @static
  27516. * @memberOf _
  27517. * @since 0.1.0
  27518. * @category Collection
  27519. * @param {Array|Object} collection The collection to shuffle.
  27520. * @returns {Array} Returns the new shuffled array.
  27521. * @example
  27522. *
  27523. * _.shuffle([1, 2, 3, 4]);
  27524. * // => [4, 1, 3, 2]
  27525. */
  27526. function shuffle(collection) {
  27527. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27528. return func(collection);
  27529. }
  27530. /**
  27531. * Gets the size of `collection` by returning its length for array-like
  27532. * values or the number of own enumerable string keyed properties for objects.
  27533. *
  27534. * @static
  27535. * @memberOf _
  27536. * @since 0.1.0
  27537. * @category Collection
  27538. * @param {Array|Object|string} collection The collection to inspect.
  27539. * @returns {number} Returns the collection size.
  27540. * @example
  27541. *
  27542. * _.size([1, 2, 3]);
  27543. * // => 3
  27544. *
  27545. * _.size({ 'a': 1, 'b': 2 });
  27546. * // => 2
  27547. *
  27548. * _.size('pebbles');
  27549. * // => 7
  27550. */
  27551. function size(collection) {
  27552. if (collection == null) {
  27553. return 0;
  27554. }
  27555. if (isArrayLike(collection)) {
  27556. return isString(collection) ? stringSize(collection) : collection.length;
  27557. }
  27558. var tag = getTag(collection);
  27559. if (tag == mapTag || tag == setTag) {
  27560. return collection.size;
  27561. }
  27562. return baseKeys(collection).length;
  27563. }
  27564. /**
  27565. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27566. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27567. * invoked with three arguments: (value, index|key, collection).
  27568. *
  27569. * @static
  27570. * @memberOf _
  27571. * @since 0.1.0
  27572. * @category Collection
  27573. * @param {Array|Object} collection The collection to iterate over.
  27574. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27575. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27576. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27577. * else `false`.
  27578. * @example
  27579. *
  27580. * _.some([null, 0, 'yes', false], Boolean);
  27581. * // => true
  27582. *
  27583. * var users = [
  27584. * { 'user': 'barney', 'active': true },
  27585. * { 'user': 'fred', 'active': false }
  27586. * ];
  27587. *
  27588. * // The `_.matches` iteratee shorthand.
  27589. * _.some(users, { 'user': 'barney', 'active': false });
  27590. * // => false
  27591. *
  27592. * // The `_.matchesProperty` iteratee shorthand.
  27593. * _.some(users, ['active', false]);
  27594. * // => true
  27595. *
  27596. * // The `_.property` iteratee shorthand.
  27597. * _.some(users, 'active');
  27598. * // => true
  27599. */
  27600. function some(collection, predicate, guard) {
  27601. var func = isArray(collection) ? arraySome : baseSome;
  27602. if (guard && isIterateeCall(collection, predicate, guard)) {
  27603. predicate = undefined;
  27604. }
  27605. return func(collection, getIteratee(predicate, 3));
  27606. }
  27607. /**
  27608. * Creates an array of elements, sorted in ascending order by the results of
  27609. * running each element in a collection thru each iteratee. This method
  27610. * performs a stable sort, that is, it preserves the original sort order of
  27611. * equal elements. The iteratees are invoked with one argument: (value).
  27612. *
  27613. * @static
  27614. * @memberOf _
  27615. * @since 0.1.0
  27616. * @category Collection
  27617. * @param {Array|Object} collection The collection to iterate over.
  27618. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27619. * The iteratees to sort by.
  27620. * @returns {Array} Returns the new sorted array.
  27621. * @example
  27622. *
  27623. * var users = [
  27624. * { 'user': 'fred', 'age': 48 },
  27625. * { 'user': 'barney', 'age': 36 },
  27626. * { 'user': 'fred', 'age': 40 },
  27627. * { 'user': 'barney', 'age': 34 }
  27628. * ];
  27629. *
  27630. * _.sortBy(users, [function(o) { return o.user; }]);
  27631. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27632. *
  27633. * _.sortBy(users, ['user', 'age']);
  27634. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27635. */
  27636. var sortBy = baseRest(function(collection, iteratees) {
  27637. if (collection == null) {
  27638. return [];
  27639. }
  27640. var length = iteratees.length;
  27641. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27642. iteratees = [];
  27643. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27644. iteratees = [iteratees[0]];
  27645. }
  27646. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27647. });
  27648. /*------------------------------------------------------------------------*/
  27649. /**
  27650. * Gets the timestamp of the number of milliseconds that have elapsed since
  27651. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27652. *
  27653. * @static
  27654. * @memberOf _
  27655. * @since 2.4.0
  27656. * @category Date
  27657. * @returns {number} Returns the timestamp.
  27658. * @example
  27659. *
  27660. * _.defer(function(stamp) {
  27661. * console.log(_.now() - stamp);
  27662. * }, _.now());
  27663. * // => Logs the number of milliseconds it took for the deferred invocation.
  27664. */
  27665. var now = ctxNow || function() {
  27666. return root.Date.now();
  27667. };
  27668. /*------------------------------------------------------------------------*/
  27669. /**
  27670. * The opposite of `_.before`; this method creates a function that invokes
  27671. * `func` once it's called `n` or more times.
  27672. *
  27673. * @static
  27674. * @memberOf _
  27675. * @since 0.1.0
  27676. * @category Function
  27677. * @param {number} n The number of calls before `func` is invoked.
  27678. * @param {Function} func The function to restrict.
  27679. * @returns {Function} Returns the new restricted function.
  27680. * @example
  27681. *
  27682. * var saves = ['profile', 'settings'];
  27683. *
  27684. * var done = _.after(saves.length, function() {
  27685. * console.log('done saving!');
  27686. * });
  27687. *
  27688. * _.forEach(saves, function(type) {
  27689. * asyncSave({ 'type': type, 'complete': done });
  27690. * });
  27691. * // => Logs 'done saving!' after the two async saves have completed.
  27692. */
  27693. function after(n, func) {
  27694. if (typeof func != 'function') {
  27695. throw new TypeError(FUNC_ERROR_TEXT);
  27696. }
  27697. n = toInteger(n);
  27698. return function() {
  27699. if (--n < 1) {
  27700. return func.apply(this, arguments);
  27701. }
  27702. };
  27703. }
  27704. /**
  27705. * Creates a function that invokes `func`, with up to `n` arguments,
  27706. * ignoring any additional arguments.
  27707. *
  27708. * @static
  27709. * @memberOf _
  27710. * @since 3.0.0
  27711. * @category Function
  27712. * @param {Function} func The function to cap arguments for.
  27713. * @param {number} [n=func.length] The arity cap.
  27714. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27715. * @returns {Function} Returns the new capped function.
  27716. * @example
  27717. *
  27718. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27719. * // => [6, 8, 10]
  27720. */
  27721. function ary(func, n, guard) {
  27722. n = guard ? undefined : n;
  27723. n = (func && n == null) ? func.length : n;
  27724. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27725. }
  27726. /**
  27727. * Creates a function that invokes `func`, with the `this` binding and arguments
  27728. * of the created function, while it's called less than `n` times. Subsequent
  27729. * calls to the created function return the result of the last `func` invocation.
  27730. *
  27731. * @static
  27732. * @memberOf _
  27733. * @since 3.0.0
  27734. * @category Function
  27735. * @param {number} n The number of calls at which `func` is no longer invoked.
  27736. * @param {Function} func The function to restrict.
  27737. * @returns {Function} Returns the new restricted function.
  27738. * @example
  27739. *
  27740. * jQuery(element).on('click', _.before(5, addContactToList));
  27741. * // => Allows adding up to 4 contacts to the list.
  27742. */
  27743. function before(n, func) {
  27744. var result;
  27745. if (typeof func != 'function') {
  27746. throw new TypeError(FUNC_ERROR_TEXT);
  27747. }
  27748. n = toInteger(n);
  27749. return function() {
  27750. if (--n > 0) {
  27751. result = func.apply(this, arguments);
  27752. }
  27753. if (n <= 1) {
  27754. func = undefined;
  27755. }
  27756. return result;
  27757. };
  27758. }
  27759. /**
  27760. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27761. * and `partials` prepended to the arguments it receives.
  27762. *
  27763. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27764. * may be used as a placeholder for partially applied arguments.
  27765. *
  27766. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27767. * property of bound functions.
  27768. *
  27769. * @static
  27770. * @memberOf _
  27771. * @since 0.1.0
  27772. * @category Function
  27773. * @param {Function} func The function to bind.
  27774. * @param {*} thisArg The `this` binding of `func`.
  27775. * @param {...*} [partials] The arguments to be partially applied.
  27776. * @returns {Function} Returns the new bound function.
  27777. * @example
  27778. *
  27779. * function greet(greeting, punctuation) {
  27780. * return greeting + ' ' + this.user + punctuation;
  27781. * }
  27782. *
  27783. * var object = { 'user': 'fred' };
  27784. *
  27785. * var bound = _.bind(greet, object, 'hi');
  27786. * bound('!');
  27787. * // => 'hi fred!'
  27788. *
  27789. * // Bound with placeholders.
  27790. * var bound = _.bind(greet, object, _, '!');
  27791. * bound('hi');
  27792. * // => 'hi fred!'
  27793. */
  27794. var bind = baseRest(function(func, thisArg, partials) {
  27795. var bitmask = WRAP_BIND_FLAG;
  27796. if (partials.length) {
  27797. var holders = replaceHolders(partials, getHolder(bind));
  27798. bitmask |= WRAP_PARTIAL_FLAG;
  27799. }
  27800. return createWrap(func, bitmask, thisArg, partials, holders);
  27801. });
  27802. /**
  27803. * Creates a function that invokes the method at `object[key]` with `partials`
  27804. * prepended to the arguments it receives.
  27805. *
  27806. * This method differs from `_.bind` by allowing bound functions to reference
  27807. * methods that may be redefined or don't yet exist. See
  27808. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27809. * for more details.
  27810. *
  27811. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27812. * builds, may be used as a placeholder for partially applied arguments.
  27813. *
  27814. * @static
  27815. * @memberOf _
  27816. * @since 0.10.0
  27817. * @category Function
  27818. * @param {Object} object The object to invoke the method on.
  27819. * @param {string} key The key of the method.
  27820. * @param {...*} [partials] The arguments to be partially applied.
  27821. * @returns {Function} Returns the new bound function.
  27822. * @example
  27823. *
  27824. * var object = {
  27825. * 'user': 'fred',
  27826. * 'greet': function(greeting, punctuation) {
  27827. * return greeting + ' ' + this.user + punctuation;
  27828. * }
  27829. * };
  27830. *
  27831. * var bound = _.bindKey(object, 'greet', 'hi');
  27832. * bound('!');
  27833. * // => 'hi fred!'
  27834. *
  27835. * object.greet = function(greeting, punctuation) {
  27836. * return greeting + 'ya ' + this.user + punctuation;
  27837. * };
  27838. *
  27839. * bound('!');
  27840. * // => 'hiya fred!'
  27841. *
  27842. * // Bound with placeholders.
  27843. * var bound = _.bindKey(object, 'greet', _, '!');
  27844. * bound('hi');
  27845. * // => 'hiya fred!'
  27846. */
  27847. var bindKey = baseRest(function(object, key, partials) {
  27848. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27849. if (partials.length) {
  27850. var holders = replaceHolders(partials, getHolder(bindKey));
  27851. bitmask |= WRAP_PARTIAL_FLAG;
  27852. }
  27853. return createWrap(key, bitmask, object, partials, holders);
  27854. });
  27855. /**
  27856. * Creates a function that accepts arguments of `func` and either invokes
  27857. * `func` returning its result, if at least `arity` number of arguments have
  27858. * been provided, or returns a function that accepts the remaining `func`
  27859. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27860. * is not sufficient.
  27861. *
  27862. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27863. * may be used as a placeholder for provided arguments.
  27864. *
  27865. * **Note:** This method doesn't set the "length" property of curried functions.
  27866. *
  27867. * @static
  27868. * @memberOf _
  27869. * @since 2.0.0
  27870. * @category Function
  27871. * @param {Function} func The function to curry.
  27872. * @param {number} [arity=func.length] The arity of `func`.
  27873. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27874. * @returns {Function} Returns the new curried function.
  27875. * @example
  27876. *
  27877. * var abc = function(a, b, c) {
  27878. * return [a, b, c];
  27879. * };
  27880. *
  27881. * var curried = _.curry(abc);
  27882. *
  27883. * curried(1)(2)(3);
  27884. * // => [1, 2, 3]
  27885. *
  27886. * curried(1, 2)(3);
  27887. * // => [1, 2, 3]
  27888. *
  27889. * curried(1, 2, 3);
  27890. * // => [1, 2, 3]
  27891. *
  27892. * // Curried with placeholders.
  27893. * curried(1)(_, 3)(2);
  27894. * // => [1, 2, 3]
  27895. */
  27896. function curry(func, arity, guard) {
  27897. arity = guard ? undefined : arity;
  27898. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27899. result.placeholder = curry.placeholder;
  27900. return result;
  27901. }
  27902. /**
  27903. * This method is like `_.curry` except that arguments are applied to `func`
  27904. * in the manner of `_.partialRight` instead of `_.partial`.
  27905. *
  27906. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27907. * builds, may be used as a placeholder for provided arguments.
  27908. *
  27909. * **Note:** This method doesn't set the "length" property of curried functions.
  27910. *
  27911. * @static
  27912. * @memberOf _
  27913. * @since 3.0.0
  27914. * @category Function
  27915. * @param {Function} func The function to curry.
  27916. * @param {number} [arity=func.length] The arity of `func`.
  27917. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27918. * @returns {Function} Returns the new curried function.
  27919. * @example
  27920. *
  27921. * var abc = function(a, b, c) {
  27922. * return [a, b, c];
  27923. * };
  27924. *
  27925. * var curried = _.curryRight(abc);
  27926. *
  27927. * curried(3)(2)(1);
  27928. * // => [1, 2, 3]
  27929. *
  27930. * curried(2, 3)(1);
  27931. * // => [1, 2, 3]
  27932. *
  27933. * curried(1, 2, 3);
  27934. * // => [1, 2, 3]
  27935. *
  27936. * // Curried with placeholders.
  27937. * curried(3)(1, _)(2);
  27938. * // => [1, 2, 3]
  27939. */
  27940. function curryRight(func, arity, guard) {
  27941. arity = guard ? undefined : arity;
  27942. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27943. result.placeholder = curryRight.placeholder;
  27944. return result;
  27945. }
  27946. /**
  27947. * Creates a debounced function that delays invoking `func` until after `wait`
  27948. * milliseconds have elapsed since the last time the debounced function was
  27949. * invoked. The debounced function comes with a `cancel` method to cancel
  27950. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27951. * Provide `options` to indicate whether `func` should be invoked on the
  27952. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27953. * with the last arguments provided to the debounced function. Subsequent
  27954. * calls to the debounced function return the result of the last `func`
  27955. * invocation.
  27956. *
  27957. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27958. * invoked on the trailing edge of the timeout only if the debounced function
  27959. * is invoked more than once during the `wait` timeout.
  27960. *
  27961. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27962. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27963. *
  27964. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27965. * for details over the differences between `_.debounce` and `_.throttle`.
  27966. *
  27967. * @static
  27968. * @memberOf _
  27969. * @since 0.1.0
  27970. * @category Function
  27971. * @param {Function} func The function to debounce.
  27972. * @param {number} [wait=0] The number of milliseconds to delay.
  27973. * @param {Object} [options={}] The options object.
  27974. * @param {boolean} [options.leading=false]
  27975. * Specify invoking on the leading edge of the timeout.
  27976. * @param {number} [options.maxWait]
  27977. * The maximum time `func` is allowed to be delayed before it's invoked.
  27978. * @param {boolean} [options.trailing=true]
  27979. * Specify invoking on the trailing edge of the timeout.
  27980. * @returns {Function} Returns the new debounced function.
  27981. * @example
  27982. *
  27983. * // Avoid costly calculations while the window size is in flux.
  27984. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27985. *
  27986. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27987. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27988. * 'leading': true,
  27989. * 'trailing': false
  27990. * }));
  27991. *
  27992. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27993. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27994. * var source = new EventSource('/stream');
  27995. * jQuery(source).on('message', debounced);
  27996. *
  27997. * // Cancel the trailing debounced invocation.
  27998. * jQuery(window).on('popstate', debounced.cancel);
  27999. */
  28000. function debounce(func, wait, options) {
  28001. var lastArgs,
  28002. lastThis,
  28003. maxWait,
  28004. result,
  28005. timerId,
  28006. lastCallTime,
  28007. lastInvokeTime = 0,
  28008. leading = false,
  28009. maxing = false,
  28010. trailing = true;
  28011. if (typeof func != 'function') {
  28012. throw new TypeError(FUNC_ERROR_TEXT);
  28013. }
  28014. wait = toNumber(wait) || 0;
  28015. if (isObject(options)) {
  28016. leading = !!options.leading;
  28017. maxing = 'maxWait' in options;
  28018. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28019. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28020. }
  28021. function invokeFunc(time) {
  28022. var args = lastArgs,
  28023. thisArg = lastThis;
  28024. lastArgs = lastThis = undefined;
  28025. lastInvokeTime = time;
  28026. result = func.apply(thisArg, args);
  28027. return result;
  28028. }
  28029. function leadingEdge(time) {
  28030. // Reset any `maxWait` timer.
  28031. lastInvokeTime = time;
  28032. // Start the timer for the trailing edge.
  28033. timerId = setTimeout(timerExpired, wait);
  28034. // Invoke the leading edge.
  28035. return leading ? invokeFunc(time) : result;
  28036. }
  28037. function remainingWait(time) {
  28038. var timeSinceLastCall = time - lastCallTime,
  28039. timeSinceLastInvoke = time - lastInvokeTime,
  28040. timeWaiting = wait - timeSinceLastCall;
  28041. return maxing
  28042. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28043. : timeWaiting;
  28044. }
  28045. function shouldInvoke(time) {
  28046. var timeSinceLastCall = time - lastCallTime,
  28047. timeSinceLastInvoke = time - lastInvokeTime;
  28048. // Either this is the first call, activity has stopped and we're at the
  28049. // trailing edge, the system time has gone backwards and we're treating
  28050. // it as the trailing edge, or we've hit the `maxWait` limit.
  28051. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28052. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28053. }
  28054. function timerExpired() {
  28055. var time = now();
  28056. if (shouldInvoke(time)) {
  28057. return trailingEdge(time);
  28058. }
  28059. // Restart the timer.
  28060. timerId = setTimeout(timerExpired, remainingWait(time));
  28061. }
  28062. function trailingEdge(time) {
  28063. timerId = undefined;
  28064. // Only invoke if we have `lastArgs` which means `func` has been
  28065. // debounced at least once.
  28066. if (trailing && lastArgs) {
  28067. return invokeFunc(time);
  28068. }
  28069. lastArgs = lastThis = undefined;
  28070. return result;
  28071. }
  28072. function cancel() {
  28073. if (timerId !== undefined) {
  28074. clearTimeout(timerId);
  28075. }
  28076. lastInvokeTime = 0;
  28077. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28078. }
  28079. function flush() {
  28080. return timerId === undefined ? result : trailingEdge(now());
  28081. }
  28082. function debounced() {
  28083. var time = now(),
  28084. isInvoking = shouldInvoke(time);
  28085. lastArgs = arguments;
  28086. lastThis = this;
  28087. lastCallTime = time;
  28088. if (isInvoking) {
  28089. if (timerId === undefined) {
  28090. return leadingEdge(lastCallTime);
  28091. }
  28092. if (maxing) {
  28093. // Handle invocations in a tight loop.
  28094. clearTimeout(timerId);
  28095. timerId = setTimeout(timerExpired, wait);
  28096. return invokeFunc(lastCallTime);
  28097. }
  28098. }
  28099. if (timerId === undefined) {
  28100. timerId = setTimeout(timerExpired, wait);
  28101. }
  28102. return result;
  28103. }
  28104. debounced.cancel = cancel;
  28105. debounced.flush = flush;
  28106. return debounced;
  28107. }
  28108. /**
  28109. * Defers invoking the `func` until the current call stack has cleared. Any
  28110. * additional arguments are provided to `func` when it's invoked.
  28111. *
  28112. * @static
  28113. * @memberOf _
  28114. * @since 0.1.0
  28115. * @category Function
  28116. * @param {Function} func The function to defer.
  28117. * @param {...*} [args] The arguments to invoke `func` with.
  28118. * @returns {number} Returns the timer id.
  28119. * @example
  28120. *
  28121. * _.defer(function(text) {
  28122. * console.log(text);
  28123. * }, 'deferred');
  28124. * // => Logs 'deferred' after one millisecond.
  28125. */
  28126. var defer = baseRest(function(func, args) {
  28127. return baseDelay(func, 1, args);
  28128. });
  28129. /**
  28130. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28131. * provided to `func` when it's invoked.
  28132. *
  28133. * @static
  28134. * @memberOf _
  28135. * @since 0.1.0
  28136. * @category Function
  28137. * @param {Function} func The function to delay.
  28138. * @param {number} wait The number of milliseconds to delay invocation.
  28139. * @param {...*} [args] The arguments to invoke `func` with.
  28140. * @returns {number} Returns the timer id.
  28141. * @example
  28142. *
  28143. * _.delay(function(text) {
  28144. * console.log(text);
  28145. * }, 1000, 'later');
  28146. * // => Logs 'later' after one second.
  28147. */
  28148. var delay = baseRest(function(func, wait, args) {
  28149. return baseDelay(func, toNumber(wait) || 0, args);
  28150. });
  28151. /**
  28152. * Creates a function that invokes `func` with arguments reversed.
  28153. *
  28154. * @static
  28155. * @memberOf _
  28156. * @since 4.0.0
  28157. * @category Function
  28158. * @param {Function} func The function to flip arguments for.
  28159. * @returns {Function} Returns the new flipped function.
  28160. * @example
  28161. *
  28162. * var flipped = _.flip(function() {
  28163. * return _.toArray(arguments);
  28164. * });
  28165. *
  28166. * flipped('a', 'b', 'c', 'd');
  28167. * // => ['d', 'c', 'b', 'a']
  28168. */
  28169. function flip(func) {
  28170. return createWrap(func, WRAP_FLIP_FLAG);
  28171. }
  28172. /**
  28173. * Creates a function that memoizes the result of `func`. If `resolver` is
  28174. * provided, it determines the cache key for storing the result based on the
  28175. * arguments provided to the memoized function. By default, the first argument
  28176. * provided to the memoized function is used as the map cache key. The `func`
  28177. * is invoked with the `this` binding of the memoized function.
  28178. *
  28179. * **Note:** The cache is exposed as the `cache` property on the memoized
  28180. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28181. * constructor with one whose instances implement the
  28182. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28183. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28184. *
  28185. * @static
  28186. * @memberOf _
  28187. * @since 0.1.0
  28188. * @category Function
  28189. * @param {Function} func The function to have its output memoized.
  28190. * @param {Function} [resolver] The function to resolve the cache key.
  28191. * @returns {Function} Returns the new memoized function.
  28192. * @example
  28193. *
  28194. * var object = { 'a': 1, 'b': 2 };
  28195. * var other = { 'c': 3, 'd': 4 };
  28196. *
  28197. * var values = _.memoize(_.values);
  28198. * values(object);
  28199. * // => [1, 2]
  28200. *
  28201. * values(other);
  28202. * // => [3, 4]
  28203. *
  28204. * object.a = 2;
  28205. * values(object);
  28206. * // => [1, 2]
  28207. *
  28208. * // Modify the result cache.
  28209. * values.cache.set(object, ['a', 'b']);
  28210. * values(object);
  28211. * // => ['a', 'b']
  28212. *
  28213. * // Replace `_.memoize.Cache`.
  28214. * _.memoize.Cache = WeakMap;
  28215. */
  28216. function memoize(func, resolver) {
  28217. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28218. throw new TypeError(FUNC_ERROR_TEXT);
  28219. }
  28220. var memoized = function() {
  28221. var args = arguments,
  28222. key = resolver ? resolver.apply(this, args) : args[0],
  28223. cache = memoized.cache;
  28224. if (cache.has(key)) {
  28225. return cache.get(key);
  28226. }
  28227. var result = func.apply(this, args);
  28228. memoized.cache = cache.set(key, result) || cache;
  28229. return result;
  28230. };
  28231. memoized.cache = new (memoize.Cache || MapCache);
  28232. return memoized;
  28233. }
  28234. // Expose `MapCache`.
  28235. memoize.Cache = MapCache;
  28236. /**
  28237. * Creates a function that negates the result of the predicate `func`. The
  28238. * `func` predicate is invoked with the `this` binding and arguments of the
  28239. * created function.
  28240. *
  28241. * @static
  28242. * @memberOf _
  28243. * @since 3.0.0
  28244. * @category Function
  28245. * @param {Function} predicate The predicate to negate.
  28246. * @returns {Function} Returns the new negated function.
  28247. * @example
  28248. *
  28249. * function isEven(n) {
  28250. * return n % 2 == 0;
  28251. * }
  28252. *
  28253. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28254. * // => [1, 3, 5]
  28255. */
  28256. function negate(predicate) {
  28257. if (typeof predicate != 'function') {
  28258. throw new TypeError(FUNC_ERROR_TEXT);
  28259. }
  28260. return function() {
  28261. var args = arguments;
  28262. switch (args.length) {
  28263. case 0: return !predicate.call(this);
  28264. case 1: return !predicate.call(this, args[0]);
  28265. case 2: return !predicate.call(this, args[0], args[1]);
  28266. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28267. }
  28268. return !predicate.apply(this, args);
  28269. };
  28270. }
  28271. /**
  28272. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28273. * to the function return the value of the first invocation. The `func` is
  28274. * invoked with the `this` binding and arguments of the created function.
  28275. *
  28276. * @static
  28277. * @memberOf _
  28278. * @since 0.1.0
  28279. * @category Function
  28280. * @param {Function} func The function to restrict.
  28281. * @returns {Function} Returns the new restricted function.
  28282. * @example
  28283. *
  28284. * var initialize = _.once(createApplication);
  28285. * initialize();
  28286. * initialize();
  28287. * // => `createApplication` is invoked once
  28288. */
  28289. function once(func) {
  28290. return before(2, func);
  28291. }
  28292. /**
  28293. * Creates a function that invokes `func` with its arguments transformed.
  28294. *
  28295. * @static
  28296. * @since 4.0.0
  28297. * @memberOf _
  28298. * @category Function
  28299. * @param {Function} func The function to wrap.
  28300. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28301. * The argument transforms.
  28302. * @returns {Function} Returns the new function.
  28303. * @example
  28304. *
  28305. * function doubled(n) {
  28306. * return n * 2;
  28307. * }
  28308. *
  28309. * function square(n) {
  28310. * return n * n;
  28311. * }
  28312. *
  28313. * var func = _.overArgs(function(x, y) {
  28314. * return [x, y];
  28315. * }, [square, doubled]);
  28316. *
  28317. * func(9, 3);
  28318. * // => [81, 6]
  28319. *
  28320. * func(10, 5);
  28321. * // => [100, 10]
  28322. */
  28323. var overArgs = castRest(function(func, transforms) {
  28324. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28325. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28326. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28327. var funcsLength = transforms.length;
  28328. return baseRest(function(args) {
  28329. var index = -1,
  28330. length = nativeMin(args.length, funcsLength);
  28331. while (++index < length) {
  28332. args[index] = transforms[index].call(this, args[index]);
  28333. }
  28334. return apply(func, this, args);
  28335. });
  28336. });
  28337. /**
  28338. * Creates a function that invokes `func` with `partials` prepended to the
  28339. * arguments it receives. This method is like `_.bind` except it does **not**
  28340. * alter the `this` binding.
  28341. *
  28342. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28343. * builds, may be used as a placeholder for partially applied arguments.
  28344. *
  28345. * **Note:** This method doesn't set the "length" property of partially
  28346. * applied functions.
  28347. *
  28348. * @static
  28349. * @memberOf _
  28350. * @since 0.2.0
  28351. * @category Function
  28352. * @param {Function} func The function to partially apply arguments to.
  28353. * @param {...*} [partials] The arguments to be partially applied.
  28354. * @returns {Function} Returns the new partially applied function.
  28355. * @example
  28356. *
  28357. * function greet(greeting, name) {
  28358. * return greeting + ' ' + name;
  28359. * }
  28360. *
  28361. * var sayHelloTo = _.partial(greet, 'hello');
  28362. * sayHelloTo('fred');
  28363. * // => 'hello fred'
  28364. *
  28365. * // Partially applied with placeholders.
  28366. * var greetFred = _.partial(greet, _, 'fred');
  28367. * greetFred('hi');
  28368. * // => 'hi fred'
  28369. */
  28370. var partial = baseRest(function(func, partials) {
  28371. var holders = replaceHolders(partials, getHolder(partial));
  28372. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28373. });
  28374. /**
  28375. * This method is like `_.partial` except that partially applied arguments
  28376. * are appended to the arguments it receives.
  28377. *
  28378. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28379. * builds, may be used as a placeholder for partially applied arguments.
  28380. *
  28381. * **Note:** This method doesn't set the "length" property of partially
  28382. * applied functions.
  28383. *
  28384. * @static
  28385. * @memberOf _
  28386. * @since 1.0.0
  28387. * @category Function
  28388. * @param {Function} func The function to partially apply arguments to.
  28389. * @param {...*} [partials] The arguments to be partially applied.
  28390. * @returns {Function} Returns the new partially applied function.
  28391. * @example
  28392. *
  28393. * function greet(greeting, name) {
  28394. * return greeting + ' ' + name;
  28395. * }
  28396. *
  28397. * var greetFred = _.partialRight(greet, 'fred');
  28398. * greetFred('hi');
  28399. * // => 'hi fred'
  28400. *
  28401. * // Partially applied with placeholders.
  28402. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28403. * sayHelloTo('fred');
  28404. * // => 'hello fred'
  28405. */
  28406. var partialRight = baseRest(function(func, partials) {
  28407. var holders = replaceHolders(partials, getHolder(partialRight));
  28408. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28409. });
  28410. /**
  28411. * Creates a function that invokes `func` with arguments arranged according
  28412. * to the specified `indexes` where the argument value at the first index is
  28413. * provided as the first argument, the argument value at the second index is
  28414. * provided as the second argument, and so on.
  28415. *
  28416. * @static
  28417. * @memberOf _
  28418. * @since 3.0.0
  28419. * @category Function
  28420. * @param {Function} func The function to rearrange arguments for.
  28421. * @param {...(number|number[])} indexes The arranged argument indexes.
  28422. * @returns {Function} Returns the new function.
  28423. * @example
  28424. *
  28425. * var rearged = _.rearg(function(a, b, c) {
  28426. * return [a, b, c];
  28427. * }, [2, 0, 1]);
  28428. *
  28429. * rearged('b', 'c', 'a')
  28430. * // => ['a', 'b', 'c']
  28431. */
  28432. var rearg = flatRest(function(func, indexes) {
  28433. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28434. });
  28435. /**
  28436. * Creates a function that invokes `func` with the `this` binding of the
  28437. * created function and arguments from `start` and beyond provided as
  28438. * an array.
  28439. *
  28440. * **Note:** This method is based on the
  28441. * [rest parameter](https://mdn.io/rest_parameters).
  28442. *
  28443. * @static
  28444. * @memberOf _
  28445. * @since 4.0.0
  28446. * @category Function
  28447. * @param {Function} func The function to apply a rest parameter to.
  28448. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28449. * @returns {Function} Returns the new function.
  28450. * @example
  28451. *
  28452. * var say = _.rest(function(what, names) {
  28453. * return what + ' ' + _.initial(names).join(', ') +
  28454. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28455. * });
  28456. *
  28457. * say('hello', 'fred', 'barney', 'pebbles');
  28458. * // => 'hello fred, barney, & pebbles'
  28459. */
  28460. function rest(func, start) {
  28461. if (typeof func != 'function') {
  28462. throw new TypeError(FUNC_ERROR_TEXT);
  28463. }
  28464. start = start === undefined ? start : toInteger(start);
  28465. return baseRest(func, start);
  28466. }
  28467. /**
  28468. * Creates a function that invokes `func` with the `this` binding of the
  28469. * create function and an array of arguments much like
  28470. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28471. *
  28472. * **Note:** This method is based on the
  28473. * [spread operator](https://mdn.io/spread_operator).
  28474. *
  28475. * @static
  28476. * @memberOf _
  28477. * @since 3.2.0
  28478. * @category Function
  28479. * @param {Function} func The function to spread arguments over.
  28480. * @param {number} [start=0] The start position of the spread.
  28481. * @returns {Function} Returns the new function.
  28482. * @example
  28483. *
  28484. * var say = _.spread(function(who, what) {
  28485. * return who + ' says ' + what;
  28486. * });
  28487. *
  28488. * say(['fred', 'hello']);
  28489. * // => 'fred says hello'
  28490. *
  28491. * var numbers = Promise.all([
  28492. * Promise.resolve(40),
  28493. * Promise.resolve(36)
  28494. * ]);
  28495. *
  28496. * numbers.then(_.spread(function(x, y) {
  28497. * return x + y;
  28498. * }));
  28499. * // => a Promise of 76
  28500. */
  28501. function spread(func, start) {
  28502. if (typeof func != 'function') {
  28503. throw new TypeError(FUNC_ERROR_TEXT);
  28504. }
  28505. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28506. return baseRest(function(args) {
  28507. var array = args[start],
  28508. otherArgs = castSlice(args, 0, start);
  28509. if (array) {
  28510. arrayPush(otherArgs, array);
  28511. }
  28512. return apply(func, this, otherArgs);
  28513. });
  28514. }
  28515. /**
  28516. * Creates a throttled function that only invokes `func` at most once per
  28517. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28518. * method to cancel delayed `func` invocations and a `flush` method to
  28519. * immediately invoke them. Provide `options` to indicate whether `func`
  28520. * should be invoked on the leading and/or trailing edge of the `wait`
  28521. * timeout. The `func` is invoked with the last arguments provided to the
  28522. * throttled function. Subsequent calls to the throttled function return the
  28523. * result of the last `func` invocation.
  28524. *
  28525. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28526. * invoked on the trailing edge of the timeout only if the throttled function
  28527. * is invoked more than once during the `wait` timeout.
  28528. *
  28529. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28530. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28531. *
  28532. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28533. * for details over the differences between `_.throttle` and `_.debounce`.
  28534. *
  28535. * @static
  28536. * @memberOf _
  28537. * @since 0.1.0
  28538. * @category Function
  28539. * @param {Function} func The function to throttle.
  28540. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28541. * @param {Object} [options={}] The options object.
  28542. * @param {boolean} [options.leading=true]
  28543. * Specify invoking on the leading edge of the timeout.
  28544. * @param {boolean} [options.trailing=true]
  28545. * Specify invoking on the trailing edge of the timeout.
  28546. * @returns {Function} Returns the new throttled function.
  28547. * @example
  28548. *
  28549. * // Avoid excessively updating the position while scrolling.
  28550. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28551. *
  28552. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28553. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28554. * jQuery(element).on('click', throttled);
  28555. *
  28556. * // Cancel the trailing throttled invocation.
  28557. * jQuery(window).on('popstate', throttled.cancel);
  28558. */
  28559. function throttle(func, wait, options) {
  28560. var leading = true,
  28561. trailing = true;
  28562. if (typeof func != 'function') {
  28563. throw new TypeError(FUNC_ERROR_TEXT);
  28564. }
  28565. if (isObject(options)) {
  28566. leading = 'leading' in options ? !!options.leading : leading;
  28567. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28568. }
  28569. return debounce(func, wait, {
  28570. 'leading': leading,
  28571. 'maxWait': wait,
  28572. 'trailing': trailing
  28573. });
  28574. }
  28575. /**
  28576. * Creates a function that accepts up to one argument, ignoring any
  28577. * additional arguments.
  28578. *
  28579. * @static
  28580. * @memberOf _
  28581. * @since 4.0.0
  28582. * @category Function
  28583. * @param {Function} func The function to cap arguments for.
  28584. * @returns {Function} Returns the new capped function.
  28585. * @example
  28586. *
  28587. * _.map(['6', '8', '10'], _.unary(parseInt));
  28588. * // => [6, 8, 10]
  28589. */
  28590. function unary(func) {
  28591. return ary(func, 1);
  28592. }
  28593. /**
  28594. * Creates a function that provides `value` to `wrapper` as its first
  28595. * argument. Any additional arguments provided to the function are appended
  28596. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28597. * binding of the created function.
  28598. *
  28599. * @static
  28600. * @memberOf _
  28601. * @since 0.1.0
  28602. * @category Function
  28603. * @param {*} value The value to wrap.
  28604. * @param {Function} [wrapper=identity] The wrapper function.
  28605. * @returns {Function} Returns the new function.
  28606. * @example
  28607. *
  28608. * var p = _.wrap(_.escape, function(func, text) {
  28609. * return '<p>' + func(text) + '</p>';
  28610. * });
  28611. *
  28612. * p('fred, barney, & pebbles');
  28613. * // => '<p>fred, barney, &amp; pebbles</p>'
  28614. */
  28615. function wrap(value, wrapper) {
  28616. return partial(castFunction(wrapper), value);
  28617. }
  28618. /*------------------------------------------------------------------------*/
  28619. /**
  28620. * Casts `value` as an array if it's not one.
  28621. *
  28622. * @static
  28623. * @memberOf _
  28624. * @since 4.4.0
  28625. * @category Lang
  28626. * @param {*} value The value to inspect.
  28627. * @returns {Array} Returns the cast array.
  28628. * @example
  28629. *
  28630. * _.castArray(1);
  28631. * // => [1]
  28632. *
  28633. * _.castArray({ 'a': 1 });
  28634. * // => [{ 'a': 1 }]
  28635. *
  28636. * _.castArray('abc');
  28637. * // => ['abc']
  28638. *
  28639. * _.castArray(null);
  28640. * // => [null]
  28641. *
  28642. * _.castArray(undefined);
  28643. * // => [undefined]
  28644. *
  28645. * _.castArray();
  28646. * // => []
  28647. *
  28648. * var array = [1, 2, 3];
  28649. * console.log(_.castArray(array) === array);
  28650. * // => true
  28651. */
  28652. function castArray() {
  28653. if (!arguments.length) {
  28654. return [];
  28655. }
  28656. var value = arguments[0];
  28657. return isArray(value) ? value : [value];
  28658. }
  28659. /**
  28660. * Creates a shallow clone of `value`.
  28661. *
  28662. * **Note:** This method is loosely based on the
  28663. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28664. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28665. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28666. * arrays. The own enumerable properties of `arguments` objects are cloned
  28667. * as plain objects. An empty object is returned for uncloneable values such
  28668. * as error objects, functions, DOM nodes, and WeakMaps.
  28669. *
  28670. * @static
  28671. * @memberOf _
  28672. * @since 0.1.0
  28673. * @category Lang
  28674. * @param {*} value The value to clone.
  28675. * @returns {*} Returns the cloned value.
  28676. * @see _.cloneDeep
  28677. * @example
  28678. *
  28679. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28680. *
  28681. * var shallow = _.clone(objects);
  28682. * console.log(shallow[0] === objects[0]);
  28683. * // => true
  28684. */
  28685. function clone(value) {
  28686. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28687. }
  28688. /**
  28689. * This method is like `_.clone` except that it accepts `customizer` which
  28690. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28691. * cloning is handled by the method instead. The `customizer` is invoked with
  28692. * up to four arguments; (value [, index|key, object, stack]).
  28693. *
  28694. * @static
  28695. * @memberOf _
  28696. * @since 4.0.0
  28697. * @category Lang
  28698. * @param {*} value The value to clone.
  28699. * @param {Function} [customizer] The function to customize cloning.
  28700. * @returns {*} Returns the cloned value.
  28701. * @see _.cloneDeepWith
  28702. * @example
  28703. *
  28704. * function customizer(value) {
  28705. * if (_.isElement(value)) {
  28706. * return value.cloneNode(false);
  28707. * }
  28708. * }
  28709. *
  28710. * var el = _.cloneWith(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. * // => 0
  28718. */
  28719. function cloneWith(value, customizer) {
  28720. customizer = typeof customizer == 'function' ? customizer : undefined;
  28721. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28722. }
  28723. /**
  28724. * This method is like `_.clone` except that it recursively clones `value`.
  28725. *
  28726. * @static
  28727. * @memberOf _
  28728. * @since 1.0.0
  28729. * @category Lang
  28730. * @param {*} value The value to recursively clone.
  28731. * @returns {*} Returns the deep cloned value.
  28732. * @see _.clone
  28733. * @example
  28734. *
  28735. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28736. *
  28737. * var deep = _.cloneDeep(objects);
  28738. * console.log(deep[0] === objects[0]);
  28739. * // => false
  28740. */
  28741. function cloneDeep(value) {
  28742. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28743. }
  28744. /**
  28745. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28746. *
  28747. * @static
  28748. * @memberOf _
  28749. * @since 4.0.0
  28750. * @category Lang
  28751. * @param {*} value The value to recursively clone.
  28752. * @param {Function} [customizer] The function to customize cloning.
  28753. * @returns {*} Returns the deep cloned value.
  28754. * @see _.cloneWith
  28755. * @example
  28756. *
  28757. * function customizer(value) {
  28758. * if (_.isElement(value)) {
  28759. * return value.cloneNode(true);
  28760. * }
  28761. * }
  28762. *
  28763. * var el = _.cloneDeepWith(document.body, customizer);
  28764. *
  28765. * console.log(el === document.body);
  28766. * // => false
  28767. * console.log(el.nodeName);
  28768. * // => 'BODY'
  28769. * console.log(el.childNodes.length);
  28770. * // => 20
  28771. */
  28772. function cloneDeepWith(value, customizer) {
  28773. customizer = typeof customizer == 'function' ? customizer : undefined;
  28774. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28775. }
  28776. /**
  28777. * Checks if `object` conforms to `source` by invoking the predicate
  28778. * properties of `source` with the corresponding property values of `object`.
  28779. *
  28780. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28781. * partially applied.
  28782. *
  28783. * @static
  28784. * @memberOf _
  28785. * @since 4.14.0
  28786. * @category Lang
  28787. * @param {Object} object The object to inspect.
  28788. * @param {Object} source The object of property predicates to conform to.
  28789. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28790. * @example
  28791. *
  28792. * var object = { 'a': 1, 'b': 2 };
  28793. *
  28794. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28795. * // => true
  28796. *
  28797. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28798. * // => false
  28799. */
  28800. function conformsTo(object, source) {
  28801. return source == null || baseConformsTo(object, source, keys(source));
  28802. }
  28803. /**
  28804. * Performs a
  28805. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28806. * comparison between two values to determine if they are equivalent.
  28807. *
  28808. * @static
  28809. * @memberOf _
  28810. * @since 4.0.0
  28811. * @category Lang
  28812. * @param {*} value The value to compare.
  28813. * @param {*} other The other value to compare.
  28814. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28815. * @example
  28816. *
  28817. * var object = { 'a': 1 };
  28818. * var other = { 'a': 1 };
  28819. *
  28820. * _.eq(object, object);
  28821. * // => true
  28822. *
  28823. * _.eq(object, other);
  28824. * // => false
  28825. *
  28826. * _.eq('a', 'a');
  28827. * // => true
  28828. *
  28829. * _.eq('a', Object('a'));
  28830. * // => false
  28831. *
  28832. * _.eq(NaN, NaN);
  28833. * // => true
  28834. */
  28835. function eq(value, other) {
  28836. return value === other || (value !== value && other !== other);
  28837. }
  28838. /**
  28839. * Checks if `value` is greater than `other`.
  28840. *
  28841. * @static
  28842. * @memberOf _
  28843. * @since 3.9.0
  28844. * @category Lang
  28845. * @param {*} value The value to compare.
  28846. * @param {*} other The other value to compare.
  28847. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28848. * else `false`.
  28849. * @see _.lt
  28850. * @example
  28851. *
  28852. * _.gt(3, 1);
  28853. * // => true
  28854. *
  28855. * _.gt(3, 3);
  28856. * // => false
  28857. *
  28858. * _.gt(1, 3);
  28859. * // => false
  28860. */
  28861. var gt = createRelationalOperation(baseGt);
  28862. /**
  28863. * Checks if `value` is greater than or equal to `other`.
  28864. *
  28865. * @static
  28866. * @memberOf _
  28867. * @since 3.9.0
  28868. * @category Lang
  28869. * @param {*} value The value to compare.
  28870. * @param {*} other The other value to compare.
  28871. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28872. * `other`, else `false`.
  28873. * @see _.lte
  28874. * @example
  28875. *
  28876. * _.gte(3, 1);
  28877. * // => true
  28878. *
  28879. * _.gte(3, 3);
  28880. * // => true
  28881. *
  28882. * _.gte(1, 3);
  28883. * // => false
  28884. */
  28885. var gte = createRelationalOperation(function(value, other) {
  28886. return value >= other;
  28887. });
  28888. /**
  28889. * Checks if `value` is likely an `arguments` object.
  28890. *
  28891. * @static
  28892. * @memberOf _
  28893. * @since 0.1.0
  28894. * @category Lang
  28895. * @param {*} value The value to check.
  28896. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28897. * else `false`.
  28898. * @example
  28899. *
  28900. * _.isArguments(function() { return arguments; }());
  28901. * // => true
  28902. *
  28903. * _.isArguments([1, 2, 3]);
  28904. * // => false
  28905. */
  28906. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28907. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28908. !propertyIsEnumerable.call(value, 'callee');
  28909. };
  28910. /**
  28911. * Checks if `value` is classified as an `Array` object.
  28912. *
  28913. * @static
  28914. * @memberOf _
  28915. * @since 0.1.0
  28916. * @category Lang
  28917. * @param {*} value The value to check.
  28918. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28919. * @example
  28920. *
  28921. * _.isArray([1, 2, 3]);
  28922. * // => true
  28923. *
  28924. * _.isArray(document.body.children);
  28925. * // => false
  28926. *
  28927. * _.isArray('abc');
  28928. * // => false
  28929. *
  28930. * _.isArray(_.noop);
  28931. * // => false
  28932. */
  28933. var isArray = Array.isArray;
  28934. /**
  28935. * Checks if `value` is classified as an `ArrayBuffer` object.
  28936. *
  28937. * @static
  28938. * @memberOf _
  28939. * @since 4.3.0
  28940. * @category Lang
  28941. * @param {*} value The value to check.
  28942. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28943. * @example
  28944. *
  28945. * _.isArrayBuffer(new ArrayBuffer(2));
  28946. * // => true
  28947. *
  28948. * _.isArrayBuffer(new Array(2));
  28949. * // => false
  28950. */
  28951. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28952. /**
  28953. * Checks if `value` is array-like. A value is considered array-like if it's
  28954. * not a function and has a `value.length` that's an integer greater than or
  28955. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28956. *
  28957. * @static
  28958. * @memberOf _
  28959. * @since 4.0.0
  28960. * @category Lang
  28961. * @param {*} value The value to check.
  28962. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28963. * @example
  28964. *
  28965. * _.isArrayLike([1, 2, 3]);
  28966. * // => true
  28967. *
  28968. * _.isArrayLike(document.body.children);
  28969. * // => true
  28970. *
  28971. * _.isArrayLike('abc');
  28972. * // => true
  28973. *
  28974. * _.isArrayLike(_.noop);
  28975. * // => false
  28976. */
  28977. function isArrayLike(value) {
  28978. return value != null && isLength(value.length) && !isFunction(value);
  28979. }
  28980. /**
  28981. * This method is like `_.isArrayLike` except that it also checks if `value`
  28982. * is an object.
  28983. *
  28984. * @static
  28985. * @memberOf _
  28986. * @since 4.0.0
  28987. * @category Lang
  28988. * @param {*} value The value to check.
  28989. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28990. * else `false`.
  28991. * @example
  28992. *
  28993. * _.isArrayLikeObject([1, 2, 3]);
  28994. * // => true
  28995. *
  28996. * _.isArrayLikeObject(document.body.children);
  28997. * // => true
  28998. *
  28999. * _.isArrayLikeObject('abc');
  29000. * // => false
  29001. *
  29002. * _.isArrayLikeObject(_.noop);
  29003. * // => false
  29004. */
  29005. function isArrayLikeObject(value) {
  29006. return isObjectLike(value) && isArrayLike(value);
  29007. }
  29008. /**
  29009. * Checks if `value` is classified as a boolean primitive or object.
  29010. *
  29011. * @static
  29012. * @memberOf _
  29013. * @since 0.1.0
  29014. * @category Lang
  29015. * @param {*} value The value to check.
  29016. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29017. * @example
  29018. *
  29019. * _.isBoolean(false);
  29020. * // => true
  29021. *
  29022. * _.isBoolean(null);
  29023. * // => false
  29024. */
  29025. function isBoolean(value) {
  29026. return value === true || value === false ||
  29027. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29028. }
  29029. /**
  29030. * Checks if `value` is a buffer.
  29031. *
  29032. * @static
  29033. * @memberOf _
  29034. * @since 4.3.0
  29035. * @category Lang
  29036. * @param {*} value The value to check.
  29037. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29038. * @example
  29039. *
  29040. * _.isBuffer(new Buffer(2));
  29041. * // => true
  29042. *
  29043. * _.isBuffer(new Uint8Array(2));
  29044. * // => false
  29045. */
  29046. var isBuffer = nativeIsBuffer || stubFalse;
  29047. /**
  29048. * Checks if `value` is classified as a `Date` object.
  29049. *
  29050. * @static
  29051. * @memberOf _
  29052. * @since 0.1.0
  29053. * @category Lang
  29054. * @param {*} value The value to check.
  29055. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29056. * @example
  29057. *
  29058. * _.isDate(new Date);
  29059. * // => true
  29060. *
  29061. * _.isDate('Mon April 23 2012');
  29062. * // => false
  29063. */
  29064. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29065. /**
  29066. * Checks if `value` is likely a DOM element.
  29067. *
  29068. * @static
  29069. * @memberOf _
  29070. * @since 0.1.0
  29071. * @category Lang
  29072. * @param {*} value The value to check.
  29073. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29074. * @example
  29075. *
  29076. * _.isElement(document.body);
  29077. * // => true
  29078. *
  29079. * _.isElement('<body>');
  29080. * // => false
  29081. */
  29082. function isElement(value) {
  29083. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29084. }
  29085. /**
  29086. * Checks if `value` is an empty object, collection, map, or set.
  29087. *
  29088. * Objects are considered empty if they have no own enumerable string keyed
  29089. * properties.
  29090. *
  29091. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29092. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29093. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29094. *
  29095. * @static
  29096. * @memberOf _
  29097. * @since 0.1.0
  29098. * @category Lang
  29099. * @param {*} value The value to check.
  29100. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29101. * @example
  29102. *
  29103. * _.isEmpty(null);
  29104. * // => true
  29105. *
  29106. * _.isEmpty(true);
  29107. * // => true
  29108. *
  29109. * _.isEmpty(1);
  29110. * // => true
  29111. *
  29112. * _.isEmpty([1, 2, 3]);
  29113. * // => false
  29114. *
  29115. * _.isEmpty({ 'a': 1 });
  29116. * // => false
  29117. */
  29118. function isEmpty(value) {
  29119. if (value == null) {
  29120. return true;
  29121. }
  29122. if (isArrayLike(value) &&
  29123. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29124. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29125. return !value.length;
  29126. }
  29127. var tag = getTag(value);
  29128. if (tag == mapTag || tag == setTag) {
  29129. return !value.size;
  29130. }
  29131. if (isPrototype(value)) {
  29132. return !baseKeys(value).length;
  29133. }
  29134. for (var key in value) {
  29135. if (hasOwnProperty.call(value, key)) {
  29136. return false;
  29137. }
  29138. }
  29139. return true;
  29140. }
  29141. /**
  29142. * Performs a deep comparison between two values to determine if they are
  29143. * equivalent.
  29144. *
  29145. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29146. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29147. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29148. * by their own, not inherited, enumerable properties. Functions and DOM
  29149. * nodes are compared by strict equality, i.e. `===`.
  29150. *
  29151. * @static
  29152. * @memberOf _
  29153. * @since 0.1.0
  29154. * @category Lang
  29155. * @param {*} value The value to compare.
  29156. * @param {*} other The other value to compare.
  29157. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29158. * @example
  29159. *
  29160. * var object = { 'a': 1 };
  29161. * var other = { 'a': 1 };
  29162. *
  29163. * _.isEqual(object, other);
  29164. * // => true
  29165. *
  29166. * object === other;
  29167. * // => false
  29168. */
  29169. function isEqual(value, other) {
  29170. return baseIsEqual(value, other);
  29171. }
  29172. /**
  29173. * This method is like `_.isEqual` except that it accepts `customizer` which
  29174. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29175. * are handled by the method instead. The `customizer` is invoked with up to
  29176. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29177. *
  29178. * @static
  29179. * @memberOf _
  29180. * @since 4.0.0
  29181. * @category Lang
  29182. * @param {*} value The value to compare.
  29183. * @param {*} other The other value to compare.
  29184. * @param {Function} [customizer] The function to customize comparisons.
  29185. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29186. * @example
  29187. *
  29188. * function isGreeting(value) {
  29189. * return /^h(?:i|ello)$/.test(value);
  29190. * }
  29191. *
  29192. * function customizer(objValue, othValue) {
  29193. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29194. * return true;
  29195. * }
  29196. * }
  29197. *
  29198. * var array = ['hello', 'goodbye'];
  29199. * var other = ['hi', 'goodbye'];
  29200. *
  29201. * _.isEqualWith(array, other, customizer);
  29202. * // => true
  29203. */
  29204. function isEqualWith(value, other, customizer) {
  29205. customizer = typeof customizer == 'function' ? customizer : undefined;
  29206. var result = customizer ? customizer(value, other) : undefined;
  29207. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29208. }
  29209. /**
  29210. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29211. * `SyntaxError`, `TypeError`, or `URIError` object.
  29212. *
  29213. * @static
  29214. * @memberOf _
  29215. * @since 3.0.0
  29216. * @category Lang
  29217. * @param {*} value The value to check.
  29218. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29219. * @example
  29220. *
  29221. * _.isError(new Error);
  29222. * // => true
  29223. *
  29224. * _.isError(Error);
  29225. * // => false
  29226. */
  29227. function isError(value) {
  29228. if (!isObjectLike(value)) {
  29229. return false;
  29230. }
  29231. var tag = baseGetTag(value);
  29232. return tag == errorTag || tag == domExcTag ||
  29233. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29234. }
  29235. /**
  29236. * Checks if `value` is a finite primitive number.
  29237. *
  29238. * **Note:** This method is based on
  29239. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29240. *
  29241. * @static
  29242. * @memberOf _
  29243. * @since 0.1.0
  29244. * @category Lang
  29245. * @param {*} value The value to check.
  29246. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29247. * @example
  29248. *
  29249. * _.isFinite(3);
  29250. * // => true
  29251. *
  29252. * _.isFinite(Number.MIN_VALUE);
  29253. * // => true
  29254. *
  29255. * _.isFinite(Infinity);
  29256. * // => false
  29257. *
  29258. * _.isFinite('3');
  29259. * // => false
  29260. */
  29261. function isFinite(value) {
  29262. return typeof value == 'number' && nativeIsFinite(value);
  29263. }
  29264. /**
  29265. * Checks if `value` is classified as a `Function` object.
  29266. *
  29267. * @static
  29268. * @memberOf _
  29269. * @since 0.1.0
  29270. * @category Lang
  29271. * @param {*} value The value to check.
  29272. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29273. * @example
  29274. *
  29275. * _.isFunction(_);
  29276. * // => true
  29277. *
  29278. * _.isFunction(/abc/);
  29279. * // => false
  29280. */
  29281. function isFunction(value) {
  29282. if (!isObject(value)) {
  29283. return false;
  29284. }
  29285. // The use of `Object#toString` avoids issues with the `typeof` operator
  29286. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29287. var tag = baseGetTag(value);
  29288. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29289. }
  29290. /**
  29291. * Checks if `value` is an integer.
  29292. *
  29293. * **Note:** This method is based on
  29294. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29295. *
  29296. * @static
  29297. * @memberOf _
  29298. * @since 4.0.0
  29299. * @category Lang
  29300. * @param {*} value The value to check.
  29301. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29302. * @example
  29303. *
  29304. * _.isInteger(3);
  29305. * // => true
  29306. *
  29307. * _.isInteger(Number.MIN_VALUE);
  29308. * // => false
  29309. *
  29310. * _.isInteger(Infinity);
  29311. * // => false
  29312. *
  29313. * _.isInteger('3');
  29314. * // => false
  29315. */
  29316. function isInteger(value) {
  29317. return typeof value == 'number' && value == toInteger(value);
  29318. }
  29319. /**
  29320. * Checks if `value` is a valid array-like length.
  29321. *
  29322. * **Note:** This method is loosely based on
  29323. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29324. *
  29325. * @static
  29326. * @memberOf _
  29327. * @since 4.0.0
  29328. * @category Lang
  29329. * @param {*} value The value to check.
  29330. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29331. * @example
  29332. *
  29333. * _.isLength(3);
  29334. * // => true
  29335. *
  29336. * _.isLength(Number.MIN_VALUE);
  29337. * // => false
  29338. *
  29339. * _.isLength(Infinity);
  29340. * // => false
  29341. *
  29342. * _.isLength('3');
  29343. * // => false
  29344. */
  29345. function isLength(value) {
  29346. return typeof value == 'number' &&
  29347. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29348. }
  29349. /**
  29350. * Checks if `value` is the
  29351. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29352. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29353. *
  29354. * @static
  29355. * @memberOf _
  29356. * @since 0.1.0
  29357. * @category Lang
  29358. * @param {*} value The value to check.
  29359. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29360. * @example
  29361. *
  29362. * _.isObject({});
  29363. * // => true
  29364. *
  29365. * _.isObject([1, 2, 3]);
  29366. * // => true
  29367. *
  29368. * _.isObject(_.noop);
  29369. * // => true
  29370. *
  29371. * _.isObject(null);
  29372. * // => false
  29373. */
  29374. function isObject(value) {
  29375. var type = typeof value;
  29376. return value != null && (type == 'object' || type == 'function');
  29377. }
  29378. /**
  29379. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29380. * and has a `typeof` result of "object".
  29381. *
  29382. * @static
  29383. * @memberOf _
  29384. * @since 4.0.0
  29385. * @category Lang
  29386. * @param {*} value The value to check.
  29387. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29388. * @example
  29389. *
  29390. * _.isObjectLike({});
  29391. * // => true
  29392. *
  29393. * _.isObjectLike([1, 2, 3]);
  29394. * // => true
  29395. *
  29396. * _.isObjectLike(_.noop);
  29397. * // => false
  29398. *
  29399. * _.isObjectLike(null);
  29400. * // => false
  29401. */
  29402. function isObjectLike(value) {
  29403. return value != null && typeof value == 'object';
  29404. }
  29405. /**
  29406. * Checks if `value` is classified as a `Map` object.
  29407. *
  29408. * @static
  29409. * @memberOf _
  29410. * @since 4.3.0
  29411. * @category Lang
  29412. * @param {*} value The value to check.
  29413. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29414. * @example
  29415. *
  29416. * _.isMap(new Map);
  29417. * // => true
  29418. *
  29419. * _.isMap(new WeakMap);
  29420. * // => false
  29421. */
  29422. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29423. /**
  29424. * Performs a partial deep comparison between `object` and `source` to
  29425. * determine if `object` contains equivalent property values.
  29426. *
  29427. * **Note:** This method is equivalent to `_.matches` when `source` is
  29428. * partially applied.
  29429. *
  29430. * Partial comparisons will match empty array and empty object `source`
  29431. * values against any array or object value, respectively. See `_.isEqual`
  29432. * for a list of supported value comparisons.
  29433. *
  29434. * @static
  29435. * @memberOf _
  29436. * @since 3.0.0
  29437. * @category Lang
  29438. * @param {Object} object The object to inspect.
  29439. * @param {Object} source The object of property values to match.
  29440. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29441. * @example
  29442. *
  29443. * var object = { 'a': 1, 'b': 2 };
  29444. *
  29445. * _.isMatch(object, { 'b': 2 });
  29446. * // => true
  29447. *
  29448. * _.isMatch(object, { 'b': 1 });
  29449. * // => false
  29450. */
  29451. function isMatch(object, source) {
  29452. return object === source || baseIsMatch(object, source, getMatchData(source));
  29453. }
  29454. /**
  29455. * This method is like `_.isMatch` except that it accepts `customizer` which
  29456. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29457. * are handled by the method instead. The `customizer` is invoked with five
  29458. * arguments: (objValue, srcValue, index|key, object, source).
  29459. *
  29460. * @static
  29461. * @memberOf _
  29462. * @since 4.0.0
  29463. * @category Lang
  29464. * @param {Object} object The object to inspect.
  29465. * @param {Object} source The object of property values to match.
  29466. * @param {Function} [customizer] The function to customize comparisons.
  29467. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29468. * @example
  29469. *
  29470. * function isGreeting(value) {
  29471. * return /^h(?:i|ello)$/.test(value);
  29472. * }
  29473. *
  29474. * function customizer(objValue, srcValue) {
  29475. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29476. * return true;
  29477. * }
  29478. * }
  29479. *
  29480. * var object = { 'greeting': 'hello' };
  29481. * var source = { 'greeting': 'hi' };
  29482. *
  29483. * _.isMatchWith(object, source, customizer);
  29484. * // => true
  29485. */
  29486. function isMatchWith(object, source, customizer) {
  29487. customizer = typeof customizer == 'function' ? customizer : undefined;
  29488. return baseIsMatch(object, source, getMatchData(source), customizer);
  29489. }
  29490. /**
  29491. * Checks if `value` is `NaN`.
  29492. *
  29493. * **Note:** This method is based on
  29494. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29495. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29496. * `undefined` and other non-number values.
  29497. *
  29498. * @static
  29499. * @memberOf _
  29500. * @since 0.1.0
  29501. * @category Lang
  29502. * @param {*} value The value to check.
  29503. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29504. * @example
  29505. *
  29506. * _.isNaN(NaN);
  29507. * // => true
  29508. *
  29509. * _.isNaN(new Number(NaN));
  29510. * // => true
  29511. *
  29512. * isNaN(undefined);
  29513. * // => true
  29514. *
  29515. * _.isNaN(undefined);
  29516. * // => false
  29517. */
  29518. function isNaN(value) {
  29519. // An `NaN` primitive is the only value that is not equal to itself.
  29520. // Perform the `toStringTag` check first to avoid errors with some
  29521. // ActiveX objects in IE.
  29522. return isNumber(value) && value != +value;
  29523. }
  29524. /**
  29525. * Checks if `value` is a pristine native function.
  29526. *
  29527. * **Note:** This method can't reliably detect native functions in the presence
  29528. * of the core-js package because core-js circumvents this kind of detection.
  29529. * Despite multiple requests, the core-js maintainer has made it clear: any
  29530. * attempt to fix the detection will be obstructed. As a result, we're left
  29531. * with little choice but to throw an error. Unfortunately, this also affects
  29532. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29533. * which rely on core-js.
  29534. *
  29535. * @static
  29536. * @memberOf _
  29537. * @since 3.0.0
  29538. * @category Lang
  29539. * @param {*} value The value to check.
  29540. * @returns {boolean} Returns `true` if `value` is a native function,
  29541. * else `false`.
  29542. * @example
  29543. *
  29544. * _.isNative(Array.prototype.push);
  29545. * // => true
  29546. *
  29547. * _.isNative(_);
  29548. * // => false
  29549. */
  29550. function isNative(value) {
  29551. if (isMaskable(value)) {
  29552. throw new Error(CORE_ERROR_TEXT);
  29553. }
  29554. return baseIsNative(value);
  29555. }
  29556. /**
  29557. * Checks if `value` is `null`.
  29558. *
  29559. * @static
  29560. * @memberOf _
  29561. * @since 0.1.0
  29562. * @category Lang
  29563. * @param {*} value The value to check.
  29564. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29565. * @example
  29566. *
  29567. * _.isNull(null);
  29568. * // => true
  29569. *
  29570. * _.isNull(void 0);
  29571. * // => false
  29572. */
  29573. function isNull(value) {
  29574. return value === null;
  29575. }
  29576. /**
  29577. * Checks if `value` is `null` or `undefined`.
  29578. *
  29579. * @static
  29580. * @memberOf _
  29581. * @since 4.0.0
  29582. * @category Lang
  29583. * @param {*} value The value to check.
  29584. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29585. * @example
  29586. *
  29587. * _.isNil(null);
  29588. * // => true
  29589. *
  29590. * _.isNil(void 0);
  29591. * // => true
  29592. *
  29593. * _.isNil(NaN);
  29594. * // => false
  29595. */
  29596. function isNil(value) {
  29597. return value == null;
  29598. }
  29599. /**
  29600. * Checks if `value` is classified as a `Number` primitive or object.
  29601. *
  29602. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29603. * classified as numbers, use the `_.isFinite` method.
  29604. *
  29605. * @static
  29606. * @memberOf _
  29607. * @since 0.1.0
  29608. * @category Lang
  29609. * @param {*} value The value to check.
  29610. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29611. * @example
  29612. *
  29613. * _.isNumber(3);
  29614. * // => true
  29615. *
  29616. * _.isNumber(Number.MIN_VALUE);
  29617. * // => true
  29618. *
  29619. * _.isNumber(Infinity);
  29620. * // => true
  29621. *
  29622. * _.isNumber('3');
  29623. * // => false
  29624. */
  29625. function isNumber(value) {
  29626. return typeof value == 'number' ||
  29627. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29628. }
  29629. /**
  29630. * Checks if `value` is a plain object, that is, an object created by the
  29631. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29632. *
  29633. * @static
  29634. * @memberOf _
  29635. * @since 0.8.0
  29636. * @category Lang
  29637. * @param {*} value The value to check.
  29638. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29639. * @example
  29640. *
  29641. * function Foo() {
  29642. * this.a = 1;
  29643. * }
  29644. *
  29645. * _.isPlainObject(new Foo);
  29646. * // => false
  29647. *
  29648. * _.isPlainObject([1, 2, 3]);
  29649. * // => false
  29650. *
  29651. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29652. * // => true
  29653. *
  29654. * _.isPlainObject(Object.create(null));
  29655. * // => true
  29656. */
  29657. function isPlainObject(value) {
  29658. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29659. return false;
  29660. }
  29661. var proto = getPrototype(value);
  29662. if (proto === null) {
  29663. return true;
  29664. }
  29665. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29666. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29667. funcToString.call(Ctor) == objectCtorString;
  29668. }
  29669. /**
  29670. * Checks if `value` is classified as a `RegExp` object.
  29671. *
  29672. * @static
  29673. * @memberOf _
  29674. * @since 0.1.0
  29675. * @category Lang
  29676. * @param {*} value The value to check.
  29677. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29678. * @example
  29679. *
  29680. * _.isRegExp(/abc/);
  29681. * // => true
  29682. *
  29683. * _.isRegExp('/abc/');
  29684. * // => false
  29685. */
  29686. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29687. /**
  29688. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29689. * double precision number which isn't the result of a rounded unsafe integer.
  29690. *
  29691. * **Note:** This method is based on
  29692. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29693. *
  29694. * @static
  29695. * @memberOf _
  29696. * @since 4.0.0
  29697. * @category Lang
  29698. * @param {*} value The value to check.
  29699. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29700. * @example
  29701. *
  29702. * _.isSafeInteger(3);
  29703. * // => true
  29704. *
  29705. * _.isSafeInteger(Number.MIN_VALUE);
  29706. * // => false
  29707. *
  29708. * _.isSafeInteger(Infinity);
  29709. * // => false
  29710. *
  29711. * _.isSafeInteger('3');
  29712. * // => false
  29713. */
  29714. function isSafeInteger(value) {
  29715. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29716. }
  29717. /**
  29718. * Checks if `value` is classified as a `Set` object.
  29719. *
  29720. * @static
  29721. * @memberOf _
  29722. * @since 4.3.0
  29723. * @category Lang
  29724. * @param {*} value The value to check.
  29725. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29726. * @example
  29727. *
  29728. * _.isSet(new Set);
  29729. * // => true
  29730. *
  29731. * _.isSet(new WeakSet);
  29732. * // => false
  29733. */
  29734. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29735. /**
  29736. * Checks if `value` is classified as a `String` primitive or object.
  29737. *
  29738. * @static
  29739. * @since 0.1.0
  29740. * @memberOf _
  29741. * @category Lang
  29742. * @param {*} value The value to check.
  29743. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29744. * @example
  29745. *
  29746. * _.isString('abc');
  29747. * // => true
  29748. *
  29749. * _.isString(1);
  29750. * // => false
  29751. */
  29752. function isString(value) {
  29753. return typeof value == 'string' ||
  29754. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29755. }
  29756. /**
  29757. * Checks if `value` is classified as a `Symbol` primitive or object.
  29758. *
  29759. * @static
  29760. * @memberOf _
  29761. * @since 4.0.0
  29762. * @category Lang
  29763. * @param {*} value The value to check.
  29764. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29765. * @example
  29766. *
  29767. * _.isSymbol(Symbol.iterator);
  29768. * // => true
  29769. *
  29770. * _.isSymbol('abc');
  29771. * // => false
  29772. */
  29773. function isSymbol(value) {
  29774. return typeof value == 'symbol' ||
  29775. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29776. }
  29777. /**
  29778. * Checks if `value` is classified as a typed array.
  29779. *
  29780. * @static
  29781. * @memberOf _
  29782. * @since 3.0.0
  29783. * @category Lang
  29784. * @param {*} value The value to check.
  29785. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29786. * @example
  29787. *
  29788. * _.isTypedArray(new Uint8Array);
  29789. * // => true
  29790. *
  29791. * _.isTypedArray([]);
  29792. * // => false
  29793. */
  29794. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29795. /**
  29796. * Checks if `value` is `undefined`.
  29797. *
  29798. * @static
  29799. * @since 0.1.0
  29800. * @memberOf _
  29801. * @category Lang
  29802. * @param {*} value The value to check.
  29803. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29804. * @example
  29805. *
  29806. * _.isUndefined(void 0);
  29807. * // => true
  29808. *
  29809. * _.isUndefined(null);
  29810. * // => false
  29811. */
  29812. function isUndefined(value) {
  29813. return value === undefined;
  29814. }
  29815. /**
  29816. * Checks if `value` is classified as a `WeakMap` object.
  29817. *
  29818. * @static
  29819. * @memberOf _
  29820. * @since 4.3.0
  29821. * @category Lang
  29822. * @param {*} value The value to check.
  29823. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29824. * @example
  29825. *
  29826. * _.isWeakMap(new WeakMap);
  29827. * // => true
  29828. *
  29829. * _.isWeakMap(new Map);
  29830. * // => false
  29831. */
  29832. function isWeakMap(value) {
  29833. return isObjectLike(value) && getTag(value) == weakMapTag;
  29834. }
  29835. /**
  29836. * Checks if `value` is classified as a `WeakSet` object.
  29837. *
  29838. * @static
  29839. * @memberOf _
  29840. * @since 4.3.0
  29841. * @category Lang
  29842. * @param {*} value The value to check.
  29843. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29844. * @example
  29845. *
  29846. * _.isWeakSet(new WeakSet);
  29847. * // => true
  29848. *
  29849. * _.isWeakSet(new Set);
  29850. * // => false
  29851. */
  29852. function isWeakSet(value) {
  29853. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29854. }
  29855. /**
  29856. * Checks if `value` is less than `other`.
  29857. *
  29858. * @static
  29859. * @memberOf _
  29860. * @since 3.9.0
  29861. * @category Lang
  29862. * @param {*} value The value to compare.
  29863. * @param {*} other The other value to compare.
  29864. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29865. * else `false`.
  29866. * @see _.gt
  29867. * @example
  29868. *
  29869. * _.lt(1, 3);
  29870. * // => true
  29871. *
  29872. * _.lt(3, 3);
  29873. * // => false
  29874. *
  29875. * _.lt(3, 1);
  29876. * // => false
  29877. */
  29878. var lt = createRelationalOperation(baseLt);
  29879. /**
  29880. * Checks if `value` is less than or equal to `other`.
  29881. *
  29882. * @static
  29883. * @memberOf _
  29884. * @since 3.9.0
  29885. * @category Lang
  29886. * @param {*} value The value to compare.
  29887. * @param {*} other The other value to compare.
  29888. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29889. * `other`, else `false`.
  29890. * @see _.gte
  29891. * @example
  29892. *
  29893. * _.lte(1, 3);
  29894. * // => true
  29895. *
  29896. * _.lte(3, 3);
  29897. * // => true
  29898. *
  29899. * _.lte(3, 1);
  29900. * // => false
  29901. */
  29902. var lte = createRelationalOperation(function(value, other) {
  29903. return value <= other;
  29904. });
  29905. /**
  29906. * Converts `value` to an array.
  29907. *
  29908. * @static
  29909. * @since 0.1.0
  29910. * @memberOf _
  29911. * @category Lang
  29912. * @param {*} value The value to convert.
  29913. * @returns {Array} Returns the converted array.
  29914. * @example
  29915. *
  29916. * _.toArray({ 'a': 1, 'b': 2 });
  29917. * // => [1, 2]
  29918. *
  29919. * _.toArray('abc');
  29920. * // => ['a', 'b', 'c']
  29921. *
  29922. * _.toArray(1);
  29923. * // => []
  29924. *
  29925. * _.toArray(null);
  29926. * // => []
  29927. */
  29928. function toArray(value) {
  29929. if (!value) {
  29930. return [];
  29931. }
  29932. if (isArrayLike(value)) {
  29933. return isString(value) ? stringToArray(value) : copyArray(value);
  29934. }
  29935. if (symIterator && value[symIterator]) {
  29936. return iteratorToArray(value[symIterator]());
  29937. }
  29938. var tag = getTag(value),
  29939. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29940. return func(value);
  29941. }
  29942. /**
  29943. * Converts `value` to a finite number.
  29944. *
  29945. * @static
  29946. * @memberOf _
  29947. * @since 4.12.0
  29948. * @category Lang
  29949. * @param {*} value The value to convert.
  29950. * @returns {number} Returns the converted number.
  29951. * @example
  29952. *
  29953. * _.toFinite(3.2);
  29954. * // => 3.2
  29955. *
  29956. * _.toFinite(Number.MIN_VALUE);
  29957. * // => 5e-324
  29958. *
  29959. * _.toFinite(Infinity);
  29960. * // => 1.7976931348623157e+308
  29961. *
  29962. * _.toFinite('3.2');
  29963. * // => 3.2
  29964. */
  29965. function toFinite(value) {
  29966. if (!value) {
  29967. return value === 0 ? value : 0;
  29968. }
  29969. value = toNumber(value);
  29970. if (value === INFINITY || value === -INFINITY) {
  29971. var sign = (value < 0 ? -1 : 1);
  29972. return sign * MAX_INTEGER;
  29973. }
  29974. return value === value ? value : 0;
  29975. }
  29976. /**
  29977. * Converts `value` to an integer.
  29978. *
  29979. * **Note:** This method is loosely based on
  29980. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29981. *
  29982. * @static
  29983. * @memberOf _
  29984. * @since 4.0.0
  29985. * @category Lang
  29986. * @param {*} value The value to convert.
  29987. * @returns {number} Returns the converted integer.
  29988. * @example
  29989. *
  29990. * _.toInteger(3.2);
  29991. * // => 3
  29992. *
  29993. * _.toInteger(Number.MIN_VALUE);
  29994. * // => 0
  29995. *
  29996. * _.toInteger(Infinity);
  29997. * // => 1.7976931348623157e+308
  29998. *
  29999. * _.toInteger('3.2');
  30000. * // => 3
  30001. */
  30002. function toInteger(value) {
  30003. var result = toFinite(value),
  30004. remainder = result % 1;
  30005. return result === result ? (remainder ? result - remainder : result) : 0;
  30006. }
  30007. /**
  30008. * Converts `value` to an integer suitable for use as the length of an
  30009. * array-like object.
  30010. *
  30011. * **Note:** This method is based on
  30012. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30013. *
  30014. * @static
  30015. * @memberOf _
  30016. * @since 4.0.0
  30017. * @category Lang
  30018. * @param {*} value The value to convert.
  30019. * @returns {number} Returns the converted integer.
  30020. * @example
  30021. *
  30022. * _.toLength(3.2);
  30023. * // => 3
  30024. *
  30025. * _.toLength(Number.MIN_VALUE);
  30026. * // => 0
  30027. *
  30028. * _.toLength(Infinity);
  30029. * // => 4294967295
  30030. *
  30031. * _.toLength('3.2');
  30032. * // => 3
  30033. */
  30034. function toLength(value) {
  30035. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30036. }
  30037. /**
  30038. * Converts `value` to a number.
  30039. *
  30040. * @static
  30041. * @memberOf _
  30042. * @since 4.0.0
  30043. * @category Lang
  30044. * @param {*} value The value to process.
  30045. * @returns {number} Returns the number.
  30046. * @example
  30047. *
  30048. * _.toNumber(3.2);
  30049. * // => 3.2
  30050. *
  30051. * _.toNumber(Number.MIN_VALUE);
  30052. * // => 5e-324
  30053. *
  30054. * _.toNumber(Infinity);
  30055. * // => Infinity
  30056. *
  30057. * _.toNumber('3.2');
  30058. * // => 3.2
  30059. */
  30060. function toNumber(value) {
  30061. if (typeof value == 'number') {
  30062. return value;
  30063. }
  30064. if (isSymbol(value)) {
  30065. return NAN;
  30066. }
  30067. if (isObject(value)) {
  30068. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30069. value = isObject(other) ? (other + '') : other;
  30070. }
  30071. if (typeof value != 'string') {
  30072. return value === 0 ? value : +value;
  30073. }
  30074. value = value.replace(reTrim, '');
  30075. var isBinary = reIsBinary.test(value);
  30076. return (isBinary || reIsOctal.test(value))
  30077. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30078. : (reIsBadHex.test(value) ? NAN : +value);
  30079. }
  30080. /**
  30081. * Converts `value` to a plain object flattening inherited enumerable string
  30082. * keyed properties of `value` to own properties of the plain object.
  30083. *
  30084. * @static
  30085. * @memberOf _
  30086. * @since 3.0.0
  30087. * @category Lang
  30088. * @param {*} value The value to convert.
  30089. * @returns {Object} Returns the converted plain object.
  30090. * @example
  30091. *
  30092. * function Foo() {
  30093. * this.b = 2;
  30094. * }
  30095. *
  30096. * Foo.prototype.c = 3;
  30097. *
  30098. * _.assign({ 'a': 1 }, new Foo);
  30099. * // => { 'a': 1, 'b': 2 }
  30100. *
  30101. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30102. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30103. */
  30104. function toPlainObject(value) {
  30105. return copyObject(value, keysIn(value));
  30106. }
  30107. /**
  30108. * Converts `value` to a safe integer. A safe integer can be compared and
  30109. * represented correctly.
  30110. *
  30111. * @static
  30112. * @memberOf _
  30113. * @since 4.0.0
  30114. * @category Lang
  30115. * @param {*} value The value to convert.
  30116. * @returns {number} Returns the converted integer.
  30117. * @example
  30118. *
  30119. * _.toSafeInteger(3.2);
  30120. * // => 3
  30121. *
  30122. * _.toSafeInteger(Number.MIN_VALUE);
  30123. * // => 0
  30124. *
  30125. * _.toSafeInteger(Infinity);
  30126. * // => 9007199254740991
  30127. *
  30128. * _.toSafeInteger('3.2');
  30129. * // => 3
  30130. */
  30131. function toSafeInteger(value) {
  30132. return value
  30133. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30134. : (value === 0 ? value : 0);
  30135. }
  30136. /**
  30137. * Converts `value` to a string. An empty string is returned for `null`
  30138. * and `undefined` values. The sign of `-0` is preserved.
  30139. *
  30140. * @static
  30141. * @memberOf _
  30142. * @since 4.0.0
  30143. * @category Lang
  30144. * @param {*} value The value to convert.
  30145. * @returns {string} Returns the converted string.
  30146. * @example
  30147. *
  30148. * _.toString(null);
  30149. * // => ''
  30150. *
  30151. * _.toString(-0);
  30152. * // => '-0'
  30153. *
  30154. * _.toString([1, 2, 3]);
  30155. * // => '1,2,3'
  30156. */
  30157. function toString(value) {
  30158. return value == null ? '' : baseToString(value);
  30159. }
  30160. /*------------------------------------------------------------------------*/
  30161. /**
  30162. * Assigns own enumerable string keyed properties of source objects to the
  30163. * destination object. Source objects are applied from left to right.
  30164. * Subsequent sources overwrite property assignments of previous sources.
  30165. *
  30166. * **Note:** This method mutates `object` and is loosely based on
  30167. * [`Object.assign`](https://mdn.io/Object/assign).
  30168. *
  30169. * @static
  30170. * @memberOf _
  30171. * @since 0.10.0
  30172. * @category Object
  30173. * @param {Object} object The destination object.
  30174. * @param {...Object} [sources] The source objects.
  30175. * @returns {Object} Returns `object`.
  30176. * @see _.assignIn
  30177. * @example
  30178. *
  30179. * function Foo() {
  30180. * this.a = 1;
  30181. * }
  30182. *
  30183. * function Bar() {
  30184. * this.c = 3;
  30185. * }
  30186. *
  30187. * Foo.prototype.b = 2;
  30188. * Bar.prototype.d = 4;
  30189. *
  30190. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30191. * // => { 'a': 1, 'c': 3 }
  30192. */
  30193. var assign = createAssigner(function(object, source) {
  30194. if (isPrototype(source) || isArrayLike(source)) {
  30195. copyObject(source, keys(source), object);
  30196. return;
  30197. }
  30198. for (var key in source) {
  30199. if (hasOwnProperty.call(source, key)) {
  30200. assignValue(object, key, source[key]);
  30201. }
  30202. }
  30203. });
  30204. /**
  30205. * This method is like `_.assign` except that it iterates over own and
  30206. * inherited source properties.
  30207. *
  30208. * **Note:** This method mutates `object`.
  30209. *
  30210. * @static
  30211. * @memberOf _
  30212. * @since 4.0.0
  30213. * @alias extend
  30214. * @category Object
  30215. * @param {Object} object The destination object.
  30216. * @param {...Object} [sources] The source objects.
  30217. * @returns {Object} Returns `object`.
  30218. * @see _.assign
  30219. * @example
  30220. *
  30221. * function Foo() {
  30222. * this.a = 1;
  30223. * }
  30224. *
  30225. * function Bar() {
  30226. * this.c = 3;
  30227. * }
  30228. *
  30229. * Foo.prototype.b = 2;
  30230. * Bar.prototype.d = 4;
  30231. *
  30232. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30233. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30234. */
  30235. var assignIn = createAssigner(function(object, source) {
  30236. copyObject(source, keysIn(source), object);
  30237. });
  30238. /**
  30239. * This method is like `_.assignIn` except that it accepts `customizer`
  30240. * which is invoked to produce the assigned values. If `customizer` returns
  30241. * `undefined`, assignment is handled by the method instead. The `customizer`
  30242. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30243. *
  30244. * **Note:** This method mutates `object`.
  30245. *
  30246. * @static
  30247. * @memberOf _
  30248. * @since 4.0.0
  30249. * @alias extendWith
  30250. * @category Object
  30251. * @param {Object} object The destination object.
  30252. * @param {...Object} sources The source objects.
  30253. * @param {Function} [customizer] The function to customize assigned values.
  30254. * @returns {Object} Returns `object`.
  30255. * @see _.assignWith
  30256. * @example
  30257. *
  30258. * function customizer(objValue, srcValue) {
  30259. * return _.isUndefined(objValue) ? srcValue : objValue;
  30260. * }
  30261. *
  30262. * var defaults = _.partialRight(_.assignInWith, customizer);
  30263. *
  30264. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30265. * // => { 'a': 1, 'b': 2 }
  30266. */
  30267. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30268. copyObject(source, keysIn(source), object, customizer);
  30269. });
  30270. /**
  30271. * This method is like `_.assign` except that it accepts `customizer`
  30272. * which is invoked to produce the assigned values. If `customizer` returns
  30273. * `undefined`, assignment is handled by the method instead. The `customizer`
  30274. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30275. *
  30276. * **Note:** This method mutates `object`.
  30277. *
  30278. * @static
  30279. * @memberOf _
  30280. * @since 4.0.0
  30281. * @category Object
  30282. * @param {Object} object The destination object.
  30283. * @param {...Object} sources The source objects.
  30284. * @param {Function} [customizer] The function to customize assigned values.
  30285. * @returns {Object} Returns `object`.
  30286. * @see _.assignInWith
  30287. * @example
  30288. *
  30289. * function customizer(objValue, srcValue) {
  30290. * return _.isUndefined(objValue) ? srcValue : objValue;
  30291. * }
  30292. *
  30293. * var defaults = _.partialRight(_.assignWith, customizer);
  30294. *
  30295. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30296. * // => { 'a': 1, 'b': 2 }
  30297. */
  30298. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30299. copyObject(source, keys(source), object, customizer);
  30300. });
  30301. /**
  30302. * Creates an array of values corresponding to `paths` of `object`.
  30303. *
  30304. * @static
  30305. * @memberOf _
  30306. * @since 1.0.0
  30307. * @category Object
  30308. * @param {Object} object The object to iterate over.
  30309. * @param {...(string|string[])} [paths] The property paths to pick.
  30310. * @returns {Array} Returns the picked values.
  30311. * @example
  30312. *
  30313. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30314. *
  30315. * _.at(object, ['a[0].b.c', 'a[1]']);
  30316. * // => [3, 4]
  30317. */
  30318. var at = flatRest(baseAt);
  30319. /**
  30320. * Creates an object that inherits from the `prototype` object. If a
  30321. * `properties` object is given, its own enumerable string keyed properties
  30322. * are assigned to the created object.
  30323. *
  30324. * @static
  30325. * @memberOf _
  30326. * @since 2.3.0
  30327. * @category Object
  30328. * @param {Object} prototype The object to inherit from.
  30329. * @param {Object} [properties] The properties to assign to the object.
  30330. * @returns {Object} Returns the new object.
  30331. * @example
  30332. *
  30333. * function Shape() {
  30334. * this.x = 0;
  30335. * this.y = 0;
  30336. * }
  30337. *
  30338. * function Circle() {
  30339. * Shape.call(this);
  30340. * }
  30341. *
  30342. * Circle.prototype = _.create(Shape.prototype, {
  30343. * 'constructor': Circle
  30344. * });
  30345. *
  30346. * var circle = new Circle;
  30347. * circle instanceof Circle;
  30348. * // => true
  30349. *
  30350. * circle instanceof Shape;
  30351. * // => true
  30352. */
  30353. function create(prototype, properties) {
  30354. var result = baseCreate(prototype);
  30355. return properties == null ? result : baseAssign(result, properties);
  30356. }
  30357. /**
  30358. * Assigns own and inherited enumerable string keyed properties of source
  30359. * objects to the destination object for all destination properties that
  30360. * resolve to `undefined`. Source objects are applied from left to right.
  30361. * Once a property is set, additional values of the same property are ignored.
  30362. *
  30363. * **Note:** This method mutates `object`.
  30364. *
  30365. * @static
  30366. * @since 0.1.0
  30367. * @memberOf _
  30368. * @category Object
  30369. * @param {Object} object The destination object.
  30370. * @param {...Object} [sources] The source objects.
  30371. * @returns {Object} Returns `object`.
  30372. * @see _.defaultsDeep
  30373. * @example
  30374. *
  30375. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30376. * // => { 'a': 1, 'b': 2 }
  30377. */
  30378. var defaults = baseRest(function(object, sources) {
  30379. object = Object(object);
  30380. var index = -1;
  30381. var length = sources.length;
  30382. var guard = length > 2 ? sources[2] : undefined;
  30383. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30384. length = 1;
  30385. }
  30386. while (++index < length) {
  30387. var source = sources[index];
  30388. var props = keysIn(source);
  30389. var propsIndex = -1;
  30390. var propsLength = props.length;
  30391. while (++propsIndex < propsLength) {
  30392. var key = props[propsIndex];
  30393. var value = object[key];
  30394. if (value === undefined ||
  30395. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30396. object[key] = source[key];
  30397. }
  30398. }
  30399. }
  30400. return object;
  30401. });
  30402. /**
  30403. * This method is like `_.defaults` except that it recursively assigns
  30404. * default properties.
  30405. *
  30406. * **Note:** This method mutates `object`.
  30407. *
  30408. * @static
  30409. * @memberOf _
  30410. * @since 3.10.0
  30411. * @category Object
  30412. * @param {Object} object The destination object.
  30413. * @param {...Object} [sources] The source objects.
  30414. * @returns {Object} Returns `object`.
  30415. * @see _.defaults
  30416. * @example
  30417. *
  30418. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30419. * // => { 'a': { 'b': 2, 'c': 3 } }
  30420. */
  30421. var defaultsDeep = baseRest(function(args) {
  30422. args.push(undefined, customDefaultsMerge);
  30423. return apply(mergeWith, undefined, args);
  30424. });
  30425. /**
  30426. * This method is like `_.find` except that it returns the key of the first
  30427. * element `predicate` returns truthy for instead of the element itself.
  30428. *
  30429. * @static
  30430. * @memberOf _
  30431. * @since 1.1.0
  30432. * @category Object
  30433. * @param {Object} object The object to inspect.
  30434. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30435. * @returns {string|undefined} Returns the key of the matched element,
  30436. * else `undefined`.
  30437. * @example
  30438. *
  30439. * var users = {
  30440. * 'barney': { 'age': 36, 'active': true },
  30441. * 'fred': { 'age': 40, 'active': false },
  30442. * 'pebbles': { 'age': 1, 'active': true }
  30443. * };
  30444. *
  30445. * _.findKey(users, function(o) { return o.age < 40; });
  30446. * // => 'barney' (iteration order is not guaranteed)
  30447. *
  30448. * // The `_.matches` iteratee shorthand.
  30449. * _.findKey(users, { 'age': 1, 'active': true });
  30450. * // => 'pebbles'
  30451. *
  30452. * // The `_.matchesProperty` iteratee shorthand.
  30453. * _.findKey(users, ['active', false]);
  30454. * // => 'fred'
  30455. *
  30456. * // The `_.property` iteratee shorthand.
  30457. * _.findKey(users, 'active');
  30458. * // => 'barney'
  30459. */
  30460. function findKey(object, predicate) {
  30461. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30462. }
  30463. /**
  30464. * This method is like `_.findKey` except that it iterates over elements of
  30465. * a collection in the opposite order.
  30466. *
  30467. * @static
  30468. * @memberOf _
  30469. * @since 2.0.0
  30470. * @category Object
  30471. * @param {Object} object The object to inspect.
  30472. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30473. * @returns {string|undefined} Returns the key of the matched element,
  30474. * else `undefined`.
  30475. * @example
  30476. *
  30477. * var users = {
  30478. * 'barney': { 'age': 36, 'active': true },
  30479. * 'fred': { 'age': 40, 'active': false },
  30480. * 'pebbles': { 'age': 1, 'active': true }
  30481. * };
  30482. *
  30483. * _.findLastKey(users, function(o) { return o.age < 40; });
  30484. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30485. *
  30486. * // The `_.matches` iteratee shorthand.
  30487. * _.findLastKey(users, { 'age': 36, 'active': true });
  30488. * // => 'barney'
  30489. *
  30490. * // The `_.matchesProperty` iteratee shorthand.
  30491. * _.findLastKey(users, ['active', false]);
  30492. * // => 'fred'
  30493. *
  30494. * // The `_.property` iteratee shorthand.
  30495. * _.findLastKey(users, 'active');
  30496. * // => 'pebbles'
  30497. */
  30498. function findLastKey(object, predicate) {
  30499. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30500. }
  30501. /**
  30502. * Iterates over own and inherited enumerable string keyed properties of an
  30503. * object and invokes `iteratee` for each property. The iteratee is invoked
  30504. * with three arguments: (value, key, object). Iteratee functions may exit
  30505. * iteration early by explicitly returning `false`.
  30506. *
  30507. * @static
  30508. * @memberOf _
  30509. * @since 0.3.0
  30510. * @category Object
  30511. * @param {Object} object The object to iterate over.
  30512. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30513. * @returns {Object} Returns `object`.
  30514. * @see _.forInRight
  30515. * @example
  30516. *
  30517. * function Foo() {
  30518. * this.a = 1;
  30519. * this.b = 2;
  30520. * }
  30521. *
  30522. * Foo.prototype.c = 3;
  30523. *
  30524. * _.forIn(new Foo, function(value, key) {
  30525. * console.log(key);
  30526. * });
  30527. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30528. */
  30529. function forIn(object, iteratee) {
  30530. return object == null
  30531. ? object
  30532. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30533. }
  30534. /**
  30535. * This method is like `_.forIn` except that it iterates over properties of
  30536. * `object` in the opposite order.
  30537. *
  30538. * @static
  30539. * @memberOf _
  30540. * @since 2.0.0
  30541. * @category Object
  30542. * @param {Object} object The object to iterate over.
  30543. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30544. * @returns {Object} Returns `object`.
  30545. * @see _.forIn
  30546. * @example
  30547. *
  30548. * function Foo() {
  30549. * this.a = 1;
  30550. * this.b = 2;
  30551. * }
  30552. *
  30553. * Foo.prototype.c = 3;
  30554. *
  30555. * _.forInRight(new Foo, function(value, key) {
  30556. * console.log(key);
  30557. * });
  30558. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30559. */
  30560. function forInRight(object, iteratee) {
  30561. return object == null
  30562. ? object
  30563. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30564. }
  30565. /**
  30566. * Iterates over own enumerable string keyed properties of an object and
  30567. * invokes `iteratee` for each property. The iteratee is invoked with three
  30568. * arguments: (value, key, object). Iteratee functions may exit iteration
  30569. * early by explicitly returning `false`.
  30570. *
  30571. * @static
  30572. * @memberOf _
  30573. * @since 0.3.0
  30574. * @category Object
  30575. * @param {Object} object The object to iterate over.
  30576. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30577. * @returns {Object} Returns `object`.
  30578. * @see _.forOwnRight
  30579. * @example
  30580. *
  30581. * function Foo() {
  30582. * this.a = 1;
  30583. * this.b = 2;
  30584. * }
  30585. *
  30586. * Foo.prototype.c = 3;
  30587. *
  30588. * _.forOwn(new Foo, function(value, key) {
  30589. * console.log(key);
  30590. * });
  30591. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30592. */
  30593. function forOwn(object, iteratee) {
  30594. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30595. }
  30596. /**
  30597. * This method is like `_.forOwn` except that it iterates over properties of
  30598. * `object` in the opposite order.
  30599. *
  30600. * @static
  30601. * @memberOf _
  30602. * @since 2.0.0
  30603. * @category Object
  30604. * @param {Object} object The object to iterate over.
  30605. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30606. * @returns {Object} Returns `object`.
  30607. * @see _.forOwn
  30608. * @example
  30609. *
  30610. * function Foo() {
  30611. * this.a = 1;
  30612. * this.b = 2;
  30613. * }
  30614. *
  30615. * Foo.prototype.c = 3;
  30616. *
  30617. * _.forOwnRight(new Foo, function(value, key) {
  30618. * console.log(key);
  30619. * });
  30620. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30621. */
  30622. function forOwnRight(object, iteratee) {
  30623. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30624. }
  30625. /**
  30626. * Creates an array of function property names from own enumerable properties
  30627. * of `object`.
  30628. *
  30629. * @static
  30630. * @since 0.1.0
  30631. * @memberOf _
  30632. * @category Object
  30633. * @param {Object} object The object to inspect.
  30634. * @returns {Array} Returns the function names.
  30635. * @see _.functionsIn
  30636. * @example
  30637. *
  30638. * function Foo() {
  30639. * this.a = _.constant('a');
  30640. * this.b = _.constant('b');
  30641. * }
  30642. *
  30643. * Foo.prototype.c = _.constant('c');
  30644. *
  30645. * _.functions(new Foo);
  30646. * // => ['a', 'b']
  30647. */
  30648. function functions(object) {
  30649. return object == null ? [] : baseFunctions(object, keys(object));
  30650. }
  30651. /**
  30652. * Creates an array of function property names from own and inherited
  30653. * enumerable properties of `object`.
  30654. *
  30655. * @static
  30656. * @memberOf _
  30657. * @since 4.0.0
  30658. * @category Object
  30659. * @param {Object} object The object to inspect.
  30660. * @returns {Array} Returns the function names.
  30661. * @see _.functions
  30662. * @example
  30663. *
  30664. * function Foo() {
  30665. * this.a = _.constant('a');
  30666. * this.b = _.constant('b');
  30667. * }
  30668. *
  30669. * Foo.prototype.c = _.constant('c');
  30670. *
  30671. * _.functionsIn(new Foo);
  30672. * // => ['a', 'b', 'c']
  30673. */
  30674. function functionsIn(object) {
  30675. return object == null ? [] : baseFunctions(object, keysIn(object));
  30676. }
  30677. /**
  30678. * Gets the value at `path` of `object`. If the resolved value is
  30679. * `undefined`, the `defaultValue` is returned in its place.
  30680. *
  30681. * @static
  30682. * @memberOf _
  30683. * @since 3.7.0
  30684. * @category Object
  30685. * @param {Object} object The object to query.
  30686. * @param {Array|string} path The path of the property to get.
  30687. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30688. * @returns {*} Returns the resolved value.
  30689. * @example
  30690. *
  30691. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30692. *
  30693. * _.get(object, 'a[0].b.c');
  30694. * // => 3
  30695. *
  30696. * _.get(object, ['a', '0', 'b', 'c']);
  30697. * // => 3
  30698. *
  30699. * _.get(object, 'a.b.c', 'default');
  30700. * // => 'default'
  30701. */
  30702. function get(object, path, defaultValue) {
  30703. var result = object == null ? undefined : baseGet(object, path);
  30704. return result === undefined ? defaultValue : result;
  30705. }
  30706. /**
  30707. * Checks if `path` is a direct property of `object`.
  30708. *
  30709. * @static
  30710. * @since 0.1.0
  30711. * @memberOf _
  30712. * @category Object
  30713. * @param {Object} object The object to query.
  30714. * @param {Array|string} path The path to check.
  30715. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30716. * @example
  30717. *
  30718. * var object = { 'a': { 'b': 2 } };
  30719. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30720. *
  30721. * _.has(object, 'a');
  30722. * // => true
  30723. *
  30724. * _.has(object, 'a.b');
  30725. * // => true
  30726. *
  30727. * _.has(object, ['a', 'b']);
  30728. * // => true
  30729. *
  30730. * _.has(other, 'a');
  30731. * // => false
  30732. */
  30733. function has(object, path) {
  30734. return object != null && hasPath(object, path, baseHas);
  30735. }
  30736. /**
  30737. * Checks if `path` is a direct or inherited property of `object`.
  30738. *
  30739. * @static
  30740. * @memberOf _
  30741. * @since 4.0.0
  30742. * @category Object
  30743. * @param {Object} object The object to query.
  30744. * @param {Array|string} path The path to check.
  30745. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30746. * @example
  30747. *
  30748. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30749. *
  30750. * _.hasIn(object, 'a');
  30751. * // => true
  30752. *
  30753. * _.hasIn(object, 'a.b');
  30754. * // => true
  30755. *
  30756. * _.hasIn(object, ['a', 'b']);
  30757. * // => true
  30758. *
  30759. * _.hasIn(object, 'b');
  30760. * // => false
  30761. */
  30762. function hasIn(object, path) {
  30763. return object != null && hasPath(object, path, baseHasIn);
  30764. }
  30765. /**
  30766. * Creates an object composed of the inverted keys and values of `object`.
  30767. * If `object` contains duplicate values, subsequent values overwrite
  30768. * property assignments of previous values.
  30769. *
  30770. * @static
  30771. * @memberOf _
  30772. * @since 0.7.0
  30773. * @category Object
  30774. * @param {Object} object The object to invert.
  30775. * @returns {Object} Returns the new inverted object.
  30776. * @example
  30777. *
  30778. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30779. *
  30780. * _.invert(object);
  30781. * // => { '1': 'c', '2': 'b' }
  30782. */
  30783. var invert = createInverter(function(result, value, key) {
  30784. if (value != null &&
  30785. typeof value.toString != 'function') {
  30786. value = nativeObjectToString.call(value);
  30787. }
  30788. result[value] = key;
  30789. }, constant(identity));
  30790. /**
  30791. * This method is like `_.invert` except that the inverted object is generated
  30792. * from the results of running each element of `object` thru `iteratee`. The
  30793. * corresponding inverted value of each inverted key is an array of keys
  30794. * responsible for generating the inverted value. The iteratee is invoked
  30795. * with one argument: (value).
  30796. *
  30797. * @static
  30798. * @memberOf _
  30799. * @since 4.1.0
  30800. * @category Object
  30801. * @param {Object} object The object to invert.
  30802. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30803. * @returns {Object} Returns the new inverted object.
  30804. * @example
  30805. *
  30806. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30807. *
  30808. * _.invertBy(object);
  30809. * // => { '1': ['a', 'c'], '2': ['b'] }
  30810. *
  30811. * _.invertBy(object, function(value) {
  30812. * return 'group' + value;
  30813. * });
  30814. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30815. */
  30816. var invertBy = createInverter(function(result, value, key) {
  30817. if (value != null &&
  30818. typeof value.toString != 'function') {
  30819. value = nativeObjectToString.call(value);
  30820. }
  30821. if (hasOwnProperty.call(result, value)) {
  30822. result[value].push(key);
  30823. } else {
  30824. result[value] = [key];
  30825. }
  30826. }, getIteratee);
  30827. /**
  30828. * Invokes the method at `path` of `object`.
  30829. *
  30830. * @static
  30831. * @memberOf _
  30832. * @since 4.0.0
  30833. * @category Object
  30834. * @param {Object} object The object to query.
  30835. * @param {Array|string} path The path of the method to invoke.
  30836. * @param {...*} [args] The arguments to invoke the method with.
  30837. * @returns {*} Returns the result of the invoked method.
  30838. * @example
  30839. *
  30840. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30841. *
  30842. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30843. * // => [2, 3]
  30844. */
  30845. var invoke = baseRest(baseInvoke);
  30846. /**
  30847. * Creates an array of the own enumerable property names of `object`.
  30848. *
  30849. * **Note:** Non-object values are coerced to objects. See the
  30850. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30851. * for more details.
  30852. *
  30853. * @static
  30854. * @since 0.1.0
  30855. * @memberOf _
  30856. * @category Object
  30857. * @param {Object} object The object to query.
  30858. * @returns {Array} Returns the array of property names.
  30859. * @example
  30860. *
  30861. * function Foo() {
  30862. * this.a = 1;
  30863. * this.b = 2;
  30864. * }
  30865. *
  30866. * Foo.prototype.c = 3;
  30867. *
  30868. * _.keys(new Foo);
  30869. * // => ['a', 'b'] (iteration order is not guaranteed)
  30870. *
  30871. * _.keys('hi');
  30872. * // => ['0', '1']
  30873. */
  30874. function keys(object) {
  30875. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30876. }
  30877. /**
  30878. * Creates an array of the own and inherited enumerable property names of `object`.
  30879. *
  30880. * **Note:** Non-object values are coerced to objects.
  30881. *
  30882. * @static
  30883. * @memberOf _
  30884. * @since 3.0.0
  30885. * @category Object
  30886. * @param {Object} object The object to query.
  30887. * @returns {Array} Returns the array of property names.
  30888. * @example
  30889. *
  30890. * function Foo() {
  30891. * this.a = 1;
  30892. * this.b = 2;
  30893. * }
  30894. *
  30895. * Foo.prototype.c = 3;
  30896. *
  30897. * _.keysIn(new Foo);
  30898. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30899. */
  30900. function keysIn(object) {
  30901. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30902. }
  30903. /**
  30904. * The opposite of `_.mapValues`; this method creates an object with the
  30905. * same values as `object` and keys generated by running each own enumerable
  30906. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30907. * with three arguments: (value, key, object).
  30908. *
  30909. * @static
  30910. * @memberOf _
  30911. * @since 3.8.0
  30912. * @category Object
  30913. * @param {Object} object The object to iterate over.
  30914. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30915. * @returns {Object} Returns the new mapped object.
  30916. * @see _.mapValues
  30917. * @example
  30918. *
  30919. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30920. * return key + value;
  30921. * });
  30922. * // => { 'a1': 1, 'b2': 2 }
  30923. */
  30924. function mapKeys(object, iteratee) {
  30925. var result = {};
  30926. iteratee = getIteratee(iteratee, 3);
  30927. baseForOwn(object, function(value, key, object) {
  30928. baseAssignValue(result, iteratee(value, key, object), value);
  30929. });
  30930. return result;
  30931. }
  30932. /**
  30933. * Creates an object with the same keys as `object` and values generated
  30934. * by running each own enumerable string keyed property of `object` thru
  30935. * `iteratee`. The iteratee is invoked with three arguments:
  30936. * (value, key, object).
  30937. *
  30938. * @static
  30939. * @memberOf _
  30940. * @since 2.4.0
  30941. * @category Object
  30942. * @param {Object} object The object to iterate over.
  30943. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30944. * @returns {Object} Returns the new mapped object.
  30945. * @see _.mapKeys
  30946. * @example
  30947. *
  30948. * var users = {
  30949. * 'fred': { 'user': 'fred', 'age': 40 },
  30950. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30951. * };
  30952. *
  30953. * _.mapValues(users, function(o) { return o.age; });
  30954. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30955. *
  30956. * // The `_.property` iteratee shorthand.
  30957. * _.mapValues(users, 'age');
  30958. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30959. */
  30960. function mapValues(object, iteratee) {
  30961. var result = {};
  30962. iteratee = getIteratee(iteratee, 3);
  30963. baseForOwn(object, function(value, key, object) {
  30964. baseAssignValue(result, key, iteratee(value, key, object));
  30965. });
  30966. return result;
  30967. }
  30968. /**
  30969. * This method is like `_.assign` except that it recursively merges own and
  30970. * inherited enumerable string keyed properties of source objects into the
  30971. * destination object. Source properties that resolve to `undefined` are
  30972. * skipped if a destination value exists. Array and plain object properties
  30973. * are merged recursively. Other objects and value types are overridden by
  30974. * assignment. Source objects are applied from left to right. Subsequent
  30975. * sources overwrite property assignments of previous sources.
  30976. *
  30977. * **Note:** This method mutates `object`.
  30978. *
  30979. * @static
  30980. * @memberOf _
  30981. * @since 0.5.0
  30982. * @category Object
  30983. * @param {Object} object The destination object.
  30984. * @param {...Object} [sources] The source objects.
  30985. * @returns {Object} Returns `object`.
  30986. * @example
  30987. *
  30988. * var object = {
  30989. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30990. * };
  30991. *
  30992. * var other = {
  30993. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30994. * };
  30995. *
  30996. * _.merge(object, other);
  30997. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30998. */
  30999. var merge = createAssigner(function(object, source, srcIndex) {
  31000. baseMerge(object, source, srcIndex);
  31001. });
  31002. /**
  31003. * This method is like `_.merge` except that it accepts `customizer` which
  31004. * is invoked to produce the merged values of the destination and source
  31005. * properties. If `customizer` returns `undefined`, merging is handled by the
  31006. * method instead. The `customizer` is invoked with six arguments:
  31007. * (objValue, srcValue, key, object, source, stack).
  31008. *
  31009. * **Note:** This method mutates `object`.
  31010. *
  31011. * @static
  31012. * @memberOf _
  31013. * @since 4.0.0
  31014. * @category Object
  31015. * @param {Object} object The destination object.
  31016. * @param {...Object} sources The source objects.
  31017. * @param {Function} customizer The function to customize assigned values.
  31018. * @returns {Object} Returns `object`.
  31019. * @example
  31020. *
  31021. * function customizer(objValue, srcValue) {
  31022. * if (_.isArray(objValue)) {
  31023. * return objValue.concat(srcValue);
  31024. * }
  31025. * }
  31026. *
  31027. * var object = { 'a': [1], 'b': [2] };
  31028. * var other = { 'a': [3], 'b': [4] };
  31029. *
  31030. * _.mergeWith(object, other, customizer);
  31031. * // => { 'a': [1, 3], 'b': [2, 4] }
  31032. */
  31033. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31034. baseMerge(object, source, srcIndex, customizer);
  31035. });
  31036. /**
  31037. * The opposite of `_.pick`; this method creates an object composed of the
  31038. * own and inherited enumerable property paths of `object` that are not omitted.
  31039. *
  31040. * **Note:** This method is considerably slower than `_.pick`.
  31041. *
  31042. * @static
  31043. * @since 0.1.0
  31044. * @memberOf _
  31045. * @category Object
  31046. * @param {Object} object The source object.
  31047. * @param {...(string|string[])} [paths] The property paths to omit.
  31048. * @returns {Object} Returns the new object.
  31049. * @example
  31050. *
  31051. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31052. *
  31053. * _.omit(object, ['a', 'c']);
  31054. * // => { 'b': '2' }
  31055. */
  31056. var omit = flatRest(function(object, paths) {
  31057. var result = {};
  31058. if (object == null) {
  31059. return result;
  31060. }
  31061. var isDeep = false;
  31062. paths = arrayMap(paths, function(path) {
  31063. path = castPath(path, object);
  31064. isDeep || (isDeep = path.length > 1);
  31065. return path;
  31066. });
  31067. copyObject(object, getAllKeysIn(object), result);
  31068. if (isDeep) {
  31069. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31070. }
  31071. var length = paths.length;
  31072. while (length--) {
  31073. baseUnset(result, paths[length]);
  31074. }
  31075. return result;
  31076. });
  31077. /**
  31078. * The opposite of `_.pickBy`; this method creates an object composed of
  31079. * the own and inherited enumerable string keyed properties of `object` that
  31080. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31081. * arguments: (value, key).
  31082. *
  31083. * @static
  31084. * @memberOf _
  31085. * @since 4.0.0
  31086. * @category Object
  31087. * @param {Object} object The source object.
  31088. * @param {Function} [predicate=_.identity] The function invoked per property.
  31089. * @returns {Object} Returns the new object.
  31090. * @example
  31091. *
  31092. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31093. *
  31094. * _.omitBy(object, _.isNumber);
  31095. * // => { 'b': '2' }
  31096. */
  31097. function omitBy(object, predicate) {
  31098. return pickBy(object, negate(getIteratee(predicate)));
  31099. }
  31100. /**
  31101. * Creates an object composed of the picked `object` properties.
  31102. *
  31103. * @static
  31104. * @since 0.1.0
  31105. * @memberOf _
  31106. * @category Object
  31107. * @param {Object} object The source object.
  31108. * @param {...(string|string[])} [paths] The property paths to pick.
  31109. * @returns {Object} Returns the new object.
  31110. * @example
  31111. *
  31112. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31113. *
  31114. * _.pick(object, ['a', 'c']);
  31115. * // => { 'a': 1, 'c': 3 }
  31116. */
  31117. var pick = flatRest(function(object, paths) {
  31118. return object == null ? {} : basePick(object, paths);
  31119. });
  31120. /**
  31121. * Creates an object composed of the `object` properties `predicate` returns
  31122. * truthy for. The predicate is invoked with two arguments: (value, key).
  31123. *
  31124. * @static
  31125. * @memberOf _
  31126. * @since 4.0.0
  31127. * @category Object
  31128. * @param {Object} object The source object.
  31129. * @param {Function} [predicate=_.identity] The function invoked per property.
  31130. * @returns {Object} Returns the new object.
  31131. * @example
  31132. *
  31133. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31134. *
  31135. * _.pickBy(object, _.isNumber);
  31136. * // => { 'a': 1, 'c': 3 }
  31137. */
  31138. function pickBy(object, predicate) {
  31139. if (object == null) {
  31140. return {};
  31141. }
  31142. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31143. return [prop];
  31144. });
  31145. predicate = getIteratee(predicate);
  31146. return basePickBy(object, props, function(value, path) {
  31147. return predicate(value, path[0]);
  31148. });
  31149. }
  31150. /**
  31151. * This method is like `_.get` except that if the resolved value is a
  31152. * function it's invoked with the `this` binding of its parent object and
  31153. * its result is returned.
  31154. *
  31155. * @static
  31156. * @since 0.1.0
  31157. * @memberOf _
  31158. * @category Object
  31159. * @param {Object} object The object to query.
  31160. * @param {Array|string} path The path of the property to resolve.
  31161. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31162. * @returns {*} Returns the resolved value.
  31163. * @example
  31164. *
  31165. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31166. *
  31167. * _.result(object, 'a[0].b.c1');
  31168. * // => 3
  31169. *
  31170. * _.result(object, 'a[0].b.c2');
  31171. * // => 4
  31172. *
  31173. * _.result(object, 'a[0].b.c3', 'default');
  31174. * // => 'default'
  31175. *
  31176. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31177. * // => 'default'
  31178. */
  31179. function result(object, path, defaultValue) {
  31180. path = castPath(path, object);
  31181. var index = -1,
  31182. length = path.length;
  31183. // Ensure the loop is entered when path is empty.
  31184. if (!length) {
  31185. length = 1;
  31186. object = undefined;
  31187. }
  31188. while (++index < length) {
  31189. var value = object == null ? undefined : object[toKey(path[index])];
  31190. if (value === undefined) {
  31191. index = length;
  31192. value = defaultValue;
  31193. }
  31194. object = isFunction(value) ? value.call(object) : value;
  31195. }
  31196. return object;
  31197. }
  31198. /**
  31199. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31200. * it's created. Arrays are created for missing index properties while objects
  31201. * are created for all other missing properties. Use `_.setWith` to customize
  31202. * `path` creation.
  31203. *
  31204. * **Note:** This method mutates `object`.
  31205. *
  31206. * @static
  31207. * @memberOf _
  31208. * @since 3.7.0
  31209. * @category Object
  31210. * @param {Object} object The object to modify.
  31211. * @param {Array|string} path The path of the property to set.
  31212. * @param {*} value The value to set.
  31213. * @returns {Object} Returns `object`.
  31214. * @example
  31215. *
  31216. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31217. *
  31218. * _.set(object, 'a[0].b.c', 4);
  31219. * console.log(object.a[0].b.c);
  31220. * // => 4
  31221. *
  31222. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31223. * console.log(object.x[0].y.z);
  31224. * // => 5
  31225. */
  31226. function set(object, path, value) {
  31227. return object == null ? object : baseSet(object, path, value);
  31228. }
  31229. /**
  31230. * This method is like `_.set` except that it accepts `customizer` which is
  31231. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31232. * path creation is handled by the method instead. The `customizer` is invoked
  31233. * with three arguments: (nsValue, key, nsObject).
  31234. *
  31235. * **Note:** This method mutates `object`.
  31236. *
  31237. * @static
  31238. * @memberOf _
  31239. * @since 4.0.0
  31240. * @category Object
  31241. * @param {Object} object The object to modify.
  31242. * @param {Array|string} path The path of the property to set.
  31243. * @param {*} value The value to set.
  31244. * @param {Function} [customizer] The function to customize assigned values.
  31245. * @returns {Object} Returns `object`.
  31246. * @example
  31247. *
  31248. * var object = {};
  31249. *
  31250. * _.setWith(object, '[0][1]', 'a', Object);
  31251. * // => { '0': { '1': 'a' } }
  31252. */
  31253. function setWith(object, path, value, customizer) {
  31254. customizer = typeof customizer == 'function' ? customizer : undefined;
  31255. return object == null ? object : baseSet(object, path, value, customizer);
  31256. }
  31257. /**
  31258. * Creates an array of own enumerable string keyed-value pairs for `object`
  31259. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31260. * entries are returned.
  31261. *
  31262. * @static
  31263. * @memberOf _
  31264. * @since 4.0.0
  31265. * @alias entries
  31266. * @category Object
  31267. * @param {Object} object The object to query.
  31268. * @returns {Array} Returns the key-value pairs.
  31269. * @example
  31270. *
  31271. * function Foo() {
  31272. * this.a = 1;
  31273. * this.b = 2;
  31274. * }
  31275. *
  31276. * Foo.prototype.c = 3;
  31277. *
  31278. * _.toPairs(new Foo);
  31279. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31280. */
  31281. var toPairs = createToPairs(keys);
  31282. /**
  31283. * Creates an array of own and inherited enumerable string keyed-value pairs
  31284. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31285. * or set, its entries are returned.
  31286. *
  31287. * @static
  31288. * @memberOf _
  31289. * @since 4.0.0
  31290. * @alias entriesIn
  31291. * @category Object
  31292. * @param {Object} object The object to query.
  31293. * @returns {Array} Returns the key-value pairs.
  31294. * @example
  31295. *
  31296. * function Foo() {
  31297. * this.a = 1;
  31298. * this.b = 2;
  31299. * }
  31300. *
  31301. * Foo.prototype.c = 3;
  31302. *
  31303. * _.toPairsIn(new Foo);
  31304. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31305. */
  31306. var toPairsIn = createToPairs(keysIn);
  31307. /**
  31308. * An alternative to `_.reduce`; this method transforms `object` to a new
  31309. * `accumulator` object which is the result of running each of its own
  31310. * enumerable string keyed properties thru `iteratee`, with each invocation
  31311. * potentially mutating the `accumulator` object. If `accumulator` is not
  31312. * provided, a new object with the same `[[Prototype]]` will be used. The
  31313. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31314. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31315. *
  31316. * @static
  31317. * @memberOf _
  31318. * @since 1.3.0
  31319. * @category Object
  31320. * @param {Object} object The object to iterate over.
  31321. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31322. * @param {*} [accumulator] The custom accumulator value.
  31323. * @returns {*} Returns the accumulated value.
  31324. * @example
  31325. *
  31326. * _.transform([2, 3, 4], function(result, n) {
  31327. * result.push(n *= n);
  31328. * return n % 2 == 0;
  31329. * }, []);
  31330. * // => [4, 9]
  31331. *
  31332. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31333. * (result[value] || (result[value] = [])).push(key);
  31334. * }, {});
  31335. * // => { '1': ['a', 'c'], '2': ['b'] }
  31336. */
  31337. function transform(object, iteratee, accumulator) {
  31338. var isArr = isArray(object),
  31339. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31340. iteratee = getIteratee(iteratee, 4);
  31341. if (accumulator == null) {
  31342. var Ctor = object && object.constructor;
  31343. if (isArrLike) {
  31344. accumulator = isArr ? new Ctor : [];
  31345. }
  31346. else if (isObject(object)) {
  31347. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31348. }
  31349. else {
  31350. accumulator = {};
  31351. }
  31352. }
  31353. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31354. return iteratee(accumulator, value, index, object);
  31355. });
  31356. return accumulator;
  31357. }
  31358. /**
  31359. * Removes the property at `path` of `object`.
  31360. *
  31361. * **Note:** This method mutates `object`.
  31362. *
  31363. * @static
  31364. * @memberOf _
  31365. * @since 4.0.0
  31366. * @category Object
  31367. * @param {Object} object The object to modify.
  31368. * @param {Array|string} path The path of the property to unset.
  31369. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31370. * @example
  31371. *
  31372. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31373. * _.unset(object, 'a[0].b.c');
  31374. * // => true
  31375. *
  31376. * console.log(object);
  31377. * // => { 'a': [{ 'b': {} }] };
  31378. *
  31379. * _.unset(object, ['a', '0', 'b', 'c']);
  31380. * // => true
  31381. *
  31382. * console.log(object);
  31383. * // => { 'a': [{ 'b': {} }] };
  31384. */
  31385. function unset(object, path) {
  31386. return object == null ? true : baseUnset(object, path);
  31387. }
  31388. /**
  31389. * This method is like `_.set` except that accepts `updater` to produce the
  31390. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31391. * is invoked with one argument: (value).
  31392. *
  31393. * **Note:** This method mutates `object`.
  31394. *
  31395. * @static
  31396. * @memberOf _
  31397. * @since 4.6.0
  31398. * @category Object
  31399. * @param {Object} object The object to modify.
  31400. * @param {Array|string} path The path of the property to set.
  31401. * @param {Function} updater The function to produce the updated value.
  31402. * @returns {Object} Returns `object`.
  31403. * @example
  31404. *
  31405. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31406. *
  31407. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31408. * console.log(object.a[0].b.c);
  31409. * // => 9
  31410. *
  31411. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31412. * console.log(object.x[0].y.z);
  31413. * // => 0
  31414. */
  31415. function update(object, path, updater) {
  31416. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31417. }
  31418. /**
  31419. * This method is like `_.update` except that it accepts `customizer` which is
  31420. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31421. * path creation is handled by the method instead. The `customizer` is invoked
  31422. * with three arguments: (nsValue, key, nsObject).
  31423. *
  31424. * **Note:** This method mutates `object`.
  31425. *
  31426. * @static
  31427. * @memberOf _
  31428. * @since 4.6.0
  31429. * @category Object
  31430. * @param {Object} object The object to modify.
  31431. * @param {Array|string} path The path of the property to set.
  31432. * @param {Function} updater The function to produce the updated value.
  31433. * @param {Function} [customizer] The function to customize assigned values.
  31434. * @returns {Object} Returns `object`.
  31435. * @example
  31436. *
  31437. * var object = {};
  31438. *
  31439. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31440. * // => { '0': { '1': 'a' } }
  31441. */
  31442. function updateWith(object, path, updater, customizer) {
  31443. customizer = typeof customizer == 'function' ? customizer : undefined;
  31444. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31445. }
  31446. /**
  31447. * Creates an array of the own enumerable string keyed property values of `object`.
  31448. *
  31449. * **Note:** Non-object values are coerced to objects.
  31450. *
  31451. * @static
  31452. * @since 0.1.0
  31453. * @memberOf _
  31454. * @category Object
  31455. * @param {Object} object The object to query.
  31456. * @returns {Array} Returns the array of property values.
  31457. * @example
  31458. *
  31459. * function Foo() {
  31460. * this.a = 1;
  31461. * this.b = 2;
  31462. * }
  31463. *
  31464. * Foo.prototype.c = 3;
  31465. *
  31466. * _.values(new Foo);
  31467. * // => [1, 2] (iteration order is not guaranteed)
  31468. *
  31469. * _.values('hi');
  31470. * // => ['h', 'i']
  31471. */
  31472. function values(object) {
  31473. return object == null ? [] : baseValues(object, keys(object));
  31474. }
  31475. /**
  31476. * Creates an array of the own and inherited enumerable string keyed property
  31477. * values of `object`.
  31478. *
  31479. * **Note:** Non-object values are coerced to objects.
  31480. *
  31481. * @static
  31482. * @memberOf _
  31483. * @since 3.0.0
  31484. * @category Object
  31485. * @param {Object} object The object to query.
  31486. * @returns {Array} Returns the array of property values.
  31487. * @example
  31488. *
  31489. * function Foo() {
  31490. * this.a = 1;
  31491. * this.b = 2;
  31492. * }
  31493. *
  31494. * Foo.prototype.c = 3;
  31495. *
  31496. * _.valuesIn(new Foo);
  31497. * // => [1, 2, 3] (iteration order is not guaranteed)
  31498. */
  31499. function valuesIn(object) {
  31500. return object == null ? [] : baseValues(object, keysIn(object));
  31501. }
  31502. /*------------------------------------------------------------------------*/
  31503. /**
  31504. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31505. *
  31506. * @static
  31507. * @memberOf _
  31508. * @since 4.0.0
  31509. * @category Number
  31510. * @param {number} number The number to clamp.
  31511. * @param {number} [lower] The lower bound.
  31512. * @param {number} upper The upper bound.
  31513. * @returns {number} Returns the clamped number.
  31514. * @example
  31515. *
  31516. * _.clamp(-10, -5, 5);
  31517. * // => -5
  31518. *
  31519. * _.clamp(10, -5, 5);
  31520. * // => 5
  31521. */
  31522. function clamp(number, lower, upper) {
  31523. if (upper === undefined) {
  31524. upper = lower;
  31525. lower = undefined;
  31526. }
  31527. if (upper !== undefined) {
  31528. upper = toNumber(upper);
  31529. upper = upper === upper ? upper : 0;
  31530. }
  31531. if (lower !== undefined) {
  31532. lower = toNumber(lower);
  31533. lower = lower === lower ? lower : 0;
  31534. }
  31535. return baseClamp(toNumber(number), lower, upper);
  31536. }
  31537. /**
  31538. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31539. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31540. * If `start` is greater than `end` the params are swapped to support
  31541. * negative ranges.
  31542. *
  31543. * @static
  31544. * @memberOf _
  31545. * @since 3.3.0
  31546. * @category Number
  31547. * @param {number} number The number to check.
  31548. * @param {number} [start=0] The start of the range.
  31549. * @param {number} end The end of the range.
  31550. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31551. * @see _.range, _.rangeRight
  31552. * @example
  31553. *
  31554. * _.inRange(3, 2, 4);
  31555. * // => true
  31556. *
  31557. * _.inRange(4, 8);
  31558. * // => true
  31559. *
  31560. * _.inRange(4, 2);
  31561. * // => false
  31562. *
  31563. * _.inRange(2, 2);
  31564. * // => false
  31565. *
  31566. * _.inRange(1.2, 2);
  31567. * // => true
  31568. *
  31569. * _.inRange(5.2, 4);
  31570. * // => false
  31571. *
  31572. * _.inRange(-3, -2, -6);
  31573. * // => true
  31574. */
  31575. function inRange(number, start, end) {
  31576. start = toFinite(start);
  31577. if (end === undefined) {
  31578. end = start;
  31579. start = 0;
  31580. } else {
  31581. end = toFinite(end);
  31582. }
  31583. number = toNumber(number);
  31584. return baseInRange(number, start, end);
  31585. }
  31586. /**
  31587. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31588. * If only one argument is provided a number between `0` and the given number
  31589. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31590. * floats, a floating-point number is returned instead of an integer.
  31591. *
  31592. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31593. * floating-point values which can produce unexpected results.
  31594. *
  31595. * @static
  31596. * @memberOf _
  31597. * @since 0.7.0
  31598. * @category Number
  31599. * @param {number} [lower=0] The lower bound.
  31600. * @param {number} [upper=1] The upper bound.
  31601. * @param {boolean} [floating] Specify returning a floating-point number.
  31602. * @returns {number} Returns the random number.
  31603. * @example
  31604. *
  31605. * _.random(0, 5);
  31606. * // => an integer between 0 and 5
  31607. *
  31608. * _.random(5);
  31609. * // => also an integer between 0 and 5
  31610. *
  31611. * _.random(5, true);
  31612. * // => a floating-point number between 0 and 5
  31613. *
  31614. * _.random(1.2, 5.2);
  31615. * // => a floating-point number between 1.2 and 5.2
  31616. */
  31617. function random(lower, upper, floating) {
  31618. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31619. upper = floating = undefined;
  31620. }
  31621. if (floating === undefined) {
  31622. if (typeof upper == 'boolean') {
  31623. floating = upper;
  31624. upper = undefined;
  31625. }
  31626. else if (typeof lower == 'boolean') {
  31627. floating = lower;
  31628. lower = undefined;
  31629. }
  31630. }
  31631. if (lower === undefined && upper === undefined) {
  31632. lower = 0;
  31633. upper = 1;
  31634. }
  31635. else {
  31636. lower = toFinite(lower);
  31637. if (upper === undefined) {
  31638. upper = lower;
  31639. lower = 0;
  31640. } else {
  31641. upper = toFinite(upper);
  31642. }
  31643. }
  31644. if (lower > upper) {
  31645. var temp = lower;
  31646. lower = upper;
  31647. upper = temp;
  31648. }
  31649. if (floating || lower % 1 || upper % 1) {
  31650. var rand = nativeRandom();
  31651. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31652. }
  31653. return baseRandom(lower, upper);
  31654. }
  31655. /*------------------------------------------------------------------------*/
  31656. /**
  31657. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31658. *
  31659. * @static
  31660. * @memberOf _
  31661. * @since 3.0.0
  31662. * @category String
  31663. * @param {string} [string=''] The string to convert.
  31664. * @returns {string} Returns the camel cased string.
  31665. * @example
  31666. *
  31667. * _.camelCase('Foo Bar');
  31668. * // => 'fooBar'
  31669. *
  31670. * _.camelCase('--foo-bar--');
  31671. * // => 'fooBar'
  31672. *
  31673. * _.camelCase('__FOO_BAR__');
  31674. * // => 'fooBar'
  31675. */
  31676. var camelCase = createCompounder(function(result, word, index) {
  31677. word = word.toLowerCase();
  31678. return result + (index ? capitalize(word) : word);
  31679. });
  31680. /**
  31681. * Converts the first character of `string` to upper case and the remaining
  31682. * to lower case.
  31683. *
  31684. * @static
  31685. * @memberOf _
  31686. * @since 3.0.0
  31687. * @category String
  31688. * @param {string} [string=''] The string to capitalize.
  31689. * @returns {string} Returns the capitalized string.
  31690. * @example
  31691. *
  31692. * _.capitalize('FRED');
  31693. * // => 'Fred'
  31694. */
  31695. function capitalize(string) {
  31696. return upperFirst(toString(string).toLowerCase());
  31697. }
  31698. /**
  31699. * Deburrs `string` by converting
  31700. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31701. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31702. * letters to basic Latin letters and removing
  31703. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31704. *
  31705. * @static
  31706. * @memberOf _
  31707. * @since 3.0.0
  31708. * @category String
  31709. * @param {string} [string=''] The string to deburr.
  31710. * @returns {string} Returns the deburred string.
  31711. * @example
  31712. *
  31713. * _.deburr('déjà vu');
  31714. * // => 'deja vu'
  31715. */
  31716. function deburr(string) {
  31717. string = toString(string);
  31718. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31719. }
  31720. /**
  31721. * Checks if `string` ends with the given target string.
  31722. *
  31723. * @static
  31724. * @memberOf _
  31725. * @since 3.0.0
  31726. * @category String
  31727. * @param {string} [string=''] The string to inspect.
  31728. * @param {string} [target] The string to search for.
  31729. * @param {number} [position=string.length] The position to search up to.
  31730. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31731. * else `false`.
  31732. * @example
  31733. *
  31734. * _.endsWith('abc', 'c');
  31735. * // => true
  31736. *
  31737. * _.endsWith('abc', 'b');
  31738. * // => false
  31739. *
  31740. * _.endsWith('abc', 'b', 2);
  31741. * // => true
  31742. */
  31743. function endsWith(string, target, position) {
  31744. string = toString(string);
  31745. target = baseToString(target);
  31746. var length = string.length;
  31747. position = position === undefined
  31748. ? length
  31749. : baseClamp(toInteger(position), 0, length);
  31750. var end = position;
  31751. position -= target.length;
  31752. return position >= 0 && string.slice(position, end) == target;
  31753. }
  31754. /**
  31755. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31756. * corresponding HTML entities.
  31757. *
  31758. * **Note:** No other characters are escaped. To escape additional
  31759. * characters use a third-party library like [_he_](https://mths.be/he).
  31760. *
  31761. * Though the ">" character is escaped for symmetry, characters like
  31762. * ">" and "/" don't need escaping in HTML and have no special meaning
  31763. * unless they're part of a tag or unquoted attribute value. See
  31764. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31765. * (under "semi-related fun fact") for more details.
  31766. *
  31767. * When working with HTML you should always
  31768. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31769. * XSS vectors.
  31770. *
  31771. * @static
  31772. * @since 0.1.0
  31773. * @memberOf _
  31774. * @category String
  31775. * @param {string} [string=''] The string to escape.
  31776. * @returns {string} Returns the escaped string.
  31777. * @example
  31778. *
  31779. * _.escape('fred, barney, & pebbles');
  31780. * // => 'fred, barney, &amp; pebbles'
  31781. */
  31782. function escape(string) {
  31783. string = toString(string);
  31784. return (string && reHasUnescapedHtml.test(string))
  31785. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31786. : string;
  31787. }
  31788. /**
  31789. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31790. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31791. *
  31792. * @static
  31793. * @memberOf _
  31794. * @since 3.0.0
  31795. * @category String
  31796. * @param {string} [string=''] The string to escape.
  31797. * @returns {string} Returns the escaped string.
  31798. * @example
  31799. *
  31800. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31801. * // => '\[lodash\]\(https://lodash\.com/\)'
  31802. */
  31803. function escapeRegExp(string) {
  31804. string = toString(string);
  31805. return (string && reHasRegExpChar.test(string))
  31806. ? string.replace(reRegExpChar, '\\$&')
  31807. : string;
  31808. }
  31809. /**
  31810. * Converts `string` to
  31811. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31812. *
  31813. * @static
  31814. * @memberOf _
  31815. * @since 3.0.0
  31816. * @category String
  31817. * @param {string} [string=''] The string to convert.
  31818. * @returns {string} Returns the kebab cased string.
  31819. * @example
  31820. *
  31821. * _.kebabCase('Foo Bar');
  31822. * // => 'foo-bar'
  31823. *
  31824. * _.kebabCase('fooBar');
  31825. * // => 'foo-bar'
  31826. *
  31827. * _.kebabCase('__FOO_BAR__');
  31828. * // => 'foo-bar'
  31829. */
  31830. var kebabCase = createCompounder(function(result, word, index) {
  31831. return result + (index ? '-' : '') + word.toLowerCase();
  31832. });
  31833. /**
  31834. * Converts `string`, as space separated words, to lower case.
  31835. *
  31836. * @static
  31837. * @memberOf _
  31838. * @since 4.0.0
  31839. * @category String
  31840. * @param {string} [string=''] The string to convert.
  31841. * @returns {string} Returns the lower cased string.
  31842. * @example
  31843. *
  31844. * _.lowerCase('--Foo-Bar--');
  31845. * // => 'foo bar'
  31846. *
  31847. * _.lowerCase('fooBar');
  31848. * // => 'foo bar'
  31849. *
  31850. * _.lowerCase('__FOO_BAR__');
  31851. * // => 'foo bar'
  31852. */
  31853. var lowerCase = createCompounder(function(result, word, index) {
  31854. return result + (index ? ' ' : '') + word.toLowerCase();
  31855. });
  31856. /**
  31857. * Converts the first character of `string` to lower case.
  31858. *
  31859. * @static
  31860. * @memberOf _
  31861. * @since 4.0.0
  31862. * @category String
  31863. * @param {string} [string=''] The string to convert.
  31864. * @returns {string} Returns the converted string.
  31865. * @example
  31866. *
  31867. * _.lowerFirst('Fred');
  31868. * // => 'fred'
  31869. *
  31870. * _.lowerFirst('FRED');
  31871. * // => 'fRED'
  31872. */
  31873. var lowerFirst = createCaseFirst('toLowerCase');
  31874. /**
  31875. * Pads `string` on the left and right sides if it's shorter than `length`.
  31876. * Padding characters are truncated if they can't be evenly divided by `length`.
  31877. *
  31878. * @static
  31879. * @memberOf _
  31880. * @since 3.0.0
  31881. * @category String
  31882. * @param {string} [string=''] The string to pad.
  31883. * @param {number} [length=0] The padding length.
  31884. * @param {string} [chars=' '] The string used as padding.
  31885. * @returns {string} Returns the padded string.
  31886. * @example
  31887. *
  31888. * _.pad('abc', 8);
  31889. * // => ' abc '
  31890. *
  31891. * _.pad('abc', 8, '_-');
  31892. * // => '_-abc_-_'
  31893. *
  31894. * _.pad('abc', 3);
  31895. * // => 'abc'
  31896. */
  31897. function pad(string, length, chars) {
  31898. string = toString(string);
  31899. length = toInteger(length);
  31900. var strLength = length ? stringSize(string) : 0;
  31901. if (!length || strLength >= length) {
  31902. return string;
  31903. }
  31904. var mid = (length - strLength) / 2;
  31905. return (
  31906. createPadding(nativeFloor(mid), chars) +
  31907. string +
  31908. createPadding(nativeCeil(mid), chars)
  31909. );
  31910. }
  31911. /**
  31912. * Pads `string` on the right side if it's shorter than `length`. Padding
  31913. * characters are truncated if they exceed `length`.
  31914. *
  31915. * @static
  31916. * @memberOf _
  31917. * @since 4.0.0
  31918. * @category String
  31919. * @param {string} [string=''] The string to pad.
  31920. * @param {number} [length=0] The padding length.
  31921. * @param {string} [chars=' '] The string used as padding.
  31922. * @returns {string} Returns the padded string.
  31923. * @example
  31924. *
  31925. * _.padEnd('abc', 6);
  31926. * // => 'abc '
  31927. *
  31928. * _.padEnd('abc', 6, '_-');
  31929. * // => 'abc_-_'
  31930. *
  31931. * _.padEnd('abc', 3);
  31932. * // => 'abc'
  31933. */
  31934. function padEnd(string, length, chars) {
  31935. string = toString(string);
  31936. length = toInteger(length);
  31937. var strLength = length ? stringSize(string) : 0;
  31938. return (length && strLength < length)
  31939. ? (string + createPadding(length - strLength, chars))
  31940. : string;
  31941. }
  31942. /**
  31943. * Pads `string` on the left side if it's shorter than `length`. Padding
  31944. * characters are truncated if they exceed `length`.
  31945. *
  31946. * @static
  31947. * @memberOf _
  31948. * @since 4.0.0
  31949. * @category String
  31950. * @param {string} [string=''] The string to pad.
  31951. * @param {number} [length=0] The padding length.
  31952. * @param {string} [chars=' '] The string used as padding.
  31953. * @returns {string} Returns the padded string.
  31954. * @example
  31955. *
  31956. * _.padStart('abc', 6);
  31957. * // => ' abc'
  31958. *
  31959. * _.padStart('abc', 6, '_-');
  31960. * // => '_-_abc'
  31961. *
  31962. * _.padStart('abc', 3);
  31963. * // => 'abc'
  31964. */
  31965. function padStart(string, length, chars) {
  31966. string = toString(string);
  31967. length = toInteger(length);
  31968. var strLength = length ? stringSize(string) : 0;
  31969. return (length && strLength < length)
  31970. ? (createPadding(length - strLength, chars) + string)
  31971. : string;
  31972. }
  31973. /**
  31974. * Converts `string` to an integer of the specified radix. If `radix` is
  31975. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31976. * hexadecimal, in which case a `radix` of `16` is used.
  31977. *
  31978. * **Note:** This method aligns with the
  31979. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31980. *
  31981. * @static
  31982. * @memberOf _
  31983. * @since 1.1.0
  31984. * @category String
  31985. * @param {string} string The string to convert.
  31986. * @param {number} [radix=10] The radix to interpret `value` by.
  31987. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31988. * @returns {number} Returns the converted integer.
  31989. * @example
  31990. *
  31991. * _.parseInt('08');
  31992. * // => 8
  31993. *
  31994. * _.map(['6', '08', '10'], _.parseInt);
  31995. * // => [6, 8, 10]
  31996. */
  31997. function parseInt(string, radix, guard) {
  31998. if (guard || radix == null) {
  31999. radix = 0;
  32000. } else if (radix) {
  32001. radix = +radix;
  32002. }
  32003. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32004. }
  32005. /**
  32006. * Repeats the given string `n` times.
  32007. *
  32008. * @static
  32009. * @memberOf _
  32010. * @since 3.0.0
  32011. * @category String
  32012. * @param {string} [string=''] The string to repeat.
  32013. * @param {number} [n=1] The number of times to repeat the string.
  32014. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32015. * @returns {string} Returns the repeated string.
  32016. * @example
  32017. *
  32018. * _.repeat('*', 3);
  32019. * // => '***'
  32020. *
  32021. * _.repeat('abc', 2);
  32022. * // => 'abcabc'
  32023. *
  32024. * _.repeat('abc', 0);
  32025. * // => ''
  32026. */
  32027. function repeat(string, n, guard) {
  32028. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32029. n = 1;
  32030. } else {
  32031. n = toInteger(n);
  32032. }
  32033. return baseRepeat(toString(string), n);
  32034. }
  32035. /**
  32036. * Replaces matches for `pattern` in `string` with `replacement`.
  32037. *
  32038. * **Note:** This method is based on
  32039. * [`String#replace`](https://mdn.io/String/replace).
  32040. *
  32041. * @static
  32042. * @memberOf _
  32043. * @since 4.0.0
  32044. * @category String
  32045. * @param {string} [string=''] The string to modify.
  32046. * @param {RegExp|string} pattern The pattern to replace.
  32047. * @param {Function|string} replacement The match replacement.
  32048. * @returns {string} Returns the modified string.
  32049. * @example
  32050. *
  32051. * _.replace('Hi Fred', 'Fred', 'Barney');
  32052. * // => 'Hi Barney'
  32053. */
  32054. function replace() {
  32055. var args = arguments,
  32056. string = toString(args[0]);
  32057. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32058. }
  32059. /**
  32060. * Converts `string` to
  32061. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32062. *
  32063. * @static
  32064. * @memberOf _
  32065. * @since 3.0.0
  32066. * @category String
  32067. * @param {string} [string=''] The string to convert.
  32068. * @returns {string} Returns the snake cased string.
  32069. * @example
  32070. *
  32071. * _.snakeCase('Foo Bar');
  32072. * // => 'foo_bar'
  32073. *
  32074. * _.snakeCase('fooBar');
  32075. * // => 'foo_bar'
  32076. *
  32077. * _.snakeCase('--FOO-BAR--');
  32078. * // => 'foo_bar'
  32079. */
  32080. var snakeCase = createCompounder(function(result, word, index) {
  32081. return result + (index ? '_' : '') + word.toLowerCase();
  32082. });
  32083. /**
  32084. * Splits `string` by `separator`.
  32085. *
  32086. * **Note:** This method is based on
  32087. * [`String#split`](https://mdn.io/String/split).
  32088. *
  32089. * @static
  32090. * @memberOf _
  32091. * @since 4.0.0
  32092. * @category String
  32093. * @param {string} [string=''] The string to split.
  32094. * @param {RegExp|string} separator The separator pattern to split by.
  32095. * @param {number} [limit] The length to truncate results to.
  32096. * @returns {Array} Returns the string segments.
  32097. * @example
  32098. *
  32099. * _.split('a-b-c', '-', 2);
  32100. * // => ['a', 'b']
  32101. */
  32102. function split(string, separator, limit) {
  32103. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32104. separator = limit = undefined;
  32105. }
  32106. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32107. if (!limit) {
  32108. return [];
  32109. }
  32110. string = toString(string);
  32111. if (string && (
  32112. typeof separator == 'string' ||
  32113. (separator != null && !isRegExp(separator))
  32114. )) {
  32115. separator = baseToString(separator);
  32116. if (!separator && hasUnicode(string)) {
  32117. return castSlice(stringToArray(string), 0, limit);
  32118. }
  32119. }
  32120. return string.split(separator, limit);
  32121. }
  32122. /**
  32123. * Converts `string` to
  32124. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32125. *
  32126. * @static
  32127. * @memberOf _
  32128. * @since 3.1.0
  32129. * @category String
  32130. * @param {string} [string=''] The string to convert.
  32131. * @returns {string} Returns the start cased string.
  32132. * @example
  32133. *
  32134. * _.startCase('--foo-bar--');
  32135. * // => 'Foo Bar'
  32136. *
  32137. * _.startCase('fooBar');
  32138. * // => 'Foo Bar'
  32139. *
  32140. * _.startCase('__FOO_BAR__');
  32141. * // => 'FOO BAR'
  32142. */
  32143. var startCase = createCompounder(function(result, word, index) {
  32144. return result + (index ? ' ' : '') + upperFirst(word);
  32145. });
  32146. /**
  32147. * Checks if `string` starts with the given target string.
  32148. *
  32149. * @static
  32150. * @memberOf _
  32151. * @since 3.0.0
  32152. * @category String
  32153. * @param {string} [string=''] The string to inspect.
  32154. * @param {string} [target] The string to search for.
  32155. * @param {number} [position=0] The position to search from.
  32156. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32157. * else `false`.
  32158. * @example
  32159. *
  32160. * _.startsWith('abc', 'a');
  32161. * // => true
  32162. *
  32163. * _.startsWith('abc', 'b');
  32164. * // => false
  32165. *
  32166. * _.startsWith('abc', 'b', 1);
  32167. * // => true
  32168. */
  32169. function startsWith(string, target, position) {
  32170. string = toString(string);
  32171. position = position == null
  32172. ? 0
  32173. : baseClamp(toInteger(position), 0, string.length);
  32174. target = baseToString(target);
  32175. return string.slice(position, position + target.length) == target;
  32176. }
  32177. /**
  32178. * Creates a compiled template function that can interpolate data properties
  32179. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32180. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32181. * properties may be accessed as free variables in the template. If a setting
  32182. * object is given, it takes precedence over `_.templateSettings` values.
  32183. *
  32184. * **Note:** In the development build `_.template` utilizes
  32185. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32186. * for easier debugging.
  32187. *
  32188. * For more information on precompiling templates see
  32189. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32190. *
  32191. * For more information on Chrome extension sandboxes see
  32192. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32193. *
  32194. * @static
  32195. * @since 0.1.0
  32196. * @memberOf _
  32197. * @category String
  32198. * @param {string} [string=''] The template string.
  32199. * @param {Object} [options={}] The options object.
  32200. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32201. * The HTML "escape" delimiter.
  32202. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32203. * The "evaluate" delimiter.
  32204. * @param {Object} [options.imports=_.templateSettings.imports]
  32205. * An object to import into the template as free variables.
  32206. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32207. * The "interpolate" delimiter.
  32208. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32209. * The sourceURL of the compiled template.
  32210. * @param {string} [options.variable='obj']
  32211. * The data object variable name.
  32212. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32213. * @returns {Function} Returns the compiled template function.
  32214. * @example
  32215. *
  32216. * // Use the "interpolate" delimiter to create a compiled template.
  32217. * var compiled = _.template('hello <%= user %>!');
  32218. * compiled({ 'user': 'fred' });
  32219. * // => 'hello fred!'
  32220. *
  32221. * // Use the HTML "escape" delimiter to escape data property values.
  32222. * var compiled = _.template('<b><%- value %></b>');
  32223. * compiled({ 'value': '<script>' });
  32224. * // => '<b>&lt;script&gt;</b>'
  32225. *
  32226. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32227. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32228. * compiled({ 'users': ['fred', 'barney'] });
  32229. * // => '<li>fred</li><li>barney</li>'
  32230. *
  32231. * // Use the internal `print` function in "evaluate" delimiters.
  32232. * var compiled = _.template('<% print("hello " + user); %>!');
  32233. * compiled({ 'user': 'barney' });
  32234. * // => 'hello barney!'
  32235. *
  32236. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32237. * // Disable support by replacing the "interpolate" delimiter.
  32238. * var compiled = _.template('hello ${ user }!');
  32239. * compiled({ 'user': 'pebbles' });
  32240. * // => 'hello pebbles!'
  32241. *
  32242. * // Use backslashes to treat delimiters as plain text.
  32243. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32244. * compiled({ 'value': 'ignored' });
  32245. * // => '<%- value %>'
  32246. *
  32247. * // Use the `imports` option to import `jQuery` as `jq`.
  32248. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32249. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32250. * compiled({ 'users': ['fred', 'barney'] });
  32251. * // => '<li>fred</li><li>barney</li>'
  32252. *
  32253. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32254. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32255. * compiled(data);
  32256. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32257. *
  32258. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32259. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32260. * compiled.source;
  32261. * // => function(data) {
  32262. * // var __t, __p = '';
  32263. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32264. * // return __p;
  32265. * // }
  32266. *
  32267. * // Use custom template delimiters.
  32268. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32269. * var compiled = _.template('hello {{ user }}!');
  32270. * compiled({ 'user': 'mustache' });
  32271. * // => 'hello mustache!'
  32272. *
  32273. * // Use the `source` property to inline compiled templates for meaningful
  32274. * // line numbers in error messages and stack traces.
  32275. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32276. * var JST = {\
  32277. * "main": ' + _.template(mainText).source + '\
  32278. * };\
  32279. * ');
  32280. */
  32281. function template(string, options, guard) {
  32282. // Based on John Resig's `tmpl` implementation
  32283. // (http://ejohn.org/blog/javascript-micro-templating/)
  32284. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32285. var settings = lodash.templateSettings;
  32286. if (guard && isIterateeCall(string, options, guard)) {
  32287. options = undefined;
  32288. }
  32289. string = toString(string);
  32290. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32291. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32292. importsKeys = keys(imports),
  32293. importsValues = baseValues(imports, importsKeys);
  32294. var isEscaping,
  32295. isEvaluating,
  32296. index = 0,
  32297. interpolate = options.interpolate || reNoMatch,
  32298. source = "__p += '";
  32299. // Compile the regexp to match each delimiter.
  32300. var reDelimiters = RegExp(
  32301. (options.escape || reNoMatch).source + '|' +
  32302. interpolate.source + '|' +
  32303. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32304. (options.evaluate || reNoMatch).source + '|$'
  32305. , 'g');
  32306. // Use a sourceURL for easier debugging.
  32307. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32308. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32309. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32310. var sourceURL = '//# sourceURL=' +
  32311. (hasOwnProperty.call(options, 'sourceURL')
  32312. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32313. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32314. ) + '\n';
  32315. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32316. interpolateValue || (interpolateValue = esTemplateValue);
  32317. // Escape characters that can't be included in string literals.
  32318. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32319. // Replace delimiters with snippets.
  32320. if (escapeValue) {
  32321. isEscaping = true;
  32322. source += "' +\n__e(" + escapeValue + ") +\n'";
  32323. }
  32324. if (evaluateValue) {
  32325. isEvaluating = true;
  32326. source += "';\n" + evaluateValue + ";\n__p += '";
  32327. }
  32328. if (interpolateValue) {
  32329. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32330. }
  32331. index = offset + match.length;
  32332. // The JS engine embedded in Adobe products needs `match` returned in
  32333. // order to produce the correct `offset` value.
  32334. return match;
  32335. });
  32336. source += "';\n";
  32337. // If `variable` is not specified wrap a with-statement around the generated
  32338. // code to add the data object to the top of the scope chain.
  32339. // Like with sourceURL, we take care to not check the option's prototype,
  32340. // as this configuration is a code injection vector.
  32341. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32342. if (!variable) {
  32343. source = 'with (obj) {\n' + source + '\n}\n';
  32344. }
  32345. // Cleanup code by stripping empty strings.
  32346. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32347. .replace(reEmptyStringMiddle, '$1')
  32348. .replace(reEmptyStringTrailing, '$1;');
  32349. // Frame code as the function body.
  32350. source = 'function(' + (variable || 'obj') + ') {\n' +
  32351. (variable
  32352. ? ''
  32353. : 'obj || (obj = {});\n'
  32354. ) +
  32355. "var __t, __p = ''" +
  32356. (isEscaping
  32357. ? ', __e = _.escape'
  32358. : ''
  32359. ) +
  32360. (isEvaluating
  32361. ? ', __j = Array.prototype.join;\n' +
  32362. "function print() { __p += __j.call(arguments, '') }\n"
  32363. : ';\n'
  32364. ) +
  32365. source +
  32366. 'return __p\n}';
  32367. var result = attempt(function() {
  32368. return Function(importsKeys, sourceURL + 'return ' + source)
  32369. .apply(undefined, importsValues);
  32370. });
  32371. // Provide the compiled function's source by its `toString` method or
  32372. // the `source` property as a convenience for inlining compiled templates.
  32373. result.source = source;
  32374. if (isError(result)) {
  32375. throw result;
  32376. }
  32377. return result;
  32378. }
  32379. /**
  32380. * Converts `string`, as a whole, to lower case just like
  32381. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32382. *
  32383. * @static
  32384. * @memberOf _
  32385. * @since 4.0.0
  32386. * @category String
  32387. * @param {string} [string=''] The string to convert.
  32388. * @returns {string} Returns the lower cased string.
  32389. * @example
  32390. *
  32391. * _.toLower('--Foo-Bar--');
  32392. * // => '--foo-bar--'
  32393. *
  32394. * _.toLower('fooBar');
  32395. * // => 'foobar'
  32396. *
  32397. * _.toLower('__FOO_BAR__');
  32398. * // => '__foo_bar__'
  32399. */
  32400. function toLower(value) {
  32401. return toString(value).toLowerCase();
  32402. }
  32403. /**
  32404. * Converts `string`, as a whole, to upper case just like
  32405. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32406. *
  32407. * @static
  32408. * @memberOf _
  32409. * @since 4.0.0
  32410. * @category String
  32411. * @param {string} [string=''] The string to convert.
  32412. * @returns {string} Returns the upper cased string.
  32413. * @example
  32414. *
  32415. * _.toUpper('--foo-bar--');
  32416. * // => '--FOO-BAR--'
  32417. *
  32418. * _.toUpper('fooBar');
  32419. * // => 'FOOBAR'
  32420. *
  32421. * _.toUpper('__foo_bar__');
  32422. * // => '__FOO_BAR__'
  32423. */
  32424. function toUpper(value) {
  32425. return toString(value).toUpperCase();
  32426. }
  32427. /**
  32428. * Removes leading and trailing whitespace or specified characters from `string`.
  32429. *
  32430. * @static
  32431. * @memberOf _
  32432. * @since 3.0.0
  32433. * @category String
  32434. * @param {string} [string=''] The string to trim.
  32435. * @param {string} [chars=whitespace] The characters to trim.
  32436. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32437. * @returns {string} Returns the trimmed string.
  32438. * @example
  32439. *
  32440. * _.trim(' abc ');
  32441. * // => 'abc'
  32442. *
  32443. * _.trim('-_-abc-_-', '_-');
  32444. * // => 'abc'
  32445. *
  32446. * _.map([' foo ', ' bar '], _.trim);
  32447. * // => ['foo', 'bar']
  32448. */
  32449. function trim(string, chars, guard) {
  32450. string = toString(string);
  32451. if (string && (guard || chars === undefined)) {
  32452. return string.replace(reTrim, '');
  32453. }
  32454. if (!string || !(chars = baseToString(chars))) {
  32455. return string;
  32456. }
  32457. var strSymbols = stringToArray(string),
  32458. chrSymbols = stringToArray(chars),
  32459. start = charsStartIndex(strSymbols, chrSymbols),
  32460. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32461. return castSlice(strSymbols, start, end).join('');
  32462. }
  32463. /**
  32464. * Removes trailing whitespace or specified characters from `string`.
  32465. *
  32466. * @static
  32467. * @memberOf _
  32468. * @since 4.0.0
  32469. * @category String
  32470. * @param {string} [string=''] The string to trim.
  32471. * @param {string} [chars=whitespace] The characters to trim.
  32472. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32473. * @returns {string} Returns the trimmed string.
  32474. * @example
  32475. *
  32476. * _.trimEnd(' abc ');
  32477. * // => ' abc'
  32478. *
  32479. * _.trimEnd('-_-abc-_-', '_-');
  32480. * // => '-_-abc'
  32481. */
  32482. function trimEnd(string, chars, guard) {
  32483. string = toString(string);
  32484. if (string && (guard || chars === undefined)) {
  32485. return string.replace(reTrimEnd, '');
  32486. }
  32487. if (!string || !(chars = baseToString(chars))) {
  32488. return string;
  32489. }
  32490. var strSymbols = stringToArray(string),
  32491. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32492. return castSlice(strSymbols, 0, end).join('');
  32493. }
  32494. /**
  32495. * Removes leading whitespace or specified characters from `string`.
  32496. *
  32497. * @static
  32498. * @memberOf _
  32499. * @since 4.0.0
  32500. * @category String
  32501. * @param {string} [string=''] The string to trim.
  32502. * @param {string} [chars=whitespace] The characters to trim.
  32503. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32504. * @returns {string} Returns the trimmed string.
  32505. * @example
  32506. *
  32507. * _.trimStart(' abc ');
  32508. * // => 'abc '
  32509. *
  32510. * _.trimStart('-_-abc-_-', '_-');
  32511. * // => 'abc-_-'
  32512. */
  32513. function trimStart(string, chars, guard) {
  32514. string = toString(string);
  32515. if (string && (guard || chars === undefined)) {
  32516. return string.replace(reTrimStart, '');
  32517. }
  32518. if (!string || !(chars = baseToString(chars))) {
  32519. return string;
  32520. }
  32521. var strSymbols = stringToArray(string),
  32522. start = charsStartIndex(strSymbols, stringToArray(chars));
  32523. return castSlice(strSymbols, start).join('');
  32524. }
  32525. /**
  32526. * Truncates `string` if it's longer than the given maximum string length.
  32527. * The last characters of the truncated string are replaced with the omission
  32528. * string which defaults to "...".
  32529. *
  32530. * @static
  32531. * @memberOf _
  32532. * @since 4.0.0
  32533. * @category String
  32534. * @param {string} [string=''] The string to truncate.
  32535. * @param {Object} [options={}] The options object.
  32536. * @param {number} [options.length=30] The maximum string length.
  32537. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32538. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32539. * @returns {string} Returns the truncated string.
  32540. * @example
  32541. *
  32542. * _.truncate('hi-diddly-ho there, neighborino');
  32543. * // => 'hi-diddly-ho there, neighbo...'
  32544. *
  32545. * _.truncate('hi-diddly-ho there, neighborino', {
  32546. * 'length': 24,
  32547. * 'separator': ' '
  32548. * });
  32549. * // => 'hi-diddly-ho there,...'
  32550. *
  32551. * _.truncate('hi-diddly-ho there, neighborino', {
  32552. * 'length': 24,
  32553. * 'separator': /,? +/
  32554. * });
  32555. * // => 'hi-diddly-ho there...'
  32556. *
  32557. * _.truncate('hi-diddly-ho there, neighborino', {
  32558. * 'omission': ' [...]'
  32559. * });
  32560. * // => 'hi-diddly-ho there, neig [...]'
  32561. */
  32562. function truncate(string, options) {
  32563. var length = DEFAULT_TRUNC_LENGTH,
  32564. omission = DEFAULT_TRUNC_OMISSION;
  32565. if (isObject(options)) {
  32566. var separator = 'separator' in options ? options.separator : separator;
  32567. length = 'length' in options ? toInteger(options.length) : length;
  32568. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32569. }
  32570. string = toString(string);
  32571. var strLength = string.length;
  32572. if (hasUnicode(string)) {
  32573. var strSymbols = stringToArray(string);
  32574. strLength = strSymbols.length;
  32575. }
  32576. if (length >= strLength) {
  32577. return string;
  32578. }
  32579. var end = length - stringSize(omission);
  32580. if (end < 1) {
  32581. return omission;
  32582. }
  32583. var result = strSymbols
  32584. ? castSlice(strSymbols, 0, end).join('')
  32585. : string.slice(0, end);
  32586. if (separator === undefined) {
  32587. return result + omission;
  32588. }
  32589. if (strSymbols) {
  32590. end += (result.length - end);
  32591. }
  32592. if (isRegExp(separator)) {
  32593. if (string.slice(end).search(separator)) {
  32594. var match,
  32595. substring = result;
  32596. if (!separator.global) {
  32597. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32598. }
  32599. separator.lastIndex = 0;
  32600. while ((match = separator.exec(substring))) {
  32601. var newEnd = match.index;
  32602. }
  32603. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32604. }
  32605. } else if (string.indexOf(baseToString(separator), end) != end) {
  32606. var index = result.lastIndexOf(separator);
  32607. if (index > -1) {
  32608. result = result.slice(0, index);
  32609. }
  32610. }
  32611. return result + omission;
  32612. }
  32613. /**
  32614. * The inverse of `_.escape`; this method converts the HTML entities
  32615. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32616. * their corresponding characters.
  32617. *
  32618. * **Note:** No other HTML entities are unescaped. To unescape additional
  32619. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32620. *
  32621. * @static
  32622. * @memberOf _
  32623. * @since 0.6.0
  32624. * @category String
  32625. * @param {string} [string=''] The string to unescape.
  32626. * @returns {string} Returns the unescaped string.
  32627. * @example
  32628. *
  32629. * _.unescape('fred, barney, &amp; pebbles');
  32630. * // => 'fred, barney, & pebbles'
  32631. */
  32632. function unescape(string) {
  32633. string = toString(string);
  32634. return (string && reHasEscapedHtml.test(string))
  32635. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32636. : string;
  32637. }
  32638. /**
  32639. * Converts `string`, as space separated words, to upper case.
  32640. *
  32641. * @static
  32642. * @memberOf _
  32643. * @since 4.0.0
  32644. * @category String
  32645. * @param {string} [string=''] The string to convert.
  32646. * @returns {string} Returns the upper cased string.
  32647. * @example
  32648. *
  32649. * _.upperCase('--foo-bar');
  32650. * // => 'FOO BAR'
  32651. *
  32652. * _.upperCase('fooBar');
  32653. * // => 'FOO BAR'
  32654. *
  32655. * _.upperCase('__foo_bar__');
  32656. * // => 'FOO BAR'
  32657. */
  32658. var upperCase = createCompounder(function(result, word, index) {
  32659. return result + (index ? ' ' : '') + word.toUpperCase();
  32660. });
  32661. /**
  32662. * Converts the first character of `string` to upper case.
  32663. *
  32664. * @static
  32665. * @memberOf _
  32666. * @since 4.0.0
  32667. * @category String
  32668. * @param {string} [string=''] The string to convert.
  32669. * @returns {string} Returns the converted string.
  32670. * @example
  32671. *
  32672. * _.upperFirst('fred');
  32673. * // => 'Fred'
  32674. *
  32675. * _.upperFirst('FRED');
  32676. * // => 'FRED'
  32677. */
  32678. var upperFirst = createCaseFirst('toUpperCase');
  32679. /**
  32680. * Splits `string` into an array of its words.
  32681. *
  32682. * @static
  32683. * @memberOf _
  32684. * @since 3.0.0
  32685. * @category String
  32686. * @param {string} [string=''] The string to inspect.
  32687. * @param {RegExp|string} [pattern] The pattern to match words.
  32688. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32689. * @returns {Array} Returns the words of `string`.
  32690. * @example
  32691. *
  32692. * _.words('fred, barney, & pebbles');
  32693. * // => ['fred', 'barney', 'pebbles']
  32694. *
  32695. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32696. * // => ['fred', 'barney', '&', 'pebbles']
  32697. */
  32698. function words(string, pattern, guard) {
  32699. string = toString(string);
  32700. pattern = guard ? undefined : pattern;
  32701. if (pattern === undefined) {
  32702. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32703. }
  32704. return string.match(pattern) || [];
  32705. }
  32706. /*------------------------------------------------------------------------*/
  32707. /**
  32708. * Attempts to invoke `func`, returning either the result or the caught error
  32709. * object. Any additional arguments are provided to `func` when it's invoked.
  32710. *
  32711. * @static
  32712. * @memberOf _
  32713. * @since 3.0.0
  32714. * @category Util
  32715. * @param {Function} func The function to attempt.
  32716. * @param {...*} [args] The arguments to invoke `func` with.
  32717. * @returns {*} Returns the `func` result or error object.
  32718. * @example
  32719. *
  32720. * // Avoid throwing errors for invalid selectors.
  32721. * var elements = _.attempt(function(selector) {
  32722. * return document.querySelectorAll(selector);
  32723. * }, '>_>');
  32724. *
  32725. * if (_.isError(elements)) {
  32726. * elements = [];
  32727. * }
  32728. */
  32729. var attempt = baseRest(function(func, args) {
  32730. try {
  32731. return apply(func, undefined, args);
  32732. } catch (e) {
  32733. return isError(e) ? e : new Error(e);
  32734. }
  32735. });
  32736. /**
  32737. * Binds methods of an object to the object itself, overwriting the existing
  32738. * method.
  32739. *
  32740. * **Note:** This method doesn't set the "length" property of bound functions.
  32741. *
  32742. * @static
  32743. * @since 0.1.0
  32744. * @memberOf _
  32745. * @category Util
  32746. * @param {Object} object The object to bind and assign the bound methods to.
  32747. * @param {...(string|string[])} methodNames The object method names to bind.
  32748. * @returns {Object} Returns `object`.
  32749. * @example
  32750. *
  32751. * var view = {
  32752. * 'label': 'docs',
  32753. * 'click': function() {
  32754. * console.log('clicked ' + this.label);
  32755. * }
  32756. * };
  32757. *
  32758. * _.bindAll(view, ['click']);
  32759. * jQuery(element).on('click', view.click);
  32760. * // => Logs 'clicked docs' when clicked.
  32761. */
  32762. var bindAll = flatRest(function(object, methodNames) {
  32763. arrayEach(methodNames, function(key) {
  32764. key = toKey(key);
  32765. baseAssignValue(object, key, bind(object[key], object));
  32766. });
  32767. return object;
  32768. });
  32769. /**
  32770. * Creates a function that iterates over `pairs` and invokes the corresponding
  32771. * function of the first predicate to return truthy. The predicate-function
  32772. * pairs are invoked with the `this` binding and arguments of the created
  32773. * function.
  32774. *
  32775. * @static
  32776. * @memberOf _
  32777. * @since 4.0.0
  32778. * @category Util
  32779. * @param {Array} pairs The predicate-function pairs.
  32780. * @returns {Function} Returns the new composite function.
  32781. * @example
  32782. *
  32783. * var func = _.cond([
  32784. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32785. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32786. * [_.stubTrue, _.constant('no match')]
  32787. * ]);
  32788. *
  32789. * func({ 'a': 1, 'b': 2 });
  32790. * // => 'matches A'
  32791. *
  32792. * func({ 'a': 0, 'b': 1 });
  32793. * // => 'matches B'
  32794. *
  32795. * func({ 'a': '1', 'b': '2' });
  32796. * // => 'no match'
  32797. */
  32798. function cond(pairs) {
  32799. var length = pairs == null ? 0 : pairs.length,
  32800. toIteratee = getIteratee();
  32801. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32802. if (typeof pair[1] != 'function') {
  32803. throw new TypeError(FUNC_ERROR_TEXT);
  32804. }
  32805. return [toIteratee(pair[0]), pair[1]];
  32806. });
  32807. return baseRest(function(args) {
  32808. var index = -1;
  32809. while (++index < length) {
  32810. var pair = pairs[index];
  32811. if (apply(pair[0], this, args)) {
  32812. return apply(pair[1], this, args);
  32813. }
  32814. }
  32815. });
  32816. }
  32817. /**
  32818. * Creates a function that invokes the predicate properties of `source` with
  32819. * the corresponding property values of a given object, returning `true` if
  32820. * all predicates return truthy, else `false`.
  32821. *
  32822. * **Note:** The created function is equivalent to `_.conformsTo` with
  32823. * `source` partially applied.
  32824. *
  32825. * @static
  32826. * @memberOf _
  32827. * @since 4.0.0
  32828. * @category Util
  32829. * @param {Object} source The object of property predicates to conform to.
  32830. * @returns {Function} Returns the new spec function.
  32831. * @example
  32832. *
  32833. * var objects = [
  32834. * { 'a': 2, 'b': 1 },
  32835. * { 'a': 1, 'b': 2 }
  32836. * ];
  32837. *
  32838. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32839. * // => [{ 'a': 1, 'b': 2 }]
  32840. */
  32841. function conforms(source) {
  32842. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32843. }
  32844. /**
  32845. * Creates a function that returns `value`.
  32846. *
  32847. * @static
  32848. * @memberOf _
  32849. * @since 2.4.0
  32850. * @category Util
  32851. * @param {*} value The value to return from the new function.
  32852. * @returns {Function} Returns the new constant function.
  32853. * @example
  32854. *
  32855. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32856. *
  32857. * console.log(objects);
  32858. * // => [{ 'a': 1 }, { 'a': 1 }]
  32859. *
  32860. * console.log(objects[0] === objects[1]);
  32861. * // => true
  32862. */
  32863. function constant(value) {
  32864. return function() {
  32865. return value;
  32866. };
  32867. }
  32868. /**
  32869. * Checks `value` to determine whether a default value should be returned in
  32870. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32871. * or `undefined`.
  32872. *
  32873. * @static
  32874. * @memberOf _
  32875. * @since 4.14.0
  32876. * @category Util
  32877. * @param {*} value The value to check.
  32878. * @param {*} defaultValue The default value.
  32879. * @returns {*} Returns the resolved value.
  32880. * @example
  32881. *
  32882. * _.defaultTo(1, 10);
  32883. * // => 1
  32884. *
  32885. * _.defaultTo(undefined, 10);
  32886. * // => 10
  32887. */
  32888. function defaultTo(value, defaultValue) {
  32889. return (value == null || value !== value) ? defaultValue : value;
  32890. }
  32891. /**
  32892. * Creates a function that returns the result of invoking the given functions
  32893. * with the `this` binding of the created function, where each successive
  32894. * invocation is supplied the return value of the previous.
  32895. *
  32896. * @static
  32897. * @memberOf _
  32898. * @since 3.0.0
  32899. * @category Util
  32900. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32901. * @returns {Function} Returns the new composite function.
  32902. * @see _.flowRight
  32903. * @example
  32904. *
  32905. * function square(n) {
  32906. * return n * n;
  32907. * }
  32908. *
  32909. * var addSquare = _.flow([_.add, square]);
  32910. * addSquare(1, 2);
  32911. * // => 9
  32912. */
  32913. var flow = createFlow();
  32914. /**
  32915. * This method is like `_.flow` except that it creates a function that
  32916. * invokes the given functions from right to left.
  32917. *
  32918. * @static
  32919. * @since 3.0.0
  32920. * @memberOf _
  32921. * @category Util
  32922. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32923. * @returns {Function} Returns the new composite function.
  32924. * @see _.flow
  32925. * @example
  32926. *
  32927. * function square(n) {
  32928. * return n * n;
  32929. * }
  32930. *
  32931. * var addSquare = _.flowRight([square, _.add]);
  32932. * addSquare(1, 2);
  32933. * // => 9
  32934. */
  32935. var flowRight = createFlow(true);
  32936. /**
  32937. * This method returns the first argument it receives.
  32938. *
  32939. * @static
  32940. * @since 0.1.0
  32941. * @memberOf _
  32942. * @category Util
  32943. * @param {*} value Any value.
  32944. * @returns {*} Returns `value`.
  32945. * @example
  32946. *
  32947. * var object = { 'a': 1 };
  32948. *
  32949. * console.log(_.identity(object) === object);
  32950. * // => true
  32951. */
  32952. function identity(value) {
  32953. return value;
  32954. }
  32955. /**
  32956. * Creates a function that invokes `func` with the arguments of the created
  32957. * function. If `func` is a property name, the created function returns the
  32958. * property value for a given element. If `func` is an array or object, the
  32959. * created function returns `true` for elements that contain the equivalent
  32960. * source properties, otherwise it returns `false`.
  32961. *
  32962. * @static
  32963. * @since 4.0.0
  32964. * @memberOf _
  32965. * @category Util
  32966. * @param {*} [func=_.identity] The value to convert to a callback.
  32967. * @returns {Function} Returns the callback.
  32968. * @example
  32969. *
  32970. * var users = [
  32971. * { 'user': 'barney', 'age': 36, 'active': true },
  32972. * { 'user': 'fred', 'age': 40, 'active': false }
  32973. * ];
  32974. *
  32975. * // The `_.matches` iteratee shorthand.
  32976. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32977. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32978. *
  32979. * // The `_.matchesProperty` iteratee shorthand.
  32980. * _.filter(users, _.iteratee(['user', 'fred']));
  32981. * // => [{ 'user': 'fred', 'age': 40 }]
  32982. *
  32983. * // The `_.property` iteratee shorthand.
  32984. * _.map(users, _.iteratee('user'));
  32985. * // => ['barney', 'fred']
  32986. *
  32987. * // Create custom iteratee shorthands.
  32988. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32989. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32990. * return func.test(string);
  32991. * };
  32992. * });
  32993. *
  32994. * _.filter(['abc', 'def'], /ef/);
  32995. * // => ['def']
  32996. */
  32997. function iteratee(func) {
  32998. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32999. }
  33000. /**
  33001. * Creates a function that performs a partial deep comparison between a given
  33002. * object and `source`, returning `true` if the given object has equivalent
  33003. * property values, else `false`.
  33004. *
  33005. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33006. * partially applied.
  33007. *
  33008. * Partial comparisons will match empty array and empty object `source`
  33009. * values against any array or object value, respectively. See `_.isEqual`
  33010. * for a list of supported value comparisons.
  33011. *
  33012. * @static
  33013. * @memberOf _
  33014. * @since 3.0.0
  33015. * @category Util
  33016. * @param {Object} source The object of property values to match.
  33017. * @returns {Function} Returns the new spec function.
  33018. * @example
  33019. *
  33020. * var objects = [
  33021. * { 'a': 1, 'b': 2, 'c': 3 },
  33022. * { 'a': 4, 'b': 5, 'c': 6 }
  33023. * ];
  33024. *
  33025. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33026. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33027. */
  33028. function matches(source) {
  33029. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33030. }
  33031. /**
  33032. * Creates a function that performs a partial deep comparison between the
  33033. * value at `path` of a given object to `srcValue`, returning `true` if the
  33034. * object value is equivalent, else `false`.
  33035. *
  33036. * **Note:** Partial comparisons will match empty array and empty object
  33037. * `srcValue` values against any array or object value, respectively. See
  33038. * `_.isEqual` for a list of supported value comparisons.
  33039. *
  33040. * @static
  33041. * @memberOf _
  33042. * @since 3.2.0
  33043. * @category Util
  33044. * @param {Array|string} path The path of the property to get.
  33045. * @param {*} srcValue The value to match.
  33046. * @returns {Function} Returns the new spec function.
  33047. * @example
  33048. *
  33049. * var objects = [
  33050. * { 'a': 1, 'b': 2, 'c': 3 },
  33051. * { 'a': 4, 'b': 5, 'c': 6 }
  33052. * ];
  33053. *
  33054. * _.find(objects, _.matchesProperty('a', 4));
  33055. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33056. */
  33057. function matchesProperty(path, srcValue) {
  33058. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33059. }
  33060. /**
  33061. * Creates a function that invokes the method at `path` of a given object.
  33062. * Any additional arguments are provided to the invoked method.
  33063. *
  33064. * @static
  33065. * @memberOf _
  33066. * @since 3.7.0
  33067. * @category Util
  33068. * @param {Array|string} path The path of the method to invoke.
  33069. * @param {...*} [args] The arguments to invoke the method with.
  33070. * @returns {Function} Returns the new invoker function.
  33071. * @example
  33072. *
  33073. * var objects = [
  33074. * { 'a': { 'b': _.constant(2) } },
  33075. * { 'a': { 'b': _.constant(1) } }
  33076. * ];
  33077. *
  33078. * _.map(objects, _.method('a.b'));
  33079. * // => [2, 1]
  33080. *
  33081. * _.map(objects, _.method(['a', 'b']));
  33082. * // => [2, 1]
  33083. */
  33084. var method = baseRest(function(path, args) {
  33085. return function(object) {
  33086. return baseInvoke(object, path, args);
  33087. };
  33088. });
  33089. /**
  33090. * The opposite of `_.method`; this method creates a function that invokes
  33091. * the method at a given path of `object`. Any additional arguments are
  33092. * provided to the invoked method.
  33093. *
  33094. * @static
  33095. * @memberOf _
  33096. * @since 3.7.0
  33097. * @category Util
  33098. * @param {Object} object The object to query.
  33099. * @param {...*} [args] The arguments to invoke the method with.
  33100. * @returns {Function} Returns the new invoker function.
  33101. * @example
  33102. *
  33103. * var array = _.times(3, _.constant),
  33104. * object = { 'a': array, 'b': array, 'c': array };
  33105. *
  33106. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33107. * // => [2, 0]
  33108. *
  33109. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33110. * // => [2, 0]
  33111. */
  33112. var methodOf = baseRest(function(object, args) {
  33113. return function(path) {
  33114. return baseInvoke(object, path, args);
  33115. };
  33116. });
  33117. /**
  33118. * Adds all own enumerable string keyed function properties of a source
  33119. * object to the destination object. If `object` is a function, then methods
  33120. * are added to its prototype as well.
  33121. *
  33122. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33123. * avoid conflicts caused by modifying the original.
  33124. *
  33125. * @static
  33126. * @since 0.1.0
  33127. * @memberOf _
  33128. * @category Util
  33129. * @param {Function|Object} [object=lodash] The destination object.
  33130. * @param {Object} source The object of functions to add.
  33131. * @param {Object} [options={}] The options object.
  33132. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33133. * @returns {Function|Object} Returns `object`.
  33134. * @example
  33135. *
  33136. * function vowels(string) {
  33137. * return _.filter(string, function(v) {
  33138. * return /[aeiou]/i.test(v);
  33139. * });
  33140. * }
  33141. *
  33142. * _.mixin({ 'vowels': vowels });
  33143. * _.vowels('fred');
  33144. * // => ['e']
  33145. *
  33146. * _('fred').vowels().value();
  33147. * // => ['e']
  33148. *
  33149. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33150. * _('fred').vowels();
  33151. * // => ['e']
  33152. */
  33153. function mixin(object, source, options) {
  33154. var props = keys(source),
  33155. methodNames = baseFunctions(source, props);
  33156. if (options == null &&
  33157. !(isObject(source) && (methodNames.length || !props.length))) {
  33158. options = source;
  33159. source = object;
  33160. object = this;
  33161. methodNames = baseFunctions(source, keys(source));
  33162. }
  33163. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33164. isFunc = isFunction(object);
  33165. arrayEach(methodNames, function(methodName) {
  33166. var func = source[methodName];
  33167. object[methodName] = func;
  33168. if (isFunc) {
  33169. object.prototype[methodName] = function() {
  33170. var chainAll = this.__chain__;
  33171. if (chain || chainAll) {
  33172. var result = object(this.__wrapped__),
  33173. actions = result.__actions__ = copyArray(this.__actions__);
  33174. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33175. result.__chain__ = chainAll;
  33176. return result;
  33177. }
  33178. return func.apply(object, arrayPush([this.value()], arguments));
  33179. };
  33180. }
  33181. });
  33182. return object;
  33183. }
  33184. /**
  33185. * Reverts the `_` variable to its previous value and returns a reference to
  33186. * the `lodash` function.
  33187. *
  33188. * @static
  33189. * @since 0.1.0
  33190. * @memberOf _
  33191. * @category Util
  33192. * @returns {Function} Returns the `lodash` function.
  33193. * @example
  33194. *
  33195. * var lodash = _.noConflict();
  33196. */
  33197. function noConflict() {
  33198. if (root._ === this) {
  33199. root._ = oldDash;
  33200. }
  33201. return this;
  33202. }
  33203. /**
  33204. * This method returns `undefined`.
  33205. *
  33206. * @static
  33207. * @memberOf _
  33208. * @since 2.3.0
  33209. * @category Util
  33210. * @example
  33211. *
  33212. * _.times(2, _.noop);
  33213. * // => [undefined, undefined]
  33214. */
  33215. function noop() {
  33216. // No operation performed.
  33217. }
  33218. /**
  33219. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33220. * the nth argument from the end is returned.
  33221. *
  33222. * @static
  33223. * @memberOf _
  33224. * @since 4.0.0
  33225. * @category Util
  33226. * @param {number} [n=0] The index of the argument to return.
  33227. * @returns {Function} Returns the new pass-thru function.
  33228. * @example
  33229. *
  33230. * var func = _.nthArg(1);
  33231. * func('a', 'b', 'c', 'd');
  33232. * // => 'b'
  33233. *
  33234. * var func = _.nthArg(-2);
  33235. * func('a', 'b', 'c', 'd');
  33236. * // => 'c'
  33237. */
  33238. function nthArg(n) {
  33239. n = toInteger(n);
  33240. return baseRest(function(args) {
  33241. return baseNth(args, n);
  33242. });
  33243. }
  33244. /**
  33245. * Creates a function that invokes `iteratees` with the arguments it receives
  33246. * and returns their results.
  33247. *
  33248. * @static
  33249. * @memberOf _
  33250. * @since 4.0.0
  33251. * @category Util
  33252. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33253. * The iteratees to invoke.
  33254. * @returns {Function} Returns the new function.
  33255. * @example
  33256. *
  33257. * var func = _.over([Math.max, Math.min]);
  33258. *
  33259. * func(1, 2, 3, 4);
  33260. * // => [4, 1]
  33261. */
  33262. var over = createOver(arrayMap);
  33263. /**
  33264. * Creates a function that checks if **all** of the `predicates` return
  33265. * truthy when invoked with the arguments it receives.
  33266. *
  33267. * @static
  33268. * @memberOf _
  33269. * @since 4.0.0
  33270. * @category Util
  33271. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33272. * The predicates to check.
  33273. * @returns {Function} Returns the new function.
  33274. * @example
  33275. *
  33276. * var func = _.overEvery([Boolean, isFinite]);
  33277. *
  33278. * func('1');
  33279. * // => true
  33280. *
  33281. * func(null);
  33282. * // => false
  33283. *
  33284. * func(NaN);
  33285. * // => false
  33286. */
  33287. var overEvery = createOver(arrayEvery);
  33288. /**
  33289. * Creates a function that checks if **any** of the `predicates` return
  33290. * truthy when invoked with the arguments it receives.
  33291. *
  33292. * @static
  33293. * @memberOf _
  33294. * @since 4.0.0
  33295. * @category Util
  33296. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33297. * The predicates to check.
  33298. * @returns {Function} Returns the new function.
  33299. * @example
  33300. *
  33301. * var func = _.overSome([Boolean, isFinite]);
  33302. *
  33303. * func('1');
  33304. * // => true
  33305. *
  33306. * func(null);
  33307. * // => true
  33308. *
  33309. * func(NaN);
  33310. * // => false
  33311. */
  33312. var overSome = createOver(arraySome);
  33313. /**
  33314. * Creates a function that returns the value at `path` of a given object.
  33315. *
  33316. * @static
  33317. * @memberOf _
  33318. * @since 2.4.0
  33319. * @category Util
  33320. * @param {Array|string} path The path of the property to get.
  33321. * @returns {Function} Returns the new accessor function.
  33322. * @example
  33323. *
  33324. * var objects = [
  33325. * { 'a': { 'b': 2 } },
  33326. * { 'a': { 'b': 1 } }
  33327. * ];
  33328. *
  33329. * _.map(objects, _.property('a.b'));
  33330. * // => [2, 1]
  33331. *
  33332. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33333. * // => [1, 2]
  33334. */
  33335. function property(path) {
  33336. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33337. }
  33338. /**
  33339. * The opposite of `_.property`; this method creates a function that returns
  33340. * the value at a given path of `object`.
  33341. *
  33342. * @static
  33343. * @memberOf _
  33344. * @since 3.0.0
  33345. * @category Util
  33346. * @param {Object} object The object to query.
  33347. * @returns {Function} Returns the new accessor function.
  33348. * @example
  33349. *
  33350. * var array = [0, 1, 2],
  33351. * object = { 'a': array, 'b': array, 'c': array };
  33352. *
  33353. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33354. * // => [2, 0]
  33355. *
  33356. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33357. * // => [2, 0]
  33358. */
  33359. function propertyOf(object) {
  33360. return function(path) {
  33361. return object == null ? undefined : baseGet(object, path);
  33362. };
  33363. }
  33364. /**
  33365. * Creates an array of numbers (positive and/or negative) progressing from
  33366. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33367. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33368. * it's set to `start` with `start` then set to `0`.
  33369. *
  33370. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33371. * floating-point values which can produce unexpected results.
  33372. *
  33373. * @static
  33374. * @since 0.1.0
  33375. * @memberOf _
  33376. * @category Util
  33377. * @param {number} [start=0] The start of the range.
  33378. * @param {number} end The end of the range.
  33379. * @param {number} [step=1] The value to increment or decrement by.
  33380. * @returns {Array} Returns the range of numbers.
  33381. * @see _.inRange, _.rangeRight
  33382. * @example
  33383. *
  33384. * _.range(4);
  33385. * // => [0, 1, 2, 3]
  33386. *
  33387. * _.range(-4);
  33388. * // => [0, -1, -2, -3]
  33389. *
  33390. * _.range(1, 5);
  33391. * // => [1, 2, 3, 4]
  33392. *
  33393. * _.range(0, 20, 5);
  33394. * // => [0, 5, 10, 15]
  33395. *
  33396. * _.range(0, -4, -1);
  33397. * // => [0, -1, -2, -3]
  33398. *
  33399. * _.range(1, 4, 0);
  33400. * // => [1, 1, 1]
  33401. *
  33402. * _.range(0);
  33403. * // => []
  33404. */
  33405. var range = createRange();
  33406. /**
  33407. * This method is like `_.range` except that it populates values in
  33408. * descending order.
  33409. *
  33410. * @static
  33411. * @memberOf _
  33412. * @since 4.0.0
  33413. * @category Util
  33414. * @param {number} [start=0] The start of the range.
  33415. * @param {number} end The end of the range.
  33416. * @param {number} [step=1] The value to increment or decrement by.
  33417. * @returns {Array} Returns the range of numbers.
  33418. * @see _.inRange, _.range
  33419. * @example
  33420. *
  33421. * _.rangeRight(4);
  33422. * // => [3, 2, 1, 0]
  33423. *
  33424. * _.rangeRight(-4);
  33425. * // => [-3, -2, -1, 0]
  33426. *
  33427. * _.rangeRight(1, 5);
  33428. * // => [4, 3, 2, 1]
  33429. *
  33430. * _.rangeRight(0, 20, 5);
  33431. * // => [15, 10, 5, 0]
  33432. *
  33433. * _.rangeRight(0, -4, -1);
  33434. * // => [-3, -2, -1, 0]
  33435. *
  33436. * _.rangeRight(1, 4, 0);
  33437. * // => [1, 1, 1]
  33438. *
  33439. * _.rangeRight(0);
  33440. * // => []
  33441. */
  33442. var rangeRight = createRange(true);
  33443. /**
  33444. * This method returns a new empty array.
  33445. *
  33446. * @static
  33447. * @memberOf _
  33448. * @since 4.13.0
  33449. * @category Util
  33450. * @returns {Array} Returns the new empty array.
  33451. * @example
  33452. *
  33453. * var arrays = _.times(2, _.stubArray);
  33454. *
  33455. * console.log(arrays);
  33456. * // => [[], []]
  33457. *
  33458. * console.log(arrays[0] === arrays[1]);
  33459. * // => false
  33460. */
  33461. function stubArray() {
  33462. return [];
  33463. }
  33464. /**
  33465. * This method returns `false`.
  33466. *
  33467. * @static
  33468. * @memberOf _
  33469. * @since 4.13.0
  33470. * @category Util
  33471. * @returns {boolean} Returns `false`.
  33472. * @example
  33473. *
  33474. * _.times(2, _.stubFalse);
  33475. * // => [false, false]
  33476. */
  33477. function stubFalse() {
  33478. return false;
  33479. }
  33480. /**
  33481. * This method returns a new empty object.
  33482. *
  33483. * @static
  33484. * @memberOf _
  33485. * @since 4.13.0
  33486. * @category Util
  33487. * @returns {Object} Returns the new empty object.
  33488. * @example
  33489. *
  33490. * var objects = _.times(2, _.stubObject);
  33491. *
  33492. * console.log(objects);
  33493. * // => [{}, {}]
  33494. *
  33495. * console.log(objects[0] === objects[1]);
  33496. * // => false
  33497. */
  33498. function stubObject() {
  33499. return {};
  33500. }
  33501. /**
  33502. * This method returns an empty string.
  33503. *
  33504. * @static
  33505. * @memberOf _
  33506. * @since 4.13.0
  33507. * @category Util
  33508. * @returns {string} Returns the empty string.
  33509. * @example
  33510. *
  33511. * _.times(2, _.stubString);
  33512. * // => ['', '']
  33513. */
  33514. function stubString() {
  33515. return '';
  33516. }
  33517. /**
  33518. * This method returns `true`.
  33519. *
  33520. * @static
  33521. * @memberOf _
  33522. * @since 4.13.0
  33523. * @category Util
  33524. * @returns {boolean} Returns `true`.
  33525. * @example
  33526. *
  33527. * _.times(2, _.stubTrue);
  33528. * // => [true, true]
  33529. */
  33530. function stubTrue() {
  33531. return true;
  33532. }
  33533. /**
  33534. * Invokes the iteratee `n` times, returning an array of the results of
  33535. * each invocation. The iteratee is invoked with one argument; (index).
  33536. *
  33537. * @static
  33538. * @since 0.1.0
  33539. * @memberOf _
  33540. * @category Util
  33541. * @param {number} n The number of times to invoke `iteratee`.
  33542. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33543. * @returns {Array} Returns the array of results.
  33544. * @example
  33545. *
  33546. * _.times(3, String);
  33547. * // => ['0', '1', '2']
  33548. *
  33549. * _.times(4, _.constant(0));
  33550. * // => [0, 0, 0, 0]
  33551. */
  33552. function times(n, iteratee) {
  33553. n = toInteger(n);
  33554. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33555. return [];
  33556. }
  33557. var index = MAX_ARRAY_LENGTH,
  33558. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33559. iteratee = getIteratee(iteratee);
  33560. n -= MAX_ARRAY_LENGTH;
  33561. var result = baseTimes(length, iteratee);
  33562. while (++index < n) {
  33563. iteratee(index);
  33564. }
  33565. return result;
  33566. }
  33567. /**
  33568. * Converts `value` to a property path array.
  33569. *
  33570. * @static
  33571. * @memberOf _
  33572. * @since 4.0.0
  33573. * @category Util
  33574. * @param {*} value The value to convert.
  33575. * @returns {Array} Returns the new property path array.
  33576. * @example
  33577. *
  33578. * _.toPath('a.b.c');
  33579. * // => ['a', 'b', 'c']
  33580. *
  33581. * _.toPath('a[0].b.c');
  33582. * // => ['a', '0', 'b', 'c']
  33583. */
  33584. function toPath(value) {
  33585. if (isArray(value)) {
  33586. return arrayMap(value, toKey);
  33587. }
  33588. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33589. }
  33590. /**
  33591. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33592. *
  33593. * @static
  33594. * @since 0.1.0
  33595. * @memberOf _
  33596. * @category Util
  33597. * @param {string} [prefix=''] The value to prefix the ID with.
  33598. * @returns {string} Returns the unique ID.
  33599. * @example
  33600. *
  33601. * _.uniqueId('contact_');
  33602. * // => 'contact_104'
  33603. *
  33604. * _.uniqueId();
  33605. * // => '105'
  33606. */
  33607. function uniqueId(prefix) {
  33608. var id = ++idCounter;
  33609. return toString(prefix) + id;
  33610. }
  33611. /*------------------------------------------------------------------------*/
  33612. /**
  33613. * Adds two numbers.
  33614. *
  33615. * @static
  33616. * @memberOf _
  33617. * @since 3.4.0
  33618. * @category Math
  33619. * @param {number} augend The first number in an addition.
  33620. * @param {number} addend The second number in an addition.
  33621. * @returns {number} Returns the total.
  33622. * @example
  33623. *
  33624. * _.add(6, 4);
  33625. * // => 10
  33626. */
  33627. var add = createMathOperation(function(augend, addend) {
  33628. return augend + addend;
  33629. }, 0);
  33630. /**
  33631. * Computes `number` rounded up to `precision`.
  33632. *
  33633. * @static
  33634. * @memberOf _
  33635. * @since 3.10.0
  33636. * @category Math
  33637. * @param {number} number The number to round up.
  33638. * @param {number} [precision=0] The precision to round up to.
  33639. * @returns {number} Returns the rounded up number.
  33640. * @example
  33641. *
  33642. * _.ceil(4.006);
  33643. * // => 5
  33644. *
  33645. * _.ceil(6.004, 2);
  33646. * // => 6.01
  33647. *
  33648. * _.ceil(6040, -2);
  33649. * // => 6100
  33650. */
  33651. var ceil = createRound('ceil');
  33652. /**
  33653. * Divide two numbers.
  33654. *
  33655. * @static
  33656. * @memberOf _
  33657. * @since 4.7.0
  33658. * @category Math
  33659. * @param {number} dividend The first number in a division.
  33660. * @param {number} divisor The second number in a division.
  33661. * @returns {number} Returns the quotient.
  33662. * @example
  33663. *
  33664. * _.divide(6, 4);
  33665. * // => 1.5
  33666. */
  33667. var divide = createMathOperation(function(dividend, divisor) {
  33668. return dividend / divisor;
  33669. }, 1);
  33670. /**
  33671. * Computes `number` rounded down to `precision`.
  33672. *
  33673. * @static
  33674. * @memberOf _
  33675. * @since 3.10.0
  33676. * @category Math
  33677. * @param {number} number The number to round down.
  33678. * @param {number} [precision=0] The precision to round down to.
  33679. * @returns {number} Returns the rounded down number.
  33680. * @example
  33681. *
  33682. * _.floor(4.006);
  33683. * // => 4
  33684. *
  33685. * _.floor(0.046, 2);
  33686. * // => 0.04
  33687. *
  33688. * _.floor(4060, -2);
  33689. * // => 4000
  33690. */
  33691. var floor = createRound('floor');
  33692. /**
  33693. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33694. * `undefined` is returned.
  33695. *
  33696. * @static
  33697. * @since 0.1.0
  33698. * @memberOf _
  33699. * @category Math
  33700. * @param {Array} array The array to iterate over.
  33701. * @returns {*} Returns the maximum value.
  33702. * @example
  33703. *
  33704. * _.max([4, 2, 8, 6]);
  33705. * // => 8
  33706. *
  33707. * _.max([]);
  33708. * // => undefined
  33709. */
  33710. function max(array) {
  33711. return (array && array.length)
  33712. ? baseExtremum(array, identity, baseGt)
  33713. : undefined;
  33714. }
  33715. /**
  33716. * This method is like `_.max` except that it accepts `iteratee` which is
  33717. * invoked for each element in `array` to generate the criterion by which
  33718. * the value is ranked. The iteratee is invoked with one argument: (value).
  33719. *
  33720. * @static
  33721. * @memberOf _
  33722. * @since 4.0.0
  33723. * @category Math
  33724. * @param {Array} array The array to iterate over.
  33725. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33726. * @returns {*} Returns the maximum value.
  33727. * @example
  33728. *
  33729. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33730. *
  33731. * _.maxBy(objects, function(o) { return o.n; });
  33732. * // => { 'n': 2 }
  33733. *
  33734. * // The `_.property` iteratee shorthand.
  33735. * _.maxBy(objects, 'n');
  33736. * // => { 'n': 2 }
  33737. */
  33738. function maxBy(array, iteratee) {
  33739. return (array && array.length)
  33740. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33741. : undefined;
  33742. }
  33743. /**
  33744. * Computes the mean of the values in `array`.
  33745. *
  33746. * @static
  33747. * @memberOf _
  33748. * @since 4.0.0
  33749. * @category Math
  33750. * @param {Array} array The array to iterate over.
  33751. * @returns {number} Returns the mean.
  33752. * @example
  33753. *
  33754. * _.mean([4, 2, 8, 6]);
  33755. * // => 5
  33756. */
  33757. function mean(array) {
  33758. return baseMean(array, identity);
  33759. }
  33760. /**
  33761. * This method is like `_.mean` except that it accepts `iteratee` which is
  33762. * invoked for each element in `array` to generate the value to be averaged.
  33763. * The iteratee is invoked with one argument: (value).
  33764. *
  33765. * @static
  33766. * @memberOf _
  33767. * @since 4.7.0
  33768. * @category Math
  33769. * @param {Array} array The array to iterate over.
  33770. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33771. * @returns {number} Returns the mean.
  33772. * @example
  33773. *
  33774. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33775. *
  33776. * _.meanBy(objects, function(o) { return o.n; });
  33777. * // => 5
  33778. *
  33779. * // The `_.property` iteratee shorthand.
  33780. * _.meanBy(objects, 'n');
  33781. * // => 5
  33782. */
  33783. function meanBy(array, iteratee) {
  33784. return baseMean(array, getIteratee(iteratee, 2));
  33785. }
  33786. /**
  33787. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33788. * `undefined` is returned.
  33789. *
  33790. * @static
  33791. * @since 0.1.0
  33792. * @memberOf _
  33793. * @category Math
  33794. * @param {Array} array The array to iterate over.
  33795. * @returns {*} Returns the minimum value.
  33796. * @example
  33797. *
  33798. * _.min([4, 2, 8, 6]);
  33799. * // => 2
  33800. *
  33801. * _.min([]);
  33802. * // => undefined
  33803. */
  33804. function min(array) {
  33805. return (array && array.length)
  33806. ? baseExtremum(array, identity, baseLt)
  33807. : undefined;
  33808. }
  33809. /**
  33810. * This method is like `_.min` except that it accepts `iteratee` which is
  33811. * invoked for each element in `array` to generate the criterion by which
  33812. * the value is ranked. The iteratee is invoked with one argument: (value).
  33813. *
  33814. * @static
  33815. * @memberOf _
  33816. * @since 4.0.0
  33817. * @category Math
  33818. * @param {Array} array The array to iterate over.
  33819. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33820. * @returns {*} Returns the minimum value.
  33821. * @example
  33822. *
  33823. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33824. *
  33825. * _.minBy(objects, function(o) { return o.n; });
  33826. * // => { 'n': 1 }
  33827. *
  33828. * // The `_.property` iteratee shorthand.
  33829. * _.minBy(objects, 'n');
  33830. * // => { 'n': 1 }
  33831. */
  33832. function minBy(array, iteratee) {
  33833. return (array && array.length)
  33834. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33835. : undefined;
  33836. }
  33837. /**
  33838. * Multiply two numbers.
  33839. *
  33840. * @static
  33841. * @memberOf _
  33842. * @since 4.7.0
  33843. * @category Math
  33844. * @param {number} multiplier The first number in a multiplication.
  33845. * @param {number} multiplicand The second number in a multiplication.
  33846. * @returns {number} Returns the product.
  33847. * @example
  33848. *
  33849. * _.multiply(6, 4);
  33850. * // => 24
  33851. */
  33852. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33853. return multiplier * multiplicand;
  33854. }, 1);
  33855. /**
  33856. * Computes `number` rounded to `precision`.
  33857. *
  33858. * @static
  33859. * @memberOf _
  33860. * @since 3.10.0
  33861. * @category Math
  33862. * @param {number} number The number to round.
  33863. * @param {number} [precision=0] The precision to round to.
  33864. * @returns {number} Returns the rounded number.
  33865. * @example
  33866. *
  33867. * _.round(4.006);
  33868. * // => 4
  33869. *
  33870. * _.round(4.006, 2);
  33871. * // => 4.01
  33872. *
  33873. * _.round(4060, -2);
  33874. * // => 4100
  33875. */
  33876. var round = createRound('round');
  33877. /**
  33878. * Subtract two numbers.
  33879. *
  33880. * @static
  33881. * @memberOf _
  33882. * @since 4.0.0
  33883. * @category Math
  33884. * @param {number} minuend The first number in a subtraction.
  33885. * @param {number} subtrahend The second number in a subtraction.
  33886. * @returns {number} Returns the difference.
  33887. * @example
  33888. *
  33889. * _.subtract(6, 4);
  33890. * // => 2
  33891. */
  33892. var subtract = createMathOperation(function(minuend, subtrahend) {
  33893. return minuend - subtrahend;
  33894. }, 0);
  33895. /**
  33896. * Computes the sum of the values in `array`.
  33897. *
  33898. * @static
  33899. * @memberOf _
  33900. * @since 3.4.0
  33901. * @category Math
  33902. * @param {Array} array The array to iterate over.
  33903. * @returns {number} Returns the sum.
  33904. * @example
  33905. *
  33906. * _.sum([4, 2, 8, 6]);
  33907. * // => 20
  33908. */
  33909. function sum(array) {
  33910. return (array && array.length)
  33911. ? baseSum(array, identity)
  33912. : 0;
  33913. }
  33914. /**
  33915. * This method is like `_.sum` except that it accepts `iteratee` which is
  33916. * invoked for each element in `array` to generate the value to be summed.
  33917. * The iteratee is invoked with one argument: (value).
  33918. *
  33919. * @static
  33920. * @memberOf _
  33921. * @since 4.0.0
  33922. * @category Math
  33923. * @param {Array} array The array to iterate over.
  33924. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33925. * @returns {number} Returns the sum.
  33926. * @example
  33927. *
  33928. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33929. *
  33930. * _.sumBy(objects, function(o) { return o.n; });
  33931. * // => 20
  33932. *
  33933. * // The `_.property` iteratee shorthand.
  33934. * _.sumBy(objects, 'n');
  33935. * // => 20
  33936. */
  33937. function sumBy(array, iteratee) {
  33938. return (array && array.length)
  33939. ? baseSum(array, getIteratee(iteratee, 2))
  33940. : 0;
  33941. }
  33942. /*------------------------------------------------------------------------*/
  33943. // Add methods that return wrapped values in chain sequences.
  33944. lodash.after = after;
  33945. lodash.ary = ary;
  33946. lodash.assign = assign;
  33947. lodash.assignIn = assignIn;
  33948. lodash.assignInWith = assignInWith;
  33949. lodash.assignWith = assignWith;
  33950. lodash.at = at;
  33951. lodash.before = before;
  33952. lodash.bind = bind;
  33953. lodash.bindAll = bindAll;
  33954. lodash.bindKey = bindKey;
  33955. lodash.castArray = castArray;
  33956. lodash.chain = chain;
  33957. lodash.chunk = chunk;
  33958. lodash.compact = compact;
  33959. lodash.concat = concat;
  33960. lodash.cond = cond;
  33961. lodash.conforms = conforms;
  33962. lodash.constant = constant;
  33963. lodash.countBy = countBy;
  33964. lodash.create = create;
  33965. lodash.curry = curry;
  33966. lodash.curryRight = curryRight;
  33967. lodash.debounce = debounce;
  33968. lodash.defaults = defaults;
  33969. lodash.defaultsDeep = defaultsDeep;
  33970. lodash.defer = defer;
  33971. lodash.delay = delay;
  33972. lodash.difference = difference;
  33973. lodash.differenceBy = differenceBy;
  33974. lodash.differenceWith = differenceWith;
  33975. lodash.drop = drop;
  33976. lodash.dropRight = dropRight;
  33977. lodash.dropRightWhile = dropRightWhile;
  33978. lodash.dropWhile = dropWhile;
  33979. lodash.fill = fill;
  33980. lodash.filter = filter;
  33981. lodash.flatMap = flatMap;
  33982. lodash.flatMapDeep = flatMapDeep;
  33983. lodash.flatMapDepth = flatMapDepth;
  33984. lodash.flatten = flatten;
  33985. lodash.flattenDeep = flattenDeep;
  33986. lodash.flattenDepth = flattenDepth;
  33987. lodash.flip = flip;
  33988. lodash.flow = flow;
  33989. lodash.flowRight = flowRight;
  33990. lodash.fromPairs = fromPairs;
  33991. lodash.functions = functions;
  33992. lodash.functionsIn = functionsIn;
  33993. lodash.groupBy = groupBy;
  33994. lodash.initial = initial;
  33995. lodash.intersection = intersection;
  33996. lodash.intersectionBy = intersectionBy;
  33997. lodash.intersectionWith = intersectionWith;
  33998. lodash.invert = invert;
  33999. lodash.invertBy = invertBy;
  34000. lodash.invokeMap = invokeMap;
  34001. lodash.iteratee = iteratee;
  34002. lodash.keyBy = keyBy;
  34003. lodash.keys = keys;
  34004. lodash.keysIn = keysIn;
  34005. lodash.map = map;
  34006. lodash.mapKeys = mapKeys;
  34007. lodash.mapValues = mapValues;
  34008. lodash.matches = matches;
  34009. lodash.matchesProperty = matchesProperty;
  34010. lodash.memoize = memoize;
  34011. lodash.merge = merge;
  34012. lodash.mergeWith = mergeWith;
  34013. lodash.method = method;
  34014. lodash.methodOf = methodOf;
  34015. lodash.mixin = mixin;
  34016. lodash.negate = negate;
  34017. lodash.nthArg = nthArg;
  34018. lodash.omit = omit;
  34019. lodash.omitBy = omitBy;
  34020. lodash.once = once;
  34021. lodash.orderBy = orderBy;
  34022. lodash.over = over;
  34023. lodash.overArgs = overArgs;
  34024. lodash.overEvery = overEvery;
  34025. lodash.overSome = overSome;
  34026. lodash.partial = partial;
  34027. lodash.partialRight = partialRight;
  34028. lodash.partition = partition;
  34029. lodash.pick = pick;
  34030. lodash.pickBy = pickBy;
  34031. lodash.property = property;
  34032. lodash.propertyOf = propertyOf;
  34033. lodash.pull = pull;
  34034. lodash.pullAll = pullAll;
  34035. lodash.pullAllBy = pullAllBy;
  34036. lodash.pullAllWith = pullAllWith;
  34037. lodash.pullAt = pullAt;
  34038. lodash.range = range;
  34039. lodash.rangeRight = rangeRight;
  34040. lodash.rearg = rearg;
  34041. lodash.reject = reject;
  34042. lodash.remove = remove;
  34043. lodash.rest = rest;
  34044. lodash.reverse = reverse;
  34045. lodash.sampleSize = sampleSize;
  34046. lodash.set = set;
  34047. lodash.setWith = setWith;
  34048. lodash.shuffle = shuffle;
  34049. lodash.slice = slice;
  34050. lodash.sortBy = sortBy;
  34051. lodash.sortedUniq = sortedUniq;
  34052. lodash.sortedUniqBy = sortedUniqBy;
  34053. lodash.split = split;
  34054. lodash.spread = spread;
  34055. lodash.tail = tail;
  34056. lodash.take = take;
  34057. lodash.takeRight = takeRight;
  34058. lodash.takeRightWhile = takeRightWhile;
  34059. lodash.takeWhile = takeWhile;
  34060. lodash.tap = tap;
  34061. lodash.throttle = throttle;
  34062. lodash.thru = thru;
  34063. lodash.toArray = toArray;
  34064. lodash.toPairs = toPairs;
  34065. lodash.toPairsIn = toPairsIn;
  34066. lodash.toPath = toPath;
  34067. lodash.toPlainObject = toPlainObject;
  34068. lodash.transform = transform;
  34069. lodash.unary = unary;
  34070. lodash.union = union;
  34071. lodash.unionBy = unionBy;
  34072. lodash.unionWith = unionWith;
  34073. lodash.uniq = uniq;
  34074. lodash.uniqBy = uniqBy;
  34075. lodash.uniqWith = uniqWith;
  34076. lodash.unset = unset;
  34077. lodash.unzip = unzip;
  34078. lodash.unzipWith = unzipWith;
  34079. lodash.update = update;
  34080. lodash.updateWith = updateWith;
  34081. lodash.values = values;
  34082. lodash.valuesIn = valuesIn;
  34083. lodash.without = without;
  34084. lodash.words = words;
  34085. lodash.wrap = wrap;
  34086. lodash.xor = xor;
  34087. lodash.xorBy = xorBy;
  34088. lodash.xorWith = xorWith;
  34089. lodash.zip = zip;
  34090. lodash.zipObject = zipObject;
  34091. lodash.zipObjectDeep = zipObjectDeep;
  34092. lodash.zipWith = zipWith;
  34093. // Add aliases.
  34094. lodash.entries = toPairs;
  34095. lodash.entriesIn = toPairsIn;
  34096. lodash.extend = assignIn;
  34097. lodash.extendWith = assignInWith;
  34098. // Add methods to `lodash.prototype`.
  34099. mixin(lodash, lodash);
  34100. /*------------------------------------------------------------------------*/
  34101. // Add methods that return unwrapped values in chain sequences.
  34102. lodash.add = add;
  34103. lodash.attempt = attempt;
  34104. lodash.camelCase = camelCase;
  34105. lodash.capitalize = capitalize;
  34106. lodash.ceil = ceil;
  34107. lodash.clamp = clamp;
  34108. lodash.clone = clone;
  34109. lodash.cloneDeep = cloneDeep;
  34110. lodash.cloneDeepWith = cloneDeepWith;
  34111. lodash.cloneWith = cloneWith;
  34112. lodash.conformsTo = conformsTo;
  34113. lodash.deburr = deburr;
  34114. lodash.defaultTo = defaultTo;
  34115. lodash.divide = divide;
  34116. lodash.endsWith = endsWith;
  34117. lodash.eq = eq;
  34118. lodash.escape = escape;
  34119. lodash.escapeRegExp = escapeRegExp;
  34120. lodash.every = every;
  34121. lodash.find = find;
  34122. lodash.findIndex = findIndex;
  34123. lodash.findKey = findKey;
  34124. lodash.findLast = findLast;
  34125. lodash.findLastIndex = findLastIndex;
  34126. lodash.findLastKey = findLastKey;
  34127. lodash.floor = floor;
  34128. lodash.forEach = forEach;
  34129. lodash.forEachRight = forEachRight;
  34130. lodash.forIn = forIn;
  34131. lodash.forInRight = forInRight;
  34132. lodash.forOwn = forOwn;
  34133. lodash.forOwnRight = forOwnRight;
  34134. lodash.get = get;
  34135. lodash.gt = gt;
  34136. lodash.gte = gte;
  34137. lodash.has = has;
  34138. lodash.hasIn = hasIn;
  34139. lodash.head = head;
  34140. lodash.identity = identity;
  34141. lodash.includes = includes;
  34142. lodash.indexOf = indexOf;
  34143. lodash.inRange = inRange;
  34144. lodash.invoke = invoke;
  34145. lodash.isArguments = isArguments;
  34146. lodash.isArray = isArray;
  34147. lodash.isArrayBuffer = isArrayBuffer;
  34148. lodash.isArrayLike = isArrayLike;
  34149. lodash.isArrayLikeObject = isArrayLikeObject;
  34150. lodash.isBoolean = isBoolean;
  34151. lodash.isBuffer = isBuffer;
  34152. lodash.isDate = isDate;
  34153. lodash.isElement = isElement;
  34154. lodash.isEmpty = isEmpty;
  34155. lodash.isEqual = isEqual;
  34156. lodash.isEqualWith = isEqualWith;
  34157. lodash.isError = isError;
  34158. lodash.isFinite = isFinite;
  34159. lodash.isFunction = isFunction;
  34160. lodash.isInteger = isInteger;
  34161. lodash.isLength = isLength;
  34162. lodash.isMap = isMap;
  34163. lodash.isMatch = isMatch;
  34164. lodash.isMatchWith = isMatchWith;
  34165. lodash.isNaN = isNaN;
  34166. lodash.isNative = isNative;
  34167. lodash.isNil = isNil;
  34168. lodash.isNull = isNull;
  34169. lodash.isNumber = isNumber;
  34170. lodash.isObject = isObject;
  34171. lodash.isObjectLike = isObjectLike;
  34172. lodash.isPlainObject = isPlainObject;
  34173. lodash.isRegExp = isRegExp;
  34174. lodash.isSafeInteger = isSafeInteger;
  34175. lodash.isSet = isSet;
  34176. lodash.isString = isString;
  34177. lodash.isSymbol = isSymbol;
  34178. lodash.isTypedArray = isTypedArray;
  34179. lodash.isUndefined = isUndefined;
  34180. lodash.isWeakMap = isWeakMap;
  34181. lodash.isWeakSet = isWeakSet;
  34182. lodash.join = join;
  34183. lodash.kebabCase = kebabCase;
  34184. lodash.last = last;
  34185. lodash.lastIndexOf = lastIndexOf;
  34186. lodash.lowerCase = lowerCase;
  34187. lodash.lowerFirst = lowerFirst;
  34188. lodash.lt = lt;
  34189. lodash.lte = lte;
  34190. lodash.max = max;
  34191. lodash.maxBy = maxBy;
  34192. lodash.mean = mean;
  34193. lodash.meanBy = meanBy;
  34194. lodash.min = min;
  34195. lodash.minBy = minBy;
  34196. lodash.stubArray = stubArray;
  34197. lodash.stubFalse = stubFalse;
  34198. lodash.stubObject = stubObject;
  34199. lodash.stubString = stubString;
  34200. lodash.stubTrue = stubTrue;
  34201. lodash.multiply = multiply;
  34202. lodash.nth = nth;
  34203. lodash.noConflict = noConflict;
  34204. lodash.noop = noop;
  34205. lodash.now = now;
  34206. lodash.pad = pad;
  34207. lodash.padEnd = padEnd;
  34208. lodash.padStart = padStart;
  34209. lodash.parseInt = parseInt;
  34210. lodash.random = random;
  34211. lodash.reduce = reduce;
  34212. lodash.reduceRight = reduceRight;
  34213. lodash.repeat = repeat;
  34214. lodash.replace = replace;
  34215. lodash.result = result;
  34216. lodash.round = round;
  34217. lodash.runInContext = runInContext;
  34218. lodash.sample = sample;
  34219. lodash.size = size;
  34220. lodash.snakeCase = snakeCase;
  34221. lodash.some = some;
  34222. lodash.sortedIndex = sortedIndex;
  34223. lodash.sortedIndexBy = sortedIndexBy;
  34224. lodash.sortedIndexOf = sortedIndexOf;
  34225. lodash.sortedLastIndex = sortedLastIndex;
  34226. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34227. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34228. lodash.startCase = startCase;
  34229. lodash.startsWith = startsWith;
  34230. lodash.subtract = subtract;
  34231. lodash.sum = sum;
  34232. lodash.sumBy = sumBy;
  34233. lodash.template = template;
  34234. lodash.times = times;
  34235. lodash.toFinite = toFinite;
  34236. lodash.toInteger = toInteger;
  34237. lodash.toLength = toLength;
  34238. lodash.toLower = toLower;
  34239. lodash.toNumber = toNumber;
  34240. lodash.toSafeInteger = toSafeInteger;
  34241. lodash.toString = toString;
  34242. lodash.toUpper = toUpper;
  34243. lodash.trim = trim;
  34244. lodash.trimEnd = trimEnd;
  34245. lodash.trimStart = trimStart;
  34246. lodash.truncate = truncate;
  34247. lodash.unescape = unescape;
  34248. lodash.uniqueId = uniqueId;
  34249. lodash.upperCase = upperCase;
  34250. lodash.upperFirst = upperFirst;
  34251. // Add aliases.
  34252. lodash.each = forEach;
  34253. lodash.eachRight = forEachRight;
  34254. lodash.first = head;
  34255. mixin(lodash, (function() {
  34256. var source = {};
  34257. baseForOwn(lodash, function(func, methodName) {
  34258. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34259. source[methodName] = func;
  34260. }
  34261. });
  34262. return source;
  34263. }()), { 'chain': false });
  34264. /*------------------------------------------------------------------------*/
  34265. /**
  34266. * The semantic version number.
  34267. *
  34268. * @static
  34269. * @memberOf _
  34270. * @type {string}
  34271. */
  34272. lodash.VERSION = VERSION;
  34273. // Assign default placeholders.
  34274. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34275. lodash[methodName].placeholder = lodash;
  34276. });
  34277. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34278. arrayEach(['drop', 'take'], function(methodName, index) {
  34279. LazyWrapper.prototype[methodName] = function(n) {
  34280. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34281. var result = (this.__filtered__ && !index)
  34282. ? new LazyWrapper(this)
  34283. : this.clone();
  34284. if (result.__filtered__) {
  34285. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34286. } else {
  34287. result.__views__.push({
  34288. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34289. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34290. });
  34291. }
  34292. return result;
  34293. };
  34294. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34295. return this.reverse()[methodName](n).reverse();
  34296. };
  34297. });
  34298. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34299. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34300. var type = index + 1,
  34301. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34302. LazyWrapper.prototype[methodName] = function(iteratee) {
  34303. var result = this.clone();
  34304. result.__iteratees__.push({
  34305. 'iteratee': getIteratee(iteratee, 3),
  34306. 'type': type
  34307. });
  34308. result.__filtered__ = result.__filtered__ || isFilter;
  34309. return result;
  34310. };
  34311. });
  34312. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34313. arrayEach(['head', 'last'], function(methodName, index) {
  34314. var takeName = 'take' + (index ? 'Right' : '');
  34315. LazyWrapper.prototype[methodName] = function() {
  34316. return this[takeName](1).value()[0];
  34317. };
  34318. });
  34319. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34320. arrayEach(['initial', 'tail'], function(methodName, index) {
  34321. var dropName = 'drop' + (index ? '' : 'Right');
  34322. LazyWrapper.prototype[methodName] = function() {
  34323. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34324. };
  34325. });
  34326. LazyWrapper.prototype.compact = function() {
  34327. return this.filter(identity);
  34328. };
  34329. LazyWrapper.prototype.find = function(predicate) {
  34330. return this.filter(predicate).head();
  34331. };
  34332. LazyWrapper.prototype.findLast = function(predicate) {
  34333. return this.reverse().find(predicate);
  34334. };
  34335. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34336. if (typeof path == 'function') {
  34337. return new LazyWrapper(this);
  34338. }
  34339. return this.map(function(value) {
  34340. return baseInvoke(value, path, args);
  34341. });
  34342. });
  34343. LazyWrapper.prototype.reject = function(predicate) {
  34344. return this.filter(negate(getIteratee(predicate)));
  34345. };
  34346. LazyWrapper.prototype.slice = function(start, end) {
  34347. start = toInteger(start);
  34348. var result = this;
  34349. if (result.__filtered__ && (start > 0 || end < 0)) {
  34350. return new LazyWrapper(result);
  34351. }
  34352. if (start < 0) {
  34353. result = result.takeRight(-start);
  34354. } else if (start) {
  34355. result = result.drop(start);
  34356. }
  34357. if (end !== undefined) {
  34358. end = toInteger(end);
  34359. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34360. }
  34361. return result;
  34362. };
  34363. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34364. return this.reverse().takeWhile(predicate).reverse();
  34365. };
  34366. LazyWrapper.prototype.toArray = function() {
  34367. return this.take(MAX_ARRAY_LENGTH);
  34368. };
  34369. // Add `LazyWrapper` methods to `lodash.prototype`.
  34370. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34371. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34372. isTaker = /^(?:head|last)$/.test(methodName),
  34373. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34374. retUnwrapped = isTaker || /^find/.test(methodName);
  34375. if (!lodashFunc) {
  34376. return;
  34377. }
  34378. lodash.prototype[methodName] = function() {
  34379. var value = this.__wrapped__,
  34380. args = isTaker ? [1] : arguments,
  34381. isLazy = value instanceof LazyWrapper,
  34382. iteratee = args[0],
  34383. useLazy = isLazy || isArray(value);
  34384. var interceptor = function(value) {
  34385. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34386. return (isTaker && chainAll) ? result[0] : result;
  34387. };
  34388. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34389. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34390. isLazy = useLazy = false;
  34391. }
  34392. var chainAll = this.__chain__,
  34393. isHybrid = !!this.__actions__.length,
  34394. isUnwrapped = retUnwrapped && !chainAll,
  34395. onlyLazy = isLazy && !isHybrid;
  34396. if (!retUnwrapped && useLazy) {
  34397. value = onlyLazy ? value : new LazyWrapper(this);
  34398. var result = func.apply(value, args);
  34399. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34400. return new LodashWrapper(result, chainAll);
  34401. }
  34402. if (isUnwrapped && onlyLazy) {
  34403. return func.apply(this, args);
  34404. }
  34405. result = this.thru(interceptor);
  34406. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34407. };
  34408. });
  34409. // Add `Array` methods to `lodash.prototype`.
  34410. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34411. var func = arrayProto[methodName],
  34412. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34413. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34414. lodash.prototype[methodName] = function() {
  34415. var args = arguments;
  34416. if (retUnwrapped && !this.__chain__) {
  34417. var value = this.value();
  34418. return func.apply(isArray(value) ? value : [], args);
  34419. }
  34420. return this[chainName](function(value) {
  34421. return func.apply(isArray(value) ? value : [], args);
  34422. });
  34423. };
  34424. });
  34425. // Map minified method names to their real names.
  34426. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34427. var lodashFunc = lodash[methodName];
  34428. if (lodashFunc) {
  34429. var key = lodashFunc.name + '';
  34430. if (!hasOwnProperty.call(realNames, key)) {
  34431. realNames[key] = [];
  34432. }
  34433. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34434. }
  34435. });
  34436. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34437. 'name': 'wrapper',
  34438. 'func': undefined
  34439. }];
  34440. // Add methods to `LazyWrapper`.
  34441. LazyWrapper.prototype.clone = lazyClone;
  34442. LazyWrapper.prototype.reverse = lazyReverse;
  34443. LazyWrapper.prototype.value = lazyValue;
  34444. // Add chain sequence methods to the `lodash` wrapper.
  34445. lodash.prototype.at = wrapperAt;
  34446. lodash.prototype.chain = wrapperChain;
  34447. lodash.prototype.commit = wrapperCommit;
  34448. lodash.prototype.next = wrapperNext;
  34449. lodash.prototype.plant = wrapperPlant;
  34450. lodash.prototype.reverse = wrapperReverse;
  34451. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34452. // Add lazy aliases.
  34453. lodash.prototype.first = lodash.prototype.head;
  34454. if (symIterator) {
  34455. lodash.prototype[symIterator] = wrapperToIterator;
  34456. }
  34457. return lodash;
  34458. });
  34459. /*--------------------------------------------------------------------------*/
  34460. // Export lodash.
  34461. var _ = runInContext();
  34462. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34463. if (true) {
  34464. // Expose Lodash on the global object to prevent errors when Lodash is
  34465. // loaded by a script tag in the presence of an AMD loader.
  34466. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34467. // Use `_.noConflict` to remove Lodash from the global object.
  34468. root._ = _;
  34469. // Define as an anonymous module so, through path mapping, it can be
  34470. // referenced as the "underscore" module.
  34471. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34472. return _;
  34473. }).call(exports, __webpack_require__, exports, module),
  34474. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34475. }
  34476. // Check for `exports` after `define` in case a build optimizer adds it.
  34477. else {}
  34478. }.call(this));
  34479. /* 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)))
  34480. /***/ }),
  34481. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34482. /*!***************************************************!*\
  34483. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34484. \***************************************************/
  34485. /*! exports provided: default */
  34486. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34487. "use strict";
  34488. __webpack_require__.r(__webpack_exports__);
  34489. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34490. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34491. * @version 1.16.1
  34492. * @license
  34493. * Copyright (c) 2016 Federico Zivolo and contributors
  34494. *
  34495. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34496. * of this software and associated documentation files (the "Software"), to deal
  34497. * in the Software without restriction, including without limitation the rights
  34498. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34499. * copies of the Software, and to permit persons to whom the Software is
  34500. * furnished to do so, subject to the following conditions:
  34501. *
  34502. * The above copyright notice and this permission notice shall be included in all
  34503. * copies or substantial portions of the Software.
  34504. *
  34505. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34506. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34507. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34508. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34509. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34510. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34511. * SOFTWARE.
  34512. */
  34513. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34514. var timeoutDuration = function () {
  34515. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34516. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34517. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34518. return 1;
  34519. }
  34520. }
  34521. return 0;
  34522. }();
  34523. function microtaskDebounce(fn) {
  34524. var called = false;
  34525. return function () {
  34526. if (called) {
  34527. return;
  34528. }
  34529. called = true;
  34530. window.Promise.resolve().then(function () {
  34531. called = false;
  34532. fn();
  34533. });
  34534. };
  34535. }
  34536. function taskDebounce(fn) {
  34537. var scheduled = false;
  34538. return function () {
  34539. if (!scheduled) {
  34540. scheduled = true;
  34541. setTimeout(function () {
  34542. scheduled = false;
  34543. fn();
  34544. }, timeoutDuration);
  34545. }
  34546. };
  34547. }
  34548. var supportsMicroTasks = isBrowser && window.Promise;
  34549. /**
  34550. * Create a debounced version of a method, that's asynchronously deferred
  34551. * but called in the minimum time possible.
  34552. *
  34553. * @method
  34554. * @memberof Popper.Utils
  34555. * @argument {Function} fn
  34556. * @returns {Function}
  34557. */
  34558. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34559. /**
  34560. * Check if the given variable is a function
  34561. * @method
  34562. * @memberof Popper.Utils
  34563. * @argument {Any} functionToCheck - variable to check
  34564. * @returns {Boolean} answer to: is a function?
  34565. */
  34566. function isFunction(functionToCheck) {
  34567. var getType = {};
  34568. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34569. }
  34570. /**
  34571. * Get CSS computed property of the given element
  34572. * @method
  34573. * @memberof Popper.Utils
  34574. * @argument {Eement} element
  34575. * @argument {String} property
  34576. */
  34577. function getStyleComputedProperty(element, property) {
  34578. if (element.nodeType !== 1) {
  34579. return [];
  34580. }
  34581. // NOTE: 1 DOM access here
  34582. var window = element.ownerDocument.defaultView;
  34583. var css = window.getComputedStyle(element, null);
  34584. return property ? css[property] : css;
  34585. }
  34586. /**
  34587. * Returns the parentNode or the host of the element
  34588. * @method
  34589. * @memberof Popper.Utils
  34590. * @argument {Element} element
  34591. * @returns {Element} parent
  34592. */
  34593. function getParentNode(element) {
  34594. if (element.nodeName === 'HTML') {
  34595. return element;
  34596. }
  34597. return element.parentNode || element.host;
  34598. }
  34599. /**
  34600. * Returns the scrolling parent of the given element
  34601. * @method
  34602. * @memberof Popper.Utils
  34603. * @argument {Element} element
  34604. * @returns {Element} scroll parent
  34605. */
  34606. function getScrollParent(element) {
  34607. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34608. if (!element) {
  34609. return document.body;
  34610. }
  34611. switch (element.nodeName) {
  34612. case 'HTML':
  34613. case 'BODY':
  34614. return element.ownerDocument.body;
  34615. case '#document':
  34616. return element.body;
  34617. }
  34618. // Firefox want us to check `-x` and `-y` variations as well
  34619. var _getStyleComputedProp = getStyleComputedProperty(element),
  34620. overflow = _getStyleComputedProp.overflow,
  34621. overflowX = _getStyleComputedProp.overflowX,
  34622. overflowY = _getStyleComputedProp.overflowY;
  34623. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34624. return element;
  34625. }
  34626. return getScrollParent(getParentNode(element));
  34627. }
  34628. /**
  34629. * Returns the reference node of the reference object, or the reference object itself.
  34630. * @method
  34631. * @memberof Popper.Utils
  34632. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34633. * @returns {Element} parent
  34634. */
  34635. function getReferenceNode(reference) {
  34636. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34637. }
  34638. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34639. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34640. /**
  34641. * Determines if the browser is Internet Explorer
  34642. * @method
  34643. * @memberof Popper.Utils
  34644. * @param {Number} version to check
  34645. * @returns {Boolean} isIE
  34646. */
  34647. function isIE(version) {
  34648. if (version === 11) {
  34649. return isIE11;
  34650. }
  34651. if (version === 10) {
  34652. return isIE10;
  34653. }
  34654. return isIE11 || isIE10;
  34655. }
  34656. /**
  34657. * Returns the offset parent of the given element
  34658. * @method
  34659. * @memberof Popper.Utils
  34660. * @argument {Element} element
  34661. * @returns {Element} offset parent
  34662. */
  34663. function getOffsetParent(element) {
  34664. if (!element) {
  34665. return document.documentElement;
  34666. }
  34667. var noOffsetParent = isIE(10) ? document.body : null;
  34668. // NOTE: 1 DOM access here
  34669. var offsetParent = element.offsetParent || null;
  34670. // Skip hidden elements which don't have an offsetParent
  34671. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34672. offsetParent = (element = element.nextElementSibling).offsetParent;
  34673. }
  34674. var nodeName = offsetParent && offsetParent.nodeName;
  34675. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34676. return element ? element.ownerDocument.documentElement : document.documentElement;
  34677. }
  34678. // .offsetParent will return the closest TH, TD or TABLE in case
  34679. // no offsetParent is present, I hate this job...
  34680. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34681. return getOffsetParent(offsetParent);
  34682. }
  34683. return offsetParent;
  34684. }
  34685. function isOffsetContainer(element) {
  34686. var nodeName = element.nodeName;
  34687. if (nodeName === 'BODY') {
  34688. return false;
  34689. }
  34690. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34691. }
  34692. /**
  34693. * Finds the root node (document, shadowDOM root) of the given element
  34694. * @method
  34695. * @memberof Popper.Utils
  34696. * @argument {Element} node
  34697. * @returns {Element} root node
  34698. */
  34699. function getRoot(node) {
  34700. if (node.parentNode !== null) {
  34701. return getRoot(node.parentNode);
  34702. }
  34703. return node;
  34704. }
  34705. /**
  34706. * Finds the offset parent common to the two provided nodes
  34707. * @method
  34708. * @memberof Popper.Utils
  34709. * @argument {Element} element1
  34710. * @argument {Element} element2
  34711. * @returns {Element} common offset parent
  34712. */
  34713. function findCommonOffsetParent(element1, element2) {
  34714. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34715. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34716. return document.documentElement;
  34717. }
  34718. // Here we make sure to give as "start" the element that comes first in the DOM
  34719. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34720. var start = order ? element1 : element2;
  34721. var end = order ? element2 : element1;
  34722. // Get common ancestor container
  34723. var range = document.createRange();
  34724. range.setStart(start, 0);
  34725. range.setEnd(end, 0);
  34726. var commonAncestorContainer = range.commonAncestorContainer;
  34727. // Both nodes are inside #document
  34728. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34729. if (isOffsetContainer(commonAncestorContainer)) {
  34730. return commonAncestorContainer;
  34731. }
  34732. return getOffsetParent(commonAncestorContainer);
  34733. }
  34734. // one of the nodes is inside shadowDOM, find which one
  34735. var element1root = getRoot(element1);
  34736. if (element1root.host) {
  34737. return findCommonOffsetParent(element1root.host, element2);
  34738. } else {
  34739. return findCommonOffsetParent(element1, getRoot(element2).host);
  34740. }
  34741. }
  34742. /**
  34743. * Gets the scroll value of the given element in the given side (top and left)
  34744. * @method
  34745. * @memberof Popper.Utils
  34746. * @argument {Element} element
  34747. * @argument {String} side `top` or `left`
  34748. * @returns {number} amount of scrolled pixels
  34749. */
  34750. function getScroll(element) {
  34751. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34752. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34753. var nodeName = element.nodeName;
  34754. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34755. var html = element.ownerDocument.documentElement;
  34756. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34757. return scrollingElement[upperSide];
  34758. }
  34759. return element[upperSide];
  34760. }
  34761. /*
  34762. * Sum or subtract the element scroll values (left and top) from a given rect object
  34763. * @method
  34764. * @memberof Popper.Utils
  34765. * @param {Object} rect - Rect object you want to change
  34766. * @param {HTMLElement} element - The element from the function reads the scroll values
  34767. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34768. * @return {Object} rect - The modifier rect object
  34769. */
  34770. function includeScroll(rect, element) {
  34771. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34772. var scrollTop = getScroll(element, 'top');
  34773. var scrollLeft = getScroll(element, 'left');
  34774. var modifier = subtract ? -1 : 1;
  34775. rect.top += scrollTop * modifier;
  34776. rect.bottom += scrollTop * modifier;
  34777. rect.left += scrollLeft * modifier;
  34778. rect.right += scrollLeft * modifier;
  34779. return rect;
  34780. }
  34781. /*
  34782. * Helper to detect borders of a given element
  34783. * @method
  34784. * @memberof Popper.Utils
  34785. * @param {CSSStyleDeclaration} styles
  34786. * Result of `getStyleComputedProperty` on the given element
  34787. * @param {String} axis - `x` or `y`
  34788. * @return {number} borders - The borders size of the given axis
  34789. */
  34790. function getBordersSize(styles, axis) {
  34791. var sideA = axis === 'x' ? 'Left' : 'Top';
  34792. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34793. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34794. }
  34795. function getSize(axis, body, html, computedStyle) {
  34796. 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);
  34797. }
  34798. function getWindowSizes(document) {
  34799. var body = document.body;
  34800. var html = document.documentElement;
  34801. var computedStyle = isIE(10) && getComputedStyle(html);
  34802. return {
  34803. height: getSize('Height', body, html, computedStyle),
  34804. width: getSize('Width', body, html, computedStyle)
  34805. };
  34806. }
  34807. var classCallCheck = function (instance, Constructor) {
  34808. if (!(instance instanceof Constructor)) {
  34809. throw new TypeError("Cannot call a class as a function");
  34810. }
  34811. };
  34812. var createClass = function () {
  34813. function defineProperties(target, props) {
  34814. for (var i = 0; i < props.length; i++) {
  34815. var descriptor = props[i];
  34816. descriptor.enumerable = descriptor.enumerable || false;
  34817. descriptor.configurable = true;
  34818. if ("value" in descriptor) descriptor.writable = true;
  34819. Object.defineProperty(target, descriptor.key, descriptor);
  34820. }
  34821. }
  34822. return function (Constructor, protoProps, staticProps) {
  34823. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34824. if (staticProps) defineProperties(Constructor, staticProps);
  34825. return Constructor;
  34826. };
  34827. }();
  34828. var defineProperty = function (obj, key, value) {
  34829. if (key in obj) {
  34830. Object.defineProperty(obj, key, {
  34831. value: value,
  34832. enumerable: true,
  34833. configurable: true,
  34834. writable: true
  34835. });
  34836. } else {
  34837. obj[key] = value;
  34838. }
  34839. return obj;
  34840. };
  34841. var _extends = Object.assign || function (target) {
  34842. for (var i = 1; i < arguments.length; i++) {
  34843. var source = arguments[i];
  34844. for (var key in source) {
  34845. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34846. target[key] = source[key];
  34847. }
  34848. }
  34849. }
  34850. return target;
  34851. };
  34852. /**
  34853. * Given element offsets, generate an output similar to getBoundingClientRect
  34854. * @method
  34855. * @memberof Popper.Utils
  34856. * @argument {Object} offsets
  34857. * @returns {Object} ClientRect like output
  34858. */
  34859. function getClientRect(offsets) {
  34860. return _extends({}, offsets, {
  34861. right: offsets.left + offsets.width,
  34862. bottom: offsets.top + offsets.height
  34863. });
  34864. }
  34865. /**
  34866. * Get bounding client rect of given element
  34867. * @method
  34868. * @memberof Popper.Utils
  34869. * @param {HTMLElement} element
  34870. * @return {Object} client rect
  34871. */
  34872. function getBoundingClientRect(element) {
  34873. var rect = {};
  34874. // IE10 10 FIX: Please, don't ask, the element isn't
  34875. // considered in DOM in some circumstances...
  34876. // This isn't reproducible in IE10 compatibility mode of IE11
  34877. try {
  34878. if (isIE(10)) {
  34879. rect = element.getBoundingClientRect();
  34880. var scrollTop = getScroll(element, 'top');
  34881. var scrollLeft = getScroll(element, 'left');
  34882. rect.top += scrollTop;
  34883. rect.left += scrollLeft;
  34884. rect.bottom += scrollTop;
  34885. rect.right += scrollLeft;
  34886. } else {
  34887. rect = element.getBoundingClientRect();
  34888. }
  34889. } catch (e) {}
  34890. var result = {
  34891. left: rect.left,
  34892. top: rect.top,
  34893. width: rect.right - rect.left,
  34894. height: rect.bottom - rect.top
  34895. };
  34896. // subtract scrollbar size from sizes
  34897. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34898. var width = sizes.width || element.clientWidth || result.width;
  34899. var height = sizes.height || element.clientHeight || result.height;
  34900. var horizScrollbar = element.offsetWidth - width;
  34901. var vertScrollbar = element.offsetHeight - height;
  34902. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34903. // we make this check conditional for performance reasons
  34904. if (horizScrollbar || vertScrollbar) {
  34905. var styles = getStyleComputedProperty(element);
  34906. horizScrollbar -= getBordersSize(styles, 'x');
  34907. vertScrollbar -= getBordersSize(styles, 'y');
  34908. result.width -= horizScrollbar;
  34909. result.height -= vertScrollbar;
  34910. }
  34911. return getClientRect(result);
  34912. }
  34913. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34914. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34915. var isIE10 = isIE(10);
  34916. var isHTML = parent.nodeName === 'HTML';
  34917. var childrenRect = getBoundingClientRect(children);
  34918. var parentRect = getBoundingClientRect(parent);
  34919. var scrollParent = getScrollParent(children);
  34920. var styles = getStyleComputedProperty(parent);
  34921. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34922. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34923. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34924. if (fixedPosition && isHTML) {
  34925. parentRect.top = Math.max(parentRect.top, 0);
  34926. parentRect.left = Math.max(parentRect.left, 0);
  34927. }
  34928. var offsets = getClientRect({
  34929. top: childrenRect.top - parentRect.top - borderTopWidth,
  34930. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34931. width: childrenRect.width,
  34932. height: childrenRect.height
  34933. });
  34934. offsets.marginTop = 0;
  34935. offsets.marginLeft = 0;
  34936. // Subtract margins of documentElement in case it's being used as parent
  34937. // we do this only on HTML because it's the only element that behaves
  34938. // differently when margins are applied to it. The margins are included in
  34939. // the box of the documentElement, in the other cases not.
  34940. if (!isIE10 && isHTML) {
  34941. var marginTop = parseFloat(styles.marginTop);
  34942. var marginLeft = parseFloat(styles.marginLeft);
  34943. offsets.top -= borderTopWidth - marginTop;
  34944. offsets.bottom -= borderTopWidth - marginTop;
  34945. offsets.left -= borderLeftWidth - marginLeft;
  34946. offsets.right -= borderLeftWidth - marginLeft;
  34947. // Attach marginTop and marginLeft because in some circumstances we may need them
  34948. offsets.marginTop = marginTop;
  34949. offsets.marginLeft = marginLeft;
  34950. }
  34951. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34952. offsets = includeScroll(offsets, parent);
  34953. }
  34954. return offsets;
  34955. }
  34956. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34957. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34958. var html = element.ownerDocument.documentElement;
  34959. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34960. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34961. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34962. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34963. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34964. var offset = {
  34965. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34966. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34967. width: width,
  34968. height: height
  34969. };
  34970. return getClientRect(offset);
  34971. }
  34972. /**
  34973. * Check if the given element is fixed or is inside a fixed parent
  34974. * @method
  34975. * @memberof Popper.Utils
  34976. * @argument {Element} element
  34977. * @argument {Element} customContainer
  34978. * @returns {Boolean} answer to "isFixed?"
  34979. */
  34980. function isFixed(element) {
  34981. var nodeName = element.nodeName;
  34982. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34983. return false;
  34984. }
  34985. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34986. return true;
  34987. }
  34988. var parentNode = getParentNode(element);
  34989. if (!parentNode) {
  34990. return false;
  34991. }
  34992. return isFixed(parentNode);
  34993. }
  34994. /**
  34995. * Finds the first parent of an element that has a transformed property defined
  34996. * @method
  34997. * @memberof Popper.Utils
  34998. * @argument {Element} element
  34999. * @returns {Element} first transformed parent or documentElement
  35000. */
  35001. function getFixedPositionOffsetParent(element) {
  35002. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35003. if (!element || !element.parentElement || isIE()) {
  35004. return document.documentElement;
  35005. }
  35006. var el = element.parentElement;
  35007. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35008. el = el.parentElement;
  35009. }
  35010. return el || document.documentElement;
  35011. }
  35012. /**
  35013. * Computed the boundaries limits and return them
  35014. * @method
  35015. * @memberof Popper.Utils
  35016. * @param {HTMLElement} popper
  35017. * @param {HTMLElement} reference
  35018. * @param {number} padding
  35019. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35020. * @param {Boolean} fixedPosition - Is in fixed position mode
  35021. * @returns {Object} Coordinates of the boundaries
  35022. */
  35023. function getBoundaries(popper, reference, padding, boundariesElement) {
  35024. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35025. // NOTE: 1 DOM access here
  35026. var boundaries = { top: 0, left: 0 };
  35027. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35028. // Handle viewport case
  35029. if (boundariesElement === 'viewport') {
  35030. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35031. } else {
  35032. // Handle other cases based on DOM element used as boundaries
  35033. var boundariesNode = void 0;
  35034. if (boundariesElement === 'scrollParent') {
  35035. boundariesNode = getScrollParent(getParentNode(reference));
  35036. if (boundariesNode.nodeName === 'BODY') {
  35037. boundariesNode = popper.ownerDocument.documentElement;
  35038. }
  35039. } else if (boundariesElement === 'window') {
  35040. boundariesNode = popper.ownerDocument.documentElement;
  35041. } else {
  35042. boundariesNode = boundariesElement;
  35043. }
  35044. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35045. // In case of HTML, we need a different computation
  35046. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35047. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35048. height = _getWindowSizes.height,
  35049. width = _getWindowSizes.width;
  35050. boundaries.top += offsets.top - offsets.marginTop;
  35051. boundaries.bottom = height + offsets.top;
  35052. boundaries.left += offsets.left - offsets.marginLeft;
  35053. boundaries.right = width + offsets.left;
  35054. } else {
  35055. // for all the other DOM elements, this one is good
  35056. boundaries = offsets;
  35057. }
  35058. }
  35059. // Add paddings
  35060. padding = padding || 0;
  35061. var isPaddingNumber = typeof padding === 'number';
  35062. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35063. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35064. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35065. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35066. return boundaries;
  35067. }
  35068. function getArea(_ref) {
  35069. var width = _ref.width,
  35070. height = _ref.height;
  35071. return width * height;
  35072. }
  35073. /**
  35074. * Utility used to transform the `auto` placement to the placement with more
  35075. * available space.
  35076. * @method
  35077. * @memberof Popper.Utils
  35078. * @argument {Object} data - The data object generated by update method
  35079. * @argument {Object} options - Modifiers configuration and options
  35080. * @returns {Object} The data object, properly modified
  35081. */
  35082. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35083. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35084. if (placement.indexOf('auto') === -1) {
  35085. return placement;
  35086. }
  35087. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35088. var rects = {
  35089. top: {
  35090. width: boundaries.width,
  35091. height: refRect.top - boundaries.top
  35092. },
  35093. right: {
  35094. width: boundaries.right - refRect.right,
  35095. height: boundaries.height
  35096. },
  35097. bottom: {
  35098. width: boundaries.width,
  35099. height: boundaries.bottom - refRect.bottom
  35100. },
  35101. left: {
  35102. width: refRect.left - boundaries.left,
  35103. height: boundaries.height
  35104. }
  35105. };
  35106. var sortedAreas = Object.keys(rects).map(function (key) {
  35107. return _extends({
  35108. key: key
  35109. }, rects[key], {
  35110. area: getArea(rects[key])
  35111. });
  35112. }).sort(function (a, b) {
  35113. return b.area - a.area;
  35114. });
  35115. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35116. var width = _ref2.width,
  35117. height = _ref2.height;
  35118. return width >= popper.clientWidth && height >= popper.clientHeight;
  35119. });
  35120. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35121. var variation = placement.split('-')[1];
  35122. return computedPlacement + (variation ? '-' + variation : '');
  35123. }
  35124. /**
  35125. * Get offsets to the reference element
  35126. * @method
  35127. * @memberof Popper.Utils
  35128. * @param {Object} state
  35129. * @param {Element} popper - the popper element
  35130. * @param {Element} reference - the reference element (the popper will be relative to this)
  35131. * @param {Element} fixedPosition - is in fixed position mode
  35132. * @returns {Object} An object containing the offsets which will be applied to the popper
  35133. */
  35134. function getReferenceOffsets(state, popper, reference) {
  35135. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35136. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35137. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35138. }
  35139. /**
  35140. * Get the outer sizes of the given element (offset size + margins)
  35141. * @method
  35142. * @memberof Popper.Utils
  35143. * @argument {Element} element
  35144. * @returns {Object} object containing width and height properties
  35145. */
  35146. function getOuterSizes(element) {
  35147. var window = element.ownerDocument.defaultView;
  35148. var styles = window.getComputedStyle(element);
  35149. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35150. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35151. var result = {
  35152. width: element.offsetWidth + y,
  35153. height: element.offsetHeight + x
  35154. };
  35155. return result;
  35156. }
  35157. /**
  35158. * Get the opposite placement of the given one
  35159. * @method
  35160. * @memberof Popper.Utils
  35161. * @argument {String} placement
  35162. * @returns {String} flipped placement
  35163. */
  35164. function getOppositePlacement(placement) {
  35165. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35166. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35167. return hash[matched];
  35168. });
  35169. }
  35170. /**
  35171. * Get offsets to the popper
  35172. * @method
  35173. * @memberof Popper.Utils
  35174. * @param {Object} position - CSS position the Popper will get applied
  35175. * @param {HTMLElement} popper - the popper element
  35176. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35177. * @param {String} placement - one of the valid placement options
  35178. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35179. */
  35180. function getPopperOffsets(popper, referenceOffsets, placement) {
  35181. placement = placement.split('-')[0];
  35182. // Get popper node sizes
  35183. var popperRect = getOuterSizes(popper);
  35184. // Add position, width and height to our offsets object
  35185. var popperOffsets = {
  35186. width: popperRect.width,
  35187. height: popperRect.height
  35188. };
  35189. // depending by the popper placement we have to compute its offsets slightly differently
  35190. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35191. var mainSide = isHoriz ? 'top' : 'left';
  35192. var secondarySide = isHoriz ? 'left' : 'top';
  35193. var measurement = isHoriz ? 'height' : 'width';
  35194. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35195. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35196. if (placement === secondarySide) {
  35197. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35198. } else {
  35199. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35200. }
  35201. return popperOffsets;
  35202. }
  35203. /**
  35204. * Mimics the `find` method of Array
  35205. * @method
  35206. * @memberof Popper.Utils
  35207. * @argument {Array} arr
  35208. * @argument prop
  35209. * @argument value
  35210. * @returns index or -1
  35211. */
  35212. function find(arr, check) {
  35213. // use native find if supported
  35214. if (Array.prototype.find) {
  35215. return arr.find(check);
  35216. }
  35217. // use `filter` to obtain the same behavior of `find`
  35218. return arr.filter(check)[0];
  35219. }
  35220. /**
  35221. * Return the index of the matching object
  35222. * @method
  35223. * @memberof Popper.Utils
  35224. * @argument {Array} arr
  35225. * @argument prop
  35226. * @argument value
  35227. * @returns index or -1
  35228. */
  35229. function findIndex(arr, prop, value) {
  35230. // use native findIndex if supported
  35231. if (Array.prototype.findIndex) {
  35232. return arr.findIndex(function (cur) {
  35233. return cur[prop] === value;
  35234. });
  35235. }
  35236. // use `find` + `indexOf` if `findIndex` isn't supported
  35237. var match = find(arr, function (obj) {
  35238. return obj[prop] === value;
  35239. });
  35240. return arr.indexOf(match);
  35241. }
  35242. /**
  35243. * Loop trough the list of modifiers and run them in order,
  35244. * each of them will then edit the data object.
  35245. * @method
  35246. * @memberof Popper.Utils
  35247. * @param {dataObject} data
  35248. * @param {Array} modifiers
  35249. * @param {String} ends - Optional modifier name used as stopper
  35250. * @returns {dataObject}
  35251. */
  35252. function runModifiers(modifiers, data, ends) {
  35253. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35254. modifiersToRun.forEach(function (modifier) {
  35255. if (modifier['function']) {
  35256. // eslint-disable-line dot-notation
  35257. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35258. }
  35259. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35260. if (modifier.enabled && isFunction(fn)) {
  35261. // Add properties to offsets to make them a complete clientRect object
  35262. // we do this before each modifier to make sure the previous one doesn't
  35263. // mess with these values
  35264. data.offsets.popper = getClientRect(data.offsets.popper);
  35265. data.offsets.reference = getClientRect(data.offsets.reference);
  35266. data = fn(data, modifier);
  35267. }
  35268. });
  35269. return data;
  35270. }
  35271. /**
  35272. * Updates the position of the popper, computing the new offsets and applying
  35273. * the new style.<br />
  35274. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35275. * @method
  35276. * @memberof Popper
  35277. */
  35278. function update() {
  35279. // if popper is destroyed, don't perform any further update
  35280. if (this.state.isDestroyed) {
  35281. return;
  35282. }
  35283. var data = {
  35284. instance: this,
  35285. styles: {},
  35286. arrowStyles: {},
  35287. attributes: {},
  35288. flipped: false,
  35289. offsets: {}
  35290. };
  35291. // compute reference element offsets
  35292. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35293. // compute auto placement, store placement inside the data object,
  35294. // modifiers will be able to edit `placement` if needed
  35295. // and refer to originalPlacement to know the original value
  35296. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35297. // store the computed placement inside `originalPlacement`
  35298. data.originalPlacement = data.placement;
  35299. data.positionFixed = this.options.positionFixed;
  35300. // compute the popper offsets
  35301. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35302. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35303. // run the modifiers
  35304. data = runModifiers(this.modifiers, data);
  35305. // the first `update` will call `onCreate` callback
  35306. // the other ones will call `onUpdate` callback
  35307. if (!this.state.isCreated) {
  35308. this.state.isCreated = true;
  35309. this.options.onCreate(data);
  35310. } else {
  35311. this.options.onUpdate(data);
  35312. }
  35313. }
  35314. /**
  35315. * Helper used to know if the given modifier is enabled.
  35316. * @method
  35317. * @memberof Popper.Utils
  35318. * @returns {Boolean}
  35319. */
  35320. function isModifierEnabled(modifiers, modifierName) {
  35321. return modifiers.some(function (_ref) {
  35322. var name = _ref.name,
  35323. enabled = _ref.enabled;
  35324. return enabled && name === modifierName;
  35325. });
  35326. }
  35327. /**
  35328. * Get the prefixed supported property name
  35329. * @method
  35330. * @memberof Popper.Utils
  35331. * @argument {String} property (camelCase)
  35332. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35333. */
  35334. function getSupportedPropertyName(property) {
  35335. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35336. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35337. for (var i = 0; i < prefixes.length; i++) {
  35338. var prefix = prefixes[i];
  35339. var toCheck = prefix ? '' + prefix + upperProp : property;
  35340. if (typeof document.body.style[toCheck] !== 'undefined') {
  35341. return toCheck;
  35342. }
  35343. }
  35344. return null;
  35345. }
  35346. /**
  35347. * Destroys the popper.
  35348. * @method
  35349. * @memberof Popper
  35350. */
  35351. function destroy() {
  35352. this.state.isDestroyed = true;
  35353. // touch DOM only if `applyStyle` modifier is enabled
  35354. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35355. this.popper.removeAttribute('x-placement');
  35356. this.popper.style.position = '';
  35357. this.popper.style.top = '';
  35358. this.popper.style.left = '';
  35359. this.popper.style.right = '';
  35360. this.popper.style.bottom = '';
  35361. this.popper.style.willChange = '';
  35362. this.popper.style[getSupportedPropertyName('transform')] = '';
  35363. }
  35364. this.disableEventListeners();
  35365. // remove the popper if user explicitly asked for the deletion on destroy
  35366. // do not use `remove` because IE11 doesn't support it
  35367. if (this.options.removeOnDestroy) {
  35368. this.popper.parentNode.removeChild(this.popper);
  35369. }
  35370. return this;
  35371. }
  35372. /**
  35373. * Get the window associated with the element
  35374. * @argument {Element} element
  35375. * @returns {Window}
  35376. */
  35377. function getWindow(element) {
  35378. var ownerDocument = element.ownerDocument;
  35379. return ownerDocument ? ownerDocument.defaultView : window;
  35380. }
  35381. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35382. var isBody = scrollParent.nodeName === 'BODY';
  35383. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35384. target.addEventListener(event, callback, { passive: true });
  35385. if (!isBody) {
  35386. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35387. }
  35388. scrollParents.push(target);
  35389. }
  35390. /**
  35391. * Setup needed event listeners used to update the popper position
  35392. * @method
  35393. * @memberof Popper.Utils
  35394. * @private
  35395. */
  35396. function setupEventListeners(reference, options, state, updateBound) {
  35397. // Resize event listener on window
  35398. state.updateBound = updateBound;
  35399. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35400. // Scroll event listener on scroll parents
  35401. var scrollElement = getScrollParent(reference);
  35402. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35403. state.scrollElement = scrollElement;
  35404. state.eventsEnabled = true;
  35405. return state;
  35406. }
  35407. /**
  35408. * It will add resize/scroll events and start recalculating
  35409. * position of the popper element when they are triggered.
  35410. * @method
  35411. * @memberof Popper
  35412. */
  35413. function enableEventListeners() {
  35414. if (!this.state.eventsEnabled) {
  35415. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35416. }
  35417. }
  35418. /**
  35419. * Remove event listeners used to update the popper position
  35420. * @method
  35421. * @memberof Popper.Utils
  35422. * @private
  35423. */
  35424. function removeEventListeners(reference, state) {
  35425. // Remove resize event listener on window
  35426. getWindow(reference).removeEventListener('resize', state.updateBound);
  35427. // Remove scroll event listener on scroll parents
  35428. state.scrollParents.forEach(function (target) {
  35429. target.removeEventListener('scroll', state.updateBound);
  35430. });
  35431. // Reset state
  35432. state.updateBound = null;
  35433. state.scrollParents = [];
  35434. state.scrollElement = null;
  35435. state.eventsEnabled = false;
  35436. return state;
  35437. }
  35438. /**
  35439. * It will remove resize/scroll events and won't recalculate popper position
  35440. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35441. * unless you call `update` method manually.
  35442. * @method
  35443. * @memberof Popper
  35444. */
  35445. function disableEventListeners() {
  35446. if (this.state.eventsEnabled) {
  35447. cancelAnimationFrame(this.scheduleUpdate);
  35448. this.state = removeEventListeners(this.reference, this.state);
  35449. }
  35450. }
  35451. /**
  35452. * Tells if a given input is a number
  35453. * @method
  35454. * @memberof Popper.Utils
  35455. * @param {*} input to check
  35456. * @return {Boolean}
  35457. */
  35458. function isNumeric(n) {
  35459. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35460. }
  35461. /**
  35462. * Set the style to the given popper
  35463. * @method
  35464. * @memberof Popper.Utils
  35465. * @argument {Element} element - Element to apply the style to
  35466. * @argument {Object} styles
  35467. * Object with a list of properties and values which will be applied to the element
  35468. */
  35469. function setStyles(element, styles) {
  35470. Object.keys(styles).forEach(function (prop) {
  35471. var unit = '';
  35472. // add unit if the value is numeric and is one of the following
  35473. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35474. unit = 'px';
  35475. }
  35476. element.style[prop] = styles[prop] + unit;
  35477. });
  35478. }
  35479. /**
  35480. * Set the attributes to the given popper
  35481. * @method
  35482. * @memberof Popper.Utils
  35483. * @argument {Element} element - Element to apply the attributes to
  35484. * @argument {Object} styles
  35485. * Object with a list of properties and values which will be applied to the element
  35486. */
  35487. function setAttributes(element, attributes) {
  35488. Object.keys(attributes).forEach(function (prop) {
  35489. var value = attributes[prop];
  35490. if (value !== false) {
  35491. element.setAttribute(prop, attributes[prop]);
  35492. } else {
  35493. element.removeAttribute(prop);
  35494. }
  35495. });
  35496. }
  35497. /**
  35498. * @function
  35499. * @memberof Modifiers
  35500. * @argument {Object} data - The data object generated by `update` method
  35501. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35502. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35503. * @argument {Object} options - Modifiers configuration and options
  35504. * @returns {Object} The same data object
  35505. */
  35506. function applyStyle(data) {
  35507. // any property present in `data.styles` will be applied to the popper,
  35508. // in this way we can make the 3rd party modifiers add custom styles to it
  35509. // Be aware, modifiers could override the properties defined in the previous
  35510. // lines of this modifier!
  35511. setStyles(data.instance.popper, data.styles);
  35512. // any property present in `data.attributes` will be applied to the popper,
  35513. // they will be set as HTML attributes of the element
  35514. setAttributes(data.instance.popper, data.attributes);
  35515. // if arrowElement is defined and arrowStyles has some properties
  35516. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35517. setStyles(data.arrowElement, data.arrowStyles);
  35518. }
  35519. return data;
  35520. }
  35521. /**
  35522. * Set the x-placement attribute before everything else because it could be used
  35523. * to add margins to the popper margins needs to be calculated to get the
  35524. * correct popper offsets.
  35525. * @method
  35526. * @memberof Popper.modifiers
  35527. * @param {HTMLElement} reference - The reference element used to position the popper
  35528. * @param {HTMLElement} popper - The HTML element used as popper
  35529. * @param {Object} options - Popper.js options
  35530. */
  35531. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35532. // compute reference element offsets
  35533. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35534. // compute auto placement, store placement inside the data object,
  35535. // modifiers will be able to edit `placement` if needed
  35536. // and refer to originalPlacement to know the original value
  35537. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35538. popper.setAttribute('x-placement', placement);
  35539. // Apply `position` to popper before anything else because
  35540. // without the position applied we can't guarantee correct computations
  35541. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35542. return options;
  35543. }
  35544. /**
  35545. * @function
  35546. * @memberof Popper.Utils
  35547. * @argument {Object} data - The data object generated by `update` method
  35548. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35549. * @returns {Object} The popper's position offsets rounded
  35550. *
  35551. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35552. * good as it can be within reason.
  35553. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35554. *
  35555. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35556. * as well on High DPI screens).
  35557. *
  35558. * Firefox prefers no rounding for positioning and does not have blurriness on
  35559. * high DPI screens.
  35560. *
  35561. * Only horizontal placement and left/right values need to be considered.
  35562. */
  35563. function getRoundedOffsets(data, shouldRound) {
  35564. var _data$offsets = data.offsets,
  35565. popper = _data$offsets.popper,
  35566. reference = _data$offsets.reference;
  35567. var round = Math.round,
  35568. floor = Math.floor;
  35569. var noRound = function noRound(v) {
  35570. return v;
  35571. };
  35572. var referenceWidth = round(reference.width);
  35573. var popperWidth = round(popper.width);
  35574. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35575. var isVariation = data.placement.indexOf('-') !== -1;
  35576. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35577. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35578. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35579. var verticalToInteger = !shouldRound ? noRound : round;
  35580. return {
  35581. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35582. top: verticalToInteger(popper.top),
  35583. bottom: verticalToInteger(popper.bottom),
  35584. right: horizontalToInteger(popper.right)
  35585. };
  35586. }
  35587. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35588. /**
  35589. * @function
  35590. * @memberof Modifiers
  35591. * @argument {Object} data - The data object generated by `update` method
  35592. * @argument {Object} options - Modifiers configuration and options
  35593. * @returns {Object} The data object, properly modified
  35594. */
  35595. function computeStyle(data, options) {
  35596. var x = options.x,
  35597. y = options.y;
  35598. var popper = data.offsets.popper;
  35599. // Remove this legacy support in Popper.js v2
  35600. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35601. return modifier.name === 'applyStyle';
  35602. }).gpuAcceleration;
  35603. if (legacyGpuAccelerationOption !== undefined) {
  35604. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35605. }
  35606. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35607. var offsetParent = getOffsetParent(data.instance.popper);
  35608. var offsetParentRect = getBoundingClientRect(offsetParent);
  35609. // Styles
  35610. var styles = {
  35611. position: popper.position
  35612. };
  35613. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35614. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35615. var sideB = y === 'right' ? 'left' : 'right';
  35616. // if gpuAcceleration is set to `true` and transform is supported,
  35617. // we use `translate3d` to apply the position to the popper we
  35618. // automatically use the supported prefixed version if needed
  35619. var prefixedProperty = getSupportedPropertyName('transform');
  35620. // now, let's make a step back and look at this code closely (wtf?)
  35621. // If the content of the popper grows once it's been positioned, it
  35622. // may happen that the popper gets misplaced because of the new content
  35623. // overflowing its reference element
  35624. // To avoid this problem, we provide two options (x and y), which allow
  35625. // the consumer to define the offset origin.
  35626. // If we position a popper on top of a reference element, we can set
  35627. // `x` to `top` to make the popper grow towards its top instead of
  35628. // its bottom.
  35629. var left = void 0,
  35630. top = void 0;
  35631. if (sideA === 'bottom') {
  35632. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35633. // and not the bottom of the html element
  35634. if (offsetParent.nodeName === 'HTML') {
  35635. top = -offsetParent.clientHeight + offsets.bottom;
  35636. } else {
  35637. top = -offsetParentRect.height + offsets.bottom;
  35638. }
  35639. } else {
  35640. top = offsets.top;
  35641. }
  35642. if (sideB === 'right') {
  35643. if (offsetParent.nodeName === 'HTML') {
  35644. left = -offsetParent.clientWidth + offsets.right;
  35645. } else {
  35646. left = -offsetParentRect.width + offsets.right;
  35647. }
  35648. } else {
  35649. left = offsets.left;
  35650. }
  35651. if (gpuAcceleration && prefixedProperty) {
  35652. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35653. styles[sideA] = 0;
  35654. styles[sideB] = 0;
  35655. styles.willChange = 'transform';
  35656. } else {
  35657. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35658. var invertTop = sideA === 'bottom' ? -1 : 1;
  35659. var invertLeft = sideB === 'right' ? -1 : 1;
  35660. styles[sideA] = top * invertTop;
  35661. styles[sideB] = left * invertLeft;
  35662. styles.willChange = sideA + ', ' + sideB;
  35663. }
  35664. // Attributes
  35665. var attributes = {
  35666. 'x-placement': data.placement
  35667. };
  35668. // Update `data` attributes, styles and arrowStyles
  35669. data.attributes = _extends({}, attributes, data.attributes);
  35670. data.styles = _extends({}, styles, data.styles);
  35671. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35672. return data;
  35673. }
  35674. /**
  35675. * Helper used to know if the given modifier depends from another one.<br />
  35676. * It checks if the needed modifier is listed and enabled.
  35677. * @method
  35678. * @memberof Popper.Utils
  35679. * @param {Array} modifiers - list of modifiers
  35680. * @param {String} requestingName - name of requesting modifier
  35681. * @param {String} requestedName - name of requested modifier
  35682. * @returns {Boolean}
  35683. */
  35684. function isModifierRequired(modifiers, requestingName, requestedName) {
  35685. var requesting = find(modifiers, function (_ref) {
  35686. var name = _ref.name;
  35687. return name === requestingName;
  35688. });
  35689. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35690. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35691. });
  35692. if (!isRequired) {
  35693. var _requesting = '`' + requestingName + '`';
  35694. var requested = '`' + requestedName + '`';
  35695. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35696. }
  35697. return isRequired;
  35698. }
  35699. /**
  35700. * @function
  35701. * @memberof Modifiers
  35702. * @argument {Object} data - The data object generated by update method
  35703. * @argument {Object} options - Modifiers configuration and options
  35704. * @returns {Object} The data object, properly modified
  35705. */
  35706. function arrow(data, options) {
  35707. var _data$offsets$arrow;
  35708. // arrow depends on keepTogether in order to work
  35709. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35710. return data;
  35711. }
  35712. var arrowElement = options.element;
  35713. // if arrowElement is a string, suppose it's a CSS selector
  35714. if (typeof arrowElement === 'string') {
  35715. arrowElement = data.instance.popper.querySelector(arrowElement);
  35716. // if arrowElement is not found, don't run the modifier
  35717. if (!arrowElement) {
  35718. return data;
  35719. }
  35720. } else {
  35721. // if the arrowElement isn't a query selector we must check that the
  35722. // provided DOM node is child of its popper node
  35723. if (!data.instance.popper.contains(arrowElement)) {
  35724. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35725. return data;
  35726. }
  35727. }
  35728. var placement = data.placement.split('-')[0];
  35729. var _data$offsets = data.offsets,
  35730. popper = _data$offsets.popper,
  35731. reference = _data$offsets.reference;
  35732. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35733. var len = isVertical ? 'height' : 'width';
  35734. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35735. var side = sideCapitalized.toLowerCase();
  35736. var altSide = isVertical ? 'left' : 'top';
  35737. var opSide = isVertical ? 'bottom' : 'right';
  35738. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35739. //
  35740. // extends keepTogether behavior making sure the popper and its
  35741. // reference have enough pixels in conjunction
  35742. //
  35743. // top/left side
  35744. if (reference[opSide] - arrowElementSize < popper[side]) {
  35745. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35746. }
  35747. // bottom/right side
  35748. if (reference[side] + arrowElementSize > popper[opSide]) {
  35749. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35750. }
  35751. data.offsets.popper = getClientRect(data.offsets.popper);
  35752. // compute center of the popper
  35753. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35754. // Compute the sideValue using the updated popper offsets
  35755. // take popper margin in account because we don't have this info available
  35756. var css = getStyleComputedProperty(data.instance.popper);
  35757. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35758. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35759. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35760. // prevent arrowElement from being placed not contiguously to its popper
  35761. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35762. data.arrowElement = arrowElement;
  35763. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35764. return data;
  35765. }
  35766. /**
  35767. * Get the opposite placement variation of the given one
  35768. * @method
  35769. * @memberof Popper.Utils
  35770. * @argument {String} placement variation
  35771. * @returns {String} flipped placement variation
  35772. */
  35773. function getOppositeVariation(variation) {
  35774. if (variation === 'end') {
  35775. return 'start';
  35776. } else if (variation === 'start') {
  35777. return 'end';
  35778. }
  35779. return variation;
  35780. }
  35781. /**
  35782. * List of accepted placements to use as values of the `placement` option.<br />
  35783. * Valid placements are:
  35784. * - `auto`
  35785. * - `top`
  35786. * - `right`
  35787. * - `bottom`
  35788. * - `left`
  35789. *
  35790. * Each placement can have a variation from this list:
  35791. * - `-start`
  35792. * - `-end`
  35793. *
  35794. * Variations are interpreted easily if you think of them as the left to right
  35795. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35796. * is right.<br />
  35797. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35798. *
  35799. * Some valid examples are:
  35800. * - `top-end` (on top of reference, right aligned)
  35801. * - `right-start` (on right of reference, top aligned)
  35802. * - `bottom` (on bottom, centered)
  35803. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35804. *
  35805. * @static
  35806. * @type {Array}
  35807. * @enum {String}
  35808. * @readonly
  35809. * @method placements
  35810. * @memberof Popper
  35811. */
  35812. 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'];
  35813. // Get rid of `auto` `auto-start` and `auto-end`
  35814. var validPlacements = placements.slice(3);
  35815. /**
  35816. * Given an initial placement, returns all the subsequent placements
  35817. * clockwise (or counter-clockwise).
  35818. *
  35819. * @method
  35820. * @memberof Popper.Utils
  35821. * @argument {String} placement - A valid placement (it accepts variations)
  35822. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35823. * @returns {Array} placements including their variations
  35824. */
  35825. function clockwise(placement) {
  35826. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35827. var index = validPlacements.indexOf(placement);
  35828. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35829. return counter ? arr.reverse() : arr;
  35830. }
  35831. var BEHAVIORS = {
  35832. FLIP: 'flip',
  35833. CLOCKWISE: 'clockwise',
  35834. COUNTERCLOCKWISE: 'counterclockwise'
  35835. };
  35836. /**
  35837. * @function
  35838. * @memberof Modifiers
  35839. * @argument {Object} data - The data object generated by update method
  35840. * @argument {Object} options - Modifiers configuration and options
  35841. * @returns {Object} The data object, properly modified
  35842. */
  35843. function flip(data, options) {
  35844. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35845. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35846. return data;
  35847. }
  35848. if (data.flipped && data.placement === data.originalPlacement) {
  35849. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35850. return data;
  35851. }
  35852. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35853. var placement = data.placement.split('-')[0];
  35854. var placementOpposite = getOppositePlacement(placement);
  35855. var variation = data.placement.split('-')[1] || '';
  35856. var flipOrder = [];
  35857. switch (options.behavior) {
  35858. case BEHAVIORS.FLIP:
  35859. flipOrder = [placement, placementOpposite];
  35860. break;
  35861. case BEHAVIORS.CLOCKWISE:
  35862. flipOrder = clockwise(placement);
  35863. break;
  35864. case BEHAVIORS.COUNTERCLOCKWISE:
  35865. flipOrder = clockwise(placement, true);
  35866. break;
  35867. default:
  35868. flipOrder = options.behavior;
  35869. }
  35870. flipOrder.forEach(function (step, index) {
  35871. if (placement !== step || flipOrder.length === index + 1) {
  35872. return data;
  35873. }
  35874. placement = data.placement.split('-')[0];
  35875. placementOpposite = getOppositePlacement(placement);
  35876. var popperOffsets = data.offsets.popper;
  35877. var refOffsets = data.offsets.reference;
  35878. // using floor because the reference offsets may contain decimals we are not going to consider here
  35879. var floor = Math.floor;
  35880. 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);
  35881. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35882. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35883. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35884. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35885. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35886. // flip the variation if required
  35887. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35888. // flips variation if reference element overflows boundaries
  35889. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35890. // flips variation if popper content overflows boundaries
  35891. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35892. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35893. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35894. // this boolean to detect any flip loop
  35895. data.flipped = true;
  35896. if (overlapsRef || overflowsBoundaries) {
  35897. placement = flipOrder[index + 1];
  35898. }
  35899. if (flippedVariation) {
  35900. variation = getOppositeVariation(variation);
  35901. }
  35902. data.placement = placement + (variation ? '-' + variation : '');
  35903. // this object contains `position`, we want to preserve it along with
  35904. // any additional property we may add in the future
  35905. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35906. data = runModifiers(data.instance.modifiers, data, 'flip');
  35907. }
  35908. });
  35909. return data;
  35910. }
  35911. /**
  35912. * @function
  35913. * @memberof Modifiers
  35914. * @argument {Object} data - The data object generated by update method
  35915. * @argument {Object} options - Modifiers configuration and options
  35916. * @returns {Object} The data object, properly modified
  35917. */
  35918. function keepTogether(data) {
  35919. var _data$offsets = data.offsets,
  35920. popper = _data$offsets.popper,
  35921. reference = _data$offsets.reference;
  35922. var placement = data.placement.split('-')[0];
  35923. var floor = Math.floor;
  35924. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35925. var side = isVertical ? 'right' : 'bottom';
  35926. var opSide = isVertical ? 'left' : 'top';
  35927. var measurement = isVertical ? 'width' : 'height';
  35928. if (popper[side] < floor(reference[opSide])) {
  35929. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35930. }
  35931. if (popper[opSide] > floor(reference[side])) {
  35932. data.offsets.popper[opSide] = floor(reference[side]);
  35933. }
  35934. return data;
  35935. }
  35936. /**
  35937. * Converts a string containing value + unit into a px value number
  35938. * @function
  35939. * @memberof {modifiers~offset}
  35940. * @private
  35941. * @argument {String} str - Value + unit string
  35942. * @argument {String} measurement - `height` or `width`
  35943. * @argument {Object} popperOffsets
  35944. * @argument {Object} referenceOffsets
  35945. * @returns {Number|String}
  35946. * Value in pixels, or original string if no values were extracted
  35947. */
  35948. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35949. // separate value from unit
  35950. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35951. var value = +split[1];
  35952. var unit = split[2];
  35953. // If it's not a number it's an operator, I guess
  35954. if (!value) {
  35955. return str;
  35956. }
  35957. if (unit.indexOf('%') === 0) {
  35958. var element = void 0;
  35959. switch (unit) {
  35960. case '%p':
  35961. element = popperOffsets;
  35962. break;
  35963. case '%':
  35964. case '%r':
  35965. default:
  35966. element = referenceOffsets;
  35967. }
  35968. var rect = getClientRect(element);
  35969. return rect[measurement] / 100 * value;
  35970. } else if (unit === 'vh' || unit === 'vw') {
  35971. // if is a vh or vw, we calculate the size based on the viewport
  35972. var size = void 0;
  35973. if (unit === 'vh') {
  35974. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35975. } else {
  35976. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35977. }
  35978. return size / 100 * value;
  35979. } else {
  35980. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35981. // if is an implicit unit, it's px, and we return just the value
  35982. return value;
  35983. }
  35984. }
  35985. /**
  35986. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35987. * @function
  35988. * @memberof {modifiers~offset}
  35989. * @private
  35990. * @argument {String} offset
  35991. * @argument {Object} popperOffsets
  35992. * @argument {Object} referenceOffsets
  35993. * @argument {String} basePlacement
  35994. * @returns {Array} a two cells array with x and y offsets in numbers
  35995. */
  35996. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35997. var offsets = [0, 0];
  35998. // Use height if placement is left or right and index is 0 otherwise use width
  35999. // in this way the first offset will use an axis and the second one
  36000. // will use the other one
  36001. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36002. // Split the offset string to obtain a list of values and operands
  36003. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36004. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36005. return frag.trim();
  36006. });
  36007. // Detect if the offset string contains a pair of values or a single one
  36008. // they could be separated by comma or space
  36009. var divider = fragments.indexOf(find(fragments, function (frag) {
  36010. return frag.search(/,|\s/) !== -1;
  36011. }));
  36012. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36013. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36014. }
  36015. // If divider is found, we divide the list of values and operands to divide
  36016. // them by ofset X and Y.
  36017. var splitRegex = /\s*,\s*|\s+/;
  36018. 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];
  36019. // Convert the values with units to absolute pixels to allow our computations
  36020. ops = ops.map(function (op, index) {
  36021. // Most of the units rely on the orientation of the popper
  36022. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36023. var mergeWithPrevious = false;
  36024. return op
  36025. // This aggregates any `+` or `-` sign that aren't considered operators
  36026. // e.g.: 10 + +5 => [10, +, +5]
  36027. .reduce(function (a, b) {
  36028. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36029. a[a.length - 1] = b;
  36030. mergeWithPrevious = true;
  36031. return a;
  36032. } else if (mergeWithPrevious) {
  36033. a[a.length - 1] += b;
  36034. mergeWithPrevious = false;
  36035. return a;
  36036. } else {
  36037. return a.concat(b);
  36038. }
  36039. }, [])
  36040. // Here we convert the string values into number values (in px)
  36041. .map(function (str) {
  36042. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36043. });
  36044. });
  36045. // Loop trough the offsets arrays and execute the operations
  36046. ops.forEach(function (op, index) {
  36047. op.forEach(function (frag, index2) {
  36048. if (isNumeric(frag)) {
  36049. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36050. }
  36051. });
  36052. });
  36053. return offsets;
  36054. }
  36055. /**
  36056. * @function
  36057. * @memberof Modifiers
  36058. * @argument {Object} data - The data object generated by update method
  36059. * @argument {Object} options - Modifiers configuration and options
  36060. * @argument {Number|String} options.offset=0
  36061. * The offset value as described in the modifier description
  36062. * @returns {Object} The data object, properly modified
  36063. */
  36064. function offset(data, _ref) {
  36065. var offset = _ref.offset;
  36066. var placement = data.placement,
  36067. _data$offsets = data.offsets,
  36068. popper = _data$offsets.popper,
  36069. reference = _data$offsets.reference;
  36070. var basePlacement = placement.split('-')[0];
  36071. var offsets = void 0;
  36072. if (isNumeric(+offset)) {
  36073. offsets = [+offset, 0];
  36074. } else {
  36075. offsets = parseOffset(offset, popper, reference, basePlacement);
  36076. }
  36077. if (basePlacement === 'left') {
  36078. popper.top += offsets[0];
  36079. popper.left -= offsets[1];
  36080. } else if (basePlacement === 'right') {
  36081. popper.top += offsets[0];
  36082. popper.left += offsets[1];
  36083. } else if (basePlacement === 'top') {
  36084. popper.left += offsets[0];
  36085. popper.top -= offsets[1];
  36086. } else if (basePlacement === 'bottom') {
  36087. popper.left += offsets[0];
  36088. popper.top += offsets[1];
  36089. }
  36090. data.popper = popper;
  36091. return data;
  36092. }
  36093. /**
  36094. * @function
  36095. * @memberof Modifiers
  36096. * @argument {Object} data - The data object generated by `update` method
  36097. * @argument {Object} options - Modifiers configuration and options
  36098. * @returns {Object} The data object, properly modified
  36099. */
  36100. function preventOverflow(data, options) {
  36101. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36102. // If offsetParent is the reference element, we really want to
  36103. // go one step up and use the next offsetParent as reference to
  36104. // avoid to make this modifier completely useless and look like broken
  36105. if (data.instance.reference === boundariesElement) {
  36106. boundariesElement = getOffsetParent(boundariesElement);
  36107. }
  36108. // NOTE: DOM access here
  36109. // resets the popper's position so that the document size can be calculated excluding
  36110. // the size of the popper element itself
  36111. var transformProp = getSupportedPropertyName('transform');
  36112. var popperStyles = data.instance.popper.style; // assignment to help minification
  36113. var top = popperStyles.top,
  36114. left = popperStyles.left,
  36115. transform = popperStyles[transformProp];
  36116. popperStyles.top = '';
  36117. popperStyles.left = '';
  36118. popperStyles[transformProp] = '';
  36119. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36120. // NOTE: DOM access here
  36121. // restores the original style properties after the offsets have been computed
  36122. popperStyles.top = top;
  36123. popperStyles.left = left;
  36124. popperStyles[transformProp] = transform;
  36125. options.boundaries = boundaries;
  36126. var order = options.priority;
  36127. var popper = data.offsets.popper;
  36128. var check = {
  36129. primary: function primary(placement) {
  36130. var value = popper[placement];
  36131. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36132. value = Math.max(popper[placement], boundaries[placement]);
  36133. }
  36134. return defineProperty({}, placement, value);
  36135. },
  36136. secondary: function secondary(placement) {
  36137. var mainSide = placement === 'right' ? 'left' : 'top';
  36138. var value = popper[mainSide];
  36139. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36140. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36141. }
  36142. return defineProperty({}, mainSide, value);
  36143. }
  36144. };
  36145. order.forEach(function (placement) {
  36146. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36147. popper = _extends({}, popper, check[side](placement));
  36148. });
  36149. data.offsets.popper = popper;
  36150. return data;
  36151. }
  36152. /**
  36153. * @function
  36154. * @memberof Modifiers
  36155. * @argument {Object} data - The data object generated by `update` method
  36156. * @argument {Object} options - Modifiers configuration and options
  36157. * @returns {Object} The data object, properly modified
  36158. */
  36159. function shift(data) {
  36160. var placement = data.placement;
  36161. var basePlacement = placement.split('-')[0];
  36162. var shiftvariation = placement.split('-')[1];
  36163. // if shift shiftvariation is specified, run the modifier
  36164. if (shiftvariation) {
  36165. var _data$offsets = data.offsets,
  36166. reference = _data$offsets.reference,
  36167. popper = _data$offsets.popper;
  36168. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36169. var side = isVertical ? 'left' : 'top';
  36170. var measurement = isVertical ? 'width' : 'height';
  36171. var shiftOffsets = {
  36172. start: defineProperty({}, side, reference[side]),
  36173. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36174. };
  36175. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36176. }
  36177. return data;
  36178. }
  36179. /**
  36180. * @function
  36181. * @memberof Modifiers
  36182. * @argument {Object} data - The data object generated by update method
  36183. * @argument {Object} options - Modifiers configuration and options
  36184. * @returns {Object} The data object, properly modified
  36185. */
  36186. function hide(data) {
  36187. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36188. return data;
  36189. }
  36190. var refRect = data.offsets.reference;
  36191. var bound = find(data.instance.modifiers, function (modifier) {
  36192. return modifier.name === 'preventOverflow';
  36193. }).boundaries;
  36194. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36195. // Avoid unnecessary DOM access if visibility hasn't changed
  36196. if (data.hide === true) {
  36197. return data;
  36198. }
  36199. data.hide = true;
  36200. data.attributes['x-out-of-boundaries'] = '';
  36201. } else {
  36202. // Avoid unnecessary DOM access if visibility hasn't changed
  36203. if (data.hide === false) {
  36204. return data;
  36205. }
  36206. data.hide = false;
  36207. data.attributes['x-out-of-boundaries'] = false;
  36208. }
  36209. return data;
  36210. }
  36211. /**
  36212. * @function
  36213. * @memberof Modifiers
  36214. * @argument {Object} data - The data object generated by `update` method
  36215. * @argument {Object} options - Modifiers configuration and options
  36216. * @returns {Object} The data object, properly modified
  36217. */
  36218. function inner(data) {
  36219. var placement = data.placement;
  36220. var basePlacement = placement.split('-')[0];
  36221. var _data$offsets = data.offsets,
  36222. popper = _data$offsets.popper,
  36223. reference = _data$offsets.reference;
  36224. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36225. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36226. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36227. data.placement = getOppositePlacement(placement);
  36228. data.offsets.popper = getClientRect(popper);
  36229. return data;
  36230. }
  36231. /**
  36232. * Modifier function, each modifier can have a function of this type assigned
  36233. * to its `fn` property.<br />
  36234. * These functions will be called on each update, this means that you must
  36235. * make sure they are performant enough to avoid performance bottlenecks.
  36236. *
  36237. * @function ModifierFn
  36238. * @argument {dataObject} data - The data object generated by `update` method
  36239. * @argument {Object} options - Modifiers configuration and options
  36240. * @returns {dataObject} The data object, properly modified
  36241. */
  36242. /**
  36243. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36244. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36245. * needed by the library.
  36246. *
  36247. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36248. * All the other properties are configurations that could be tweaked.
  36249. * @namespace modifiers
  36250. */
  36251. var modifiers = {
  36252. /**
  36253. * Modifier used to shift the popper on the start or end of its reference
  36254. * element.<br />
  36255. * It will read the variation of the `placement` property.<br />
  36256. * It can be one either `-end` or `-start`.
  36257. * @memberof modifiers
  36258. * @inner
  36259. */
  36260. shift: {
  36261. /** @prop {number} order=100 - Index used to define the order of execution */
  36262. order: 100,
  36263. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36264. enabled: true,
  36265. /** @prop {ModifierFn} */
  36266. fn: shift
  36267. },
  36268. /**
  36269. * The `offset` modifier can shift your popper on both its axis.
  36270. *
  36271. * It accepts the following units:
  36272. * - `px` or unit-less, interpreted as pixels
  36273. * - `%` or `%r`, percentage relative to the length of the reference element
  36274. * - `%p`, percentage relative to the length of the popper element
  36275. * - `vw`, CSS viewport width unit
  36276. * - `vh`, CSS viewport height unit
  36277. *
  36278. * For length is intended the main axis relative to the placement of the popper.<br />
  36279. * This means that if the placement is `top` or `bottom`, the length will be the
  36280. * `width`. In case of `left` or `right`, it will be the `height`.
  36281. *
  36282. * You can provide a single value (as `Number` or `String`), or a pair of values
  36283. * as `String` divided by a comma or one (or more) white spaces.<br />
  36284. * The latter is a deprecated method because it leads to confusion and will be
  36285. * removed in v2.<br />
  36286. * Additionally, it accepts additions and subtractions between different units.
  36287. * Note that multiplications and divisions aren't supported.
  36288. *
  36289. * Valid examples are:
  36290. * ```
  36291. * 10
  36292. * '10%'
  36293. * '10, 10'
  36294. * '10%, 10'
  36295. * '10 + 10%'
  36296. * '10 - 5vh + 3%'
  36297. * '-10px + 5vh, 5px - 6%'
  36298. * ```
  36299. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36300. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36301. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36302. *
  36303. * @memberof modifiers
  36304. * @inner
  36305. */
  36306. offset: {
  36307. /** @prop {number} order=200 - Index used to define the order of execution */
  36308. order: 200,
  36309. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36310. enabled: true,
  36311. /** @prop {ModifierFn} */
  36312. fn: offset,
  36313. /** @prop {Number|String} offset=0
  36314. * The offset value as described in the modifier description
  36315. */
  36316. offset: 0
  36317. },
  36318. /**
  36319. * Modifier used to prevent the popper from being positioned outside the boundary.
  36320. *
  36321. * A scenario exists where the reference itself is not within the boundaries.<br />
  36322. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36323. * In this case we need to decide whether the popper should either:
  36324. *
  36325. * - detach from the reference and remain "trapped" in the boundaries, or
  36326. * - if it should ignore the boundary and "escape with its reference"
  36327. *
  36328. * When `escapeWithReference` is set to`true` and reference is completely
  36329. * outside its boundaries, the popper will overflow (or completely leave)
  36330. * the boundaries in order to remain attached to the edge of the reference.
  36331. *
  36332. * @memberof modifiers
  36333. * @inner
  36334. */
  36335. preventOverflow: {
  36336. /** @prop {number} order=300 - Index used to define the order of execution */
  36337. order: 300,
  36338. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36339. enabled: true,
  36340. /** @prop {ModifierFn} */
  36341. fn: preventOverflow,
  36342. /**
  36343. * @prop {Array} [priority=['left','right','top','bottom']]
  36344. * Popper will try to prevent overflow following these priorities by default,
  36345. * then, it could overflow on the left and on top of the `boundariesElement`
  36346. */
  36347. priority: ['left', 'right', 'top', 'bottom'],
  36348. /**
  36349. * @prop {number} padding=5
  36350. * Amount of pixel used to define a minimum distance between the boundaries
  36351. * and the popper. This makes sure the popper always has a little padding
  36352. * between the edges of its container
  36353. */
  36354. padding: 5,
  36355. /**
  36356. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36357. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36358. * `viewport` or any DOM element.
  36359. */
  36360. boundariesElement: 'scrollParent'
  36361. },
  36362. /**
  36363. * Modifier used to make sure the reference and its popper stay near each other
  36364. * without leaving any gap between the two. Especially useful when the arrow is
  36365. * enabled and you want to ensure that it points to its reference element.
  36366. * It cares only about the first axis. You can still have poppers with margin
  36367. * between the popper and its reference element.
  36368. * @memberof modifiers
  36369. * @inner
  36370. */
  36371. keepTogether: {
  36372. /** @prop {number} order=400 - Index used to define the order of execution */
  36373. order: 400,
  36374. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36375. enabled: true,
  36376. /** @prop {ModifierFn} */
  36377. fn: keepTogether
  36378. },
  36379. /**
  36380. * This modifier is used to move the `arrowElement` of the popper to make
  36381. * sure it is positioned between the reference element and its popper element.
  36382. * It will read the outer size of the `arrowElement` node to detect how many
  36383. * pixels of conjunction are needed.
  36384. *
  36385. * It has no effect if no `arrowElement` is provided.
  36386. * @memberof modifiers
  36387. * @inner
  36388. */
  36389. arrow: {
  36390. /** @prop {number} order=500 - Index used to define the order of execution */
  36391. order: 500,
  36392. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36393. enabled: true,
  36394. /** @prop {ModifierFn} */
  36395. fn: arrow,
  36396. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36397. element: '[x-arrow]'
  36398. },
  36399. /**
  36400. * Modifier used to flip the popper's placement when it starts to overlap its
  36401. * reference element.
  36402. *
  36403. * Requires the `preventOverflow` modifier before it in order to work.
  36404. *
  36405. * **NOTE:** this modifier will interrupt the current update cycle and will
  36406. * restart it if it detects the need to flip the placement.
  36407. * @memberof modifiers
  36408. * @inner
  36409. */
  36410. flip: {
  36411. /** @prop {number} order=600 - Index used to define the order of execution */
  36412. order: 600,
  36413. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36414. enabled: true,
  36415. /** @prop {ModifierFn} */
  36416. fn: flip,
  36417. /**
  36418. * @prop {String|Array} behavior='flip'
  36419. * The behavior used to change the popper's placement. It can be one of
  36420. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36421. * placements (with optional variations)
  36422. */
  36423. behavior: 'flip',
  36424. /**
  36425. * @prop {number} padding=5
  36426. * The popper will flip if it hits the edges of the `boundariesElement`
  36427. */
  36428. padding: 5,
  36429. /**
  36430. * @prop {String|HTMLElement} boundariesElement='viewport'
  36431. * The element which will define the boundaries of the popper position.
  36432. * The popper will never be placed outside of the defined boundaries
  36433. * (except if `keepTogether` is enabled)
  36434. */
  36435. boundariesElement: 'viewport',
  36436. /**
  36437. * @prop {Boolean} flipVariations=false
  36438. * The popper will switch placement variation between `-start` and `-end` when
  36439. * the reference element overlaps its boundaries.
  36440. *
  36441. * The original placement should have a set variation.
  36442. */
  36443. flipVariations: false,
  36444. /**
  36445. * @prop {Boolean} flipVariationsByContent=false
  36446. * The popper will switch placement variation between `-start` and `-end` when
  36447. * the popper element overlaps its reference boundaries.
  36448. *
  36449. * The original placement should have a set variation.
  36450. */
  36451. flipVariationsByContent: false
  36452. },
  36453. /**
  36454. * Modifier used to make the popper flow toward the inner of the reference element.
  36455. * By default, when this modifier is disabled, the popper will be placed outside
  36456. * the reference element.
  36457. * @memberof modifiers
  36458. * @inner
  36459. */
  36460. inner: {
  36461. /** @prop {number} order=700 - Index used to define the order of execution */
  36462. order: 700,
  36463. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36464. enabled: false,
  36465. /** @prop {ModifierFn} */
  36466. fn: inner
  36467. },
  36468. /**
  36469. * Modifier used to hide the popper when its reference element is outside of the
  36470. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36471. * be used to hide with a CSS selector the popper when its reference is
  36472. * out of boundaries.
  36473. *
  36474. * Requires the `preventOverflow` modifier before it in order to work.
  36475. * @memberof modifiers
  36476. * @inner
  36477. */
  36478. hide: {
  36479. /** @prop {number} order=800 - Index used to define the order of execution */
  36480. order: 800,
  36481. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36482. enabled: true,
  36483. /** @prop {ModifierFn} */
  36484. fn: hide
  36485. },
  36486. /**
  36487. * Computes the style that will be applied to the popper element to gets
  36488. * properly positioned.
  36489. *
  36490. * Note that this modifier will not touch the DOM, it just prepares the styles
  36491. * so that `applyStyle` modifier can apply it. This separation is useful
  36492. * in case you need to replace `applyStyle` with a custom implementation.
  36493. *
  36494. * This modifier has `850` as `order` value to maintain backward compatibility
  36495. * with previous versions of Popper.js. Expect the modifiers ordering method
  36496. * to change in future major versions of the library.
  36497. *
  36498. * @memberof modifiers
  36499. * @inner
  36500. */
  36501. computeStyle: {
  36502. /** @prop {number} order=850 - Index used to define the order of execution */
  36503. order: 850,
  36504. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36505. enabled: true,
  36506. /** @prop {ModifierFn} */
  36507. fn: computeStyle,
  36508. /**
  36509. * @prop {Boolean} gpuAcceleration=true
  36510. * If true, it uses the CSS 3D transformation to position the popper.
  36511. * Otherwise, it will use the `top` and `left` properties
  36512. */
  36513. gpuAcceleration: true,
  36514. /**
  36515. * @prop {string} [x='bottom']
  36516. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36517. * Change this if your popper should grow in a direction different from `bottom`
  36518. */
  36519. x: 'bottom',
  36520. /**
  36521. * @prop {string} [x='left']
  36522. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36523. * Change this if your popper should grow in a direction different from `right`
  36524. */
  36525. y: 'right'
  36526. },
  36527. /**
  36528. * Applies the computed styles to the popper element.
  36529. *
  36530. * All the DOM manipulations are limited to this modifier. This is useful in case
  36531. * you want to integrate Popper.js inside a framework or view library and you
  36532. * want to delegate all the DOM manipulations to it.
  36533. *
  36534. * Note that if you disable this modifier, you must make sure the popper element
  36535. * has its position set to `absolute` before Popper.js can do its work!
  36536. *
  36537. * Just disable this modifier and define your own to achieve the desired effect.
  36538. *
  36539. * @memberof modifiers
  36540. * @inner
  36541. */
  36542. applyStyle: {
  36543. /** @prop {number} order=900 - Index used to define the order of execution */
  36544. order: 900,
  36545. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36546. enabled: true,
  36547. /** @prop {ModifierFn} */
  36548. fn: applyStyle,
  36549. /** @prop {Function} */
  36550. onLoad: applyStyleOnLoad,
  36551. /**
  36552. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36553. * @prop {Boolean} gpuAcceleration=true
  36554. * If true, it uses the CSS 3D transformation to position the popper.
  36555. * Otherwise, it will use the `top` and `left` properties
  36556. */
  36557. gpuAcceleration: undefined
  36558. }
  36559. };
  36560. /**
  36561. * The `dataObject` is an object containing all the information used by Popper.js.
  36562. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36563. * @name dataObject
  36564. * @property {Object} data.instance The Popper.js instance
  36565. * @property {String} data.placement Placement applied to popper
  36566. * @property {String} data.originalPlacement Placement originally defined on init
  36567. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36568. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36569. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36570. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36571. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36572. * @property {Object} data.boundaries Offsets of the popper boundaries
  36573. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36574. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36575. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36576. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36577. */
  36578. /**
  36579. * Default options provided to Popper.js constructor.<br />
  36580. * These can be overridden using the `options` argument of Popper.js.<br />
  36581. * To override an option, simply pass an object with the same
  36582. * structure of the `options` object, as the 3rd argument. For example:
  36583. * ```
  36584. * new Popper(ref, pop, {
  36585. * modifiers: {
  36586. * preventOverflow: { enabled: false }
  36587. * }
  36588. * })
  36589. * ```
  36590. * @type {Object}
  36591. * @static
  36592. * @memberof Popper
  36593. */
  36594. var Defaults = {
  36595. /**
  36596. * Popper's placement.
  36597. * @prop {Popper.placements} placement='bottom'
  36598. */
  36599. placement: 'bottom',
  36600. /**
  36601. * Set this to true if you want popper to position it self in 'fixed' mode
  36602. * @prop {Boolean} positionFixed=false
  36603. */
  36604. positionFixed: false,
  36605. /**
  36606. * Whether events (resize, scroll) are initially enabled.
  36607. * @prop {Boolean} eventsEnabled=true
  36608. */
  36609. eventsEnabled: true,
  36610. /**
  36611. * Set to true if you want to automatically remove the popper when
  36612. * you call the `destroy` method.
  36613. * @prop {Boolean} removeOnDestroy=false
  36614. */
  36615. removeOnDestroy: false,
  36616. /**
  36617. * Callback called when the popper is created.<br />
  36618. * By default, it is set to no-op.<br />
  36619. * Access Popper.js instance with `data.instance`.
  36620. * @prop {onCreate}
  36621. */
  36622. onCreate: function onCreate() {},
  36623. /**
  36624. * Callback called when the popper is updated. This callback is not called
  36625. * on the initialization/creation of the popper, but only on subsequent
  36626. * updates.<br />
  36627. * By default, it is set to no-op.<br />
  36628. * Access Popper.js instance with `data.instance`.
  36629. * @prop {onUpdate}
  36630. */
  36631. onUpdate: function onUpdate() {},
  36632. /**
  36633. * List of modifiers used to modify the offsets before they are applied to the popper.
  36634. * They provide most of the functionalities of Popper.js.
  36635. * @prop {modifiers}
  36636. */
  36637. modifiers: modifiers
  36638. };
  36639. /**
  36640. * @callback onCreate
  36641. * @param {dataObject} data
  36642. */
  36643. /**
  36644. * @callback onUpdate
  36645. * @param {dataObject} data
  36646. */
  36647. // Utils
  36648. // Methods
  36649. var Popper = function () {
  36650. /**
  36651. * Creates a new Popper.js instance.
  36652. * @class Popper
  36653. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36654. * @param {Element} popper - The HTML / XML element used as the popper
  36655. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36656. * @return {Object} instance - The generated Popper.js instance
  36657. */
  36658. function Popper(reference, popper) {
  36659. var _this = this;
  36660. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36661. classCallCheck(this, Popper);
  36662. this.scheduleUpdate = function () {
  36663. return requestAnimationFrame(_this.update);
  36664. };
  36665. // make update() debounced, so that it only runs at most once-per-tick
  36666. this.update = debounce(this.update.bind(this));
  36667. // with {} we create a new object with the options inside it
  36668. this.options = _extends({}, Popper.Defaults, options);
  36669. // init state
  36670. this.state = {
  36671. isDestroyed: false,
  36672. isCreated: false,
  36673. scrollParents: []
  36674. };
  36675. // get reference and popper elements (allow jQuery wrappers)
  36676. this.reference = reference && reference.jquery ? reference[0] : reference;
  36677. this.popper = popper && popper.jquery ? popper[0] : popper;
  36678. // Deep merge modifiers options
  36679. this.options.modifiers = {};
  36680. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36681. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36682. });
  36683. // Refactoring modifiers' list (Object => Array)
  36684. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36685. return _extends({
  36686. name: name
  36687. }, _this.options.modifiers[name]);
  36688. })
  36689. // sort the modifiers by order
  36690. .sort(function (a, b) {
  36691. return a.order - b.order;
  36692. });
  36693. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36694. // such code is executed in the same order of its modifier
  36695. // they could add new properties to their options configuration
  36696. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36697. this.modifiers.forEach(function (modifierOptions) {
  36698. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36699. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36700. }
  36701. });
  36702. // fire the first update to position the popper in the right place
  36703. this.update();
  36704. var eventsEnabled = this.options.eventsEnabled;
  36705. if (eventsEnabled) {
  36706. // setup event listeners, they will take care of update the position in specific situations
  36707. this.enableEventListeners();
  36708. }
  36709. this.state.eventsEnabled = eventsEnabled;
  36710. }
  36711. // We can't use class properties because they don't get listed in the
  36712. // class prototype and break stuff like Sinon stubs
  36713. createClass(Popper, [{
  36714. key: 'update',
  36715. value: function update$$1() {
  36716. return update.call(this);
  36717. }
  36718. }, {
  36719. key: 'destroy',
  36720. value: function destroy$$1() {
  36721. return destroy.call(this);
  36722. }
  36723. }, {
  36724. key: 'enableEventListeners',
  36725. value: function enableEventListeners$$1() {
  36726. return enableEventListeners.call(this);
  36727. }
  36728. }, {
  36729. key: 'disableEventListeners',
  36730. value: function disableEventListeners$$1() {
  36731. return disableEventListeners.call(this);
  36732. }
  36733. /**
  36734. * Schedules an update. It will run on the next UI update available.
  36735. * @method scheduleUpdate
  36736. * @memberof Popper
  36737. */
  36738. /**
  36739. * Collection of utilities useful when writing custom modifiers.
  36740. * Starting from version 1.7, this method is available only if you
  36741. * include `popper-utils.js` before `popper.js`.
  36742. *
  36743. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36744. * and will be removed in v2! Use the PopperUtils module directly instead.
  36745. * Due to the high instability of the methods contained in Utils, we can't
  36746. * guarantee them to follow semver. Use them at your own risk!
  36747. * @static
  36748. * @private
  36749. * @type {Object}
  36750. * @deprecated since version 1.8
  36751. * @member Utils
  36752. * @memberof Popper
  36753. */
  36754. }]);
  36755. return Popper;
  36756. }();
  36757. /**
  36758. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36759. * and lets you use it as replacement of a real DOM node.<br />
  36760. * You can use this method to position a popper relatively to a set of coordinates
  36761. * in case you don't have a DOM node to use as reference.
  36762. *
  36763. * ```
  36764. * new Popper(referenceObject, popperNode);
  36765. * ```
  36766. *
  36767. * NB: This feature isn't supported in Internet Explorer 10.
  36768. * @name referenceObject
  36769. * @property {Function} data.getBoundingClientRect
  36770. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36771. * @property {number} data.clientWidth
  36772. * An ES6 getter that will return the width of the virtual reference element.
  36773. * @property {number} data.clientHeight
  36774. * An ES6 getter that will return the height of the virtual reference element.
  36775. */
  36776. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36777. Popper.placements = placements;
  36778. Popper.Defaults = Defaults;
  36779. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36780. //# sourceMappingURL=popper.js.map
  36781. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36782. /***/ }),
  36783. /***/ "./node_modules/process/browser.js":
  36784. /*!*****************************************!*\
  36785. !*** ./node_modules/process/browser.js ***!
  36786. \*****************************************/
  36787. /*! no static exports found */
  36788. /***/ (function(module, exports) {
  36789. // shim for using process in browser
  36790. var process = module.exports = {};
  36791. // cached from whatever global is present so that test runners that stub it
  36792. // don't break things. But we need to wrap it in a try catch in case it is
  36793. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36794. // function because try/catches deoptimize in certain engines.
  36795. var cachedSetTimeout;
  36796. var cachedClearTimeout;
  36797. function defaultSetTimout() {
  36798. throw new Error('setTimeout has not been defined');
  36799. }
  36800. function defaultClearTimeout () {
  36801. throw new Error('clearTimeout has not been defined');
  36802. }
  36803. (function () {
  36804. try {
  36805. if (typeof setTimeout === 'function') {
  36806. cachedSetTimeout = setTimeout;
  36807. } else {
  36808. cachedSetTimeout = defaultSetTimout;
  36809. }
  36810. } catch (e) {
  36811. cachedSetTimeout = defaultSetTimout;
  36812. }
  36813. try {
  36814. if (typeof clearTimeout === 'function') {
  36815. cachedClearTimeout = clearTimeout;
  36816. } else {
  36817. cachedClearTimeout = defaultClearTimeout;
  36818. }
  36819. } catch (e) {
  36820. cachedClearTimeout = defaultClearTimeout;
  36821. }
  36822. } ())
  36823. function runTimeout(fun) {
  36824. if (cachedSetTimeout === setTimeout) {
  36825. //normal enviroments in sane situations
  36826. return setTimeout(fun, 0);
  36827. }
  36828. // if setTimeout wasn't available but was latter defined
  36829. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36830. cachedSetTimeout = setTimeout;
  36831. return setTimeout(fun, 0);
  36832. }
  36833. try {
  36834. // when when somebody has screwed with setTimeout but no I.E. maddness
  36835. return cachedSetTimeout(fun, 0);
  36836. } catch(e){
  36837. try {
  36838. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36839. return cachedSetTimeout.call(null, fun, 0);
  36840. } catch(e){
  36841. // 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
  36842. return cachedSetTimeout.call(this, fun, 0);
  36843. }
  36844. }
  36845. }
  36846. function runClearTimeout(marker) {
  36847. if (cachedClearTimeout === clearTimeout) {
  36848. //normal enviroments in sane situations
  36849. return clearTimeout(marker);
  36850. }
  36851. // if clearTimeout wasn't available but was latter defined
  36852. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36853. cachedClearTimeout = clearTimeout;
  36854. return clearTimeout(marker);
  36855. }
  36856. try {
  36857. // when when somebody has screwed with setTimeout but no I.E. maddness
  36858. return cachedClearTimeout(marker);
  36859. } catch (e){
  36860. try {
  36861. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36862. return cachedClearTimeout.call(null, marker);
  36863. } catch (e){
  36864. // 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.
  36865. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36866. return cachedClearTimeout.call(this, marker);
  36867. }
  36868. }
  36869. }
  36870. var queue = [];
  36871. var draining = false;
  36872. var currentQueue;
  36873. var queueIndex = -1;
  36874. function cleanUpNextTick() {
  36875. if (!draining || !currentQueue) {
  36876. return;
  36877. }
  36878. draining = false;
  36879. if (currentQueue.length) {
  36880. queue = currentQueue.concat(queue);
  36881. } else {
  36882. queueIndex = -1;
  36883. }
  36884. if (queue.length) {
  36885. drainQueue();
  36886. }
  36887. }
  36888. function drainQueue() {
  36889. if (draining) {
  36890. return;
  36891. }
  36892. var timeout = runTimeout(cleanUpNextTick);
  36893. draining = true;
  36894. var len = queue.length;
  36895. while(len) {
  36896. currentQueue = queue;
  36897. queue = [];
  36898. while (++queueIndex < len) {
  36899. if (currentQueue) {
  36900. currentQueue[queueIndex].run();
  36901. }
  36902. }
  36903. queueIndex = -1;
  36904. len = queue.length;
  36905. }
  36906. currentQueue = null;
  36907. draining = false;
  36908. runClearTimeout(timeout);
  36909. }
  36910. process.nextTick = function (fun) {
  36911. var args = new Array(arguments.length - 1);
  36912. if (arguments.length > 1) {
  36913. for (var i = 1; i < arguments.length; i++) {
  36914. args[i - 1] = arguments[i];
  36915. }
  36916. }
  36917. queue.push(new Item(fun, args));
  36918. if (queue.length === 1 && !draining) {
  36919. runTimeout(drainQueue);
  36920. }
  36921. };
  36922. // v8 likes predictible objects
  36923. function Item(fun, array) {
  36924. this.fun = fun;
  36925. this.array = array;
  36926. }
  36927. Item.prototype.run = function () {
  36928. this.fun.apply(null, this.array);
  36929. };
  36930. process.title = 'browser';
  36931. process.browser = true;
  36932. process.env = {};
  36933. process.argv = [];
  36934. process.version = ''; // empty string to avoid regexp issues
  36935. process.versions = {};
  36936. function noop() {}
  36937. process.on = noop;
  36938. process.addListener = noop;
  36939. process.once = noop;
  36940. process.off = noop;
  36941. process.removeListener = noop;
  36942. process.removeAllListeners = noop;
  36943. process.emit = noop;
  36944. process.prependListener = noop;
  36945. process.prependOnceListener = noop;
  36946. process.listeners = function (name) { return [] }
  36947. process.binding = function (name) {
  36948. throw new Error('process.binding is not supported');
  36949. };
  36950. process.cwd = function () { return '/' };
  36951. process.chdir = function (dir) {
  36952. throw new Error('process.chdir is not supported');
  36953. };
  36954. process.umask = function() { return 0; };
  36955. /***/ }),
  36956. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36957. /*!***************************************************!*\
  36958. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36959. \***************************************************/
  36960. /*! no static exports found */
  36961. /***/ (function(module, exports, __webpack_require__) {
  36962. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36963. * Pusher JavaScript Library v5.0.3
  36964. * https://pusher.com/
  36965. *
  36966. * Copyright 2017, Pusher
  36967. * Released under the MIT licence.
  36968. */
  36969. (function webpackUniversalModuleDefinition(root, factory) {
  36970. if(true)
  36971. module.exports = factory();
  36972. else {}
  36973. })(window, function() {
  36974. return /******/ (function(modules) { // webpackBootstrap
  36975. /******/ // The module cache
  36976. /******/ var installedModules = {};
  36977. /******/
  36978. /******/ // The require function
  36979. /******/ function __webpack_require__(moduleId) {
  36980. /******/
  36981. /******/ // Check if module is in cache
  36982. /******/ if(installedModules[moduleId]) {
  36983. /******/ return installedModules[moduleId].exports;
  36984. /******/ }
  36985. /******/ // Create a new module (and put it into the cache)
  36986. /******/ var module = installedModules[moduleId] = {
  36987. /******/ i: moduleId,
  36988. /******/ l: false,
  36989. /******/ exports: {}
  36990. /******/ };
  36991. /******/
  36992. /******/ // Execute the module function
  36993. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36994. /******/
  36995. /******/ // Flag the module as loaded
  36996. /******/ module.l = true;
  36997. /******/
  36998. /******/ // Return the exports of the module
  36999. /******/ return module.exports;
  37000. /******/ }
  37001. /******/
  37002. /******/
  37003. /******/ // expose the modules object (__webpack_modules__)
  37004. /******/ __webpack_require__.m = modules;
  37005. /******/
  37006. /******/ // expose the module cache
  37007. /******/ __webpack_require__.c = installedModules;
  37008. /******/
  37009. /******/ // define getter function for harmony exports
  37010. /******/ __webpack_require__.d = function(exports, name, getter) {
  37011. /******/ if(!__webpack_require__.o(exports, name)) {
  37012. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37013. /******/ }
  37014. /******/ };
  37015. /******/
  37016. /******/ // define __esModule on exports
  37017. /******/ __webpack_require__.r = function(exports) {
  37018. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37019. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37020. /******/ }
  37021. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37022. /******/ };
  37023. /******/
  37024. /******/ // create a fake namespace object
  37025. /******/ // mode & 1: value is a module id, require it
  37026. /******/ // mode & 2: merge all properties of value into the ns
  37027. /******/ // mode & 4: return value when already ns object
  37028. /******/ // mode & 8|1: behave like require
  37029. /******/ __webpack_require__.t = function(value, mode) {
  37030. /******/ if(mode & 1) value = __webpack_require__(value);
  37031. /******/ if(mode & 8) return value;
  37032. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37033. /******/ var ns = Object.create(null);
  37034. /******/ __webpack_require__.r(ns);
  37035. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37036. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37037. /******/ return ns;
  37038. /******/ };
  37039. /******/
  37040. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37041. /******/ __webpack_require__.n = function(module) {
  37042. /******/ var getter = module && module.__esModule ?
  37043. /******/ function getDefault() { return module['default']; } :
  37044. /******/ function getModuleExports() { return module; };
  37045. /******/ __webpack_require__.d(getter, 'a', getter);
  37046. /******/ return getter;
  37047. /******/ };
  37048. /******/
  37049. /******/ // Object.prototype.hasOwnProperty.call
  37050. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37051. /******/
  37052. /******/ // __webpack_public_path__
  37053. /******/ __webpack_require__.p = "";
  37054. /******/
  37055. /******/
  37056. /******/ // Load entry module and return exports
  37057. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37058. /******/ })
  37059. /************************************************************************/
  37060. /******/ ([
  37061. /* 0 */
  37062. /***/ (function(module, exports, __webpack_require__) {
  37063. (function(nacl) {
  37064. 'use strict';
  37065. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37066. // Public domain.
  37067. //
  37068. // Implementation derived from TweetNaCl version 20140427.
  37069. // See for details: http://tweetnacl.cr.yp.to/
  37070. var gf = function(init) {
  37071. var i, r = new Float64Array(16);
  37072. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37073. return r;
  37074. };
  37075. // Pluggable, initialized in high-level API below.
  37076. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37077. var _0 = new Uint8Array(16);
  37078. var _9 = new Uint8Array(32); _9[0] = 9;
  37079. var gf0 = gf(),
  37080. gf1 = gf([1]),
  37081. _121665 = gf([0xdb41, 1]),
  37082. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37083. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37084. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37085. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37086. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37087. function ts64(x, i, h, l) {
  37088. x[i] = (h >> 24) & 0xff;
  37089. x[i+1] = (h >> 16) & 0xff;
  37090. x[i+2] = (h >> 8) & 0xff;
  37091. x[i+3] = h & 0xff;
  37092. x[i+4] = (l >> 24) & 0xff;
  37093. x[i+5] = (l >> 16) & 0xff;
  37094. x[i+6] = (l >> 8) & 0xff;
  37095. x[i+7] = l & 0xff;
  37096. }
  37097. function vn(x, xi, y, yi, n) {
  37098. var i,d = 0;
  37099. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37100. return (1 & ((d - 1) >>> 8)) - 1;
  37101. }
  37102. function crypto_verify_16(x, xi, y, yi) {
  37103. return vn(x,xi,y,yi,16);
  37104. }
  37105. function crypto_verify_32(x, xi, y, yi) {
  37106. return vn(x,xi,y,yi,32);
  37107. }
  37108. function core_salsa20(o, p, k, c) {
  37109. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37110. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37111. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37112. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37113. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37114. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37115. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37116. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37117. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37118. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37119. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37120. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37121. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37122. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37123. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37124. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37125. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37126. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37127. x15 = j15, u;
  37128. for (var i = 0; i < 20; i += 2) {
  37129. u = x0 + x12 | 0;
  37130. x4 ^= u<<7 | u>>>(32-7);
  37131. u = x4 + x0 | 0;
  37132. x8 ^= u<<9 | u>>>(32-9);
  37133. u = x8 + x4 | 0;
  37134. x12 ^= u<<13 | u>>>(32-13);
  37135. u = x12 + x8 | 0;
  37136. x0 ^= u<<18 | u>>>(32-18);
  37137. u = x5 + x1 | 0;
  37138. x9 ^= u<<7 | u>>>(32-7);
  37139. u = x9 + x5 | 0;
  37140. x13 ^= u<<9 | u>>>(32-9);
  37141. u = x13 + x9 | 0;
  37142. x1 ^= u<<13 | u>>>(32-13);
  37143. u = x1 + x13 | 0;
  37144. x5 ^= u<<18 | u>>>(32-18);
  37145. u = x10 + x6 | 0;
  37146. x14 ^= u<<7 | u>>>(32-7);
  37147. u = x14 + x10 | 0;
  37148. x2 ^= u<<9 | u>>>(32-9);
  37149. u = x2 + x14 | 0;
  37150. x6 ^= u<<13 | u>>>(32-13);
  37151. u = x6 + x2 | 0;
  37152. x10 ^= u<<18 | u>>>(32-18);
  37153. u = x15 + x11 | 0;
  37154. x3 ^= u<<7 | u>>>(32-7);
  37155. u = x3 + x15 | 0;
  37156. x7 ^= u<<9 | u>>>(32-9);
  37157. u = x7 + x3 | 0;
  37158. x11 ^= u<<13 | u>>>(32-13);
  37159. u = x11 + x7 | 0;
  37160. x15 ^= u<<18 | u>>>(32-18);
  37161. u = x0 + x3 | 0;
  37162. x1 ^= u<<7 | u>>>(32-7);
  37163. u = x1 + x0 | 0;
  37164. x2 ^= u<<9 | u>>>(32-9);
  37165. u = x2 + x1 | 0;
  37166. x3 ^= u<<13 | u>>>(32-13);
  37167. u = x3 + x2 | 0;
  37168. x0 ^= u<<18 | u>>>(32-18);
  37169. u = x5 + x4 | 0;
  37170. x6 ^= u<<7 | u>>>(32-7);
  37171. u = x6 + x5 | 0;
  37172. x7 ^= u<<9 | u>>>(32-9);
  37173. u = x7 + x6 | 0;
  37174. x4 ^= u<<13 | u>>>(32-13);
  37175. u = x4 + x7 | 0;
  37176. x5 ^= u<<18 | u>>>(32-18);
  37177. u = x10 + x9 | 0;
  37178. x11 ^= u<<7 | u>>>(32-7);
  37179. u = x11 + x10 | 0;
  37180. x8 ^= u<<9 | u>>>(32-9);
  37181. u = x8 + x11 | 0;
  37182. x9 ^= u<<13 | u>>>(32-13);
  37183. u = x9 + x8 | 0;
  37184. x10 ^= u<<18 | u>>>(32-18);
  37185. u = x15 + x14 | 0;
  37186. x12 ^= u<<7 | u>>>(32-7);
  37187. u = x12 + x15 | 0;
  37188. x13 ^= u<<9 | u>>>(32-9);
  37189. u = x13 + x12 | 0;
  37190. x14 ^= u<<13 | u>>>(32-13);
  37191. u = x14 + x13 | 0;
  37192. x15 ^= u<<18 | u>>>(32-18);
  37193. }
  37194. x0 = x0 + j0 | 0;
  37195. x1 = x1 + j1 | 0;
  37196. x2 = x2 + j2 | 0;
  37197. x3 = x3 + j3 | 0;
  37198. x4 = x4 + j4 | 0;
  37199. x5 = x5 + j5 | 0;
  37200. x6 = x6 + j6 | 0;
  37201. x7 = x7 + j7 | 0;
  37202. x8 = x8 + j8 | 0;
  37203. x9 = x9 + j9 | 0;
  37204. x10 = x10 + j10 | 0;
  37205. x11 = x11 + j11 | 0;
  37206. x12 = x12 + j12 | 0;
  37207. x13 = x13 + j13 | 0;
  37208. x14 = x14 + j14 | 0;
  37209. x15 = x15 + j15 | 0;
  37210. o[ 0] = x0 >>> 0 & 0xff;
  37211. o[ 1] = x0 >>> 8 & 0xff;
  37212. o[ 2] = x0 >>> 16 & 0xff;
  37213. o[ 3] = x0 >>> 24 & 0xff;
  37214. o[ 4] = x1 >>> 0 & 0xff;
  37215. o[ 5] = x1 >>> 8 & 0xff;
  37216. o[ 6] = x1 >>> 16 & 0xff;
  37217. o[ 7] = x1 >>> 24 & 0xff;
  37218. o[ 8] = x2 >>> 0 & 0xff;
  37219. o[ 9] = x2 >>> 8 & 0xff;
  37220. o[10] = x2 >>> 16 & 0xff;
  37221. o[11] = x2 >>> 24 & 0xff;
  37222. o[12] = x3 >>> 0 & 0xff;
  37223. o[13] = x3 >>> 8 & 0xff;
  37224. o[14] = x3 >>> 16 & 0xff;
  37225. o[15] = x3 >>> 24 & 0xff;
  37226. o[16] = x4 >>> 0 & 0xff;
  37227. o[17] = x4 >>> 8 & 0xff;
  37228. o[18] = x4 >>> 16 & 0xff;
  37229. o[19] = x4 >>> 24 & 0xff;
  37230. o[20] = x5 >>> 0 & 0xff;
  37231. o[21] = x5 >>> 8 & 0xff;
  37232. o[22] = x5 >>> 16 & 0xff;
  37233. o[23] = x5 >>> 24 & 0xff;
  37234. o[24] = x6 >>> 0 & 0xff;
  37235. o[25] = x6 >>> 8 & 0xff;
  37236. o[26] = x6 >>> 16 & 0xff;
  37237. o[27] = x6 >>> 24 & 0xff;
  37238. o[28] = x7 >>> 0 & 0xff;
  37239. o[29] = x7 >>> 8 & 0xff;
  37240. o[30] = x7 >>> 16 & 0xff;
  37241. o[31] = x7 >>> 24 & 0xff;
  37242. o[32] = x8 >>> 0 & 0xff;
  37243. o[33] = x8 >>> 8 & 0xff;
  37244. o[34] = x8 >>> 16 & 0xff;
  37245. o[35] = x8 >>> 24 & 0xff;
  37246. o[36] = x9 >>> 0 & 0xff;
  37247. o[37] = x9 >>> 8 & 0xff;
  37248. o[38] = x9 >>> 16 & 0xff;
  37249. o[39] = x9 >>> 24 & 0xff;
  37250. o[40] = x10 >>> 0 & 0xff;
  37251. o[41] = x10 >>> 8 & 0xff;
  37252. o[42] = x10 >>> 16 & 0xff;
  37253. o[43] = x10 >>> 24 & 0xff;
  37254. o[44] = x11 >>> 0 & 0xff;
  37255. o[45] = x11 >>> 8 & 0xff;
  37256. o[46] = x11 >>> 16 & 0xff;
  37257. o[47] = x11 >>> 24 & 0xff;
  37258. o[48] = x12 >>> 0 & 0xff;
  37259. o[49] = x12 >>> 8 & 0xff;
  37260. o[50] = x12 >>> 16 & 0xff;
  37261. o[51] = x12 >>> 24 & 0xff;
  37262. o[52] = x13 >>> 0 & 0xff;
  37263. o[53] = x13 >>> 8 & 0xff;
  37264. o[54] = x13 >>> 16 & 0xff;
  37265. o[55] = x13 >>> 24 & 0xff;
  37266. o[56] = x14 >>> 0 & 0xff;
  37267. o[57] = x14 >>> 8 & 0xff;
  37268. o[58] = x14 >>> 16 & 0xff;
  37269. o[59] = x14 >>> 24 & 0xff;
  37270. o[60] = x15 >>> 0 & 0xff;
  37271. o[61] = x15 >>> 8 & 0xff;
  37272. o[62] = x15 >>> 16 & 0xff;
  37273. o[63] = x15 >>> 24 & 0xff;
  37274. }
  37275. function core_hsalsa20(o,p,k,c) {
  37276. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37277. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37278. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37279. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37280. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37281. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37282. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37283. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37284. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37285. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37286. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37287. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37288. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37289. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37290. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37291. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37292. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37293. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37294. x15 = j15, u;
  37295. for (var i = 0; i < 20; i += 2) {
  37296. u = x0 + x12 | 0;
  37297. x4 ^= u<<7 | u>>>(32-7);
  37298. u = x4 + x0 | 0;
  37299. x8 ^= u<<9 | u>>>(32-9);
  37300. u = x8 + x4 | 0;
  37301. x12 ^= u<<13 | u>>>(32-13);
  37302. u = x12 + x8 | 0;
  37303. x0 ^= u<<18 | u>>>(32-18);
  37304. u = x5 + x1 | 0;
  37305. x9 ^= u<<7 | u>>>(32-7);
  37306. u = x9 + x5 | 0;
  37307. x13 ^= u<<9 | u>>>(32-9);
  37308. u = x13 + x9 | 0;
  37309. x1 ^= u<<13 | u>>>(32-13);
  37310. u = x1 + x13 | 0;
  37311. x5 ^= u<<18 | u>>>(32-18);
  37312. u = x10 + x6 | 0;
  37313. x14 ^= u<<7 | u>>>(32-7);
  37314. u = x14 + x10 | 0;
  37315. x2 ^= u<<9 | u>>>(32-9);
  37316. u = x2 + x14 | 0;
  37317. x6 ^= u<<13 | u>>>(32-13);
  37318. u = x6 + x2 | 0;
  37319. x10 ^= u<<18 | u>>>(32-18);
  37320. u = x15 + x11 | 0;
  37321. x3 ^= u<<7 | u>>>(32-7);
  37322. u = x3 + x15 | 0;
  37323. x7 ^= u<<9 | u>>>(32-9);
  37324. u = x7 + x3 | 0;
  37325. x11 ^= u<<13 | u>>>(32-13);
  37326. u = x11 + x7 | 0;
  37327. x15 ^= u<<18 | u>>>(32-18);
  37328. u = x0 + x3 | 0;
  37329. x1 ^= u<<7 | u>>>(32-7);
  37330. u = x1 + x0 | 0;
  37331. x2 ^= u<<9 | u>>>(32-9);
  37332. u = x2 + x1 | 0;
  37333. x3 ^= u<<13 | u>>>(32-13);
  37334. u = x3 + x2 | 0;
  37335. x0 ^= u<<18 | u>>>(32-18);
  37336. u = x5 + x4 | 0;
  37337. x6 ^= u<<7 | u>>>(32-7);
  37338. u = x6 + x5 | 0;
  37339. x7 ^= u<<9 | u>>>(32-9);
  37340. u = x7 + x6 | 0;
  37341. x4 ^= u<<13 | u>>>(32-13);
  37342. u = x4 + x7 | 0;
  37343. x5 ^= u<<18 | u>>>(32-18);
  37344. u = x10 + x9 | 0;
  37345. x11 ^= u<<7 | u>>>(32-7);
  37346. u = x11 + x10 | 0;
  37347. x8 ^= u<<9 | u>>>(32-9);
  37348. u = x8 + x11 | 0;
  37349. x9 ^= u<<13 | u>>>(32-13);
  37350. u = x9 + x8 | 0;
  37351. x10 ^= u<<18 | u>>>(32-18);
  37352. u = x15 + x14 | 0;
  37353. x12 ^= u<<7 | u>>>(32-7);
  37354. u = x12 + x15 | 0;
  37355. x13 ^= u<<9 | u>>>(32-9);
  37356. u = x13 + x12 | 0;
  37357. x14 ^= u<<13 | u>>>(32-13);
  37358. u = x14 + x13 | 0;
  37359. x15 ^= u<<18 | u>>>(32-18);
  37360. }
  37361. o[ 0] = x0 >>> 0 & 0xff;
  37362. o[ 1] = x0 >>> 8 & 0xff;
  37363. o[ 2] = x0 >>> 16 & 0xff;
  37364. o[ 3] = x0 >>> 24 & 0xff;
  37365. o[ 4] = x5 >>> 0 & 0xff;
  37366. o[ 5] = x5 >>> 8 & 0xff;
  37367. o[ 6] = x5 >>> 16 & 0xff;
  37368. o[ 7] = x5 >>> 24 & 0xff;
  37369. o[ 8] = x10 >>> 0 & 0xff;
  37370. o[ 9] = x10 >>> 8 & 0xff;
  37371. o[10] = x10 >>> 16 & 0xff;
  37372. o[11] = x10 >>> 24 & 0xff;
  37373. o[12] = x15 >>> 0 & 0xff;
  37374. o[13] = x15 >>> 8 & 0xff;
  37375. o[14] = x15 >>> 16 & 0xff;
  37376. o[15] = x15 >>> 24 & 0xff;
  37377. o[16] = x6 >>> 0 & 0xff;
  37378. o[17] = x6 >>> 8 & 0xff;
  37379. o[18] = x6 >>> 16 & 0xff;
  37380. o[19] = x6 >>> 24 & 0xff;
  37381. o[20] = x7 >>> 0 & 0xff;
  37382. o[21] = x7 >>> 8 & 0xff;
  37383. o[22] = x7 >>> 16 & 0xff;
  37384. o[23] = x7 >>> 24 & 0xff;
  37385. o[24] = x8 >>> 0 & 0xff;
  37386. o[25] = x8 >>> 8 & 0xff;
  37387. o[26] = x8 >>> 16 & 0xff;
  37388. o[27] = x8 >>> 24 & 0xff;
  37389. o[28] = x9 >>> 0 & 0xff;
  37390. o[29] = x9 >>> 8 & 0xff;
  37391. o[30] = x9 >>> 16 & 0xff;
  37392. o[31] = x9 >>> 24 & 0xff;
  37393. }
  37394. function crypto_core_salsa20(out,inp,k,c) {
  37395. core_salsa20(out,inp,k,c);
  37396. }
  37397. function crypto_core_hsalsa20(out,inp,k,c) {
  37398. core_hsalsa20(out,inp,k,c);
  37399. }
  37400. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37401. // "expand 32-byte k"
  37402. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37403. var z = new Uint8Array(16), x = new Uint8Array(64);
  37404. var u, i;
  37405. for (i = 0; i < 16; i++) z[i] = 0;
  37406. for (i = 0; i < 8; i++) z[i] = n[i];
  37407. while (b >= 64) {
  37408. crypto_core_salsa20(x,z,k,sigma);
  37409. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37410. u = 1;
  37411. for (i = 8; i < 16; i++) {
  37412. u = u + (z[i] & 0xff) | 0;
  37413. z[i] = u & 0xff;
  37414. u >>>= 8;
  37415. }
  37416. b -= 64;
  37417. cpos += 64;
  37418. mpos += 64;
  37419. }
  37420. if (b > 0) {
  37421. crypto_core_salsa20(x,z,k,sigma);
  37422. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37423. }
  37424. return 0;
  37425. }
  37426. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37427. var z = new Uint8Array(16), x = new Uint8Array(64);
  37428. var u, i;
  37429. for (i = 0; i < 16; i++) z[i] = 0;
  37430. for (i = 0; i < 8; i++) z[i] = n[i];
  37431. while (b >= 64) {
  37432. crypto_core_salsa20(x,z,k,sigma);
  37433. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37434. u = 1;
  37435. for (i = 8; i < 16; i++) {
  37436. u = u + (z[i] & 0xff) | 0;
  37437. z[i] = u & 0xff;
  37438. u >>>= 8;
  37439. }
  37440. b -= 64;
  37441. cpos += 64;
  37442. }
  37443. if (b > 0) {
  37444. crypto_core_salsa20(x,z,k,sigma);
  37445. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37446. }
  37447. return 0;
  37448. }
  37449. function crypto_stream(c,cpos,d,n,k) {
  37450. var s = new Uint8Array(32);
  37451. crypto_core_hsalsa20(s,n,k,sigma);
  37452. var sn = new Uint8Array(8);
  37453. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37454. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37455. }
  37456. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37457. var s = new Uint8Array(32);
  37458. crypto_core_hsalsa20(s,n,k,sigma);
  37459. var sn = new Uint8Array(8);
  37460. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37461. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37462. }
  37463. /*
  37464. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37465. * https://github.com/floodyberry/poly1305-donna
  37466. */
  37467. var poly1305 = function(key) {
  37468. this.buffer = new Uint8Array(16);
  37469. this.r = new Uint16Array(10);
  37470. this.h = new Uint16Array(10);
  37471. this.pad = new Uint16Array(8);
  37472. this.leftover = 0;
  37473. this.fin = 0;
  37474. var t0, t1, t2, t3, t4, t5, t6, t7;
  37475. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37476. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37477. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37478. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37479. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37480. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37481. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37482. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37483. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37484. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37485. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37486. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37487. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37488. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37489. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37490. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37491. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37492. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37493. };
  37494. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37495. var hibit = this.fin ? 0 : (1 << 11);
  37496. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37497. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37498. var h0 = this.h[0],
  37499. h1 = this.h[1],
  37500. h2 = this.h[2],
  37501. h3 = this.h[3],
  37502. h4 = this.h[4],
  37503. h5 = this.h[5],
  37504. h6 = this.h[6],
  37505. h7 = this.h[7],
  37506. h8 = this.h[8],
  37507. h9 = this.h[9];
  37508. var r0 = this.r[0],
  37509. r1 = this.r[1],
  37510. r2 = this.r[2],
  37511. r3 = this.r[3],
  37512. r4 = this.r[4],
  37513. r5 = this.r[5],
  37514. r6 = this.r[6],
  37515. r7 = this.r[7],
  37516. r8 = this.r[8],
  37517. r9 = this.r[9];
  37518. while (bytes >= 16) {
  37519. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37520. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37521. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37522. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37523. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37524. h5 += ((t4 >>> 1)) & 0x1fff;
  37525. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37526. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37527. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37528. h9 += ((t7 >>> 5)) | hibit;
  37529. c = 0;
  37530. d0 = c;
  37531. d0 += h0 * r0;
  37532. d0 += h1 * (5 * r9);
  37533. d0 += h2 * (5 * r8);
  37534. d0 += h3 * (5 * r7);
  37535. d0 += h4 * (5 * r6);
  37536. c = (d0 >>> 13); d0 &= 0x1fff;
  37537. d0 += h5 * (5 * r5);
  37538. d0 += h6 * (5 * r4);
  37539. d0 += h7 * (5 * r3);
  37540. d0 += h8 * (5 * r2);
  37541. d0 += h9 * (5 * r1);
  37542. c += (d0 >>> 13); d0 &= 0x1fff;
  37543. d1 = c;
  37544. d1 += h0 * r1;
  37545. d1 += h1 * r0;
  37546. d1 += h2 * (5 * r9);
  37547. d1 += h3 * (5 * r8);
  37548. d1 += h4 * (5 * r7);
  37549. c = (d1 >>> 13); d1 &= 0x1fff;
  37550. d1 += h5 * (5 * r6);
  37551. d1 += h6 * (5 * r5);
  37552. d1 += h7 * (5 * r4);
  37553. d1 += h8 * (5 * r3);
  37554. d1 += h9 * (5 * r2);
  37555. c += (d1 >>> 13); d1 &= 0x1fff;
  37556. d2 = c;
  37557. d2 += h0 * r2;
  37558. d2 += h1 * r1;
  37559. d2 += h2 * r0;
  37560. d2 += h3 * (5 * r9);
  37561. d2 += h4 * (5 * r8);
  37562. c = (d2 >>> 13); d2 &= 0x1fff;
  37563. d2 += h5 * (5 * r7);
  37564. d2 += h6 * (5 * r6);
  37565. d2 += h7 * (5 * r5);
  37566. d2 += h8 * (5 * r4);
  37567. d2 += h9 * (5 * r3);
  37568. c += (d2 >>> 13); d2 &= 0x1fff;
  37569. d3 = c;
  37570. d3 += h0 * r3;
  37571. d3 += h1 * r2;
  37572. d3 += h2 * r1;
  37573. d3 += h3 * r0;
  37574. d3 += h4 * (5 * r9);
  37575. c = (d3 >>> 13); d3 &= 0x1fff;
  37576. d3 += h5 * (5 * r8);
  37577. d3 += h6 * (5 * r7);
  37578. d3 += h7 * (5 * r6);
  37579. d3 += h8 * (5 * r5);
  37580. d3 += h9 * (5 * r4);
  37581. c += (d3 >>> 13); d3 &= 0x1fff;
  37582. d4 = c;
  37583. d4 += h0 * r4;
  37584. d4 += h1 * r3;
  37585. d4 += h2 * r2;
  37586. d4 += h3 * r1;
  37587. d4 += h4 * r0;
  37588. c = (d4 >>> 13); d4 &= 0x1fff;
  37589. d4 += h5 * (5 * r9);
  37590. d4 += h6 * (5 * r8);
  37591. d4 += h7 * (5 * r7);
  37592. d4 += h8 * (5 * r6);
  37593. d4 += h9 * (5 * r5);
  37594. c += (d4 >>> 13); d4 &= 0x1fff;
  37595. d5 = c;
  37596. d5 += h0 * r5;
  37597. d5 += h1 * r4;
  37598. d5 += h2 * r3;
  37599. d5 += h3 * r2;
  37600. d5 += h4 * r1;
  37601. c = (d5 >>> 13); d5 &= 0x1fff;
  37602. d5 += h5 * r0;
  37603. d5 += h6 * (5 * r9);
  37604. d5 += h7 * (5 * r8);
  37605. d5 += h8 * (5 * r7);
  37606. d5 += h9 * (5 * r6);
  37607. c += (d5 >>> 13); d5 &= 0x1fff;
  37608. d6 = c;
  37609. d6 += h0 * r6;
  37610. d6 += h1 * r5;
  37611. d6 += h2 * r4;
  37612. d6 += h3 * r3;
  37613. d6 += h4 * r2;
  37614. c = (d6 >>> 13); d6 &= 0x1fff;
  37615. d6 += h5 * r1;
  37616. d6 += h6 * r0;
  37617. d6 += h7 * (5 * r9);
  37618. d6 += h8 * (5 * r8);
  37619. d6 += h9 * (5 * r7);
  37620. c += (d6 >>> 13); d6 &= 0x1fff;
  37621. d7 = c;
  37622. d7 += h0 * r7;
  37623. d7 += h1 * r6;
  37624. d7 += h2 * r5;
  37625. d7 += h3 * r4;
  37626. d7 += h4 * r3;
  37627. c = (d7 >>> 13); d7 &= 0x1fff;
  37628. d7 += h5 * r2;
  37629. d7 += h6 * r1;
  37630. d7 += h7 * r0;
  37631. d7 += h8 * (5 * r9);
  37632. d7 += h9 * (5 * r8);
  37633. c += (d7 >>> 13); d7 &= 0x1fff;
  37634. d8 = c;
  37635. d8 += h0 * r8;
  37636. d8 += h1 * r7;
  37637. d8 += h2 * r6;
  37638. d8 += h3 * r5;
  37639. d8 += h4 * r4;
  37640. c = (d8 >>> 13); d8 &= 0x1fff;
  37641. d8 += h5 * r3;
  37642. d8 += h6 * r2;
  37643. d8 += h7 * r1;
  37644. d8 += h8 * r0;
  37645. d8 += h9 * (5 * r9);
  37646. c += (d8 >>> 13); d8 &= 0x1fff;
  37647. d9 = c;
  37648. d9 += h0 * r9;
  37649. d9 += h1 * r8;
  37650. d9 += h2 * r7;
  37651. d9 += h3 * r6;
  37652. d9 += h4 * r5;
  37653. c = (d9 >>> 13); d9 &= 0x1fff;
  37654. d9 += h5 * r4;
  37655. d9 += h6 * r3;
  37656. d9 += h7 * r2;
  37657. d9 += h8 * r1;
  37658. d9 += h9 * r0;
  37659. c += (d9 >>> 13); d9 &= 0x1fff;
  37660. c = (((c << 2) + c)) | 0;
  37661. c = (c + d0) | 0;
  37662. d0 = c & 0x1fff;
  37663. c = (c >>> 13);
  37664. d1 += c;
  37665. h0 = d0;
  37666. h1 = d1;
  37667. h2 = d2;
  37668. h3 = d3;
  37669. h4 = d4;
  37670. h5 = d5;
  37671. h6 = d6;
  37672. h7 = d7;
  37673. h8 = d8;
  37674. h9 = d9;
  37675. mpos += 16;
  37676. bytes -= 16;
  37677. }
  37678. this.h[0] = h0;
  37679. this.h[1] = h1;
  37680. this.h[2] = h2;
  37681. this.h[3] = h3;
  37682. this.h[4] = h4;
  37683. this.h[5] = h5;
  37684. this.h[6] = h6;
  37685. this.h[7] = h7;
  37686. this.h[8] = h8;
  37687. this.h[9] = h9;
  37688. };
  37689. poly1305.prototype.finish = function(mac, macpos) {
  37690. var g = new Uint16Array(10);
  37691. var c, mask, f, i;
  37692. if (this.leftover) {
  37693. i = this.leftover;
  37694. this.buffer[i++] = 1;
  37695. for (; i < 16; i++) this.buffer[i] = 0;
  37696. this.fin = 1;
  37697. this.blocks(this.buffer, 0, 16);
  37698. }
  37699. c = this.h[1] >>> 13;
  37700. this.h[1] &= 0x1fff;
  37701. for (i = 2; i < 10; i++) {
  37702. this.h[i] += c;
  37703. c = this.h[i] >>> 13;
  37704. this.h[i] &= 0x1fff;
  37705. }
  37706. this.h[0] += (c * 5);
  37707. c = this.h[0] >>> 13;
  37708. this.h[0] &= 0x1fff;
  37709. this.h[1] += c;
  37710. c = this.h[1] >>> 13;
  37711. this.h[1] &= 0x1fff;
  37712. this.h[2] += c;
  37713. g[0] = this.h[0] + 5;
  37714. c = g[0] >>> 13;
  37715. g[0] &= 0x1fff;
  37716. for (i = 1; i < 10; i++) {
  37717. g[i] = this.h[i] + c;
  37718. c = g[i] >>> 13;
  37719. g[i] &= 0x1fff;
  37720. }
  37721. g[9] -= (1 << 13);
  37722. mask = (c ^ 1) - 1;
  37723. for (i = 0; i < 10; i++) g[i] &= mask;
  37724. mask = ~mask;
  37725. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37726. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37727. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37728. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37729. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37730. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37731. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37732. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37733. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37734. f = this.h[0] + this.pad[0];
  37735. this.h[0] = f & 0xffff;
  37736. for (i = 1; i < 8; i++) {
  37737. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37738. this.h[i] = f & 0xffff;
  37739. }
  37740. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37741. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37742. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37743. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37744. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37745. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37746. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37747. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37748. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37749. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37750. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37751. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37752. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37753. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37754. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37755. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37756. };
  37757. poly1305.prototype.update = function(m, mpos, bytes) {
  37758. var i, want;
  37759. if (this.leftover) {
  37760. want = (16 - this.leftover);
  37761. if (want > bytes)
  37762. want = bytes;
  37763. for (i = 0; i < want; i++)
  37764. this.buffer[this.leftover + i] = m[mpos+i];
  37765. bytes -= want;
  37766. mpos += want;
  37767. this.leftover += want;
  37768. if (this.leftover < 16)
  37769. return;
  37770. this.blocks(this.buffer, 0, 16);
  37771. this.leftover = 0;
  37772. }
  37773. if (bytes >= 16) {
  37774. want = bytes - (bytes % 16);
  37775. this.blocks(m, mpos, want);
  37776. mpos += want;
  37777. bytes -= want;
  37778. }
  37779. if (bytes) {
  37780. for (i = 0; i < bytes; i++)
  37781. this.buffer[this.leftover + i] = m[mpos+i];
  37782. this.leftover += bytes;
  37783. }
  37784. };
  37785. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37786. var s = new poly1305(k);
  37787. s.update(m, mpos, n);
  37788. s.finish(out, outpos);
  37789. return 0;
  37790. }
  37791. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37792. var x = new Uint8Array(16);
  37793. crypto_onetimeauth(x,0,m,mpos,n,k);
  37794. return crypto_verify_16(h,hpos,x,0);
  37795. }
  37796. function crypto_secretbox(c,m,d,n,k) {
  37797. var i;
  37798. if (d < 32) return -1;
  37799. crypto_stream_xor(c,0,m,0,d,n,k);
  37800. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37801. for (i = 0; i < 16; i++) c[i] = 0;
  37802. return 0;
  37803. }
  37804. function crypto_secretbox_open(m,c,d,n,k) {
  37805. var i;
  37806. var x = new Uint8Array(32);
  37807. if (d < 32) return -1;
  37808. crypto_stream(x,0,32,n,k);
  37809. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37810. crypto_stream_xor(m,0,c,0,d,n,k);
  37811. for (i = 0; i < 32; i++) m[i] = 0;
  37812. return 0;
  37813. }
  37814. function set25519(r, a) {
  37815. var i;
  37816. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37817. }
  37818. function car25519(o) {
  37819. var i, v, c = 1;
  37820. for (i = 0; i < 16; i++) {
  37821. v = o[i] + c + 65535;
  37822. c = Math.floor(v / 65536);
  37823. o[i] = v - c * 65536;
  37824. }
  37825. o[0] += c-1 + 37 * (c-1);
  37826. }
  37827. function sel25519(p, q, b) {
  37828. var t, c = ~(b-1);
  37829. for (var i = 0; i < 16; i++) {
  37830. t = c & (p[i] ^ q[i]);
  37831. p[i] ^= t;
  37832. q[i] ^= t;
  37833. }
  37834. }
  37835. function pack25519(o, n) {
  37836. var i, j, b;
  37837. var m = gf(), t = gf();
  37838. for (i = 0; i < 16; i++) t[i] = n[i];
  37839. car25519(t);
  37840. car25519(t);
  37841. car25519(t);
  37842. for (j = 0; j < 2; j++) {
  37843. m[0] = t[0] - 0xffed;
  37844. for (i = 1; i < 15; i++) {
  37845. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37846. m[i-1] &= 0xffff;
  37847. }
  37848. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37849. b = (m[15]>>16) & 1;
  37850. m[14] &= 0xffff;
  37851. sel25519(t, m, 1-b);
  37852. }
  37853. for (i = 0; i < 16; i++) {
  37854. o[2*i] = t[i] & 0xff;
  37855. o[2*i+1] = t[i]>>8;
  37856. }
  37857. }
  37858. function neq25519(a, b) {
  37859. var c = new Uint8Array(32), d = new Uint8Array(32);
  37860. pack25519(c, a);
  37861. pack25519(d, b);
  37862. return crypto_verify_32(c, 0, d, 0);
  37863. }
  37864. function par25519(a) {
  37865. var d = new Uint8Array(32);
  37866. pack25519(d, a);
  37867. return d[0] & 1;
  37868. }
  37869. function unpack25519(o, n) {
  37870. var i;
  37871. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37872. o[15] &= 0x7fff;
  37873. }
  37874. function A(o, a, b) {
  37875. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37876. }
  37877. function Z(o, a, b) {
  37878. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37879. }
  37880. function M(o, a, b) {
  37881. var v, c,
  37882. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37883. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37884. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37885. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37886. b0 = b[0],
  37887. b1 = b[1],
  37888. b2 = b[2],
  37889. b3 = b[3],
  37890. b4 = b[4],
  37891. b5 = b[5],
  37892. b6 = b[6],
  37893. b7 = b[7],
  37894. b8 = b[8],
  37895. b9 = b[9],
  37896. b10 = b[10],
  37897. b11 = b[11],
  37898. b12 = b[12],
  37899. b13 = b[13],
  37900. b14 = b[14],
  37901. b15 = b[15];
  37902. v = a[0];
  37903. t0 += v * b0;
  37904. t1 += v * b1;
  37905. t2 += v * b2;
  37906. t3 += v * b3;
  37907. t4 += v * b4;
  37908. t5 += v * b5;
  37909. t6 += v * b6;
  37910. t7 += v * b7;
  37911. t8 += v * b8;
  37912. t9 += v * b9;
  37913. t10 += v * b10;
  37914. t11 += v * b11;
  37915. t12 += v * b12;
  37916. t13 += v * b13;
  37917. t14 += v * b14;
  37918. t15 += v * b15;
  37919. v = a[1];
  37920. t1 += v * b0;
  37921. t2 += v * b1;
  37922. t3 += v * b2;
  37923. t4 += v * b3;
  37924. t5 += v * b4;
  37925. t6 += v * b5;
  37926. t7 += v * b6;
  37927. t8 += v * b7;
  37928. t9 += v * b8;
  37929. t10 += v * b9;
  37930. t11 += v * b10;
  37931. t12 += v * b11;
  37932. t13 += v * b12;
  37933. t14 += v * b13;
  37934. t15 += v * b14;
  37935. t16 += v * b15;
  37936. v = a[2];
  37937. t2 += v * b0;
  37938. t3 += v * b1;
  37939. t4 += v * b2;
  37940. t5 += v * b3;
  37941. t6 += v * b4;
  37942. t7 += v * b5;
  37943. t8 += v * b6;
  37944. t9 += v * b7;
  37945. t10 += v * b8;
  37946. t11 += v * b9;
  37947. t12 += v * b10;
  37948. t13 += v * b11;
  37949. t14 += v * b12;
  37950. t15 += v * b13;
  37951. t16 += v * b14;
  37952. t17 += v * b15;
  37953. v = a[3];
  37954. t3 += v * b0;
  37955. t4 += v * b1;
  37956. t5 += v * b2;
  37957. t6 += v * b3;
  37958. t7 += v * b4;
  37959. t8 += v * b5;
  37960. t9 += v * b6;
  37961. t10 += v * b7;
  37962. t11 += v * b8;
  37963. t12 += v * b9;
  37964. t13 += v * b10;
  37965. t14 += v * b11;
  37966. t15 += v * b12;
  37967. t16 += v * b13;
  37968. t17 += v * b14;
  37969. t18 += v * b15;
  37970. v = a[4];
  37971. t4 += v * b0;
  37972. t5 += v * b1;
  37973. t6 += v * b2;
  37974. t7 += v * b3;
  37975. t8 += v * b4;
  37976. t9 += v * b5;
  37977. t10 += v * b6;
  37978. t11 += v * b7;
  37979. t12 += v * b8;
  37980. t13 += v * b9;
  37981. t14 += v * b10;
  37982. t15 += v * b11;
  37983. t16 += v * b12;
  37984. t17 += v * b13;
  37985. t18 += v * b14;
  37986. t19 += v * b15;
  37987. v = a[5];
  37988. t5 += v * b0;
  37989. t6 += v * b1;
  37990. t7 += v * b2;
  37991. t8 += v * b3;
  37992. t9 += v * b4;
  37993. t10 += v * b5;
  37994. t11 += v * b6;
  37995. t12 += v * b7;
  37996. t13 += v * b8;
  37997. t14 += v * b9;
  37998. t15 += v * b10;
  37999. t16 += v * b11;
  38000. t17 += v * b12;
  38001. t18 += v * b13;
  38002. t19 += v * b14;
  38003. t20 += v * b15;
  38004. v = a[6];
  38005. t6 += v * b0;
  38006. t7 += v * b1;
  38007. t8 += v * b2;
  38008. t9 += v * b3;
  38009. t10 += v * b4;
  38010. t11 += v * b5;
  38011. t12 += v * b6;
  38012. t13 += v * b7;
  38013. t14 += v * b8;
  38014. t15 += v * b9;
  38015. t16 += v * b10;
  38016. t17 += v * b11;
  38017. t18 += v * b12;
  38018. t19 += v * b13;
  38019. t20 += v * b14;
  38020. t21 += v * b15;
  38021. v = a[7];
  38022. t7 += v * b0;
  38023. t8 += v * b1;
  38024. t9 += v * b2;
  38025. t10 += v * b3;
  38026. t11 += v * b4;
  38027. t12 += v * b5;
  38028. t13 += v * b6;
  38029. t14 += v * b7;
  38030. t15 += v * b8;
  38031. t16 += v * b9;
  38032. t17 += v * b10;
  38033. t18 += v * b11;
  38034. t19 += v * b12;
  38035. t20 += v * b13;
  38036. t21 += v * b14;
  38037. t22 += v * b15;
  38038. v = a[8];
  38039. t8 += v * b0;
  38040. t9 += v * b1;
  38041. t10 += v * b2;
  38042. t11 += v * b3;
  38043. t12 += v * b4;
  38044. t13 += v * b5;
  38045. t14 += v * b6;
  38046. t15 += v * b7;
  38047. t16 += v * b8;
  38048. t17 += v * b9;
  38049. t18 += v * b10;
  38050. t19 += v * b11;
  38051. t20 += v * b12;
  38052. t21 += v * b13;
  38053. t22 += v * b14;
  38054. t23 += v * b15;
  38055. v = a[9];
  38056. t9 += v * b0;
  38057. t10 += v * b1;
  38058. t11 += v * b2;
  38059. t12 += v * b3;
  38060. t13 += v * b4;
  38061. t14 += v * b5;
  38062. t15 += v * b6;
  38063. t16 += v * b7;
  38064. t17 += v * b8;
  38065. t18 += v * b9;
  38066. t19 += v * b10;
  38067. t20 += v * b11;
  38068. t21 += v * b12;
  38069. t22 += v * b13;
  38070. t23 += v * b14;
  38071. t24 += v * b15;
  38072. v = a[10];
  38073. t10 += v * b0;
  38074. t11 += v * b1;
  38075. t12 += v * b2;
  38076. t13 += v * b3;
  38077. t14 += v * b4;
  38078. t15 += v * b5;
  38079. t16 += v * b6;
  38080. t17 += v * b7;
  38081. t18 += v * b8;
  38082. t19 += v * b9;
  38083. t20 += v * b10;
  38084. t21 += v * b11;
  38085. t22 += v * b12;
  38086. t23 += v * b13;
  38087. t24 += v * b14;
  38088. t25 += v * b15;
  38089. v = a[11];
  38090. t11 += v * b0;
  38091. t12 += v * b1;
  38092. t13 += v * b2;
  38093. t14 += v * b3;
  38094. t15 += v * b4;
  38095. t16 += v * b5;
  38096. t17 += v * b6;
  38097. t18 += v * b7;
  38098. t19 += v * b8;
  38099. t20 += v * b9;
  38100. t21 += v * b10;
  38101. t22 += v * b11;
  38102. t23 += v * b12;
  38103. t24 += v * b13;
  38104. t25 += v * b14;
  38105. t26 += v * b15;
  38106. v = a[12];
  38107. t12 += v * b0;
  38108. t13 += v * b1;
  38109. t14 += v * b2;
  38110. t15 += v * b3;
  38111. t16 += v * b4;
  38112. t17 += v * b5;
  38113. t18 += v * b6;
  38114. t19 += v * b7;
  38115. t20 += v * b8;
  38116. t21 += v * b9;
  38117. t22 += v * b10;
  38118. t23 += v * b11;
  38119. t24 += v * b12;
  38120. t25 += v * b13;
  38121. t26 += v * b14;
  38122. t27 += v * b15;
  38123. v = a[13];
  38124. t13 += v * b0;
  38125. t14 += v * b1;
  38126. t15 += v * b2;
  38127. t16 += v * b3;
  38128. t17 += v * b4;
  38129. t18 += v * b5;
  38130. t19 += v * b6;
  38131. t20 += v * b7;
  38132. t21 += v * b8;
  38133. t22 += v * b9;
  38134. t23 += v * b10;
  38135. t24 += v * b11;
  38136. t25 += v * b12;
  38137. t26 += v * b13;
  38138. t27 += v * b14;
  38139. t28 += v * b15;
  38140. v = a[14];
  38141. t14 += v * b0;
  38142. t15 += v * b1;
  38143. t16 += v * b2;
  38144. t17 += v * b3;
  38145. t18 += v * b4;
  38146. t19 += v * b5;
  38147. t20 += v * b6;
  38148. t21 += v * b7;
  38149. t22 += v * b8;
  38150. t23 += v * b9;
  38151. t24 += v * b10;
  38152. t25 += v * b11;
  38153. t26 += v * b12;
  38154. t27 += v * b13;
  38155. t28 += v * b14;
  38156. t29 += v * b15;
  38157. v = a[15];
  38158. t15 += v * b0;
  38159. t16 += v * b1;
  38160. t17 += v * b2;
  38161. t18 += v * b3;
  38162. t19 += v * b4;
  38163. t20 += v * b5;
  38164. t21 += v * b6;
  38165. t22 += v * b7;
  38166. t23 += v * b8;
  38167. t24 += v * b9;
  38168. t25 += v * b10;
  38169. t26 += v * b11;
  38170. t27 += v * b12;
  38171. t28 += v * b13;
  38172. t29 += v * b14;
  38173. t30 += v * b15;
  38174. t0 += 38 * t16;
  38175. t1 += 38 * t17;
  38176. t2 += 38 * t18;
  38177. t3 += 38 * t19;
  38178. t4 += 38 * t20;
  38179. t5 += 38 * t21;
  38180. t6 += 38 * t22;
  38181. t7 += 38 * t23;
  38182. t8 += 38 * t24;
  38183. t9 += 38 * t25;
  38184. t10 += 38 * t26;
  38185. t11 += 38 * t27;
  38186. t12 += 38 * t28;
  38187. t13 += 38 * t29;
  38188. t14 += 38 * t30;
  38189. // t15 left as is
  38190. // first car
  38191. c = 1;
  38192. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38193. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38194. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38195. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38196. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38197. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38198. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38199. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38200. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38201. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38202. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38203. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38204. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38205. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38206. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38207. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38208. t0 += c-1 + 37 * (c-1);
  38209. // second car
  38210. c = 1;
  38211. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38212. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38213. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38214. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38215. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38216. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38217. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38218. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38219. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38220. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38221. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38222. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38223. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38224. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38225. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38226. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38227. t0 += c-1 + 37 * (c-1);
  38228. o[ 0] = t0;
  38229. o[ 1] = t1;
  38230. o[ 2] = t2;
  38231. o[ 3] = t3;
  38232. o[ 4] = t4;
  38233. o[ 5] = t5;
  38234. o[ 6] = t6;
  38235. o[ 7] = t7;
  38236. o[ 8] = t8;
  38237. o[ 9] = t9;
  38238. o[10] = t10;
  38239. o[11] = t11;
  38240. o[12] = t12;
  38241. o[13] = t13;
  38242. o[14] = t14;
  38243. o[15] = t15;
  38244. }
  38245. function S(o, a) {
  38246. M(o, a, a);
  38247. }
  38248. function inv25519(o, i) {
  38249. var c = gf();
  38250. var a;
  38251. for (a = 0; a < 16; a++) c[a] = i[a];
  38252. for (a = 253; a >= 0; a--) {
  38253. S(c, c);
  38254. if(a !== 2 && a !== 4) M(c, c, i);
  38255. }
  38256. for (a = 0; a < 16; a++) o[a] = c[a];
  38257. }
  38258. function pow2523(o, i) {
  38259. var c = gf();
  38260. var a;
  38261. for (a = 0; a < 16; a++) c[a] = i[a];
  38262. for (a = 250; a >= 0; a--) {
  38263. S(c, c);
  38264. if(a !== 1) M(c, c, i);
  38265. }
  38266. for (a = 0; a < 16; a++) o[a] = c[a];
  38267. }
  38268. function crypto_scalarmult(q, n, p) {
  38269. var z = new Uint8Array(32);
  38270. var x = new Float64Array(80), r, i;
  38271. var a = gf(), b = gf(), c = gf(),
  38272. d = gf(), e = gf(), f = gf();
  38273. for (i = 0; i < 31; i++) z[i] = n[i];
  38274. z[31]=(n[31]&127)|64;
  38275. z[0]&=248;
  38276. unpack25519(x,p);
  38277. for (i = 0; i < 16; i++) {
  38278. b[i]=x[i];
  38279. d[i]=a[i]=c[i]=0;
  38280. }
  38281. a[0]=d[0]=1;
  38282. for (i=254; i>=0; --i) {
  38283. r=(z[i>>>3]>>>(i&7))&1;
  38284. sel25519(a,b,r);
  38285. sel25519(c,d,r);
  38286. A(e,a,c);
  38287. Z(a,a,c);
  38288. A(c,b,d);
  38289. Z(b,b,d);
  38290. S(d,e);
  38291. S(f,a);
  38292. M(a,c,a);
  38293. M(c,b,e);
  38294. A(e,a,c);
  38295. Z(a,a,c);
  38296. S(b,a);
  38297. Z(c,d,f);
  38298. M(a,c,_121665);
  38299. A(a,a,d);
  38300. M(c,c,a);
  38301. M(a,d,f);
  38302. M(d,b,x);
  38303. S(b,e);
  38304. sel25519(a,b,r);
  38305. sel25519(c,d,r);
  38306. }
  38307. for (i = 0; i < 16; i++) {
  38308. x[i+16]=a[i];
  38309. x[i+32]=c[i];
  38310. x[i+48]=b[i];
  38311. x[i+64]=d[i];
  38312. }
  38313. var x32 = x.subarray(32);
  38314. var x16 = x.subarray(16);
  38315. inv25519(x32,x32);
  38316. M(x16,x16,x32);
  38317. pack25519(q,x16);
  38318. return 0;
  38319. }
  38320. function crypto_scalarmult_base(q, n) {
  38321. return crypto_scalarmult(q, n, _9);
  38322. }
  38323. function crypto_box_keypair(y, x) {
  38324. randombytes(x, 32);
  38325. return crypto_scalarmult_base(y, x);
  38326. }
  38327. function crypto_box_beforenm(k, y, x) {
  38328. var s = new Uint8Array(32);
  38329. crypto_scalarmult(s, x, y);
  38330. return crypto_core_hsalsa20(k, _0, s, sigma);
  38331. }
  38332. var crypto_box_afternm = crypto_secretbox;
  38333. var crypto_box_open_afternm = crypto_secretbox_open;
  38334. function crypto_box(c, m, d, n, y, x) {
  38335. var k = new Uint8Array(32);
  38336. crypto_box_beforenm(k, y, x);
  38337. return crypto_box_afternm(c, m, d, n, k);
  38338. }
  38339. function crypto_box_open(m, c, d, n, y, x) {
  38340. var k = new Uint8Array(32);
  38341. crypto_box_beforenm(k, y, x);
  38342. return crypto_box_open_afternm(m, c, d, n, k);
  38343. }
  38344. var K = [
  38345. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38346. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38347. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38348. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38349. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38350. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38351. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38352. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38353. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38354. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38355. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38356. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38357. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38358. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38359. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38360. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38361. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38362. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38363. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38364. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38365. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38366. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38367. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38368. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38369. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38370. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38371. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38372. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38373. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38374. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38375. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38376. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38377. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38378. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38379. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38380. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38381. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38382. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38383. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38384. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38385. ];
  38386. function crypto_hashblocks_hl(hh, hl, m, n) {
  38387. var wh = new Int32Array(16), wl = new Int32Array(16),
  38388. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38389. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38390. th, tl, i, j, h, l, a, b, c, d;
  38391. var ah0 = hh[0],
  38392. ah1 = hh[1],
  38393. ah2 = hh[2],
  38394. ah3 = hh[3],
  38395. ah4 = hh[4],
  38396. ah5 = hh[5],
  38397. ah6 = hh[6],
  38398. ah7 = hh[7],
  38399. al0 = hl[0],
  38400. al1 = hl[1],
  38401. al2 = hl[2],
  38402. al3 = hl[3],
  38403. al4 = hl[4],
  38404. al5 = hl[5],
  38405. al6 = hl[6],
  38406. al7 = hl[7];
  38407. var pos = 0;
  38408. while (n >= 128) {
  38409. for (i = 0; i < 16; i++) {
  38410. j = 8 * i + pos;
  38411. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38412. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38413. }
  38414. for (i = 0; i < 80; i++) {
  38415. bh0 = ah0;
  38416. bh1 = ah1;
  38417. bh2 = ah2;
  38418. bh3 = ah3;
  38419. bh4 = ah4;
  38420. bh5 = ah5;
  38421. bh6 = ah6;
  38422. bh7 = ah7;
  38423. bl0 = al0;
  38424. bl1 = al1;
  38425. bl2 = al2;
  38426. bl3 = al3;
  38427. bl4 = al4;
  38428. bl5 = al5;
  38429. bl6 = al6;
  38430. bl7 = al7;
  38431. // add
  38432. h = ah7;
  38433. l = al7;
  38434. a = l & 0xffff; b = l >>> 16;
  38435. c = h & 0xffff; d = h >>> 16;
  38436. // Sigma1
  38437. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38438. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38439. a += l & 0xffff; b += l >>> 16;
  38440. c += h & 0xffff; d += h >>> 16;
  38441. // Ch
  38442. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38443. l = (al4 & al5) ^ (~al4 & al6);
  38444. a += l & 0xffff; b += l >>> 16;
  38445. c += h & 0xffff; d += h >>> 16;
  38446. // K
  38447. h = K[i*2];
  38448. l = K[i*2+1];
  38449. a += l & 0xffff; b += l >>> 16;
  38450. c += h & 0xffff; d += h >>> 16;
  38451. // w
  38452. h = wh[i%16];
  38453. l = wl[i%16];
  38454. a += l & 0xffff; b += l >>> 16;
  38455. c += h & 0xffff; d += h >>> 16;
  38456. b += a >>> 16;
  38457. c += b >>> 16;
  38458. d += c >>> 16;
  38459. th = c & 0xffff | d << 16;
  38460. tl = a & 0xffff | b << 16;
  38461. // add
  38462. h = th;
  38463. l = tl;
  38464. a = l & 0xffff; b = l >>> 16;
  38465. c = h & 0xffff; d = h >>> 16;
  38466. // Sigma0
  38467. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38468. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38469. a += l & 0xffff; b += l >>> 16;
  38470. c += h & 0xffff; d += h >>> 16;
  38471. // Maj
  38472. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38473. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38474. a += l & 0xffff; b += l >>> 16;
  38475. c += h & 0xffff; d += h >>> 16;
  38476. b += a >>> 16;
  38477. c += b >>> 16;
  38478. d += c >>> 16;
  38479. bh7 = (c & 0xffff) | (d << 16);
  38480. bl7 = (a & 0xffff) | (b << 16);
  38481. // add
  38482. h = bh3;
  38483. l = bl3;
  38484. a = l & 0xffff; b = l >>> 16;
  38485. c = h & 0xffff; d = h >>> 16;
  38486. h = th;
  38487. l = tl;
  38488. a += l & 0xffff; b += l >>> 16;
  38489. c += h & 0xffff; d += h >>> 16;
  38490. b += a >>> 16;
  38491. c += b >>> 16;
  38492. d += c >>> 16;
  38493. bh3 = (c & 0xffff) | (d << 16);
  38494. bl3 = (a & 0xffff) | (b << 16);
  38495. ah1 = bh0;
  38496. ah2 = bh1;
  38497. ah3 = bh2;
  38498. ah4 = bh3;
  38499. ah5 = bh4;
  38500. ah6 = bh5;
  38501. ah7 = bh6;
  38502. ah0 = bh7;
  38503. al1 = bl0;
  38504. al2 = bl1;
  38505. al3 = bl2;
  38506. al4 = bl3;
  38507. al5 = bl4;
  38508. al6 = bl5;
  38509. al7 = bl6;
  38510. al0 = bl7;
  38511. if (i%16 === 15) {
  38512. for (j = 0; j < 16; j++) {
  38513. // add
  38514. h = wh[j];
  38515. l = wl[j];
  38516. a = l & 0xffff; b = l >>> 16;
  38517. c = h & 0xffff; d = h >>> 16;
  38518. h = wh[(j+9)%16];
  38519. l = wl[(j+9)%16];
  38520. a += l & 0xffff; b += l >>> 16;
  38521. c += h & 0xffff; d += h >>> 16;
  38522. // sigma0
  38523. th = wh[(j+1)%16];
  38524. tl = wl[(j+1)%16];
  38525. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38526. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38527. a += l & 0xffff; b += l >>> 16;
  38528. c += h & 0xffff; d += h >>> 16;
  38529. // sigma1
  38530. th = wh[(j+14)%16];
  38531. tl = wl[(j+14)%16];
  38532. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38533. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38534. a += l & 0xffff; b += l >>> 16;
  38535. c += h & 0xffff; d += h >>> 16;
  38536. b += a >>> 16;
  38537. c += b >>> 16;
  38538. d += c >>> 16;
  38539. wh[j] = (c & 0xffff) | (d << 16);
  38540. wl[j] = (a & 0xffff) | (b << 16);
  38541. }
  38542. }
  38543. }
  38544. // add
  38545. h = ah0;
  38546. l = al0;
  38547. a = l & 0xffff; b = l >>> 16;
  38548. c = h & 0xffff; d = h >>> 16;
  38549. h = hh[0];
  38550. l = hl[0];
  38551. a += l & 0xffff; b += l >>> 16;
  38552. c += h & 0xffff; d += h >>> 16;
  38553. b += a >>> 16;
  38554. c += b >>> 16;
  38555. d += c >>> 16;
  38556. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38557. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38558. h = ah1;
  38559. l = al1;
  38560. a = l & 0xffff; b = l >>> 16;
  38561. c = h & 0xffff; d = h >>> 16;
  38562. h = hh[1];
  38563. l = hl[1];
  38564. a += l & 0xffff; b += l >>> 16;
  38565. c += h & 0xffff; d += h >>> 16;
  38566. b += a >>> 16;
  38567. c += b >>> 16;
  38568. d += c >>> 16;
  38569. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38570. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38571. h = ah2;
  38572. l = al2;
  38573. a = l & 0xffff; b = l >>> 16;
  38574. c = h & 0xffff; d = h >>> 16;
  38575. h = hh[2];
  38576. l = hl[2];
  38577. a += l & 0xffff; b += l >>> 16;
  38578. c += h & 0xffff; d += h >>> 16;
  38579. b += a >>> 16;
  38580. c += b >>> 16;
  38581. d += c >>> 16;
  38582. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38583. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38584. h = ah3;
  38585. l = al3;
  38586. a = l & 0xffff; b = l >>> 16;
  38587. c = h & 0xffff; d = h >>> 16;
  38588. h = hh[3];
  38589. l = hl[3];
  38590. a += l & 0xffff; b += l >>> 16;
  38591. c += h & 0xffff; d += h >>> 16;
  38592. b += a >>> 16;
  38593. c += b >>> 16;
  38594. d += c >>> 16;
  38595. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38596. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38597. h = ah4;
  38598. l = al4;
  38599. a = l & 0xffff; b = l >>> 16;
  38600. c = h & 0xffff; d = h >>> 16;
  38601. h = hh[4];
  38602. l = hl[4];
  38603. a += l & 0xffff; b += l >>> 16;
  38604. c += h & 0xffff; d += h >>> 16;
  38605. b += a >>> 16;
  38606. c += b >>> 16;
  38607. d += c >>> 16;
  38608. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38609. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38610. h = ah5;
  38611. l = al5;
  38612. a = l & 0xffff; b = l >>> 16;
  38613. c = h & 0xffff; d = h >>> 16;
  38614. h = hh[5];
  38615. l = hl[5];
  38616. a += l & 0xffff; b += l >>> 16;
  38617. c += h & 0xffff; d += h >>> 16;
  38618. b += a >>> 16;
  38619. c += b >>> 16;
  38620. d += c >>> 16;
  38621. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38622. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38623. h = ah6;
  38624. l = al6;
  38625. a = l & 0xffff; b = l >>> 16;
  38626. c = h & 0xffff; d = h >>> 16;
  38627. h = hh[6];
  38628. l = hl[6];
  38629. a += l & 0xffff; b += l >>> 16;
  38630. c += h & 0xffff; d += h >>> 16;
  38631. b += a >>> 16;
  38632. c += b >>> 16;
  38633. d += c >>> 16;
  38634. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38635. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38636. h = ah7;
  38637. l = al7;
  38638. a = l & 0xffff; b = l >>> 16;
  38639. c = h & 0xffff; d = h >>> 16;
  38640. h = hh[7];
  38641. l = hl[7];
  38642. a += l & 0xffff; b += l >>> 16;
  38643. c += h & 0xffff; d += h >>> 16;
  38644. b += a >>> 16;
  38645. c += b >>> 16;
  38646. d += c >>> 16;
  38647. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38648. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38649. pos += 128;
  38650. n -= 128;
  38651. }
  38652. return n;
  38653. }
  38654. function crypto_hash(out, m, n) {
  38655. var hh = new Int32Array(8),
  38656. hl = new Int32Array(8),
  38657. x = new Uint8Array(256),
  38658. i, b = n;
  38659. hh[0] = 0x6a09e667;
  38660. hh[1] = 0xbb67ae85;
  38661. hh[2] = 0x3c6ef372;
  38662. hh[3] = 0xa54ff53a;
  38663. hh[4] = 0x510e527f;
  38664. hh[5] = 0x9b05688c;
  38665. hh[6] = 0x1f83d9ab;
  38666. hh[7] = 0x5be0cd19;
  38667. hl[0] = 0xf3bcc908;
  38668. hl[1] = 0x84caa73b;
  38669. hl[2] = 0xfe94f82b;
  38670. hl[3] = 0x5f1d36f1;
  38671. hl[4] = 0xade682d1;
  38672. hl[5] = 0x2b3e6c1f;
  38673. hl[6] = 0xfb41bd6b;
  38674. hl[7] = 0x137e2179;
  38675. crypto_hashblocks_hl(hh, hl, m, n);
  38676. n %= 128;
  38677. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38678. x[n] = 128;
  38679. n = 256-128*(n<112?1:0);
  38680. x[n-9] = 0;
  38681. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38682. crypto_hashblocks_hl(hh, hl, x, n);
  38683. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38684. return 0;
  38685. }
  38686. function add(p, q) {
  38687. var a = gf(), b = gf(), c = gf(),
  38688. d = gf(), e = gf(), f = gf(),
  38689. g = gf(), h = gf(), t = gf();
  38690. Z(a, p[1], p[0]);
  38691. Z(t, q[1], q[0]);
  38692. M(a, a, t);
  38693. A(b, p[0], p[1]);
  38694. A(t, q[0], q[1]);
  38695. M(b, b, t);
  38696. M(c, p[3], q[3]);
  38697. M(c, c, D2);
  38698. M(d, p[2], q[2]);
  38699. A(d, d, d);
  38700. Z(e, b, a);
  38701. Z(f, d, c);
  38702. A(g, d, c);
  38703. A(h, b, a);
  38704. M(p[0], e, f);
  38705. M(p[1], h, g);
  38706. M(p[2], g, f);
  38707. M(p[3], e, h);
  38708. }
  38709. function cswap(p, q, b) {
  38710. var i;
  38711. for (i = 0; i < 4; i++) {
  38712. sel25519(p[i], q[i], b);
  38713. }
  38714. }
  38715. function pack(r, p) {
  38716. var tx = gf(), ty = gf(), zi = gf();
  38717. inv25519(zi, p[2]);
  38718. M(tx, p[0], zi);
  38719. M(ty, p[1], zi);
  38720. pack25519(r, ty);
  38721. r[31] ^= par25519(tx) << 7;
  38722. }
  38723. function scalarmult(p, q, s) {
  38724. var b, i;
  38725. set25519(p[0], gf0);
  38726. set25519(p[1], gf1);
  38727. set25519(p[2], gf1);
  38728. set25519(p[3], gf0);
  38729. for (i = 255; i >= 0; --i) {
  38730. b = (s[(i/8)|0] >> (i&7)) & 1;
  38731. cswap(p, q, b);
  38732. add(q, p);
  38733. add(p, p);
  38734. cswap(p, q, b);
  38735. }
  38736. }
  38737. function scalarbase(p, s) {
  38738. var q = [gf(), gf(), gf(), gf()];
  38739. set25519(q[0], X);
  38740. set25519(q[1], Y);
  38741. set25519(q[2], gf1);
  38742. M(q[3], X, Y);
  38743. scalarmult(p, q, s);
  38744. }
  38745. function crypto_sign_keypair(pk, sk, seeded) {
  38746. var d = new Uint8Array(64);
  38747. var p = [gf(), gf(), gf(), gf()];
  38748. var i;
  38749. if (!seeded) randombytes(sk, 32);
  38750. crypto_hash(d, sk, 32);
  38751. d[0] &= 248;
  38752. d[31] &= 127;
  38753. d[31] |= 64;
  38754. scalarbase(p, d);
  38755. pack(pk, p);
  38756. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38757. return 0;
  38758. }
  38759. 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]);
  38760. function modL(r, x) {
  38761. var carry, i, j, k;
  38762. for (i = 63; i >= 32; --i) {
  38763. carry = 0;
  38764. for (j = i - 32, k = i - 12; j < k; ++j) {
  38765. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38766. carry = (x[j] + 128) >> 8;
  38767. x[j] -= carry * 256;
  38768. }
  38769. x[j] += carry;
  38770. x[i] = 0;
  38771. }
  38772. carry = 0;
  38773. for (j = 0; j < 32; j++) {
  38774. x[j] += carry - (x[31] >> 4) * L[j];
  38775. carry = x[j] >> 8;
  38776. x[j] &= 255;
  38777. }
  38778. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38779. for (i = 0; i < 32; i++) {
  38780. x[i+1] += x[i] >> 8;
  38781. r[i] = x[i] & 255;
  38782. }
  38783. }
  38784. function reduce(r) {
  38785. var x = new Float64Array(64), i;
  38786. for (i = 0; i < 64; i++) x[i] = r[i];
  38787. for (i = 0; i < 64; i++) r[i] = 0;
  38788. modL(r, x);
  38789. }
  38790. // Note: difference from C - smlen returned, not passed as argument.
  38791. function crypto_sign(sm, m, n, sk) {
  38792. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38793. var i, j, x = new Float64Array(64);
  38794. var p = [gf(), gf(), gf(), gf()];
  38795. crypto_hash(d, sk, 32);
  38796. d[0] &= 248;
  38797. d[31] &= 127;
  38798. d[31] |= 64;
  38799. var smlen = n + 64;
  38800. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38801. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38802. crypto_hash(r, sm.subarray(32), n+32);
  38803. reduce(r);
  38804. scalarbase(p, r);
  38805. pack(sm, p);
  38806. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38807. crypto_hash(h, sm, n + 64);
  38808. reduce(h);
  38809. for (i = 0; i < 64; i++) x[i] = 0;
  38810. for (i = 0; i < 32; i++) x[i] = r[i];
  38811. for (i = 0; i < 32; i++) {
  38812. for (j = 0; j < 32; j++) {
  38813. x[i+j] += h[i] * d[j];
  38814. }
  38815. }
  38816. modL(sm.subarray(32), x);
  38817. return smlen;
  38818. }
  38819. function unpackneg(r, p) {
  38820. var t = gf(), chk = gf(), num = gf(),
  38821. den = gf(), den2 = gf(), den4 = gf(),
  38822. den6 = gf();
  38823. set25519(r[2], gf1);
  38824. unpack25519(r[1], p);
  38825. S(num, r[1]);
  38826. M(den, num, D);
  38827. Z(num, num, r[2]);
  38828. A(den, r[2], den);
  38829. S(den2, den);
  38830. S(den4, den2);
  38831. M(den6, den4, den2);
  38832. M(t, den6, num);
  38833. M(t, t, den);
  38834. pow2523(t, t);
  38835. M(t, t, num);
  38836. M(t, t, den);
  38837. M(t, t, den);
  38838. M(r[0], t, den);
  38839. S(chk, r[0]);
  38840. M(chk, chk, den);
  38841. if (neq25519(chk, num)) M(r[0], r[0], I);
  38842. S(chk, r[0]);
  38843. M(chk, chk, den);
  38844. if (neq25519(chk, num)) return -1;
  38845. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38846. M(r[3], r[0], r[1]);
  38847. return 0;
  38848. }
  38849. function crypto_sign_open(m, sm, n, pk) {
  38850. var i, mlen;
  38851. var t = new Uint8Array(32), h = new Uint8Array(64);
  38852. var p = [gf(), gf(), gf(), gf()],
  38853. q = [gf(), gf(), gf(), gf()];
  38854. mlen = -1;
  38855. if (n < 64) return -1;
  38856. if (unpackneg(q, pk)) return -1;
  38857. for (i = 0; i < n; i++) m[i] = sm[i];
  38858. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38859. crypto_hash(h, m, n);
  38860. reduce(h);
  38861. scalarmult(p, q, h);
  38862. scalarbase(q, sm.subarray(32));
  38863. add(p, q);
  38864. pack(t, p);
  38865. n -= 64;
  38866. if (crypto_verify_32(sm, 0, t, 0)) {
  38867. for (i = 0; i < n; i++) m[i] = 0;
  38868. return -1;
  38869. }
  38870. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38871. mlen = n;
  38872. return mlen;
  38873. }
  38874. var crypto_secretbox_KEYBYTES = 32,
  38875. crypto_secretbox_NONCEBYTES = 24,
  38876. crypto_secretbox_ZEROBYTES = 32,
  38877. crypto_secretbox_BOXZEROBYTES = 16,
  38878. crypto_scalarmult_BYTES = 32,
  38879. crypto_scalarmult_SCALARBYTES = 32,
  38880. crypto_box_PUBLICKEYBYTES = 32,
  38881. crypto_box_SECRETKEYBYTES = 32,
  38882. crypto_box_BEFORENMBYTES = 32,
  38883. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38884. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38885. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38886. crypto_sign_BYTES = 64,
  38887. crypto_sign_PUBLICKEYBYTES = 32,
  38888. crypto_sign_SECRETKEYBYTES = 64,
  38889. crypto_sign_SEEDBYTES = 32,
  38890. crypto_hash_BYTES = 64;
  38891. nacl.lowlevel = {
  38892. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38893. crypto_stream_xor: crypto_stream_xor,
  38894. crypto_stream: crypto_stream,
  38895. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38896. crypto_stream_salsa20: crypto_stream_salsa20,
  38897. crypto_onetimeauth: crypto_onetimeauth,
  38898. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38899. crypto_verify_16: crypto_verify_16,
  38900. crypto_verify_32: crypto_verify_32,
  38901. crypto_secretbox: crypto_secretbox,
  38902. crypto_secretbox_open: crypto_secretbox_open,
  38903. crypto_scalarmult: crypto_scalarmult,
  38904. crypto_scalarmult_base: crypto_scalarmult_base,
  38905. crypto_box_beforenm: crypto_box_beforenm,
  38906. crypto_box_afternm: crypto_box_afternm,
  38907. crypto_box: crypto_box,
  38908. crypto_box_open: crypto_box_open,
  38909. crypto_box_keypair: crypto_box_keypair,
  38910. crypto_hash: crypto_hash,
  38911. crypto_sign: crypto_sign,
  38912. crypto_sign_keypair: crypto_sign_keypair,
  38913. crypto_sign_open: crypto_sign_open,
  38914. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38915. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38916. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38917. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38918. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38919. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38920. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38921. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38922. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38923. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38924. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38925. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38926. crypto_sign_BYTES: crypto_sign_BYTES,
  38927. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38928. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38929. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38930. crypto_hash_BYTES: crypto_hash_BYTES
  38931. };
  38932. /* High-level API */
  38933. function checkLengths(k, n) {
  38934. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38935. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38936. }
  38937. function checkBoxLengths(pk, sk) {
  38938. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38939. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38940. }
  38941. function checkArrayTypes() {
  38942. for (var i = 0; i < arguments.length; i++) {
  38943. if (!(arguments[i] instanceof Uint8Array))
  38944. throw new TypeError('unexpected type, use Uint8Array');
  38945. }
  38946. }
  38947. function cleanup(arr) {
  38948. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38949. }
  38950. nacl.randomBytes = function(n) {
  38951. var b = new Uint8Array(n);
  38952. randombytes(b, n);
  38953. return b;
  38954. };
  38955. nacl.secretbox = function(msg, nonce, key) {
  38956. checkArrayTypes(msg, nonce, key);
  38957. checkLengths(key, nonce);
  38958. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38959. var c = new Uint8Array(m.length);
  38960. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38961. crypto_secretbox(c, m, m.length, nonce, key);
  38962. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38963. };
  38964. nacl.secretbox.open = function(box, nonce, key) {
  38965. checkArrayTypes(box, nonce, key);
  38966. checkLengths(key, nonce);
  38967. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38968. var m = new Uint8Array(c.length);
  38969. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38970. if (c.length < 32) return null;
  38971. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38972. return m.subarray(crypto_secretbox_ZEROBYTES);
  38973. };
  38974. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38975. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38976. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38977. nacl.scalarMult = function(n, p) {
  38978. checkArrayTypes(n, p);
  38979. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38980. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38981. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38982. crypto_scalarmult(q, n, p);
  38983. return q;
  38984. };
  38985. nacl.scalarMult.base = function(n) {
  38986. checkArrayTypes(n);
  38987. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38988. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38989. crypto_scalarmult_base(q, n);
  38990. return q;
  38991. };
  38992. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38993. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38994. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38995. var k = nacl.box.before(publicKey, secretKey);
  38996. return nacl.secretbox(msg, nonce, k);
  38997. };
  38998. nacl.box.before = function(publicKey, secretKey) {
  38999. checkArrayTypes(publicKey, secretKey);
  39000. checkBoxLengths(publicKey, secretKey);
  39001. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39002. crypto_box_beforenm(k, publicKey, secretKey);
  39003. return k;
  39004. };
  39005. nacl.box.after = nacl.secretbox;
  39006. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39007. var k = nacl.box.before(publicKey, secretKey);
  39008. return nacl.secretbox.open(msg, nonce, k);
  39009. };
  39010. nacl.box.open.after = nacl.secretbox.open;
  39011. nacl.box.keyPair = function() {
  39012. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39013. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39014. crypto_box_keypair(pk, sk);
  39015. return {publicKey: pk, secretKey: sk};
  39016. };
  39017. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39018. checkArrayTypes(secretKey);
  39019. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39020. throw new Error('bad secret key size');
  39021. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39022. crypto_scalarmult_base(pk, secretKey);
  39023. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39024. };
  39025. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39026. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39027. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39028. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39029. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39030. nacl.sign = function(msg, secretKey) {
  39031. checkArrayTypes(msg, secretKey);
  39032. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39033. throw new Error('bad secret key size');
  39034. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39035. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39036. return signedMsg;
  39037. };
  39038. nacl.sign.open = function(signedMsg, publicKey) {
  39039. checkArrayTypes(signedMsg, publicKey);
  39040. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39041. throw new Error('bad public key size');
  39042. var tmp = new Uint8Array(signedMsg.length);
  39043. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39044. if (mlen < 0) return null;
  39045. var m = new Uint8Array(mlen);
  39046. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39047. return m;
  39048. };
  39049. nacl.sign.detached = function(msg, secretKey) {
  39050. var signedMsg = nacl.sign(msg, secretKey);
  39051. var sig = new Uint8Array(crypto_sign_BYTES);
  39052. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39053. return sig;
  39054. };
  39055. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39056. checkArrayTypes(msg, sig, publicKey);
  39057. if (sig.length !== crypto_sign_BYTES)
  39058. throw new Error('bad signature size');
  39059. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39060. throw new Error('bad public key size');
  39061. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39062. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39063. var i;
  39064. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39065. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39066. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39067. };
  39068. nacl.sign.keyPair = function() {
  39069. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39070. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39071. crypto_sign_keypair(pk, sk);
  39072. return {publicKey: pk, secretKey: sk};
  39073. };
  39074. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39075. checkArrayTypes(secretKey);
  39076. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39077. throw new Error('bad secret key size');
  39078. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39079. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39080. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39081. };
  39082. nacl.sign.keyPair.fromSeed = function(seed) {
  39083. checkArrayTypes(seed);
  39084. if (seed.length !== crypto_sign_SEEDBYTES)
  39085. throw new Error('bad seed size');
  39086. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39087. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39088. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39089. crypto_sign_keypair(pk, sk, true);
  39090. return {publicKey: pk, secretKey: sk};
  39091. };
  39092. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39093. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39094. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39095. nacl.sign.signatureLength = crypto_sign_BYTES;
  39096. nacl.hash = function(msg) {
  39097. checkArrayTypes(msg);
  39098. var h = new Uint8Array(crypto_hash_BYTES);
  39099. crypto_hash(h, msg, msg.length);
  39100. return h;
  39101. };
  39102. nacl.hash.hashLength = crypto_hash_BYTES;
  39103. nacl.verify = function(x, y) {
  39104. checkArrayTypes(x, y);
  39105. // Zero length arguments are considered not equal.
  39106. if (x.length === 0 || y.length === 0) return false;
  39107. if (x.length !== y.length) return false;
  39108. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39109. };
  39110. nacl.setPRNG = function(fn) {
  39111. randombytes = fn;
  39112. };
  39113. (function() {
  39114. // Initialize PRNG if environment provides CSPRNG.
  39115. // If not, methods calling randombytes will throw.
  39116. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39117. if (crypto && crypto.getRandomValues) {
  39118. // Browsers.
  39119. var QUOTA = 65536;
  39120. nacl.setPRNG(function(x, n) {
  39121. var i, v = new Uint8Array(n);
  39122. for (i = 0; i < n; i += QUOTA) {
  39123. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39124. }
  39125. for (i = 0; i < n; i++) x[i] = v[i];
  39126. cleanup(v);
  39127. });
  39128. } else if (true) {
  39129. // Node.js.
  39130. crypto = __webpack_require__(3);
  39131. if (crypto && crypto.randomBytes) {
  39132. nacl.setPRNG(function(x, n) {
  39133. var i, v = crypto.randomBytes(n);
  39134. for (i = 0; i < n; i++) x[i] = v[i];
  39135. cleanup(v);
  39136. });
  39137. }
  39138. }
  39139. })();
  39140. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39141. /***/ }),
  39142. /* 1 */
  39143. /***/ (function(module, exports, __webpack_require__) {
  39144. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39145. // Public domain.
  39146. (function(root, f) {
  39147. 'use strict';
  39148. if ( true && module.exports) module.exports = f();
  39149. else if (root.nacl) root.nacl.util = f();
  39150. else {
  39151. root.nacl = {};
  39152. root.nacl.util = f();
  39153. }
  39154. }(this, function() {
  39155. 'use strict';
  39156. var util = {};
  39157. function validateBase64(s) {
  39158. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39159. throw new TypeError('invalid encoding');
  39160. }
  39161. }
  39162. util.decodeUTF8 = function(s) {
  39163. if (typeof s !== 'string') throw new TypeError('expected string');
  39164. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39165. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39166. return b;
  39167. };
  39168. util.encodeUTF8 = function(arr) {
  39169. var i, s = [];
  39170. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39171. return decodeURIComponent(escape(s.join('')));
  39172. };
  39173. if (typeof atob === 'undefined') {
  39174. // Node.js
  39175. if (typeof Buffer.from !== 'undefined') {
  39176. // Node v6 and later
  39177. util.encodeBase64 = function (arr) { // v6 and later
  39178. return Buffer.from(arr).toString('base64');
  39179. };
  39180. util.decodeBase64 = function (s) {
  39181. validateBase64(s);
  39182. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39183. };
  39184. } else {
  39185. // Node earlier than v6
  39186. util.encodeBase64 = function (arr) { // v6 and later
  39187. return (new Buffer(arr)).toString('base64');
  39188. };
  39189. util.decodeBase64 = function(s) {
  39190. validateBase64(s);
  39191. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39192. };
  39193. }
  39194. } else {
  39195. // Browsers
  39196. util.encodeBase64 = function(arr) {
  39197. var i, s = [], len = arr.length;
  39198. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39199. return btoa(s.join(''));
  39200. };
  39201. util.decodeBase64 = function(s) {
  39202. validateBase64(s);
  39203. var i, d = atob(s), b = new Uint8Array(d.length);
  39204. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39205. return b;
  39206. };
  39207. }
  39208. return util;
  39209. }));
  39210. /***/ }),
  39211. /* 2 */
  39212. /***/ (function(module, exports, __webpack_require__) {
  39213. // required so we don't have to do require('pusher').default etc.
  39214. module.exports = __webpack_require__(4).default;
  39215. /***/ }),
  39216. /* 3 */
  39217. /***/ (function(module, exports) {
  39218. /* (ignored) */
  39219. /***/ }),
  39220. /* 4 */
  39221. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39222. "use strict";
  39223. __webpack_require__.r(__webpack_exports__);
  39224. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39225. var ScriptReceiverFactory = (function () {
  39226. function ScriptReceiverFactory(prefix, name) {
  39227. this.lastId = 0;
  39228. this.prefix = prefix;
  39229. this.name = name;
  39230. }
  39231. ScriptReceiverFactory.prototype.create = function (callback) {
  39232. this.lastId++;
  39233. var number = this.lastId;
  39234. var id = this.prefix + number;
  39235. var name = this.name + "[" + number + "]";
  39236. var called = false;
  39237. var callbackWrapper = function () {
  39238. if (!called) {
  39239. callback.apply(null, arguments);
  39240. called = true;
  39241. }
  39242. };
  39243. this[number] = callbackWrapper;
  39244. return { number: number, id: id, name: name, callback: callbackWrapper };
  39245. };
  39246. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39247. delete this[receiver.number];
  39248. };
  39249. return ScriptReceiverFactory;
  39250. }());
  39251. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39252. // CONCATENATED MODULE: ./src/core/defaults.ts
  39253. var Defaults = {
  39254. VERSION: "5.0.3",
  39255. PROTOCOL: 7,
  39256. host: 'ws.pusherapp.com',
  39257. ws_port: 80,
  39258. wss_port: 443,
  39259. ws_path: '',
  39260. sockjs_host: 'sockjs.pusher.com',
  39261. sockjs_http_port: 80,
  39262. sockjs_https_port: 443,
  39263. sockjs_path: '/pusher',
  39264. stats_host: 'stats.pusher.com',
  39265. channel_auth_endpoint: '/pusher/auth',
  39266. channel_auth_transport: 'ajax',
  39267. activity_timeout: 120000,
  39268. pong_timeout: 30000,
  39269. unavailable_timeout: 10000,
  39270. cdn_http: "http://js.pusher.com",
  39271. cdn_https: "https://js.pusher.com",
  39272. dependency_suffix: ""
  39273. };
  39274. /* harmony default export */ var defaults = (Defaults);
  39275. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39276. var dependency_loader_DependencyLoader = (function () {
  39277. function DependencyLoader(options) {
  39278. this.options = options;
  39279. this.receivers = options.receivers || ScriptReceivers;
  39280. this.loading = {};
  39281. }
  39282. DependencyLoader.prototype.load = function (name, options, callback) {
  39283. var self = this;
  39284. if (self.loading[name] && self.loading[name].length > 0) {
  39285. self.loading[name].push(callback);
  39286. }
  39287. else {
  39288. self.loading[name] = [callback];
  39289. var request = runtime.createScriptRequest(self.getPath(name, options));
  39290. var receiver = self.receivers.create(function (error) {
  39291. self.receivers.remove(receiver);
  39292. if (self.loading[name]) {
  39293. var callbacks = self.loading[name];
  39294. delete self.loading[name];
  39295. var successCallback = function (wasSuccessful) {
  39296. if (!wasSuccessful) {
  39297. request.cleanup();
  39298. }
  39299. };
  39300. for (var i = 0; i < callbacks.length; i++) {
  39301. callbacks[i](error, successCallback);
  39302. }
  39303. }
  39304. });
  39305. request.send(receiver);
  39306. }
  39307. };
  39308. DependencyLoader.prototype.getRoot = function (options) {
  39309. var cdn;
  39310. var protocol = runtime.getDocument().location.protocol;
  39311. if ((options && options.useTLS) || protocol === "https:") {
  39312. cdn = this.options.cdn_https;
  39313. }
  39314. else {
  39315. cdn = this.options.cdn_http;
  39316. }
  39317. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39318. };
  39319. DependencyLoader.prototype.getPath = function (name, options) {
  39320. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39321. };
  39322. ;
  39323. return DependencyLoader;
  39324. }());
  39325. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39326. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39327. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39328. var Dependencies = new dependency_loader({
  39329. cdn_http: defaults.cdn_http,
  39330. cdn_https: defaults.cdn_https,
  39331. version: defaults.VERSION,
  39332. suffix: defaults.dependency_suffix,
  39333. receivers: DependenciesReceivers
  39334. });
  39335. // CONCATENATED MODULE: ./src/core/base64.ts
  39336. function encode(s) {
  39337. return btoa(utob(s));
  39338. }
  39339. var fromCharCode = String.fromCharCode;
  39340. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39341. var b64tab = {};
  39342. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39343. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39344. }
  39345. var cb_utob = function (c) {
  39346. var cc = c.charCodeAt(0);
  39347. return cc < 0x80
  39348. ? c
  39349. : cc < 0x800
  39350. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39351. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39352. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39353. fromCharCode(0x80 | (cc & 0x3f));
  39354. };
  39355. var utob = function (u) {
  39356. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39357. };
  39358. var cb_encode = function (ccc) {
  39359. var padlen = [0, 2, 1][ccc.length % 3];
  39360. var ord = (ccc.charCodeAt(0) << 16) |
  39361. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39362. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39363. var chars = [
  39364. b64chars.charAt(ord >>> 18),
  39365. b64chars.charAt((ord >>> 12) & 63),
  39366. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39367. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39368. ];
  39369. return chars.join('');
  39370. };
  39371. var btoa = window.btoa ||
  39372. function (b) {
  39373. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39374. };
  39375. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39376. var Timer = (function () {
  39377. function Timer(set, clear, delay, callback) {
  39378. var _this = this;
  39379. this.clear = clear;
  39380. this.timer = set(function () {
  39381. if (_this.timer) {
  39382. _this.timer = callback(_this.timer);
  39383. }
  39384. }, delay);
  39385. }
  39386. Timer.prototype.isRunning = function () {
  39387. return this.timer !== null;
  39388. };
  39389. Timer.prototype.ensureAborted = function () {
  39390. if (this.timer) {
  39391. this.clear(this.timer);
  39392. this.timer = null;
  39393. }
  39394. };
  39395. return Timer;
  39396. }());
  39397. /* harmony default export */ var abstract_timer = (Timer);
  39398. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39399. var __extends = (undefined && undefined.__extends) || (function () {
  39400. var extendStatics = function (d, b) {
  39401. extendStatics = Object.setPrototypeOf ||
  39402. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39403. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39404. return extendStatics(d, b);
  39405. };
  39406. return function (d, b) {
  39407. extendStatics(d, b);
  39408. function __() { this.constructor = d; }
  39409. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39410. };
  39411. })();
  39412. function timers_clearTimeout(timer) {
  39413. window.clearTimeout(timer);
  39414. }
  39415. function timers_clearInterval(timer) {
  39416. window.clearInterval(timer);
  39417. }
  39418. var OneOffTimer = (function (_super) {
  39419. __extends(OneOffTimer, _super);
  39420. function OneOffTimer(delay, callback) {
  39421. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39422. callback();
  39423. return null;
  39424. }) || this;
  39425. }
  39426. return OneOffTimer;
  39427. }(abstract_timer));
  39428. var PeriodicTimer = (function (_super) {
  39429. __extends(PeriodicTimer, _super);
  39430. function PeriodicTimer(delay, callback) {
  39431. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39432. callback();
  39433. return timer;
  39434. }) || this;
  39435. }
  39436. return PeriodicTimer;
  39437. }(abstract_timer));
  39438. // CONCATENATED MODULE: ./src/core/util.ts
  39439. var Util = {
  39440. now: function () {
  39441. if (Date.now) {
  39442. return Date.now();
  39443. }
  39444. else {
  39445. return new Date().valueOf();
  39446. }
  39447. },
  39448. defer: function (callback) {
  39449. return new OneOffTimer(0, callback);
  39450. },
  39451. method: function (name) {
  39452. var args = [];
  39453. for (var _i = 1; _i < arguments.length; _i++) {
  39454. args[_i - 1] = arguments[_i];
  39455. }
  39456. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39457. return function (object) {
  39458. return object[name].apply(object, boundArguments.concat(arguments));
  39459. };
  39460. }
  39461. };
  39462. /* harmony default export */ var util = (Util);
  39463. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39464. function extend(target) {
  39465. var sources = [];
  39466. for (var _i = 1; _i < arguments.length; _i++) {
  39467. sources[_i - 1] = arguments[_i];
  39468. }
  39469. for (var i = 0; i < sources.length; i++) {
  39470. var extensions = sources[i];
  39471. for (var property in extensions) {
  39472. if (extensions[property] && extensions[property].constructor &&
  39473. extensions[property].constructor === Object) {
  39474. target[property] = extend(target[property] || {}, extensions[property]);
  39475. }
  39476. else {
  39477. target[property] = extensions[property];
  39478. }
  39479. }
  39480. }
  39481. return target;
  39482. }
  39483. function stringify() {
  39484. var m = ["Pusher"];
  39485. for (var i = 0; i < arguments.length; i++) {
  39486. if (typeof arguments[i] === "string") {
  39487. m.push(arguments[i]);
  39488. }
  39489. else {
  39490. m.push(safeJSONStringify(arguments[i]));
  39491. }
  39492. }
  39493. return m.join(" : ");
  39494. }
  39495. function arrayIndexOf(array, item) {
  39496. var nativeIndexOf = Array.prototype.indexOf;
  39497. if (array === null) {
  39498. return -1;
  39499. }
  39500. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39501. return array.indexOf(item);
  39502. }
  39503. for (var i = 0, l = array.length; i < l; i++) {
  39504. if (array[i] === item) {
  39505. return i;
  39506. }
  39507. }
  39508. return -1;
  39509. }
  39510. function objectApply(object, f) {
  39511. for (var key in object) {
  39512. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39513. f(object[key], key, object);
  39514. }
  39515. }
  39516. }
  39517. function keys(object) {
  39518. var keys = [];
  39519. objectApply(object, function (_, key) {
  39520. keys.push(key);
  39521. });
  39522. return keys;
  39523. }
  39524. function values(object) {
  39525. var values = [];
  39526. objectApply(object, function (value) {
  39527. values.push(value);
  39528. });
  39529. return values;
  39530. }
  39531. function apply(array, f, context) {
  39532. for (var i = 0; i < array.length; i++) {
  39533. f.call(context || window, array[i], i, array);
  39534. }
  39535. }
  39536. function map(array, f) {
  39537. var result = [];
  39538. for (var i = 0; i < array.length; i++) {
  39539. result.push(f(array[i], i, array, result));
  39540. }
  39541. return result;
  39542. }
  39543. function mapObject(object, f) {
  39544. var result = {};
  39545. objectApply(object, function (value, key) {
  39546. result[key] = f(value);
  39547. });
  39548. return result;
  39549. }
  39550. function filter(array, test) {
  39551. test = test || function (value) { return !!value; };
  39552. var result = [];
  39553. for (var i = 0; i < array.length; i++) {
  39554. if (test(array[i], i, array, result)) {
  39555. result.push(array[i]);
  39556. }
  39557. }
  39558. return result;
  39559. }
  39560. function filterObject(object, test) {
  39561. var result = {};
  39562. objectApply(object, function (value, key) {
  39563. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39564. result[key] = value;
  39565. }
  39566. });
  39567. return result;
  39568. }
  39569. function flatten(object) {
  39570. var result = [];
  39571. objectApply(object, function (value, key) {
  39572. result.push([key, value]);
  39573. });
  39574. return result;
  39575. }
  39576. function any(array, test) {
  39577. for (var i = 0; i < array.length; i++) {
  39578. if (test(array[i], i, array)) {
  39579. return true;
  39580. }
  39581. }
  39582. return false;
  39583. }
  39584. function collections_all(array, test) {
  39585. for (var i = 0; i < array.length; i++) {
  39586. if (!test(array[i], i, array)) {
  39587. return false;
  39588. }
  39589. }
  39590. return true;
  39591. }
  39592. function encodeParamsObject(data) {
  39593. return mapObject(data, function (value) {
  39594. if (typeof value === "object") {
  39595. value = safeJSONStringify(value);
  39596. }
  39597. return encodeURIComponent(encode(value.toString()));
  39598. });
  39599. }
  39600. function buildQueryString(data) {
  39601. var params = filterObject(data, function (value) {
  39602. return value !== undefined;
  39603. });
  39604. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39605. return query;
  39606. }
  39607. function decycleObject(object) {
  39608. var objects = [], paths = [];
  39609. return (function derez(value, path) {
  39610. var i, name, nu;
  39611. switch (typeof value) {
  39612. case 'object':
  39613. if (!value) {
  39614. return null;
  39615. }
  39616. for (i = 0; i < objects.length; i += 1) {
  39617. if (objects[i] === value) {
  39618. return { $ref: paths[i] };
  39619. }
  39620. }
  39621. objects.push(value);
  39622. paths.push(path);
  39623. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39624. nu = [];
  39625. for (i = 0; i < value.length; i += 1) {
  39626. nu[i] = derez(value[i], path + '[' + i + ']');
  39627. }
  39628. }
  39629. else {
  39630. nu = {};
  39631. for (name in value) {
  39632. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39633. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39634. }
  39635. }
  39636. }
  39637. return nu;
  39638. case 'number':
  39639. case 'string':
  39640. case 'boolean':
  39641. return value;
  39642. }
  39643. }(object, '$'));
  39644. }
  39645. function safeJSONStringify(source) {
  39646. try {
  39647. return JSON.stringify(source);
  39648. }
  39649. catch (e) {
  39650. return JSON.stringify(decycleObject(source));
  39651. }
  39652. }
  39653. // CONCATENATED MODULE: ./src/core/logger.ts
  39654. var logger_Logger = (function () {
  39655. function Logger() {
  39656. this.globalLog = function (message) {
  39657. if (window.console && window.console.log) {
  39658. window.console.log(message);
  39659. }
  39660. };
  39661. }
  39662. Logger.prototype.debug = function () {
  39663. var args = [];
  39664. for (var _i = 0; _i < arguments.length; _i++) {
  39665. args[_i] = arguments[_i];
  39666. }
  39667. this.log(this.globalLog, args);
  39668. };
  39669. Logger.prototype.warn = function () {
  39670. var args = [];
  39671. for (var _i = 0; _i < arguments.length; _i++) {
  39672. args[_i] = arguments[_i];
  39673. }
  39674. this.log(this.globalLogWarn, args);
  39675. };
  39676. Logger.prototype.error = function () {
  39677. var args = [];
  39678. for (var _i = 0; _i < arguments.length; _i++) {
  39679. args[_i] = arguments[_i];
  39680. }
  39681. this.log(this.globalLogError, args);
  39682. };
  39683. Logger.prototype.globalLogWarn = function (message) {
  39684. if (window.console && window.console.warn) {
  39685. window.console.warn(message);
  39686. }
  39687. else {
  39688. this.globalLog(message);
  39689. }
  39690. };
  39691. Logger.prototype.globalLogError = function (message) {
  39692. if (window.console && window.console.error) {
  39693. window.console.error(message);
  39694. }
  39695. else {
  39696. this.globalLogWarn(message);
  39697. }
  39698. };
  39699. Logger.prototype.log = function (defaultLoggingFunction) {
  39700. var args = [];
  39701. for (var _i = 1; _i < arguments.length; _i++) {
  39702. args[_i - 1] = arguments[_i];
  39703. }
  39704. var message = stringify.apply(this, arguments);
  39705. if (core_pusher.log) {
  39706. core_pusher.log(message);
  39707. }
  39708. else if (core_pusher.logToConsole) {
  39709. var log = defaultLoggingFunction.bind(this);
  39710. log(message);
  39711. }
  39712. };
  39713. return Logger;
  39714. }());
  39715. /* harmony default export */ var logger = (new logger_Logger());
  39716. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39717. var urlStore = {
  39718. baseUrl: "https://pusher.com",
  39719. urls: {
  39720. authenticationEndpoint: {
  39721. path: "/docs/authenticating_users",
  39722. },
  39723. javascriptQuickStart: {
  39724. path: "/docs/javascript_quick_start"
  39725. },
  39726. triggeringClientEvents: {
  39727. path: "/docs/client_api_guide/client_events#trigger-events"
  39728. }
  39729. }
  39730. };
  39731. var buildLogSuffix = function (key) {
  39732. var urlPrefix = "See:";
  39733. var urlObj = urlStore.urls[key];
  39734. if (!urlObj)
  39735. return "";
  39736. var url;
  39737. if (urlObj.fullUrl) {
  39738. url = urlObj.fullUrl;
  39739. }
  39740. else if (urlObj.path) {
  39741. url = urlStore.baseUrl + urlObj.path;
  39742. }
  39743. if (!url)
  39744. return "";
  39745. return urlPrefix + " " + url;
  39746. };
  39747. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39748. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39749. var ajax = function (context, socketId, callback) {
  39750. var self = this, xhr;
  39751. xhr = runtime.createXHR();
  39752. xhr.open("POST", self.options.authEndpoint, true);
  39753. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39754. for (var headerName in this.authOptions.headers) {
  39755. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39756. }
  39757. xhr.onreadystatechange = function () {
  39758. if (xhr.readyState === 4) {
  39759. if (xhr.status === 200) {
  39760. var data, parsed = false;
  39761. try {
  39762. data = JSON.parse(xhr.responseText);
  39763. parsed = true;
  39764. }
  39765. catch (e) {
  39766. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39767. }
  39768. if (parsed) {
  39769. callback(false, data);
  39770. }
  39771. }
  39772. else {
  39773. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39774. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39775. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39776. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39777. callback(true, xhr.status);
  39778. }
  39779. }
  39780. };
  39781. xhr.send(this.composeQuery(socketId));
  39782. return xhr;
  39783. };
  39784. /* harmony default export */ var xhr_auth = (ajax);
  39785. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39786. var jsonp = function (context, socketId, callback) {
  39787. if (this.authOptions.headers !== undefined) {
  39788. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39789. }
  39790. var callbackName = context.nextAuthCallbackID.toString();
  39791. context.nextAuthCallbackID++;
  39792. var document = context.getDocument();
  39793. var script = document.createElement("script");
  39794. context.auth_callbacks[callbackName] = function (data) {
  39795. callback(false, data);
  39796. };
  39797. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39798. script.src = this.options.authEndpoint +
  39799. '?callback=' +
  39800. encodeURIComponent(callback_name) +
  39801. '&' +
  39802. this.composeQuery(socketId);
  39803. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39804. head.insertBefore(script, head.firstChild);
  39805. };
  39806. /* harmony default export */ var jsonp_auth = (jsonp);
  39807. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39808. var ScriptRequest = (function () {
  39809. function ScriptRequest(src) {
  39810. this.src = src;
  39811. }
  39812. ScriptRequest.prototype.send = function (receiver) {
  39813. var self = this;
  39814. var errorString = "Error loading " + self.src;
  39815. self.script = document.createElement("script");
  39816. self.script.id = receiver.id;
  39817. self.script.src = self.src;
  39818. self.script.type = "text/javascript";
  39819. self.script.charset = "UTF-8";
  39820. if (self.script.addEventListener) {
  39821. self.script.onerror = function () {
  39822. receiver.callback(errorString);
  39823. };
  39824. self.script.onload = function () {
  39825. receiver.callback(null);
  39826. };
  39827. }
  39828. else {
  39829. self.script.onreadystatechange = function () {
  39830. if (self.script.readyState === 'loaded' ||
  39831. self.script.readyState === 'complete') {
  39832. receiver.callback(null);
  39833. }
  39834. };
  39835. }
  39836. if (self.script.async === undefined && document.attachEvent &&
  39837. /opera/i.test(navigator.userAgent)) {
  39838. self.errorScript = document.createElement("script");
  39839. self.errorScript.id = receiver.id + "_error";
  39840. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39841. self.script.async = self.errorScript.async = false;
  39842. }
  39843. else {
  39844. self.script.async = true;
  39845. }
  39846. var head = document.getElementsByTagName('head')[0];
  39847. head.insertBefore(self.script, head.firstChild);
  39848. if (self.errorScript) {
  39849. head.insertBefore(self.errorScript, self.script.nextSibling);
  39850. }
  39851. };
  39852. ScriptRequest.prototype.cleanup = function () {
  39853. if (this.script) {
  39854. this.script.onload = this.script.onerror = null;
  39855. this.script.onreadystatechange = null;
  39856. }
  39857. if (this.script && this.script.parentNode) {
  39858. this.script.parentNode.removeChild(this.script);
  39859. }
  39860. if (this.errorScript && this.errorScript.parentNode) {
  39861. this.errorScript.parentNode.removeChild(this.errorScript);
  39862. }
  39863. this.script = null;
  39864. this.errorScript = null;
  39865. };
  39866. return ScriptRequest;
  39867. }());
  39868. /* harmony default export */ var script_request = (ScriptRequest);
  39869. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39870. var jsonp_request_JSONPRequest = (function () {
  39871. function JSONPRequest(url, data) {
  39872. this.url = url;
  39873. this.data = data;
  39874. }
  39875. JSONPRequest.prototype.send = function (receiver) {
  39876. if (this.request) {
  39877. return;
  39878. }
  39879. var query = buildQueryString(this.data);
  39880. var url = this.url + "/" + receiver.number + "?" + query;
  39881. this.request = runtime.createScriptRequest(url);
  39882. this.request.send(receiver);
  39883. };
  39884. JSONPRequest.prototype.cleanup = function () {
  39885. if (this.request) {
  39886. this.request.cleanup();
  39887. }
  39888. };
  39889. return JSONPRequest;
  39890. }());
  39891. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39892. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39893. var getAgent = function (sender, useTLS) {
  39894. return function (data, callback) {
  39895. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39896. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39897. var request = runtime.createJSONPRequest(url, data);
  39898. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39899. ScriptReceivers.remove(receiver);
  39900. request.cleanup();
  39901. if (result && result.host) {
  39902. sender.host = result.host;
  39903. }
  39904. if (callback) {
  39905. callback(error, result);
  39906. }
  39907. });
  39908. request.send(receiver);
  39909. };
  39910. };
  39911. var jsonp_timeline_jsonp = {
  39912. name: 'jsonp',
  39913. getAgent: getAgent
  39914. };
  39915. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39916. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39917. function getGenericURL(baseScheme, params, path) {
  39918. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39919. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39920. return scheme + "://" + host + path;
  39921. }
  39922. function getGenericPath(key, queryString) {
  39923. var path = "/app/" + key;
  39924. var query = "?protocol=" + defaults.PROTOCOL +
  39925. "&client=js" +
  39926. "&version=" + defaults.VERSION +
  39927. (queryString ? ("&" + queryString) : "");
  39928. return path + query;
  39929. }
  39930. var ws = {
  39931. getInitial: function (key, params) {
  39932. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39933. return getGenericURL("ws", params, path);
  39934. }
  39935. };
  39936. var http = {
  39937. getInitial: function (key, params) {
  39938. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39939. return getGenericURL("http", params, path);
  39940. }
  39941. };
  39942. var sockjs = {
  39943. getInitial: function (key, params) {
  39944. return getGenericURL("http", params, params.httpPath || "/pusher");
  39945. },
  39946. getPath: function (key, params) {
  39947. return getGenericPath(key);
  39948. }
  39949. };
  39950. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39951. var callback_registry_CallbackRegistry = (function () {
  39952. function CallbackRegistry() {
  39953. this._callbacks = {};
  39954. }
  39955. CallbackRegistry.prototype.get = function (name) {
  39956. return this._callbacks[prefix(name)];
  39957. };
  39958. CallbackRegistry.prototype.add = function (name, callback, context) {
  39959. var prefixedEventName = prefix(name);
  39960. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39961. this._callbacks[prefixedEventName].push({
  39962. fn: callback,
  39963. context: context
  39964. });
  39965. };
  39966. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39967. if (!name && !callback && !context) {
  39968. this._callbacks = {};
  39969. return;
  39970. }
  39971. var names = name ? [prefix(name)] : keys(this._callbacks);
  39972. if (callback || context) {
  39973. this.removeCallback(names, callback, context);
  39974. }
  39975. else {
  39976. this.removeAllCallbacks(names);
  39977. }
  39978. };
  39979. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39980. apply(names, function (name) {
  39981. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39982. return (callback && callback !== binding.fn) ||
  39983. (context && context !== binding.context);
  39984. });
  39985. if (this._callbacks[name].length === 0) {
  39986. delete this._callbacks[name];
  39987. }
  39988. }, this);
  39989. };
  39990. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39991. apply(names, function (name) {
  39992. delete this._callbacks[name];
  39993. }, this);
  39994. };
  39995. return CallbackRegistry;
  39996. }());
  39997. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39998. function prefix(name) {
  39999. return "_" + name;
  40000. }
  40001. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40002. var dispatcher_Dispatcher = (function () {
  40003. function Dispatcher(failThrough) {
  40004. this.callbacks = new callback_registry();
  40005. this.global_callbacks = [];
  40006. this.failThrough = failThrough;
  40007. }
  40008. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40009. this.callbacks.add(eventName, callback, context);
  40010. return this;
  40011. };
  40012. Dispatcher.prototype.bind_global = function (callback) {
  40013. this.global_callbacks.push(callback);
  40014. return this;
  40015. };
  40016. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40017. this.callbacks.remove(eventName, callback, context);
  40018. return this;
  40019. };
  40020. Dispatcher.prototype.unbind_global = function (callback) {
  40021. if (!callback) {
  40022. this.global_callbacks = [];
  40023. return this;
  40024. }
  40025. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40026. return this;
  40027. };
  40028. Dispatcher.prototype.unbind_all = function () {
  40029. this.unbind();
  40030. this.unbind_global();
  40031. return this;
  40032. };
  40033. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40034. for (var i = 0; i < this.global_callbacks.length; i++) {
  40035. this.global_callbacks[i](eventName, data);
  40036. }
  40037. var callbacks = this.callbacks.get(eventName);
  40038. var args = [];
  40039. if (metadata) {
  40040. args.push(data, metadata);
  40041. }
  40042. else if (data) {
  40043. args.push(data);
  40044. }
  40045. if (callbacks && callbacks.length > 0) {
  40046. for (var i = 0; i < callbacks.length; i++) {
  40047. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40048. }
  40049. }
  40050. else if (this.failThrough) {
  40051. this.failThrough(eventName, data);
  40052. }
  40053. return this;
  40054. };
  40055. return Dispatcher;
  40056. }());
  40057. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40058. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40059. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40060. var extendStatics = function (d, b) {
  40061. extendStatics = Object.setPrototypeOf ||
  40062. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40063. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40064. return extendStatics(d, b);
  40065. };
  40066. return function (d, b) {
  40067. extendStatics(d, b);
  40068. function __() { this.constructor = d; }
  40069. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40070. };
  40071. })();
  40072. var transport_connection_TransportConnection = (function (_super) {
  40073. transport_connection_extends(TransportConnection, _super);
  40074. function TransportConnection(hooks, name, priority, key, options) {
  40075. var _this = _super.call(this) || this;
  40076. _this.initialize = runtime.transportConnectionInitializer;
  40077. _this.hooks = hooks;
  40078. _this.name = name;
  40079. _this.priority = priority;
  40080. _this.key = key;
  40081. _this.options = options;
  40082. _this.state = "new";
  40083. _this.timeline = options.timeline;
  40084. _this.activityTimeout = options.activityTimeout;
  40085. _this.id = _this.timeline.generateUniqueID();
  40086. return _this;
  40087. }
  40088. TransportConnection.prototype.handlesActivityChecks = function () {
  40089. return Boolean(this.hooks.handlesActivityChecks);
  40090. };
  40091. TransportConnection.prototype.supportsPing = function () {
  40092. return Boolean(this.hooks.supportsPing);
  40093. };
  40094. TransportConnection.prototype.connect = function () {
  40095. var _this = this;
  40096. if (this.socket || this.state !== "initialized") {
  40097. return false;
  40098. }
  40099. var url = this.hooks.urls.getInitial(this.key, this.options);
  40100. try {
  40101. this.socket = this.hooks.getSocket(url, this.options);
  40102. }
  40103. catch (e) {
  40104. util.defer(function () {
  40105. _this.onError(e);
  40106. _this.changeState("closed");
  40107. });
  40108. return false;
  40109. }
  40110. this.bindListeners();
  40111. logger.debug("Connecting", { transport: this.name, url: url });
  40112. this.changeState("connecting");
  40113. return true;
  40114. };
  40115. TransportConnection.prototype.close = function () {
  40116. if (this.socket) {
  40117. this.socket.close();
  40118. return true;
  40119. }
  40120. else {
  40121. return false;
  40122. }
  40123. };
  40124. TransportConnection.prototype.send = function (data) {
  40125. var _this = this;
  40126. if (this.state === "open") {
  40127. util.defer(function () {
  40128. if (_this.socket) {
  40129. _this.socket.send(data);
  40130. }
  40131. });
  40132. return true;
  40133. }
  40134. else {
  40135. return false;
  40136. }
  40137. };
  40138. TransportConnection.prototype.ping = function () {
  40139. if (this.state === "open" && this.supportsPing()) {
  40140. this.socket.ping();
  40141. }
  40142. };
  40143. TransportConnection.prototype.onOpen = function () {
  40144. if (this.hooks.beforeOpen) {
  40145. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40146. }
  40147. this.changeState("open");
  40148. this.socket.onopen = undefined;
  40149. };
  40150. TransportConnection.prototype.onError = function (error) {
  40151. this.emit("error", { type: 'WebSocketError', error: error });
  40152. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40153. };
  40154. TransportConnection.prototype.onClose = function (closeEvent) {
  40155. if (closeEvent) {
  40156. this.changeState("closed", {
  40157. code: closeEvent.code,
  40158. reason: closeEvent.reason,
  40159. wasClean: closeEvent.wasClean
  40160. });
  40161. }
  40162. else {
  40163. this.changeState("closed");
  40164. }
  40165. this.unbindListeners();
  40166. this.socket = undefined;
  40167. };
  40168. TransportConnection.prototype.onMessage = function (message) {
  40169. this.emit("message", message);
  40170. };
  40171. TransportConnection.prototype.onActivity = function () {
  40172. this.emit("activity");
  40173. };
  40174. TransportConnection.prototype.bindListeners = function () {
  40175. var _this = this;
  40176. this.socket.onopen = function () {
  40177. _this.onOpen();
  40178. };
  40179. this.socket.onerror = function (error) {
  40180. _this.onError(error);
  40181. };
  40182. this.socket.onclose = function (closeEvent) {
  40183. _this.onClose(closeEvent);
  40184. };
  40185. this.socket.onmessage = function (message) {
  40186. _this.onMessage(message);
  40187. };
  40188. if (this.supportsPing()) {
  40189. this.socket.onactivity = function () { _this.onActivity(); };
  40190. }
  40191. };
  40192. TransportConnection.prototype.unbindListeners = function () {
  40193. if (this.socket) {
  40194. this.socket.onopen = undefined;
  40195. this.socket.onerror = undefined;
  40196. this.socket.onclose = undefined;
  40197. this.socket.onmessage = undefined;
  40198. if (this.supportsPing()) {
  40199. this.socket.onactivity = undefined;
  40200. }
  40201. }
  40202. };
  40203. TransportConnection.prototype.changeState = function (state, params) {
  40204. this.state = state;
  40205. this.timeline.info(this.buildTimelineMessage({
  40206. state: state,
  40207. params: params
  40208. }));
  40209. this.emit(state, params);
  40210. };
  40211. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40212. return extend({ cid: this.id }, message);
  40213. };
  40214. return TransportConnection;
  40215. }(dispatcher));
  40216. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40217. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40218. var transport_Transport = (function () {
  40219. function Transport(hooks) {
  40220. this.hooks = hooks;
  40221. }
  40222. Transport.prototype.isSupported = function (environment) {
  40223. return this.hooks.isSupported(environment);
  40224. };
  40225. Transport.prototype.createConnection = function (name, priority, key, options) {
  40226. return new transport_connection(this.hooks, name, priority, key, options);
  40227. };
  40228. return Transport;
  40229. }());
  40230. /* harmony default export */ var transports_transport = (transport_Transport);
  40231. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40232. var WSTransport = new transports_transport({
  40233. urls: ws,
  40234. handlesActivityChecks: false,
  40235. supportsPing: false,
  40236. isInitialized: function () {
  40237. return Boolean(runtime.getWebSocketAPI());
  40238. },
  40239. isSupported: function () {
  40240. return Boolean(runtime.getWebSocketAPI());
  40241. },
  40242. getSocket: function (url) {
  40243. return runtime.createWebSocket(url);
  40244. }
  40245. });
  40246. var httpConfiguration = {
  40247. urls: http,
  40248. handlesActivityChecks: false,
  40249. supportsPing: true,
  40250. isInitialized: function () {
  40251. return true;
  40252. }
  40253. };
  40254. var streamingConfiguration = extend({ getSocket: function (url) {
  40255. return runtime.HTTPFactory.createStreamingSocket(url);
  40256. }
  40257. }, httpConfiguration);
  40258. var pollingConfiguration = extend({ getSocket: function (url) {
  40259. return runtime.HTTPFactory.createPollingSocket(url);
  40260. }
  40261. }, httpConfiguration);
  40262. var xhrConfiguration = {
  40263. isSupported: function () {
  40264. return runtime.isXHRSupported();
  40265. }
  40266. };
  40267. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40268. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40269. var Transports = {
  40270. ws: WSTransport,
  40271. xhr_streaming: XHRStreamingTransport,
  40272. xhr_polling: XHRPollingTransport
  40273. };
  40274. /* harmony default export */ var transports = (Transports);
  40275. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40276. var SockJSTransport = new transports_transport({
  40277. file: "sockjs",
  40278. urls: sockjs,
  40279. handlesActivityChecks: true,
  40280. supportsPing: false,
  40281. isSupported: function () {
  40282. return true;
  40283. },
  40284. isInitialized: function () {
  40285. return window.SockJS !== undefined;
  40286. },
  40287. getSocket: function (url, options) {
  40288. return new window.SockJS(url, null, {
  40289. js_path: Dependencies.getPath("sockjs", {
  40290. useTLS: options.useTLS
  40291. }),
  40292. ignore_null_origin: options.ignoreNullOrigin
  40293. });
  40294. },
  40295. beforeOpen: function (socket, path) {
  40296. socket.send(JSON.stringify({
  40297. path: path
  40298. }));
  40299. }
  40300. });
  40301. var xdrConfiguration = {
  40302. isSupported: function (environment) {
  40303. var yes = runtime.isXDRSupported(environment.useTLS);
  40304. return yes;
  40305. }
  40306. };
  40307. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40308. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40309. transports.xdr_streaming = XDRStreamingTransport;
  40310. transports.xdr_polling = XDRPollingTransport;
  40311. transports.sockjs = SockJSTransport;
  40312. /* harmony default export */ var transports_transports = (transports);
  40313. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40314. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40315. var extendStatics = function (d, b) {
  40316. extendStatics = Object.setPrototypeOf ||
  40317. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40318. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40319. return extendStatics(d, b);
  40320. };
  40321. return function (d, b) {
  40322. extendStatics(d, b);
  40323. function __() { this.constructor = d; }
  40324. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40325. };
  40326. })();
  40327. var NetInfo = (function (_super) {
  40328. net_info_extends(NetInfo, _super);
  40329. function NetInfo() {
  40330. var _this = _super.call(this) || this;
  40331. var self = _this;
  40332. if (window.addEventListener !== undefined) {
  40333. window.addEventListener("online", function () {
  40334. self.emit('online');
  40335. }, false);
  40336. window.addEventListener("offline", function () {
  40337. self.emit('offline');
  40338. }, false);
  40339. }
  40340. return _this;
  40341. }
  40342. NetInfo.prototype.isOnline = function () {
  40343. if (window.navigator.onLine === undefined) {
  40344. return true;
  40345. }
  40346. else {
  40347. return window.navigator.onLine;
  40348. }
  40349. };
  40350. return NetInfo;
  40351. }(dispatcher));
  40352. var net_info_Network = new NetInfo();
  40353. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40354. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40355. function AssistantToTheTransportManager(manager, transport, options) {
  40356. this.manager = manager;
  40357. this.transport = transport;
  40358. this.minPingDelay = options.minPingDelay;
  40359. this.maxPingDelay = options.maxPingDelay;
  40360. this.pingDelay = undefined;
  40361. }
  40362. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40363. var _this = this;
  40364. options = extend({}, options, {
  40365. activityTimeout: this.pingDelay
  40366. });
  40367. var connection = this.transport.createConnection(name, priority, key, options);
  40368. var openTimestamp = null;
  40369. var onOpen = function () {
  40370. connection.unbind("open", onOpen);
  40371. connection.bind("closed", onClosed);
  40372. openTimestamp = util.now();
  40373. };
  40374. var onClosed = function (closeEvent) {
  40375. connection.unbind("closed", onClosed);
  40376. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40377. _this.manager.reportDeath();
  40378. }
  40379. else if (!closeEvent.wasClean && openTimestamp) {
  40380. var lifespan = util.now() - openTimestamp;
  40381. if (lifespan < 2 * _this.maxPingDelay) {
  40382. _this.manager.reportDeath();
  40383. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40384. }
  40385. }
  40386. };
  40387. connection.bind("open", onOpen);
  40388. return connection;
  40389. };
  40390. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40391. return this.manager.isAlive() && this.transport.isSupported(environment);
  40392. };
  40393. return AssistantToTheTransportManager;
  40394. }());
  40395. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40396. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40397. var Protocol = {
  40398. decodeMessage: function (messageEvent) {
  40399. try {
  40400. var messageData = JSON.parse(messageEvent.data);
  40401. var pusherEventData = messageData.data;
  40402. if (typeof pusherEventData === 'string') {
  40403. try {
  40404. pusherEventData = JSON.parse(messageData.data);
  40405. }
  40406. catch (e) { }
  40407. }
  40408. var pusherEvent = {
  40409. event: messageData.event,
  40410. channel: messageData.channel,
  40411. data: pusherEventData,
  40412. };
  40413. if (messageData.user_id) {
  40414. pusherEvent.user_id = messageData.user_id;
  40415. }
  40416. return pusherEvent;
  40417. }
  40418. catch (e) {
  40419. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40420. }
  40421. },
  40422. encodeMessage: function (event) {
  40423. return JSON.stringify(event);
  40424. },
  40425. processHandshake: function (messageEvent) {
  40426. var message = Protocol.decodeMessage(messageEvent);
  40427. if (message.event === "pusher:connection_established") {
  40428. if (!message.data.activity_timeout) {
  40429. throw "No activity timeout specified in handshake";
  40430. }
  40431. return {
  40432. action: "connected",
  40433. id: message.data.socket_id,
  40434. activityTimeout: message.data.activity_timeout * 1000
  40435. };
  40436. }
  40437. else if (message.event === "pusher:error") {
  40438. return {
  40439. action: this.getCloseAction(message.data),
  40440. error: this.getCloseError(message.data)
  40441. };
  40442. }
  40443. else {
  40444. throw "Invalid handshake";
  40445. }
  40446. },
  40447. getCloseAction: function (closeEvent) {
  40448. if (closeEvent.code < 4000) {
  40449. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40450. return "backoff";
  40451. }
  40452. else {
  40453. return null;
  40454. }
  40455. }
  40456. else if (closeEvent.code === 4000) {
  40457. return "tls_only";
  40458. }
  40459. else if (closeEvent.code < 4100) {
  40460. return "refused";
  40461. }
  40462. else if (closeEvent.code < 4200) {
  40463. return "backoff";
  40464. }
  40465. else if (closeEvent.code < 4300) {
  40466. return "retry";
  40467. }
  40468. else {
  40469. return "refused";
  40470. }
  40471. },
  40472. getCloseError: function (closeEvent) {
  40473. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40474. return {
  40475. type: 'PusherError',
  40476. data: {
  40477. code: closeEvent.code,
  40478. message: closeEvent.reason || closeEvent.message
  40479. }
  40480. };
  40481. }
  40482. else {
  40483. return null;
  40484. }
  40485. }
  40486. };
  40487. /* harmony default export */ var protocol_protocol = (Protocol);
  40488. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40489. var connection_extends = (undefined && undefined.__extends) || (function () {
  40490. var extendStatics = function (d, b) {
  40491. extendStatics = Object.setPrototypeOf ||
  40492. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40493. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40494. return extendStatics(d, b);
  40495. };
  40496. return function (d, b) {
  40497. extendStatics(d, b);
  40498. function __() { this.constructor = d; }
  40499. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40500. };
  40501. })();
  40502. var connection_Connection = (function (_super) {
  40503. connection_extends(Connection, _super);
  40504. function Connection(id, transport) {
  40505. var _this = _super.call(this) || this;
  40506. _this.id = id;
  40507. _this.transport = transport;
  40508. _this.activityTimeout = transport.activityTimeout;
  40509. _this.bindListeners();
  40510. return _this;
  40511. }
  40512. Connection.prototype.handlesActivityChecks = function () {
  40513. return this.transport.handlesActivityChecks();
  40514. };
  40515. Connection.prototype.send = function (data) {
  40516. return this.transport.send(data);
  40517. };
  40518. Connection.prototype.send_event = function (name, data, channel) {
  40519. var event = { event: name, data: data };
  40520. if (channel) {
  40521. event.channel = channel;
  40522. }
  40523. logger.debug('Event sent', event);
  40524. return this.send(protocol_protocol.encodeMessage(event));
  40525. };
  40526. Connection.prototype.ping = function () {
  40527. if (this.transport.supportsPing()) {
  40528. this.transport.ping();
  40529. }
  40530. else {
  40531. this.send_event('pusher:ping', {});
  40532. }
  40533. };
  40534. Connection.prototype.close = function () {
  40535. this.transport.close();
  40536. };
  40537. Connection.prototype.bindListeners = function () {
  40538. var _this = this;
  40539. var listeners = {
  40540. message: function (messageEvent) {
  40541. var pusherEvent;
  40542. try {
  40543. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40544. }
  40545. catch (e) {
  40546. _this.emit('error', {
  40547. type: 'MessageParseError',
  40548. error: e,
  40549. data: messageEvent.data
  40550. });
  40551. }
  40552. if (pusherEvent !== undefined) {
  40553. logger.debug('Event recd', pusherEvent);
  40554. switch (pusherEvent.event) {
  40555. case 'pusher:error':
  40556. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40557. break;
  40558. case 'pusher:ping':
  40559. _this.emit("ping");
  40560. break;
  40561. case 'pusher:pong':
  40562. _this.emit("pong");
  40563. break;
  40564. }
  40565. _this.emit('message', pusherEvent);
  40566. }
  40567. },
  40568. activity: function () {
  40569. _this.emit("activity");
  40570. },
  40571. error: function (error) {
  40572. _this.emit("error", { type: "WebSocketError", error: error });
  40573. },
  40574. closed: function (closeEvent) {
  40575. unbindListeners();
  40576. if (closeEvent && closeEvent.code) {
  40577. _this.handleCloseEvent(closeEvent);
  40578. }
  40579. _this.transport = null;
  40580. _this.emit("closed");
  40581. }
  40582. };
  40583. var unbindListeners = function () {
  40584. objectApply(listeners, function (listener, event) {
  40585. _this.transport.unbind(event, listener);
  40586. });
  40587. };
  40588. objectApply(listeners, function (listener, event) {
  40589. _this.transport.bind(event, listener);
  40590. });
  40591. };
  40592. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40593. var action = protocol_protocol.getCloseAction(closeEvent);
  40594. var error = protocol_protocol.getCloseError(closeEvent);
  40595. if (error) {
  40596. this.emit('error', error);
  40597. }
  40598. if (action) {
  40599. this.emit(action, { action: action, error: error });
  40600. }
  40601. };
  40602. return Connection;
  40603. }(dispatcher));
  40604. /* harmony default export */ var connection_connection = (connection_Connection);
  40605. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40606. var handshake_Handshake = (function () {
  40607. function Handshake(transport, callback) {
  40608. this.transport = transport;
  40609. this.callback = callback;
  40610. this.bindListeners();
  40611. }
  40612. Handshake.prototype.close = function () {
  40613. this.unbindListeners();
  40614. this.transport.close();
  40615. };
  40616. Handshake.prototype.bindListeners = function () {
  40617. var _this = this;
  40618. this.onMessage = function (m) {
  40619. _this.unbindListeners();
  40620. var result;
  40621. try {
  40622. result = protocol_protocol.processHandshake(m);
  40623. }
  40624. catch (e) {
  40625. _this.finish("error", { error: e });
  40626. _this.transport.close();
  40627. return;
  40628. }
  40629. if (result.action === "connected") {
  40630. _this.finish("connected", {
  40631. connection: new connection_connection(result.id, _this.transport),
  40632. activityTimeout: result.activityTimeout
  40633. });
  40634. }
  40635. else {
  40636. _this.finish(result.action, { error: result.error });
  40637. _this.transport.close();
  40638. }
  40639. };
  40640. this.onClosed = function (closeEvent) {
  40641. _this.unbindListeners();
  40642. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40643. var error = protocol_protocol.getCloseError(closeEvent);
  40644. _this.finish(action, { error: error });
  40645. };
  40646. this.transport.bind("message", this.onMessage);
  40647. this.transport.bind("closed", this.onClosed);
  40648. };
  40649. Handshake.prototype.unbindListeners = function () {
  40650. this.transport.unbind("message", this.onMessage);
  40651. this.transport.unbind("closed", this.onClosed);
  40652. };
  40653. Handshake.prototype.finish = function (action, params) {
  40654. this.callback(extend({ transport: this.transport, action: action }, params));
  40655. };
  40656. return Handshake;
  40657. }());
  40658. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40659. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40660. var pusher_authorizer_PusherAuthorizer = (function () {
  40661. function PusherAuthorizer(channel, options) {
  40662. this.channel = channel;
  40663. var authTransport = options.authTransport;
  40664. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40665. throw "'" + authTransport + "' is not a recognized auth transport";
  40666. }
  40667. this.type = authTransport;
  40668. this.options = options;
  40669. this.authOptions = (options || {}).auth || {};
  40670. }
  40671. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40672. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40673. '&channel_name=' + encodeURIComponent(this.channel.name);
  40674. for (var i in this.authOptions.params) {
  40675. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40676. }
  40677. return query;
  40678. };
  40679. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40680. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40681. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40682. };
  40683. return PusherAuthorizer;
  40684. }());
  40685. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40686. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40687. var timeline_sender_TimelineSender = (function () {
  40688. function TimelineSender(timeline, options) {
  40689. this.timeline = timeline;
  40690. this.options = options || {};
  40691. }
  40692. TimelineSender.prototype.send = function (useTLS, callback) {
  40693. if (this.timeline.isEmpty()) {
  40694. return;
  40695. }
  40696. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40697. };
  40698. return TimelineSender;
  40699. }());
  40700. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40701. // CONCATENATED MODULE: ./src/core/errors.ts
  40702. var errors_extends = (undefined && undefined.__extends) || (function () {
  40703. var extendStatics = function (d, b) {
  40704. extendStatics = Object.setPrototypeOf ||
  40705. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40706. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40707. return extendStatics(d, b);
  40708. };
  40709. return function (d, b) {
  40710. extendStatics(d, b);
  40711. function __() { this.constructor = d; }
  40712. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40713. };
  40714. })();
  40715. var BadEventName = (function (_super) {
  40716. errors_extends(BadEventName, _super);
  40717. function BadEventName(msg) {
  40718. var _newTarget = this.constructor;
  40719. var _this = _super.call(this, msg) || this;
  40720. Object.setPrototypeOf(_this, _newTarget.prototype);
  40721. return _this;
  40722. }
  40723. return BadEventName;
  40724. }(Error));
  40725. var RequestTimedOut = (function (_super) {
  40726. errors_extends(RequestTimedOut, _super);
  40727. function RequestTimedOut(msg) {
  40728. var _newTarget = this.constructor;
  40729. var _this = _super.call(this, msg) || this;
  40730. Object.setPrototypeOf(_this, _newTarget.prototype);
  40731. return _this;
  40732. }
  40733. return RequestTimedOut;
  40734. }(Error));
  40735. var TransportPriorityTooLow = (function (_super) {
  40736. errors_extends(TransportPriorityTooLow, _super);
  40737. function TransportPriorityTooLow(msg) {
  40738. var _newTarget = this.constructor;
  40739. var _this = _super.call(this, msg) || this;
  40740. Object.setPrototypeOf(_this, _newTarget.prototype);
  40741. return _this;
  40742. }
  40743. return TransportPriorityTooLow;
  40744. }(Error));
  40745. var TransportClosed = (function (_super) {
  40746. errors_extends(TransportClosed, _super);
  40747. function TransportClosed(msg) {
  40748. var _newTarget = this.constructor;
  40749. var _this = _super.call(this, msg) || this;
  40750. Object.setPrototypeOf(_this, _newTarget.prototype);
  40751. return _this;
  40752. }
  40753. return TransportClosed;
  40754. }(Error));
  40755. var UnsupportedFeature = (function (_super) {
  40756. errors_extends(UnsupportedFeature, _super);
  40757. function UnsupportedFeature(msg) {
  40758. var _newTarget = this.constructor;
  40759. var _this = _super.call(this, msg) || this;
  40760. Object.setPrototypeOf(_this, _newTarget.prototype);
  40761. return _this;
  40762. }
  40763. return UnsupportedFeature;
  40764. }(Error));
  40765. var UnsupportedTransport = (function (_super) {
  40766. errors_extends(UnsupportedTransport, _super);
  40767. function UnsupportedTransport(msg) {
  40768. var _newTarget = this.constructor;
  40769. var _this = _super.call(this, msg) || this;
  40770. Object.setPrototypeOf(_this, _newTarget.prototype);
  40771. return _this;
  40772. }
  40773. return UnsupportedTransport;
  40774. }(Error));
  40775. var UnsupportedStrategy = (function (_super) {
  40776. errors_extends(UnsupportedStrategy, _super);
  40777. function UnsupportedStrategy(msg) {
  40778. var _newTarget = this.constructor;
  40779. var _this = _super.call(this, msg) || this;
  40780. Object.setPrototypeOf(_this, _newTarget.prototype);
  40781. return _this;
  40782. }
  40783. return UnsupportedStrategy;
  40784. }(Error));
  40785. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40786. var channel_extends = (undefined && undefined.__extends) || (function () {
  40787. var extendStatics = function (d, b) {
  40788. extendStatics = Object.setPrototypeOf ||
  40789. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40790. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40791. return extendStatics(d, b);
  40792. };
  40793. return function (d, b) {
  40794. extendStatics(d, b);
  40795. function __() { this.constructor = d; }
  40796. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40797. };
  40798. })();
  40799. var channel_Channel = (function (_super) {
  40800. channel_extends(Channel, _super);
  40801. function Channel(name, pusher) {
  40802. var _this = _super.call(this, function (event, data) {
  40803. logger.debug('No callbacks on ' + name + ' for ' + event);
  40804. }) || this;
  40805. _this.name = name;
  40806. _this.pusher = pusher;
  40807. _this.subscribed = false;
  40808. _this.subscriptionPending = false;
  40809. _this.subscriptionCancelled = false;
  40810. return _this;
  40811. }
  40812. Channel.prototype.authorize = function (socketId, callback) {
  40813. return callback(false, {});
  40814. };
  40815. Channel.prototype.trigger = function (event, data) {
  40816. if (event.indexOf("client-") !== 0) {
  40817. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40818. }
  40819. if (!this.subscribed) {
  40820. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40821. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40822. }
  40823. return this.pusher.send_event(event, data, this.name);
  40824. };
  40825. Channel.prototype.disconnect = function () {
  40826. this.subscribed = false;
  40827. this.subscriptionPending = false;
  40828. };
  40829. Channel.prototype.handleEvent = function (event) {
  40830. var eventName = event.event;
  40831. var data = event.data;
  40832. if (eventName === "pusher_internal:subscription_succeeded") {
  40833. this.handleSubscriptionSucceededEvent(event);
  40834. }
  40835. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40836. var metadata = {};
  40837. this.emit(eventName, data, metadata);
  40838. }
  40839. };
  40840. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40841. this.subscriptionPending = false;
  40842. this.subscribed = true;
  40843. if (this.subscriptionCancelled) {
  40844. this.pusher.unsubscribe(this.name);
  40845. }
  40846. else {
  40847. this.emit("pusher:subscription_succeeded", event.data);
  40848. }
  40849. };
  40850. Channel.prototype.subscribe = function () {
  40851. var _this = this;
  40852. if (this.subscribed) {
  40853. return;
  40854. }
  40855. this.subscriptionPending = true;
  40856. this.subscriptionCancelled = false;
  40857. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40858. if (error) {
  40859. logger.error(data);
  40860. _this.emit('pusher:subscription_error', data);
  40861. }
  40862. else {
  40863. _this.pusher.send_event('pusher:subscribe', {
  40864. auth: data.auth,
  40865. channel_data: data.channel_data,
  40866. channel: _this.name
  40867. });
  40868. }
  40869. });
  40870. };
  40871. Channel.prototype.unsubscribe = function () {
  40872. this.subscribed = false;
  40873. this.pusher.send_event('pusher:unsubscribe', {
  40874. channel: this.name
  40875. });
  40876. };
  40877. Channel.prototype.cancelSubscription = function () {
  40878. this.subscriptionCancelled = true;
  40879. };
  40880. Channel.prototype.reinstateSubscription = function () {
  40881. this.subscriptionCancelled = false;
  40882. };
  40883. return Channel;
  40884. }(dispatcher));
  40885. /* harmony default export */ var channels_channel = (channel_Channel);
  40886. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40887. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40888. var extendStatics = function (d, b) {
  40889. extendStatics = Object.setPrototypeOf ||
  40890. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40891. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40892. return extendStatics(d, b);
  40893. };
  40894. return function (d, b) {
  40895. extendStatics(d, b);
  40896. function __() { this.constructor = d; }
  40897. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40898. };
  40899. })();
  40900. var private_channel_PrivateChannel = (function (_super) {
  40901. private_channel_extends(PrivateChannel, _super);
  40902. function PrivateChannel() {
  40903. return _super !== null && _super.apply(this, arguments) || this;
  40904. }
  40905. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40906. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40907. return authorizer.authorize(socketId, callback);
  40908. };
  40909. return PrivateChannel;
  40910. }(channels_channel));
  40911. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40912. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40913. var members_Members = (function () {
  40914. function Members() {
  40915. this.reset();
  40916. }
  40917. Members.prototype.get = function (id) {
  40918. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40919. return {
  40920. id: id,
  40921. info: this.members[id]
  40922. };
  40923. }
  40924. else {
  40925. return null;
  40926. }
  40927. };
  40928. Members.prototype.each = function (callback) {
  40929. var _this = this;
  40930. objectApply(this.members, function (member, id) {
  40931. callback(_this.get(id));
  40932. });
  40933. };
  40934. Members.prototype.setMyID = function (id) {
  40935. this.myID = id;
  40936. };
  40937. Members.prototype.onSubscription = function (subscriptionData) {
  40938. this.members = subscriptionData.presence.hash;
  40939. this.count = subscriptionData.presence.count;
  40940. this.me = this.get(this.myID);
  40941. };
  40942. Members.prototype.addMember = function (memberData) {
  40943. if (this.get(memberData.user_id) === null) {
  40944. this.count++;
  40945. }
  40946. this.members[memberData.user_id] = memberData.user_info;
  40947. return this.get(memberData.user_id);
  40948. };
  40949. Members.prototype.removeMember = function (memberData) {
  40950. var member = this.get(memberData.user_id);
  40951. if (member) {
  40952. delete this.members[memberData.user_id];
  40953. this.count--;
  40954. }
  40955. return member;
  40956. };
  40957. Members.prototype.reset = function () {
  40958. this.members = {};
  40959. this.count = 0;
  40960. this.myID = null;
  40961. this.me = null;
  40962. };
  40963. return Members;
  40964. }());
  40965. /* harmony default export */ var members = (members_Members);
  40966. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40967. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40968. var extendStatics = function (d, b) {
  40969. extendStatics = Object.setPrototypeOf ||
  40970. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40971. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40972. return extendStatics(d, b);
  40973. };
  40974. return function (d, b) {
  40975. extendStatics(d, b);
  40976. function __() { this.constructor = d; }
  40977. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40978. };
  40979. })();
  40980. var presence_channel_PresenceChannel = (function (_super) {
  40981. presence_channel_extends(PresenceChannel, _super);
  40982. function PresenceChannel(name, pusher) {
  40983. var _this = _super.call(this, name, pusher) || this;
  40984. _this.members = new members();
  40985. return _this;
  40986. }
  40987. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40988. var _this = this;
  40989. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40990. if (!error) {
  40991. if (authData.channel_data === undefined) {
  40992. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40993. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40994. ("expected 'channel_data' field. " + suffix));
  40995. callback("Invalid auth response");
  40996. return;
  40997. }
  40998. var channelData = JSON.parse(authData.channel_data);
  40999. _this.members.setMyID(channelData.user_id);
  41000. }
  41001. callback(error, authData);
  41002. });
  41003. };
  41004. PresenceChannel.prototype.handleEvent = function (event) {
  41005. var eventName = event.event;
  41006. if (eventName.indexOf("pusher_internal:") === 0) {
  41007. this.handleInternalEvent(event);
  41008. }
  41009. else {
  41010. var data = event.data;
  41011. var metadata = {};
  41012. if (event.user_id) {
  41013. metadata.user_id = event.user_id;
  41014. }
  41015. this.emit(eventName, data, metadata);
  41016. }
  41017. };
  41018. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41019. var eventName = event.event;
  41020. var data = event.data;
  41021. switch (eventName) {
  41022. case "pusher_internal:subscription_succeeded":
  41023. this.handleSubscriptionSucceededEvent(event);
  41024. break;
  41025. case "pusher_internal:member_added":
  41026. var addedMember = this.members.addMember(data);
  41027. this.emit('pusher:member_added', addedMember);
  41028. break;
  41029. case "pusher_internal:member_removed":
  41030. var removedMember = this.members.removeMember(data);
  41031. if (removedMember) {
  41032. this.emit('pusher:member_removed', removedMember);
  41033. }
  41034. break;
  41035. }
  41036. };
  41037. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41038. this.subscriptionPending = false;
  41039. this.subscribed = true;
  41040. if (this.subscriptionCancelled) {
  41041. this.pusher.unsubscribe(this.name);
  41042. }
  41043. else {
  41044. this.members.onSubscription(event.data);
  41045. this.emit("pusher:subscription_succeeded", this.members);
  41046. }
  41047. };
  41048. PresenceChannel.prototype.disconnect = function () {
  41049. this.members.reset();
  41050. _super.prototype.disconnect.call(this);
  41051. };
  41052. return PresenceChannel;
  41053. }(private_channel));
  41054. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41055. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41056. var nacl_fast = __webpack_require__(0);
  41057. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41058. var nacl_util = __webpack_require__(1);
  41059. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41060. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41061. var extendStatics = function (d, b) {
  41062. extendStatics = Object.setPrototypeOf ||
  41063. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41064. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41065. return extendStatics(d, b);
  41066. };
  41067. return function (d, b) {
  41068. extendStatics(d, b);
  41069. function __() { this.constructor = d; }
  41070. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41071. };
  41072. })();
  41073. var encrypted_channel_EncryptedChannel = (function (_super) {
  41074. encrypted_channel_extends(EncryptedChannel, _super);
  41075. function EncryptedChannel() {
  41076. var _this = _super !== null && _super.apply(this, arguments) || this;
  41077. _this.key = null;
  41078. return _this;
  41079. }
  41080. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41081. var _this = this;
  41082. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41083. if (error) {
  41084. callback(true, authData);
  41085. return;
  41086. }
  41087. var sharedSecret = authData["shared_secret"];
  41088. if (!sharedSecret) {
  41089. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41090. callback(true, errorMsg);
  41091. return;
  41092. }
  41093. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41094. delete authData["shared_secret"];
  41095. callback(false, authData);
  41096. });
  41097. };
  41098. EncryptedChannel.prototype.trigger = function (event, data) {
  41099. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41100. };
  41101. EncryptedChannel.prototype.handleEvent = function (event) {
  41102. var eventName = event.event;
  41103. var data = event.data;
  41104. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41105. _super.prototype.handleEvent.call(this, event);
  41106. return;
  41107. }
  41108. this.handleEncryptedEvent(eventName, data);
  41109. };
  41110. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41111. var _this = this;
  41112. if (!this.key) {
  41113. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41114. return;
  41115. }
  41116. if (!data.ciphertext || !data.nonce) {
  41117. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41118. return;
  41119. }
  41120. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41121. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41122. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41123. return;
  41124. }
  41125. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41126. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41127. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41128. return;
  41129. }
  41130. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41131. if (bytes === null) {
  41132. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41133. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41134. if (error) {
  41135. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41136. return;
  41137. }
  41138. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41139. if (bytes === null) {
  41140. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41141. return;
  41142. }
  41143. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41144. return;
  41145. });
  41146. return;
  41147. }
  41148. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41149. };
  41150. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41151. try {
  41152. this.emit(eventName, JSON.parse(data));
  41153. }
  41154. catch (e) {
  41155. this.emit(eventName, data);
  41156. }
  41157. return this;
  41158. };
  41159. return EncryptedChannel;
  41160. }(private_channel));
  41161. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41162. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41163. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41164. var extendStatics = function (d, b) {
  41165. extendStatics = Object.setPrototypeOf ||
  41166. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41167. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41168. return extendStatics(d, b);
  41169. };
  41170. return function (d, b) {
  41171. extendStatics(d, b);
  41172. function __() { this.constructor = d; }
  41173. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41174. };
  41175. })();
  41176. var connection_manager_ConnectionManager = (function (_super) {
  41177. connection_manager_extends(ConnectionManager, _super);
  41178. function ConnectionManager(key, options) {
  41179. var _this = _super.call(this) || this;
  41180. _this.key = key;
  41181. _this.options = options || {};
  41182. _this.state = "initialized";
  41183. _this.connection = null;
  41184. _this.usingTLS = !!options.useTLS;
  41185. _this.timeline = _this.options.timeline;
  41186. _this.errorCallbacks = _this.buildErrorCallbacks();
  41187. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41188. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41189. var Network = runtime.getNetwork();
  41190. Network.bind("online", function () {
  41191. _this.timeline.info({ netinfo: "online" });
  41192. if (_this.state === "connecting" || _this.state === "unavailable") {
  41193. _this.retryIn(0);
  41194. }
  41195. });
  41196. Network.bind("offline", function () {
  41197. _this.timeline.info({ netinfo: "offline" });
  41198. if (_this.connection) {
  41199. _this.sendActivityCheck();
  41200. }
  41201. });
  41202. _this.updateStrategy();
  41203. return _this;
  41204. }
  41205. ConnectionManager.prototype.connect = function () {
  41206. if (this.connection || this.runner) {
  41207. return;
  41208. }
  41209. if (!this.strategy.isSupported()) {
  41210. this.updateState("failed");
  41211. return;
  41212. }
  41213. this.updateState("connecting");
  41214. this.startConnecting();
  41215. this.setUnavailableTimer();
  41216. };
  41217. ;
  41218. ConnectionManager.prototype.send = function (data) {
  41219. if (this.connection) {
  41220. return this.connection.send(data);
  41221. }
  41222. else {
  41223. return false;
  41224. }
  41225. };
  41226. ;
  41227. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41228. if (this.connection) {
  41229. return this.connection.send_event(name, data, channel);
  41230. }
  41231. else {
  41232. return false;
  41233. }
  41234. };
  41235. ;
  41236. ConnectionManager.prototype.disconnect = function () {
  41237. this.disconnectInternally();
  41238. this.updateState("disconnected");
  41239. };
  41240. ;
  41241. ConnectionManager.prototype.isUsingTLS = function () {
  41242. return this.usingTLS;
  41243. };
  41244. ;
  41245. ConnectionManager.prototype.startConnecting = function () {
  41246. var _this = this;
  41247. var callback = function (error, handshake) {
  41248. if (error) {
  41249. _this.runner = _this.strategy.connect(0, callback);
  41250. }
  41251. else {
  41252. if (handshake.action === "error") {
  41253. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41254. _this.timeline.error({ handshakeError: handshake.error });
  41255. }
  41256. else {
  41257. _this.abortConnecting();
  41258. _this.handshakeCallbacks[handshake.action](handshake);
  41259. }
  41260. }
  41261. };
  41262. this.runner = this.strategy.connect(0, callback);
  41263. };
  41264. ;
  41265. ConnectionManager.prototype.abortConnecting = function () {
  41266. if (this.runner) {
  41267. this.runner.abort();
  41268. this.runner = null;
  41269. }
  41270. };
  41271. ;
  41272. ConnectionManager.prototype.disconnectInternally = function () {
  41273. this.abortConnecting();
  41274. this.clearRetryTimer();
  41275. this.clearUnavailableTimer();
  41276. if (this.connection) {
  41277. var connection = this.abandonConnection();
  41278. connection.close();
  41279. }
  41280. };
  41281. ;
  41282. ConnectionManager.prototype.updateStrategy = function () {
  41283. this.strategy = this.options.getStrategy({
  41284. key: this.key,
  41285. timeline: this.timeline,
  41286. useTLS: this.usingTLS
  41287. });
  41288. };
  41289. ;
  41290. ConnectionManager.prototype.retryIn = function (delay) {
  41291. var _this = this;
  41292. this.timeline.info({ action: "retry", delay: delay });
  41293. if (delay > 0) {
  41294. this.emit("connecting_in", Math.round(delay / 1000));
  41295. }
  41296. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41297. _this.disconnectInternally();
  41298. _this.connect();
  41299. });
  41300. };
  41301. ;
  41302. ConnectionManager.prototype.clearRetryTimer = function () {
  41303. if (this.retryTimer) {
  41304. this.retryTimer.ensureAborted();
  41305. this.retryTimer = null;
  41306. }
  41307. };
  41308. ;
  41309. ConnectionManager.prototype.setUnavailableTimer = function () {
  41310. var _this = this;
  41311. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41312. _this.updateState("unavailable");
  41313. });
  41314. };
  41315. ;
  41316. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41317. if (this.unavailableTimer) {
  41318. this.unavailableTimer.ensureAborted();
  41319. }
  41320. };
  41321. ;
  41322. ConnectionManager.prototype.sendActivityCheck = function () {
  41323. var _this = this;
  41324. this.stopActivityCheck();
  41325. this.connection.ping();
  41326. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41327. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41328. _this.retryIn(0);
  41329. });
  41330. };
  41331. ;
  41332. ConnectionManager.prototype.resetActivityCheck = function () {
  41333. var _this = this;
  41334. this.stopActivityCheck();
  41335. if (this.connection && !this.connection.handlesActivityChecks()) {
  41336. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41337. _this.sendActivityCheck();
  41338. });
  41339. }
  41340. };
  41341. ;
  41342. ConnectionManager.prototype.stopActivityCheck = function () {
  41343. if (this.activityTimer) {
  41344. this.activityTimer.ensureAborted();
  41345. }
  41346. };
  41347. ;
  41348. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41349. var _this = this;
  41350. return extend({}, errorCallbacks, {
  41351. message: function (message) {
  41352. _this.resetActivityCheck();
  41353. _this.emit('message', message);
  41354. },
  41355. ping: function () {
  41356. _this.send_event('pusher:pong', {});
  41357. },
  41358. activity: function () {
  41359. _this.resetActivityCheck();
  41360. },
  41361. error: function (error) {
  41362. _this.emit("error", { type: "WebSocketError", error: error });
  41363. },
  41364. closed: function () {
  41365. _this.abandonConnection();
  41366. if (_this.shouldRetry()) {
  41367. _this.retryIn(1000);
  41368. }
  41369. }
  41370. });
  41371. };
  41372. ;
  41373. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41374. var _this = this;
  41375. return extend({}, errorCallbacks, {
  41376. connected: function (handshake) {
  41377. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41378. _this.clearUnavailableTimer();
  41379. _this.setConnection(handshake.connection);
  41380. _this.socket_id = _this.connection.id;
  41381. _this.updateState("connected", { socket_id: _this.socket_id });
  41382. }
  41383. });
  41384. };
  41385. ;
  41386. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41387. var _this = this;
  41388. var withErrorEmitted = function (callback) {
  41389. return function (result) {
  41390. if (result.error) {
  41391. _this.emit("error", { type: "WebSocketError", error: result.error });
  41392. }
  41393. callback(result);
  41394. };
  41395. };
  41396. return {
  41397. tls_only: withErrorEmitted(function () {
  41398. _this.usingTLS = true;
  41399. _this.updateStrategy();
  41400. _this.retryIn(0);
  41401. }),
  41402. refused: withErrorEmitted(function () {
  41403. _this.disconnect();
  41404. }),
  41405. backoff: withErrorEmitted(function () {
  41406. _this.retryIn(1000);
  41407. }),
  41408. retry: withErrorEmitted(function () {
  41409. _this.retryIn(0);
  41410. })
  41411. };
  41412. };
  41413. ;
  41414. ConnectionManager.prototype.setConnection = function (connection) {
  41415. this.connection = connection;
  41416. for (var event in this.connectionCallbacks) {
  41417. this.connection.bind(event, this.connectionCallbacks[event]);
  41418. }
  41419. this.resetActivityCheck();
  41420. };
  41421. ;
  41422. ConnectionManager.prototype.abandonConnection = function () {
  41423. if (!this.connection) {
  41424. return;
  41425. }
  41426. this.stopActivityCheck();
  41427. for (var event in this.connectionCallbacks) {
  41428. this.connection.unbind(event, this.connectionCallbacks[event]);
  41429. }
  41430. var connection = this.connection;
  41431. this.connection = null;
  41432. return connection;
  41433. };
  41434. ConnectionManager.prototype.updateState = function (newState, data) {
  41435. var previousState = this.state;
  41436. this.state = newState;
  41437. if (previousState !== newState) {
  41438. var newStateDescription = newState;
  41439. if (newStateDescription === "connected") {
  41440. newStateDescription += " with new socket ID " + data.socket_id;
  41441. }
  41442. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41443. this.timeline.info({ state: newState, params: data });
  41444. this.emit('state_change', { previous: previousState, current: newState });
  41445. this.emit(newState, data);
  41446. }
  41447. };
  41448. ConnectionManager.prototype.shouldRetry = function () {
  41449. return this.state === "connecting" || this.state === "connected";
  41450. };
  41451. return ConnectionManager;
  41452. }(dispatcher));
  41453. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41454. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41455. var channels_Channels = (function () {
  41456. function Channels() {
  41457. this.channels = {};
  41458. }
  41459. Channels.prototype.add = function (name, pusher) {
  41460. if (!this.channels[name]) {
  41461. this.channels[name] = createChannel(name, pusher);
  41462. }
  41463. return this.channels[name];
  41464. };
  41465. Channels.prototype.all = function () {
  41466. return values(this.channels);
  41467. };
  41468. Channels.prototype.find = function (name) {
  41469. return this.channels[name];
  41470. };
  41471. Channels.prototype.remove = function (name) {
  41472. var channel = this.channels[name];
  41473. delete this.channels[name];
  41474. return channel;
  41475. };
  41476. Channels.prototype.disconnect = function () {
  41477. objectApply(this.channels, function (channel) {
  41478. channel.disconnect();
  41479. });
  41480. };
  41481. return Channels;
  41482. }());
  41483. /* harmony default export */ var channels = (channels_Channels);
  41484. function createChannel(name, pusher) {
  41485. if (name.indexOf('private-encrypted-') === 0) {
  41486. if (false) { var errorMsg; }
  41487. return factory.createEncryptedChannel(name, pusher);
  41488. }
  41489. else if (name.indexOf('private-') === 0) {
  41490. return factory.createPrivateChannel(name, pusher);
  41491. }
  41492. else if (name.indexOf('presence-') === 0) {
  41493. return factory.createPresenceChannel(name, pusher);
  41494. }
  41495. else {
  41496. return factory.createChannel(name, pusher);
  41497. }
  41498. }
  41499. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41500. var Factory = {
  41501. createChannels: function () {
  41502. return new channels();
  41503. },
  41504. createConnectionManager: function (key, options) {
  41505. return new connection_manager(key, options);
  41506. },
  41507. createChannel: function (name, pusher) {
  41508. return new channels_channel(name, pusher);
  41509. },
  41510. createPrivateChannel: function (name, pusher) {
  41511. return new private_channel(name, pusher);
  41512. },
  41513. createPresenceChannel: function (name, pusher) {
  41514. return new presence_channel(name, pusher);
  41515. },
  41516. createEncryptedChannel: function (name, pusher) {
  41517. return new encrypted_channel(name, pusher);
  41518. },
  41519. createTimelineSender: function (timeline, options) {
  41520. return new timeline_sender(timeline, options);
  41521. },
  41522. createAuthorizer: function (channel, options) {
  41523. if (options.authorizer) {
  41524. return options.authorizer(channel, options);
  41525. }
  41526. return new pusher_authorizer(channel, options);
  41527. },
  41528. createHandshake: function (transport, callback) {
  41529. return new connection_handshake(transport, callback);
  41530. },
  41531. createAssistantToTheTransportManager: function (manager, transport, options) {
  41532. return new assistant_to_the_transport_manager(manager, transport, options);
  41533. }
  41534. };
  41535. /* harmony default export */ var factory = (Factory);
  41536. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41537. var transport_manager_TransportManager = (function () {
  41538. function TransportManager(options) {
  41539. this.options = options || {};
  41540. this.livesLeft = this.options.lives || Infinity;
  41541. }
  41542. TransportManager.prototype.getAssistant = function (transport) {
  41543. return factory.createAssistantToTheTransportManager(this, transport, {
  41544. minPingDelay: this.options.minPingDelay,
  41545. maxPingDelay: this.options.maxPingDelay
  41546. });
  41547. };
  41548. TransportManager.prototype.isAlive = function () {
  41549. return this.livesLeft > 0;
  41550. };
  41551. TransportManager.prototype.reportDeath = function () {
  41552. this.livesLeft -= 1;
  41553. };
  41554. return TransportManager;
  41555. }());
  41556. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41557. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41558. var sequential_strategy_SequentialStrategy = (function () {
  41559. function SequentialStrategy(strategies, options) {
  41560. this.strategies = strategies;
  41561. this.loop = Boolean(options.loop);
  41562. this.failFast = Boolean(options.failFast);
  41563. this.timeout = options.timeout;
  41564. this.timeoutLimit = options.timeoutLimit;
  41565. }
  41566. SequentialStrategy.prototype.isSupported = function () {
  41567. return any(this.strategies, util.method("isSupported"));
  41568. };
  41569. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41570. var _this = this;
  41571. var strategies = this.strategies;
  41572. var current = 0;
  41573. var timeout = this.timeout;
  41574. var runner = null;
  41575. var tryNextStrategy = function (error, handshake) {
  41576. if (handshake) {
  41577. callback(null, handshake);
  41578. }
  41579. else {
  41580. current = current + 1;
  41581. if (_this.loop) {
  41582. current = current % strategies.length;
  41583. }
  41584. if (current < strategies.length) {
  41585. if (timeout) {
  41586. timeout = timeout * 2;
  41587. if (_this.timeoutLimit) {
  41588. timeout = Math.min(timeout, _this.timeoutLimit);
  41589. }
  41590. }
  41591. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41592. }
  41593. else {
  41594. callback(true);
  41595. }
  41596. }
  41597. };
  41598. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41599. return {
  41600. abort: function () {
  41601. runner.abort();
  41602. },
  41603. forceMinPriority: function (p) {
  41604. minPriority = p;
  41605. if (runner) {
  41606. runner.forceMinPriority(p);
  41607. }
  41608. }
  41609. };
  41610. };
  41611. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41612. var timer = null;
  41613. var runner = null;
  41614. if (options.timeout > 0) {
  41615. timer = new OneOffTimer(options.timeout, function () {
  41616. runner.abort();
  41617. callback(true);
  41618. });
  41619. }
  41620. runner = strategy.connect(minPriority, function (error, handshake) {
  41621. if (error && timer && timer.isRunning() && !options.failFast) {
  41622. return;
  41623. }
  41624. if (timer) {
  41625. timer.ensureAborted();
  41626. }
  41627. callback(error, handshake);
  41628. });
  41629. return {
  41630. abort: function () {
  41631. if (timer) {
  41632. timer.ensureAborted();
  41633. }
  41634. runner.abort();
  41635. },
  41636. forceMinPriority: function (p) {
  41637. runner.forceMinPriority(p);
  41638. }
  41639. };
  41640. };
  41641. return SequentialStrategy;
  41642. }());
  41643. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41644. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41645. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41646. function BestConnectedEverStrategy(strategies) {
  41647. this.strategies = strategies;
  41648. }
  41649. BestConnectedEverStrategy.prototype.isSupported = function () {
  41650. return any(this.strategies, util.method("isSupported"));
  41651. };
  41652. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41653. return connect(this.strategies, minPriority, function (i, runners) {
  41654. return function (error, handshake) {
  41655. runners[i].error = error;
  41656. if (error) {
  41657. if (allRunnersFailed(runners)) {
  41658. callback(true);
  41659. }
  41660. return;
  41661. }
  41662. apply(runners, function (runner) {
  41663. runner.forceMinPriority(handshake.transport.priority);
  41664. });
  41665. callback(null, handshake);
  41666. };
  41667. });
  41668. };
  41669. return BestConnectedEverStrategy;
  41670. }());
  41671. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41672. function connect(strategies, minPriority, callbackBuilder) {
  41673. var runners = map(strategies, function (strategy, i, _, rs) {
  41674. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41675. });
  41676. return {
  41677. abort: function () {
  41678. apply(runners, abortRunner);
  41679. },
  41680. forceMinPriority: function (p) {
  41681. apply(runners, function (runner) {
  41682. runner.forceMinPriority(p);
  41683. });
  41684. }
  41685. };
  41686. }
  41687. function allRunnersFailed(runners) {
  41688. return collections_all(runners, function (runner) {
  41689. return Boolean(runner.error);
  41690. });
  41691. }
  41692. function abortRunner(runner) {
  41693. if (!runner.error && !runner.aborted) {
  41694. runner.abort();
  41695. runner.aborted = true;
  41696. }
  41697. }
  41698. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41699. var cached_strategy_CachedStrategy = (function () {
  41700. function CachedStrategy(strategy, transports, options) {
  41701. this.strategy = strategy;
  41702. this.transports = transports;
  41703. this.ttl = options.ttl || 1800 * 1000;
  41704. this.usingTLS = options.useTLS;
  41705. this.timeline = options.timeline;
  41706. }
  41707. CachedStrategy.prototype.isSupported = function () {
  41708. return this.strategy.isSupported();
  41709. };
  41710. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41711. var usingTLS = this.usingTLS;
  41712. var info = fetchTransportCache(usingTLS);
  41713. var strategies = [this.strategy];
  41714. if (info && info.timestamp + this.ttl >= util.now()) {
  41715. var transport = this.transports[info.transport];
  41716. if (transport) {
  41717. this.timeline.info({
  41718. cached: true,
  41719. transport: info.transport,
  41720. latency: info.latency
  41721. });
  41722. strategies.push(new sequential_strategy([transport], {
  41723. timeout: info.latency * 2 + 1000,
  41724. failFast: true
  41725. }));
  41726. }
  41727. }
  41728. var startTimestamp = util.now();
  41729. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41730. if (error) {
  41731. flushTransportCache(usingTLS);
  41732. if (strategies.length > 0) {
  41733. startTimestamp = util.now();
  41734. runner = strategies.pop().connect(minPriority, cb);
  41735. }
  41736. else {
  41737. callback(error);
  41738. }
  41739. }
  41740. else {
  41741. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41742. callback(null, handshake);
  41743. }
  41744. });
  41745. return {
  41746. abort: function () {
  41747. runner.abort();
  41748. },
  41749. forceMinPriority: function (p) {
  41750. minPriority = p;
  41751. if (runner) {
  41752. runner.forceMinPriority(p);
  41753. }
  41754. }
  41755. };
  41756. };
  41757. return CachedStrategy;
  41758. }());
  41759. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41760. function getTransportCacheKey(usingTLS) {
  41761. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41762. }
  41763. function fetchTransportCache(usingTLS) {
  41764. var storage = runtime.getLocalStorage();
  41765. if (storage) {
  41766. try {
  41767. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41768. if (serializedCache) {
  41769. return JSON.parse(serializedCache);
  41770. }
  41771. }
  41772. catch (e) {
  41773. flushTransportCache(usingTLS);
  41774. }
  41775. }
  41776. return null;
  41777. }
  41778. function storeTransportCache(usingTLS, transport, latency) {
  41779. var storage = runtime.getLocalStorage();
  41780. if (storage) {
  41781. try {
  41782. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41783. timestamp: util.now(),
  41784. transport: transport,
  41785. latency: latency
  41786. });
  41787. }
  41788. catch (e) {
  41789. }
  41790. }
  41791. }
  41792. function flushTransportCache(usingTLS) {
  41793. var storage = runtime.getLocalStorage();
  41794. if (storage) {
  41795. try {
  41796. delete storage[getTransportCacheKey(usingTLS)];
  41797. }
  41798. catch (e) {
  41799. }
  41800. }
  41801. }
  41802. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41803. var delayed_strategy_DelayedStrategy = (function () {
  41804. function DelayedStrategy(strategy, _a) {
  41805. var number = _a.delay;
  41806. this.strategy = strategy;
  41807. this.options = { delay: number };
  41808. }
  41809. DelayedStrategy.prototype.isSupported = function () {
  41810. return this.strategy.isSupported();
  41811. };
  41812. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41813. var strategy = this.strategy;
  41814. var runner;
  41815. var timer = new OneOffTimer(this.options.delay, function () {
  41816. runner = strategy.connect(minPriority, callback);
  41817. });
  41818. return {
  41819. abort: function () {
  41820. timer.ensureAborted();
  41821. if (runner) {
  41822. runner.abort();
  41823. }
  41824. },
  41825. forceMinPriority: function (p) {
  41826. minPriority = p;
  41827. if (runner) {
  41828. runner.forceMinPriority(p);
  41829. }
  41830. }
  41831. };
  41832. };
  41833. return DelayedStrategy;
  41834. }());
  41835. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41836. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41837. var IfStrategy = (function () {
  41838. function IfStrategy(test, trueBranch, falseBranch) {
  41839. this.test = test;
  41840. this.trueBranch = trueBranch;
  41841. this.falseBranch = falseBranch;
  41842. }
  41843. IfStrategy.prototype.isSupported = function () {
  41844. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41845. return branch.isSupported();
  41846. };
  41847. IfStrategy.prototype.connect = function (minPriority, callback) {
  41848. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41849. return branch.connect(minPriority, callback);
  41850. };
  41851. return IfStrategy;
  41852. }());
  41853. /* harmony default export */ var if_strategy = (IfStrategy);
  41854. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41855. var FirstConnectedStrategy = (function () {
  41856. function FirstConnectedStrategy(strategy) {
  41857. this.strategy = strategy;
  41858. }
  41859. FirstConnectedStrategy.prototype.isSupported = function () {
  41860. return this.strategy.isSupported();
  41861. };
  41862. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41863. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41864. if (handshake) {
  41865. runner.abort();
  41866. }
  41867. callback(error, handshake);
  41868. });
  41869. return runner;
  41870. };
  41871. return FirstConnectedStrategy;
  41872. }());
  41873. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41874. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41875. function testSupportsStrategy(strategy) {
  41876. return function () {
  41877. return strategy.isSupported();
  41878. };
  41879. }
  41880. var getDefaultStrategy = function (config, defineTransport) {
  41881. var definedTransports = {};
  41882. function defineTransportStrategy(name, type, priority, options, manager) {
  41883. var transport = defineTransport(config, name, type, priority, options, manager);
  41884. definedTransports[name] = transport;
  41885. return transport;
  41886. }
  41887. var ws_options = {
  41888. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41889. hostTLS: config.wsHost + ":" + config.wssPort,
  41890. httpPath: config.wsPath
  41891. };
  41892. var wss_options = extend({}, ws_options, {
  41893. useTLS: true
  41894. });
  41895. var sockjs_options = {
  41896. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41897. hostTLS: config.httpHost + ":" + config.httpsPort,
  41898. httpPath: config.httpPath
  41899. };
  41900. var timeouts = {
  41901. loop: true,
  41902. timeout: 15000,
  41903. timeoutLimit: 60000
  41904. };
  41905. var ws_manager = new transport_manager({
  41906. lives: 2,
  41907. minPingDelay: 10000,
  41908. maxPingDelay: config.activity_timeout
  41909. });
  41910. var streaming_manager = new transport_manager({
  41911. lives: 2,
  41912. minPingDelay: 10000,
  41913. maxPingDelay: config.activity_timeout
  41914. });
  41915. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41916. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41917. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41918. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41919. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41920. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41921. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41922. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41923. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41924. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41925. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41926. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41927. 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);
  41928. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41929. var wsStrategy;
  41930. if (config.useTLS) {
  41931. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41932. }
  41933. else {
  41934. wsStrategy = new best_connected_ever_strategy([
  41935. ws_loop,
  41936. new delayed_strategy(wss_loop, { delay: 2000 }),
  41937. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41938. ]);
  41939. }
  41940. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41941. ttl: 1800000,
  41942. timeline: config.timeline,
  41943. useTLS: config.useTLS
  41944. });
  41945. };
  41946. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41947. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41948. /* harmony default export */ var transport_connection_initializer = (function () {
  41949. var self = this;
  41950. self.timeline.info(self.buildTimelineMessage({
  41951. transport: self.name + (self.options.useTLS ? "s" : "")
  41952. }));
  41953. if (self.hooks.isInitialized()) {
  41954. self.changeState("initialized");
  41955. }
  41956. else if (self.hooks.file) {
  41957. self.changeState("initializing");
  41958. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41959. if (self.hooks.isInitialized()) {
  41960. self.changeState("initialized");
  41961. callback(true);
  41962. }
  41963. else {
  41964. if (error) {
  41965. self.onError(error);
  41966. }
  41967. self.onClose();
  41968. callback(false);
  41969. }
  41970. });
  41971. }
  41972. else {
  41973. self.onClose();
  41974. }
  41975. });
  41976. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41977. var http_xdomain_request_hooks = {
  41978. getRequest: function (socket) {
  41979. var xdr = new window.XDomainRequest();
  41980. xdr.ontimeout = function () {
  41981. socket.emit("error", new RequestTimedOut());
  41982. socket.close();
  41983. };
  41984. xdr.onerror = function (e) {
  41985. socket.emit("error", e);
  41986. socket.close();
  41987. };
  41988. xdr.onprogress = function () {
  41989. if (xdr.responseText && xdr.responseText.length > 0) {
  41990. socket.onChunk(200, xdr.responseText);
  41991. }
  41992. };
  41993. xdr.onload = function () {
  41994. if (xdr.responseText && xdr.responseText.length > 0) {
  41995. socket.onChunk(200, xdr.responseText);
  41996. }
  41997. socket.emit("finished", 200);
  41998. socket.close();
  41999. };
  42000. return xdr;
  42001. },
  42002. abortRequest: function (xdr) {
  42003. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42004. xdr.abort();
  42005. }
  42006. };
  42007. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42008. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42009. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42010. var extendStatics = function (d, b) {
  42011. extendStatics = Object.setPrototypeOf ||
  42012. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42013. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42014. return extendStatics(d, b);
  42015. };
  42016. return function (d, b) {
  42017. extendStatics(d, b);
  42018. function __() { this.constructor = d; }
  42019. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42020. };
  42021. })();
  42022. var MAX_BUFFER_LENGTH = 256 * 1024;
  42023. var http_request_HTTPRequest = (function (_super) {
  42024. http_request_extends(HTTPRequest, _super);
  42025. function HTTPRequest(hooks, method, url) {
  42026. var _this = _super.call(this) || this;
  42027. _this.hooks = hooks;
  42028. _this.method = method;
  42029. _this.url = url;
  42030. return _this;
  42031. }
  42032. HTTPRequest.prototype.start = function (payload) {
  42033. var _this = this;
  42034. this.position = 0;
  42035. this.xhr = this.hooks.getRequest(this);
  42036. this.unloader = function () {
  42037. _this.close();
  42038. };
  42039. runtime.addUnloadListener(this.unloader);
  42040. this.xhr.open(this.method, this.url, true);
  42041. if (this.xhr.setRequestHeader) {
  42042. this.xhr.setRequestHeader("Content-Type", "application/json");
  42043. }
  42044. this.xhr.send(payload);
  42045. };
  42046. HTTPRequest.prototype.close = function () {
  42047. if (this.unloader) {
  42048. runtime.removeUnloadListener(this.unloader);
  42049. this.unloader = null;
  42050. }
  42051. if (this.xhr) {
  42052. this.hooks.abortRequest(this.xhr);
  42053. this.xhr = null;
  42054. }
  42055. };
  42056. HTTPRequest.prototype.onChunk = function (status, data) {
  42057. while (true) {
  42058. var chunk = this.advanceBuffer(data);
  42059. if (chunk) {
  42060. this.emit("chunk", { status: status, data: chunk });
  42061. }
  42062. else {
  42063. break;
  42064. }
  42065. }
  42066. if (this.isBufferTooLong(data)) {
  42067. this.emit("buffer_too_long");
  42068. }
  42069. };
  42070. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42071. var unreadData = buffer.slice(this.position);
  42072. var endOfLinePosition = unreadData.indexOf("\n");
  42073. if (endOfLinePosition !== -1) {
  42074. this.position += endOfLinePosition + 1;
  42075. return unreadData.slice(0, endOfLinePosition);
  42076. }
  42077. else {
  42078. return null;
  42079. }
  42080. };
  42081. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42082. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42083. };
  42084. return HTTPRequest;
  42085. }(dispatcher));
  42086. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42087. // CONCATENATED MODULE: ./src/core/http/state.ts
  42088. var State;
  42089. (function (State) {
  42090. State[State["CONNECTING"] = 0] = "CONNECTING";
  42091. State[State["OPEN"] = 1] = "OPEN";
  42092. State[State["CLOSED"] = 3] = "CLOSED";
  42093. })(State || (State = {}));
  42094. /* harmony default export */ var state = (State);
  42095. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42096. var autoIncrement = 1;
  42097. var http_socket_HTTPSocket = (function () {
  42098. function HTTPSocket(hooks, url) {
  42099. this.hooks = hooks;
  42100. this.session = randomNumber(1000) + "/" + randomString(8);
  42101. this.location = getLocation(url);
  42102. this.readyState = state.CONNECTING;
  42103. this.openStream();
  42104. }
  42105. HTTPSocket.prototype.send = function (payload) {
  42106. return this.sendRaw(JSON.stringify([payload]));
  42107. };
  42108. HTTPSocket.prototype.ping = function () {
  42109. this.hooks.sendHeartbeat(this);
  42110. };
  42111. HTTPSocket.prototype.close = function (code, reason) {
  42112. this.onClose(code, reason, true);
  42113. };
  42114. HTTPSocket.prototype.sendRaw = function (payload) {
  42115. if (this.readyState === state.OPEN) {
  42116. try {
  42117. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42118. return true;
  42119. }
  42120. catch (e) {
  42121. return false;
  42122. }
  42123. }
  42124. else {
  42125. return false;
  42126. }
  42127. };
  42128. HTTPSocket.prototype.reconnect = function () {
  42129. this.closeStream();
  42130. this.openStream();
  42131. };
  42132. ;
  42133. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42134. this.closeStream();
  42135. this.readyState = state.CLOSED;
  42136. if (this.onclose) {
  42137. this.onclose({
  42138. code: code,
  42139. reason: reason,
  42140. wasClean: wasClean
  42141. });
  42142. }
  42143. };
  42144. HTTPSocket.prototype.onChunk = function (chunk) {
  42145. if (chunk.status !== 200) {
  42146. return;
  42147. }
  42148. if (this.readyState === state.OPEN) {
  42149. this.onActivity();
  42150. }
  42151. var payload;
  42152. var type = chunk.data.slice(0, 1);
  42153. switch (type) {
  42154. case 'o':
  42155. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42156. this.onOpen(payload);
  42157. break;
  42158. case 'a':
  42159. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42160. for (var i = 0; i < payload.length; i++) {
  42161. this.onEvent(payload[i]);
  42162. }
  42163. break;
  42164. case 'm':
  42165. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42166. this.onEvent(payload);
  42167. break;
  42168. case 'h':
  42169. this.hooks.onHeartbeat(this);
  42170. break;
  42171. case 'c':
  42172. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42173. this.onClose(payload[0], payload[1], true);
  42174. break;
  42175. }
  42176. };
  42177. HTTPSocket.prototype.onOpen = function (options) {
  42178. if (this.readyState === state.CONNECTING) {
  42179. if (options && options.hostname) {
  42180. this.location.base = replaceHost(this.location.base, options.hostname);
  42181. }
  42182. this.readyState = state.OPEN;
  42183. if (this.onopen) {
  42184. this.onopen();
  42185. }
  42186. }
  42187. else {
  42188. this.onClose(1006, "Server lost session", true);
  42189. }
  42190. };
  42191. HTTPSocket.prototype.onEvent = function (event) {
  42192. if (this.readyState === state.OPEN && this.onmessage) {
  42193. this.onmessage({ data: event });
  42194. }
  42195. };
  42196. HTTPSocket.prototype.onActivity = function () {
  42197. if (this.onactivity) {
  42198. this.onactivity();
  42199. }
  42200. };
  42201. HTTPSocket.prototype.onError = function (error) {
  42202. if (this.onerror) {
  42203. this.onerror(error);
  42204. }
  42205. };
  42206. HTTPSocket.prototype.openStream = function () {
  42207. var _this = this;
  42208. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42209. this.stream.bind("chunk", function (chunk) {
  42210. _this.onChunk(chunk);
  42211. });
  42212. this.stream.bind("finished", function (status) {
  42213. _this.hooks.onFinished(_this, status);
  42214. });
  42215. this.stream.bind("buffer_too_long", function () {
  42216. _this.reconnect();
  42217. });
  42218. try {
  42219. this.stream.start();
  42220. }
  42221. catch (error) {
  42222. util.defer(function () {
  42223. _this.onError(error);
  42224. _this.onClose(1006, "Could not start streaming", false);
  42225. });
  42226. }
  42227. };
  42228. HTTPSocket.prototype.closeStream = function () {
  42229. if (this.stream) {
  42230. this.stream.unbind_all();
  42231. this.stream.close();
  42232. this.stream = null;
  42233. }
  42234. };
  42235. return HTTPSocket;
  42236. }());
  42237. function getLocation(url) {
  42238. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42239. return {
  42240. base: parts[1],
  42241. queryString: parts[2]
  42242. };
  42243. }
  42244. function getSendURL(url, session) {
  42245. return url.base + "/" + session + "/xhr_send";
  42246. }
  42247. function getUniqueURL(url) {
  42248. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42249. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42250. }
  42251. function replaceHost(url, hostname) {
  42252. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42253. return urlParts[1] + hostname + urlParts[3];
  42254. }
  42255. function randomNumber(max) {
  42256. return Math.floor(Math.random() * max);
  42257. }
  42258. function randomString(length) {
  42259. var result = [];
  42260. for (var i = 0; i < length; i++) {
  42261. result.push(randomNumber(32).toString(32));
  42262. }
  42263. return result.join('');
  42264. }
  42265. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42266. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42267. var http_streaming_socket_hooks = {
  42268. getReceiveURL: function (url, session) {
  42269. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42270. },
  42271. onHeartbeat: function (socket) {
  42272. socket.sendRaw("[]");
  42273. },
  42274. sendHeartbeat: function (socket) {
  42275. socket.sendRaw("[]");
  42276. },
  42277. onFinished: function (socket, status) {
  42278. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42279. }
  42280. };
  42281. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42282. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42283. var http_polling_socket_hooks = {
  42284. getReceiveURL: function (url, session) {
  42285. return url.base + "/" + session + "/xhr" + url.queryString;
  42286. },
  42287. onHeartbeat: function () {
  42288. },
  42289. sendHeartbeat: function (socket) {
  42290. socket.sendRaw("[]");
  42291. },
  42292. onFinished: function (socket, status) {
  42293. if (status === 200) {
  42294. socket.reconnect();
  42295. }
  42296. else {
  42297. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42298. }
  42299. }
  42300. };
  42301. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42302. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42303. var http_xhr_request_hooks = {
  42304. getRequest: function (socket) {
  42305. var Constructor = runtime.getXHRAPI();
  42306. var xhr = new Constructor();
  42307. xhr.onreadystatechange = xhr.onprogress = function () {
  42308. switch (xhr.readyState) {
  42309. case 3:
  42310. if (xhr.responseText && xhr.responseText.length > 0) {
  42311. socket.onChunk(xhr.status, xhr.responseText);
  42312. }
  42313. break;
  42314. case 4:
  42315. if (xhr.responseText && xhr.responseText.length > 0) {
  42316. socket.onChunk(xhr.status, xhr.responseText);
  42317. }
  42318. socket.emit("finished", xhr.status);
  42319. socket.close();
  42320. break;
  42321. }
  42322. };
  42323. return xhr;
  42324. },
  42325. abortRequest: function (xhr) {
  42326. xhr.onreadystatechange = null;
  42327. xhr.abort();
  42328. }
  42329. };
  42330. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42331. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42332. var HTTP = {
  42333. createStreamingSocket: function (url) {
  42334. return this.createSocket(http_streaming_socket, url);
  42335. },
  42336. createPollingSocket: function (url) {
  42337. return this.createSocket(http_polling_socket, url);
  42338. },
  42339. createSocket: function (hooks, url) {
  42340. return new http_socket(hooks, url);
  42341. },
  42342. createXHR: function (method, url) {
  42343. return this.createRequest(http_xhr_request, method, url);
  42344. },
  42345. createRequest: function (hooks, method, url) {
  42346. return new http_request(hooks, method, url);
  42347. }
  42348. };
  42349. /* harmony default export */ var http_http = (HTTP);
  42350. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42351. http_http.createXDR = function (method, url) {
  42352. return this.createRequest(http_xdomain_request, method, url);
  42353. };
  42354. /* harmony default export */ var web_http_http = (http_http);
  42355. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42356. var Runtime = {
  42357. nextAuthCallbackID: 1,
  42358. auth_callbacks: {},
  42359. ScriptReceivers: ScriptReceivers,
  42360. DependenciesReceivers: DependenciesReceivers,
  42361. getDefaultStrategy: default_strategy,
  42362. Transports: transports_transports,
  42363. transportConnectionInitializer: transport_connection_initializer,
  42364. HTTPFactory: web_http_http,
  42365. TimelineTransport: jsonp_timeline,
  42366. getXHRAPI: function () {
  42367. return window.XMLHttpRequest;
  42368. },
  42369. getWebSocketAPI: function () {
  42370. return window.WebSocket || window.MozWebSocket;
  42371. },
  42372. setup: function (PusherClass) {
  42373. var _this = this;
  42374. window.Pusher = PusherClass;
  42375. var initializeOnDocumentBody = function () {
  42376. _this.onDocumentBody(PusherClass.ready);
  42377. };
  42378. if (!window.JSON) {
  42379. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42380. }
  42381. else {
  42382. initializeOnDocumentBody();
  42383. }
  42384. },
  42385. getDocument: function () {
  42386. return document;
  42387. },
  42388. getProtocol: function () {
  42389. return this.getDocument().location.protocol;
  42390. },
  42391. getAuthorizers: function () {
  42392. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42393. },
  42394. onDocumentBody: function (callback) {
  42395. var _this = this;
  42396. if (document.body) {
  42397. callback();
  42398. }
  42399. else {
  42400. setTimeout(function () {
  42401. _this.onDocumentBody(callback);
  42402. }, 0);
  42403. }
  42404. },
  42405. createJSONPRequest: function (url, data) {
  42406. return new jsonp_request(url, data);
  42407. },
  42408. createScriptRequest: function (src) {
  42409. return new script_request(src);
  42410. },
  42411. getLocalStorage: function () {
  42412. try {
  42413. return window.localStorage;
  42414. }
  42415. catch (e) {
  42416. return undefined;
  42417. }
  42418. },
  42419. createXHR: function () {
  42420. if (this.getXHRAPI()) {
  42421. return this.createXMLHttpRequest();
  42422. }
  42423. else {
  42424. return this.createMicrosoftXHR();
  42425. }
  42426. },
  42427. createXMLHttpRequest: function () {
  42428. var Constructor = this.getXHRAPI();
  42429. return new Constructor();
  42430. },
  42431. createMicrosoftXHR: function () {
  42432. return new ActiveXObject("Microsoft.XMLHTTP");
  42433. },
  42434. getNetwork: function () {
  42435. return net_info_Network;
  42436. },
  42437. createWebSocket: function (url) {
  42438. var Constructor = this.getWebSocketAPI();
  42439. return new Constructor(url);
  42440. },
  42441. createSocketRequest: function (method, url) {
  42442. if (this.isXHRSupported()) {
  42443. return this.HTTPFactory.createXHR(method, url);
  42444. }
  42445. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42446. return this.HTTPFactory.createXDR(method, url);
  42447. }
  42448. else {
  42449. throw "Cross-origin HTTP requests are not supported";
  42450. }
  42451. },
  42452. isXHRSupported: function () {
  42453. var Constructor = this.getXHRAPI();
  42454. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42455. },
  42456. isXDRSupported: function (useTLS) {
  42457. var protocol = useTLS ? "https:" : "http:";
  42458. var documentProtocol = this.getProtocol();
  42459. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42460. },
  42461. addUnloadListener: function (listener) {
  42462. if (window.addEventListener !== undefined) {
  42463. window.addEventListener("unload", listener, false);
  42464. }
  42465. else if (window.attachEvent !== undefined) {
  42466. window.attachEvent("onunload", listener);
  42467. }
  42468. },
  42469. removeUnloadListener: function (listener) {
  42470. if (window.addEventListener !== undefined) {
  42471. window.removeEventListener("unload", listener, false);
  42472. }
  42473. else if (window.detachEvent !== undefined) {
  42474. window.detachEvent("onunload", listener);
  42475. }
  42476. }
  42477. };
  42478. /* harmony default export */ var runtime = (Runtime);
  42479. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42480. var TimelineLevel;
  42481. (function (TimelineLevel) {
  42482. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42483. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42484. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42485. })(TimelineLevel || (TimelineLevel = {}));
  42486. /* harmony default export */ var timeline_level = (TimelineLevel);
  42487. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42488. var timeline_Timeline = (function () {
  42489. function Timeline(key, session, options) {
  42490. this.key = key;
  42491. this.session = session;
  42492. this.events = [];
  42493. this.options = options || {};
  42494. this.sent = 0;
  42495. this.uniqueID = 0;
  42496. }
  42497. Timeline.prototype.log = function (level, event) {
  42498. if (level <= this.options.level) {
  42499. this.events.push(extend({}, event, { timestamp: util.now() }));
  42500. if (this.options.limit && this.events.length > this.options.limit) {
  42501. this.events.shift();
  42502. }
  42503. }
  42504. };
  42505. Timeline.prototype.error = function (event) {
  42506. this.log(timeline_level.ERROR, event);
  42507. };
  42508. Timeline.prototype.info = function (event) {
  42509. this.log(timeline_level.INFO, event);
  42510. };
  42511. Timeline.prototype.debug = function (event) {
  42512. this.log(timeline_level.DEBUG, event);
  42513. };
  42514. Timeline.prototype.isEmpty = function () {
  42515. return this.events.length === 0;
  42516. };
  42517. Timeline.prototype.send = function (sendfn, callback) {
  42518. var _this = this;
  42519. var data = extend({
  42520. session: this.session,
  42521. bundle: this.sent + 1,
  42522. key: this.key,
  42523. lib: "js",
  42524. version: this.options.version,
  42525. cluster: this.options.cluster,
  42526. features: this.options.features,
  42527. timeline: this.events
  42528. }, this.options.params);
  42529. this.events = [];
  42530. sendfn(data, function (error, result) {
  42531. if (!error) {
  42532. _this.sent++;
  42533. }
  42534. if (callback) {
  42535. callback(error, result);
  42536. }
  42537. });
  42538. return true;
  42539. };
  42540. Timeline.prototype.generateUniqueID = function () {
  42541. this.uniqueID++;
  42542. return this.uniqueID;
  42543. };
  42544. return Timeline;
  42545. }());
  42546. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42547. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42548. var transport_strategy_TransportStrategy = (function () {
  42549. function TransportStrategy(name, priority, transport, options) {
  42550. this.name = name;
  42551. this.priority = priority;
  42552. this.transport = transport;
  42553. this.options = options || {};
  42554. }
  42555. TransportStrategy.prototype.isSupported = function () {
  42556. return this.transport.isSupported({
  42557. useTLS: this.options.useTLS
  42558. });
  42559. };
  42560. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42561. var _this = this;
  42562. if (!this.isSupported()) {
  42563. return failAttempt(new UnsupportedStrategy(), callback);
  42564. }
  42565. else if (this.priority < minPriority) {
  42566. return failAttempt(new TransportPriorityTooLow(), callback);
  42567. }
  42568. var connected = false;
  42569. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42570. var handshake = null;
  42571. var onInitialized = function () {
  42572. transport.unbind("initialized", onInitialized);
  42573. transport.connect();
  42574. };
  42575. var onOpen = function () {
  42576. handshake = factory.createHandshake(transport, function (result) {
  42577. connected = true;
  42578. unbindListeners();
  42579. callback(null, result);
  42580. });
  42581. };
  42582. var onError = function (error) {
  42583. unbindListeners();
  42584. callback(error);
  42585. };
  42586. var onClosed = function () {
  42587. unbindListeners();
  42588. var serializedTransport;
  42589. serializedTransport = safeJSONStringify(transport);
  42590. callback(new TransportClosed(serializedTransport));
  42591. };
  42592. var unbindListeners = function () {
  42593. transport.unbind("initialized", onInitialized);
  42594. transport.unbind("open", onOpen);
  42595. transport.unbind("error", onError);
  42596. transport.unbind("closed", onClosed);
  42597. };
  42598. transport.bind("initialized", onInitialized);
  42599. transport.bind("open", onOpen);
  42600. transport.bind("error", onError);
  42601. transport.bind("closed", onClosed);
  42602. transport.initialize();
  42603. return {
  42604. abort: function () {
  42605. if (connected) {
  42606. return;
  42607. }
  42608. unbindListeners();
  42609. if (handshake) {
  42610. handshake.close();
  42611. }
  42612. else {
  42613. transport.close();
  42614. }
  42615. },
  42616. forceMinPriority: function (p) {
  42617. if (connected) {
  42618. return;
  42619. }
  42620. if (_this.priority < p) {
  42621. if (handshake) {
  42622. handshake.close();
  42623. }
  42624. else {
  42625. transport.close();
  42626. }
  42627. }
  42628. }
  42629. };
  42630. };
  42631. return TransportStrategy;
  42632. }());
  42633. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42634. function failAttempt(error, callback) {
  42635. util.defer(function () {
  42636. callback(error);
  42637. });
  42638. return {
  42639. abort: function () { },
  42640. forceMinPriority: function () { }
  42641. };
  42642. }
  42643. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42644. var strategy_builder_Transports = runtime.Transports;
  42645. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42646. var transportClass = strategy_builder_Transports[type];
  42647. if (!transportClass) {
  42648. throw new UnsupportedTransport(type);
  42649. }
  42650. var enabled = (!config.enabledTransports ||
  42651. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42652. (!config.disabledTransports ||
  42653. arrayIndexOf(config.disabledTransports, name) === -1);
  42654. var transport;
  42655. if (enabled) {
  42656. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42657. key: config.key,
  42658. useTLS: config.useTLS,
  42659. timeline: config.timeline,
  42660. ignoreNullOrigin: config.ignoreNullOrigin
  42661. }, options));
  42662. }
  42663. else {
  42664. transport = strategy_builder_UnsupportedStrategy;
  42665. }
  42666. return transport;
  42667. };
  42668. var strategy_builder_UnsupportedStrategy = {
  42669. isSupported: function () {
  42670. return false;
  42671. },
  42672. connect: function (_, callback) {
  42673. var deferred = util.defer(function () {
  42674. callback(new UnsupportedStrategy());
  42675. });
  42676. return {
  42677. abort: function () {
  42678. deferred.ensureAborted();
  42679. },
  42680. forceMinPriority: function () { }
  42681. };
  42682. }
  42683. };
  42684. // CONCATENATED MODULE: ./src/core/config.ts
  42685. var getGlobalConfig = function () {
  42686. return {
  42687. wsHost: defaults.host,
  42688. wsPort: defaults.ws_port,
  42689. wssPort: defaults.wss_port,
  42690. wsPath: defaults.ws_path,
  42691. httpHost: defaults.sockjs_host,
  42692. httpPort: defaults.sockjs_http_port,
  42693. httpsPort: defaults.sockjs_https_port,
  42694. httpPath: defaults.sockjs_path,
  42695. statsHost: defaults.stats_host,
  42696. authEndpoint: defaults.channel_auth_endpoint,
  42697. authTransport: defaults.channel_auth_transport,
  42698. activity_timeout: defaults.activity_timeout,
  42699. pong_timeout: defaults.pong_timeout,
  42700. unavailable_timeout: defaults.unavailable_timeout
  42701. };
  42702. };
  42703. var getClusterConfig = function (clusterName) {
  42704. return {
  42705. wsHost: 'ws-' + clusterName + '.pusher.com',
  42706. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42707. };
  42708. };
  42709. // CONCATENATED MODULE: ./src/core/pusher.ts
  42710. var pusher_Pusher = (function () {
  42711. function Pusher(app_key, options) {
  42712. var _this = this;
  42713. checkAppKey(app_key);
  42714. options = options || {};
  42715. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42716. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42717. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42718. }
  42719. this.key = app_key;
  42720. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42721. this.channels = factory.createChannels();
  42722. this.global_emitter = new dispatcher();
  42723. this.sessionID = Math.floor(Math.random() * 1000000000);
  42724. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42725. cluster: this.config.cluster,
  42726. features: Pusher.getClientFeatures(),
  42727. params: this.config.timelineParams || {},
  42728. limit: 50,
  42729. level: timeline_level.INFO,
  42730. version: defaults.VERSION
  42731. });
  42732. if (!this.config.disableStats) {
  42733. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42734. host: this.config.statsHost,
  42735. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42736. });
  42737. }
  42738. var getStrategy = function (options) {
  42739. var config = extend({}, _this.config, options);
  42740. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42741. };
  42742. this.connection = factory.createConnectionManager(this.key, extend({
  42743. getStrategy: getStrategy,
  42744. timeline: this.timeline,
  42745. activityTimeout: this.config.activity_timeout,
  42746. pongTimeout: this.config.pong_timeout,
  42747. unavailableTimeout: this.config.unavailable_timeout
  42748. }, this.config, { useTLS: this.shouldUseTLS() }));
  42749. this.connection.bind('connected', function () {
  42750. _this.subscribeAll();
  42751. if (_this.timelineSender) {
  42752. _this.timelineSender.send(_this.connection.isUsingTLS());
  42753. }
  42754. });
  42755. this.connection.bind('message', function (event) {
  42756. var eventName = event.event;
  42757. var internal = eventName.indexOf('pusher_internal:') === 0;
  42758. if (event.channel) {
  42759. var channel = _this.channel(event.channel);
  42760. if (channel) {
  42761. channel.handleEvent(event);
  42762. }
  42763. }
  42764. if (!internal) {
  42765. _this.global_emitter.emit(event.event, event.data);
  42766. }
  42767. });
  42768. this.connection.bind('connecting', function () {
  42769. _this.channels.disconnect();
  42770. });
  42771. this.connection.bind('disconnected', function () {
  42772. _this.channels.disconnect();
  42773. });
  42774. this.connection.bind('error', function (err) {
  42775. logger.warn(err);
  42776. });
  42777. Pusher.instances.push(this);
  42778. this.timeline.info({ instances: Pusher.instances.length });
  42779. if (Pusher.isReady) {
  42780. this.connect();
  42781. }
  42782. }
  42783. Pusher.ready = function () {
  42784. Pusher.isReady = true;
  42785. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42786. Pusher.instances[i].connect();
  42787. }
  42788. };
  42789. Pusher.getClientFeatures = function () {
  42790. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42791. return t.isSupported({});
  42792. }));
  42793. };
  42794. Pusher.prototype.channel = function (name) {
  42795. return this.channels.find(name);
  42796. };
  42797. Pusher.prototype.allChannels = function () {
  42798. return this.channels.all();
  42799. };
  42800. Pusher.prototype.connect = function () {
  42801. this.connection.connect();
  42802. if (this.timelineSender) {
  42803. if (!this.timelineSenderTimer) {
  42804. var usingTLS = this.connection.isUsingTLS();
  42805. var timelineSender = this.timelineSender;
  42806. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42807. timelineSender.send(usingTLS);
  42808. });
  42809. }
  42810. }
  42811. };
  42812. Pusher.prototype.disconnect = function () {
  42813. this.connection.disconnect();
  42814. if (this.timelineSenderTimer) {
  42815. this.timelineSenderTimer.ensureAborted();
  42816. this.timelineSenderTimer = null;
  42817. }
  42818. };
  42819. Pusher.prototype.bind = function (event_name, callback, context) {
  42820. this.global_emitter.bind(event_name, callback, context);
  42821. return this;
  42822. };
  42823. Pusher.prototype.unbind = function (event_name, callback, context) {
  42824. this.global_emitter.unbind(event_name, callback, context);
  42825. return this;
  42826. };
  42827. Pusher.prototype.bind_global = function (callback) {
  42828. this.global_emitter.bind_global(callback);
  42829. return this;
  42830. };
  42831. Pusher.prototype.unbind_global = function (callback) {
  42832. this.global_emitter.unbind_global(callback);
  42833. return this;
  42834. };
  42835. Pusher.prototype.unbind_all = function (callback) {
  42836. this.global_emitter.unbind_all();
  42837. return this;
  42838. };
  42839. Pusher.prototype.subscribeAll = function () {
  42840. var channelName;
  42841. for (channelName in this.channels.channels) {
  42842. if (this.channels.channels.hasOwnProperty(channelName)) {
  42843. this.subscribe(channelName);
  42844. }
  42845. }
  42846. };
  42847. Pusher.prototype.subscribe = function (channel_name) {
  42848. var channel = this.channels.add(channel_name, this);
  42849. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42850. channel.reinstateSubscription();
  42851. }
  42852. else if (!channel.subscriptionPending &&
  42853. this.connection.state === 'connected') {
  42854. channel.subscribe();
  42855. }
  42856. return channel;
  42857. };
  42858. Pusher.prototype.unsubscribe = function (channel_name) {
  42859. var channel = this.channels.find(channel_name);
  42860. if (channel && channel.subscriptionPending) {
  42861. channel.cancelSubscription();
  42862. }
  42863. else {
  42864. channel = this.channels.remove(channel_name);
  42865. if (channel && this.connection.state === 'connected') {
  42866. channel.unsubscribe();
  42867. }
  42868. }
  42869. };
  42870. Pusher.prototype.send_event = function (event_name, data, channel) {
  42871. return this.connection.send_event(event_name, data, channel);
  42872. };
  42873. Pusher.prototype.shouldUseTLS = function () {
  42874. if (runtime.getProtocol() === 'https:') {
  42875. return true;
  42876. }
  42877. else if (this.config.forceTLS === true) {
  42878. return true;
  42879. }
  42880. else {
  42881. return Boolean(this.config.encrypted);
  42882. }
  42883. };
  42884. Pusher.instances = [];
  42885. Pusher.isReady = false;
  42886. Pusher.logToConsole = false;
  42887. Pusher.Runtime = runtime;
  42888. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42889. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42890. Pusher.auth_callbacks = runtime.auth_callbacks;
  42891. return Pusher;
  42892. }());
  42893. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42894. function checkAppKey(key) {
  42895. if (key === null || key === undefined) {
  42896. throw 'You must pass your app key when you instantiate Pusher.';
  42897. }
  42898. }
  42899. runtime.setup(pusher_Pusher);
  42900. /***/ })
  42901. /******/ ]);
  42902. });
  42903. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42904. /***/ }),
  42905. /***/ "./node_modules/setimmediate/setImmediate.js":
  42906. /*!***************************************************!*\
  42907. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42908. \***************************************************/
  42909. /*! no static exports found */
  42910. /***/ (function(module, exports, __webpack_require__) {
  42911. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42912. "use strict";
  42913. if (global.setImmediate) {
  42914. return;
  42915. }
  42916. var nextHandle = 1; // Spec says greater than zero
  42917. var tasksByHandle = {};
  42918. var currentlyRunningATask = false;
  42919. var doc = global.document;
  42920. var registerImmediate;
  42921. function setImmediate(callback) {
  42922. // Callback can either be a function or a string
  42923. if (typeof callback !== "function") {
  42924. callback = new Function("" + callback);
  42925. }
  42926. // Copy function arguments
  42927. var args = new Array(arguments.length - 1);
  42928. for (var i = 0; i < args.length; i++) {
  42929. args[i] = arguments[i + 1];
  42930. }
  42931. // Store and register the task
  42932. var task = { callback: callback, args: args };
  42933. tasksByHandle[nextHandle] = task;
  42934. registerImmediate(nextHandle);
  42935. return nextHandle++;
  42936. }
  42937. function clearImmediate(handle) {
  42938. delete tasksByHandle[handle];
  42939. }
  42940. function run(task) {
  42941. var callback = task.callback;
  42942. var args = task.args;
  42943. switch (args.length) {
  42944. case 0:
  42945. callback();
  42946. break;
  42947. case 1:
  42948. callback(args[0]);
  42949. break;
  42950. case 2:
  42951. callback(args[0], args[1]);
  42952. break;
  42953. case 3:
  42954. callback(args[0], args[1], args[2]);
  42955. break;
  42956. default:
  42957. callback.apply(undefined, args);
  42958. break;
  42959. }
  42960. }
  42961. function runIfPresent(handle) {
  42962. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42963. // So if we're currently running a task, we'll need to delay this invocation.
  42964. if (currentlyRunningATask) {
  42965. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42966. // "too much recursion" error.
  42967. setTimeout(runIfPresent, 0, handle);
  42968. } else {
  42969. var task = tasksByHandle[handle];
  42970. if (task) {
  42971. currentlyRunningATask = true;
  42972. try {
  42973. run(task);
  42974. } finally {
  42975. clearImmediate(handle);
  42976. currentlyRunningATask = false;
  42977. }
  42978. }
  42979. }
  42980. }
  42981. function installNextTickImplementation() {
  42982. registerImmediate = function(handle) {
  42983. process.nextTick(function () { runIfPresent(handle); });
  42984. };
  42985. }
  42986. function canUsePostMessage() {
  42987. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42988. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42989. if (global.postMessage && !global.importScripts) {
  42990. var postMessageIsAsynchronous = true;
  42991. var oldOnMessage = global.onmessage;
  42992. global.onmessage = function() {
  42993. postMessageIsAsynchronous = false;
  42994. };
  42995. global.postMessage("", "*");
  42996. global.onmessage = oldOnMessage;
  42997. return postMessageIsAsynchronous;
  42998. }
  42999. }
  43000. function installPostMessageImplementation() {
  43001. // Installs an event handler on `global` for the `message` event: see
  43002. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43003. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43004. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43005. var onGlobalMessage = function(event) {
  43006. if (event.source === global &&
  43007. typeof event.data === "string" &&
  43008. event.data.indexOf(messagePrefix) === 0) {
  43009. runIfPresent(+event.data.slice(messagePrefix.length));
  43010. }
  43011. };
  43012. if (global.addEventListener) {
  43013. global.addEventListener("message", onGlobalMessage, false);
  43014. } else {
  43015. global.attachEvent("onmessage", onGlobalMessage);
  43016. }
  43017. registerImmediate = function(handle) {
  43018. global.postMessage(messagePrefix + handle, "*");
  43019. };
  43020. }
  43021. function installMessageChannelImplementation() {
  43022. var channel = new MessageChannel();
  43023. channel.port1.onmessage = function(event) {
  43024. var handle = event.data;
  43025. runIfPresent(handle);
  43026. };
  43027. registerImmediate = function(handle) {
  43028. channel.port2.postMessage(handle);
  43029. };
  43030. }
  43031. function installReadyStateChangeImplementation() {
  43032. var html = doc.documentElement;
  43033. registerImmediate = function(handle) {
  43034. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43035. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43036. var script = doc.createElement("script");
  43037. script.onreadystatechange = function () {
  43038. runIfPresent(handle);
  43039. script.onreadystatechange = null;
  43040. html.removeChild(script);
  43041. script = null;
  43042. };
  43043. html.appendChild(script);
  43044. };
  43045. }
  43046. function installSetTimeoutImplementation() {
  43047. registerImmediate = function(handle) {
  43048. setTimeout(runIfPresent, 0, handle);
  43049. };
  43050. }
  43051. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43052. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43053. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43054. // Don't get fooled by e.g. browserify environments.
  43055. if ({}.toString.call(global.process) === "[object process]") {
  43056. // For Node.js before 0.9
  43057. installNextTickImplementation();
  43058. } else if (canUsePostMessage()) {
  43059. // For non-IE10 modern browsers
  43060. installPostMessageImplementation();
  43061. } else if (global.MessageChannel) {
  43062. // For web workers, where supported
  43063. installMessageChannelImplementation();
  43064. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43065. // For IE 6–8
  43066. installReadyStateChangeImplementation();
  43067. } else {
  43068. // For older browsers
  43069. installSetTimeoutImplementation();
  43070. }
  43071. attachTo.setImmediate = setImmediate;
  43072. attachTo.clearImmediate = clearImmediate;
  43073. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43074. /* 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")))
  43075. /***/ }),
  43076. /***/ "./node_modules/timers-browserify/main.js":
  43077. /*!************************************************!*\
  43078. !*** ./node_modules/timers-browserify/main.js ***!
  43079. \************************************************/
  43080. /*! no static exports found */
  43081. /***/ (function(module, exports, __webpack_require__) {
  43082. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43083. (typeof self !== "undefined" && self) ||
  43084. window;
  43085. var apply = Function.prototype.apply;
  43086. // DOM APIs, for completeness
  43087. exports.setTimeout = function() {
  43088. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43089. };
  43090. exports.setInterval = function() {
  43091. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43092. };
  43093. exports.clearTimeout =
  43094. exports.clearInterval = function(timeout) {
  43095. if (timeout) {
  43096. timeout.close();
  43097. }
  43098. };
  43099. function Timeout(id, clearFn) {
  43100. this._id = id;
  43101. this._clearFn = clearFn;
  43102. }
  43103. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43104. Timeout.prototype.close = function() {
  43105. this._clearFn.call(scope, this._id);
  43106. };
  43107. // Does not start the time, just sets up the members needed.
  43108. exports.enroll = function(item, msecs) {
  43109. clearTimeout(item._idleTimeoutId);
  43110. item._idleTimeout = msecs;
  43111. };
  43112. exports.unenroll = function(item) {
  43113. clearTimeout(item._idleTimeoutId);
  43114. item._idleTimeout = -1;
  43115. };
  43116. exports._unrefActive = exports.active = function(item) {
  43117. clearTimeout(item._idleTimeoutId);
  43118. var msecs = item._idleTimeout;
  43119. if (msecs >= 0) {
  43120. item._idleTimeoutId = setTimeout(function onTimeout() {
  43121. if (item._onTimeout)
  43122. item._onTimeout();
  43123. }, msecs);
  43124. }
  43125. };
  43126. // setimmediate attaches itself to the global object
  43127. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43128. // On some exotic environments, it's not clear which object `setimmediate` was
  43129. // able to install onto. Search each possibility in the same order as the
  43130. // `setimmediate` library.
  43131. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43132. (typeof global !== "undefined" && global.setImmediate) ||
  43133. (this && this.setImmediate);
  43134. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43135. (typeof global !== "undefined" && global.clearImmediate) ||
  43136. (this && this.clearImmediate);
  43137. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43138. /***/ }),
  43139. /***/ "./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&":
  43140. /*!*******************************************************************************************************************************************************************************************************************!*\
  43141. !*** ./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& ***!
  43142. \*******************************************************************************************************************************************************************************************************************/
  43143. /*! exports provided: render, staticRenderFns */
  43144. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43145. "use strict";
  43146. __webpack_require__.r(__webpack_exports__);
  43147. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43148. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43149. var render = function() {
  43150. var _vm = this
  43151. var _h = _vm.$createElement
  43152. var _c = _vm._self._c || _h
  43153. return _vm._m(0)
  43154. }
  43155. var staticRenderFns = [
  43156. function() {
  43157. var _vm = this
  43158. var _h = _vm.$createElement
  43159. var _c = _vm._self._c || _h
  43160. return _c("div", { staticClass: "container" }, [
  43161. _c("div", { staticClass: "row justify-content-center" }, [
  43162. _c("div", { staticClass: "col-md-8" }, [
  43163. _c("div", { staticClass: "card" }, [
  43164. _c("div", { staticClass: "card-header" }, [
  43165. _vm._v("Example Component")
  43166. ]),
  43167. _vm._v(" "),
  43168. _c("div", { staticClass: "card-body" }, [
  43169. _vm._v(
  43170. "\n I'm an example component.\n "
  43171. )
  43172. ])
  43173. ])
  43174. ])
  43175. ])
  43176. ])
  43177. }
  43178. ]
  43179. render._withStripped = true
  43180. /***/ }),
  43181. /***/ "./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&":
  43182. /*!************************************************************************************************************************************************************************************************************!*\
  43183. !*** ./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& ***!
  43184. \************************************************************************************************************************************************************************************************************/
  43185. /*! exports provided: render, staticRenderFns */
  43186. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43187. "use strict";
  43188. __webpack_require__.r(__webpack_exports__);
  43189. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43190. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43191. var render = function() {
  43192. var _vm = this
  43193. var _h = _vm.$createElement
  43194. var _c = _vm._self._c || _h
  43195. return _c(
  43196. "div",
  43197. [
  43198. _c(
  43199. "modal",
  43200. {
  43201. attrs: {
  43202. id: "asseteditModal",
  43203. tabindex: "-1",
  43204. role: "dialog",
  43205. "aria-labelledby": "asseteditModalLabel"
  43206. }
  43207. },
  43208. [
  43209. _c(
  43210. "h5",
  43211. {
  43212. staticClass: "modal-title",
  43213. attrs: { slot: "header", id: "asseteditModalLabel" },
  43214. slot: "header"
  43215. },
  43216. [_vm._v("\n Edit Work Order Information\n ")]
  43217. ),
  43218. _vm._v(" "),
  43219. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43220. _c("div", { staticClass: "form-group" }, [
  43221. _c("label", { attrs: { for: "manufacturer" } }, [
  43222. _vm._v("Manufacturer")
  43223. ]),
  43224. _vm._v(" "),
  43225. _c("input", {
  43226. directives: [
  43227. {
  43228. name: "model",
  43229. rawName: "v-model.lazy",
  43230. value: _vm.data.pcmanu,
  43231. expression: "data.pcmanu",
  43232. modifiers: { lazy: true }
  43233. }
  43234. ],
  43235. staticClass: "form-control",
  43236. attrs: {
  43237. type: "text",
  43238. name: "manufacturer",
  43239. id: "manufacturer"
  43240. },
  43241. domProps: { value: _vm.data.pcmanu },
  43242. on: {
  43243. change: function($event) {
  43244. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43245. }
  43246. }
  43247. })
  43248. ]),
  43249. _vm._v(" "),
  43250. _c("div", { staticClass: "form-group" }, [
  43251. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43252. _vm._v(" "),
  43253. _c("input", {
  43254. directives: [
  43255. {
  43256. name: "model",
  43257. rawName: "v-model.lazy",
  43258. value: _vm.data.pcmake,
  43259. expression: "data.pcmake",
  43260. modifiers: { lazy: true }
  43261. }
  43262. ],
  43263. staticClass: "form-control",
  43264. attrs: { type: "text", name: "make", id: "make" },
  43265. domProps: { value: _vm.data.pcmake },
  43266. on: {
  43267. change: function($event) {
  43268. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43269. }
  43270. }
  43271. })
  43272. ]),
  43273. _vm._v(" "),
  43274. _c("div", { staticClass: "form-group" }, [
  43275. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43276. _vm._v(" "),
  43277. _c("input", {
  43278. directives: [
  43279. {
  43280. name: "model",
  43281. rawName: "v-model.lazy",
  43282. value: _vm.data.pcnickname,
  43283. expression: "data.pcnickname",
  43284. modifiers: { lazy: true }
  43285. }
  43286. ],
  43287. staticClass: "form-control",
  43288. attrs: { type: "text", name: "nickname", id: "nickname" },
  43289. domProps: { value: _vm.data.pcnickname },
  43290. on: {
  43291. change: function($event) {
  43292. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43293. }
  43294. }
  43295. })
  43296. ]),
  43297. _vm._v(" "),
  43298. _c("div", { staticClass: "form-group" }, [
  43299. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43300. _vm._v(" "),
  43301. _c("input", {
  43302. directives: [
  43303. {
  43304. name: "model",
  43305. rawName: "v-model.lazy",
  43306. value: _vm.pcextra[2],
  43307. expression: "pcextra[2]",
  43308. modifiers: { lazy: true }
  43309. }
  43310. ],
  43311. staticClass: "form-control",
  43312. attrs: { type: "text", name: "os", id: "os" },
  43313. domProps: { value: _vm.pcextra[2] },
  43314. on: {
  43315. change: function($event) {
  43316. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43317. }
  43318. }
  43319. })
  43320. ]),
  43321. _vm._v(" "),
  43322. _c("div", { staticClass: "form-group" }, [
  43323. _c("label", { attrs: { for: "serial" } }, [
  43324. _vm._v("Serial Number")
  43325. ]),
  43326. _vm._v(" "),
  43327. _c("input", {
  43328. directives: [
  43329. {
  43330. name: "model",
  43331. rawName: "v-model.lazy",
  43332. value: _vm.pcextra[104],
  43333. expression: "pcextra[104]",
  43334. modifiers: { lazy: true }
  43335. }
  43336. ],
  43337. staticClass: "form-control",
  43338. attrs: { type: "text", id: "serial", name: "serial" },
  43339. domProps: { value: _vm.pcextra[104] },
  43340. on: {
  43341. change: function($event) {
  43342. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43343. }
  43344. }
  43345. })
  43346. ]),
  43347. _vm._v(" "),
  43348. _c("div", { staticClass: "form-group" }, [
  43349. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43350. _vm._v(" "),
  43351. _c("input", {
  43352. directives: [
  43353. {
  43354. name: "model",
  43355. rawName: "v-model.lazy",
  43356. value: _vm.pcextra[101],
  43357. expression: "pcextra[101]",
  43358. modifiers: { lazy: true }
  43359. }
  43360. ],
  43361. staticClass: "form-control",
  43362. attrs: { type: "text", id: "cpu", name: "cpu" },
  43363. domProps: { value: _vm.pcextra[101] },
  43364. on: {
  43365. change: function($event) {
  43366. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43367. }
  43368. }
  43369. })
  43370. ]),
  43371. _vm._v(" "),
  43372. _c("div", { staticClass: "form-group" }, [
  43373. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43374. _vm._v(" "),
  43375. _c("input", {
  43376. directives: [
  43377. {
  43378. name: "model",
  43379. rawName: "v-model.lazy",
  43380. value: _vm.pcextra[100],
  43381. expression: "pcextra[100]",
  43382. modifiers: { lazy: true }
  43383. }
  43384. ],
  43385. staticClass: "form-control",
  43386. attrs: { type: "text", name: "ram", id: "ram" },
  43387. domProps: { value: _vm.pcextra[100] },
  43388. on: {
  43389. change: function($event) {
  43390. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43391. }
  43392. }
  43393. })
  43394. ]),
  43395. _vm._v(" "),
  43396. _c("div", { staticClass: "form-group" }, [
  43397. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43398. _vm._v(" "),
  43399. _c("input", {
  43400. directives: [
  43401. {
  43402. name: "model",
  43403. rawName: "v-model.lazy",
  43404. value: _vm.pcextra[4],
  43405. expression: "pcextra[4]",
  43406. modifiers: { lazy: true }
  43407. }
  43408. ],
  43409. staticClass: "form-control",
  43410. attrs: { type: "text", name: "graphics", id: "grapics" },
  43411. domProps: { value: _vm.pcextra[4] },
  43412. on: {
  43413. change: function($event) {
  43414. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43415. }
  43416. }
  43417. })
  43418. ])
  43419. ]),
  43420. _vm._v(" "),
  43421. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43422. _c(
  43423. "button",
  43424. {
  43425. staticClass: "btn btn-secondary",
  43426. attrs: { type: "button", "data-dismiss": "modal" }
  43427. },
  43428. [_vm._v("Close")]
  43429. ),
  43430. _vm._v(" "),
  43431. _c(
  43432. "button",
  43433. {
  43434. staticClass: "btn btn-primary",
  43435. attrs: { type: "button" },
  43436. on: {
  43437. click: function($event) {
  43438. return _vm.updateAsset()
  43439. }
  43440. }
  43441. },
  43442. [_vm._v("Save")]
  43443. )
  43444. ])
  43445. ]
  43446. ),
  43447. _vm._v(" "),
  43448. _c("h4", { staticClass: "text-center" }, [
  43449. _vm._v(
  43450. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43451. ),
  43452. _c("small", { staticClass: "text-muted" }, [
  43453. _vm._v(_vm._s(this.data.pcnickname))
  43454. ])
  43455. ]),
  43456. _vm._v(" "),
  43457. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43458. _vm._v(" "),
  43459. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43460. _vm._v(" "),
  43461. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43462. _vm._v(" "),
  43463. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43464. _vm._v(" "),
  43465. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43466. _vm._v(" "),
  43467. _c(
  43468. "button",
  43469. {
  43470. staticClass: "btn btn-primary",
  43471. attrs: {
  43472. type: "button",
  43473. "data-toggle": "modal",
  43474. "data-target": "#asseteditModal"
  43475. }
  43476. },
  43477. [_vm._v("Edit")]
  43478. )
  43479. ],
  43480. 1
  43481. )
  43482. }
  43483. var staticRenderFns = []
  43484. render._withStripped = true
  43485. /***/ }),
  43486. /***/ "./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&":
  43487. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43488. !*** ./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& ***!
  43489. \*******************************************************************************************************************************************************************************************************************************/
  43490. /*! exports provided: render, staticRenderFns */
  43491. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43492. "use strict";
  43493. __webpack_require__.r(__webpack_exports__);
  43494. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43495. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43496. var render = function() {
  43497. var _vm = this
  43498. var _h = _vm.$createElement
  43499. var _c = _vm._self._c || _h
  43500. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43501. _c("div", { staticClass: "input-group" }, [
  43502. _c("input", {
  43503. directives: [
  43504. {
  43505. name: "model",
  43506. rawName: "v-model",
  43507. value: _vm.searchText,
  43508. expression: "searchText"
  43509. }
  43510. ],
  43511. staticClass: "form-control",
  43512. attrs: { type: "text" },
  43513. domProps: { value: _vm.searchText },
  43514. on: {
  43515. input: [
  43516. function($event) {
  43517. if ($event.target.composing) {
  43518. return
  43519. }
  43520. _vm.searchText = $event.target.value
  43521. },
  43522. _vm.searchChanged
  43523. ]
  43524. }
  43525. }),
  43526. _vm._v(" "),
  43527. _c("div", { staticClass: "form-group-append" }, [
  43528. _c(
  43529. "a",
  43530. {
  43531. staticClass: "toggle input-group-text bg-primary text-light",
  43532. on: {
  43533. mousedown: function($event) {
  43534. $event.preventDefault()
  43535. },
  43536. click: function($event) {
  43537. return _vm.setOpen(!_vm.open)
  43538. }
  43539. }
  43540. },
  43541. [
  43542. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43543. _vm._v(" "),
  43544. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43545. ]
  43546. )
  43547. ])
  43548. ]),
  43549. _vm._v(" "),
  43550. _c(
  43551. "ul",
  43552. { staticClass: "suggestion-list list-unstyled" },
  43553. _vm._l(_vm.matches, function(suggestion, index) {
  43554. return _c(
  43555. "li",
  43556. {
  43557. key: index,
  43558. on: {
  43559. mousedown: function($event) {
  43560. $event.preventDefault()
  43561. },
  43562. click: function($event) {
  43563. return _vm.suggestionSelected(suggestion)
  43564. }
  43565. }
  43566. },
  43567. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43568. )
  43569. }),
  43570. 0
  43571. )
  43572. ])
  43573. }
  43574. var staticRenderFns = []
  43575. render._withStripped = true
  43576. /***/ }),
  43577. /***/ "./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&":
  43578. /*!************************************************************************************************************************************************************************************************************************!*\
  43579. !*** ./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& ***!
  43580. \************************************************************************************************************************************************************************************************************************/
  43581. /*! exports provided: render, staticRenderFns */
  43582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43583. "use strict";
  43584. __webpack_require__.r(__webpack_exports__);
  43585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43586. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43587. var render = function() {
  43588. var _vm = this
  43589. var _h = _vm.$createElement
  43590. var _c = _vm._self._c || _h
  43591. return _c(
  43592. "modal",
  43593. {
  43594. attrs: {
  43595. id: _vm.id,
  43596. tabindex: "-1",
  43597. role: "dialog",
  43598. "aria-labelledby": _vm.id + "Label"
  43599. }
  43600. },
  43601. [
  43602. _c(
  43603. "h5",
  43604. {
  43605. staticClass: "modal-title",
  43606. attrs: { slot: "header", id: _vm.id + "Label" },
  43607. slot: "header"
  43608. },
  43609. [_vm._v("\n Edit Credential\n ")]
  43610. ),
  43611. _vm._v(" "),
  43612. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43613. _c(
  43614. "div",
  43615. { staticClass: "form" },
  43616. [
  43617. _c("autocomplete-custom-dropdown", {
  43618. attrs: {
  43619. options: _vm.descriptions,
  43620. value: _vm.creddesc,
  43621. "allow-custom": true
  43622. },
  43623. model: {
  43624. value: _vm.creddesc,
  43625. callback: function($$v) {
  43626. _vm.creddesc = $$v
  43627. },
  43628. expression: "creddesc"
  43629. }
  43630. })
  43631. ],
  43632. 1
  43633. ),
  43634. _vm._v(" "),
  43635. _c("div", { staticClass: "form-group" }, [
  43636. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43637. _vm._v(" "),
  43638. _c("input", {
  43639. directives: [
  43640. {
  43641. name: "model",
  43642. rawName: "v-model",
  43643. value: _vm.data.creduser,
  43644. expression: "data.creduser"
  43645. }
  43646. ],
  43647. staticClass: "form-control credential",
  43648. attrs: {
  43649. type: "text",
  43650. name: "newusername" + _vm.data.credid,
  43651. id: "newusername" + _vm.data.credid
  43652. },
  43653. domProps: { value: _vm.data.creduser },
  43654. on: {
  43655. input: function($event) {
  43656. if ($event.target.composing) {
  43657. return
  43658. }
  43659. _vm.$set(_vm.data, "creduser", $event.target.value)
  43660. }
  43661. }
  43662. })
  43663. ]),
  43664. _vm._v(" "),
  43665. _c("div", { staticClass: "form-group" }, [
  43666. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43667. _vm._v(" "),
  43668. _c("input", {
  43669. directives: [
  43670. {
  43671. name: "model",
  43672. rawName: "v-model",
  43673. value: _vm.data.credpass,
  43674. expression: "data.credpass"
  43675. }
  43676. ],
  43677. staticClass: "form-control credential",
  43678. attrs: {
  43679. type: "text",
  43680. name: "newpassword" + _vm.data.credid,
  43681. id: "newpassword" + _vm.data.credid
  43682. },
  43683. domProps: { value: _vm.data.credpass },
  43684. on: {
  43685. input: function($event) {
  43686. if ($event.target.composing) {
  43687. return
  43688. }
  43689. _vm.$set(_vm.data, "credpass", $event.target.value)
  43690. }
  43691. }
  43692. }),
  43693. _vm._v(" "),
  43694. _c(
  43695. "button",
  43696. {
  43697. staticClass: "btn btn-secondary",
  43698. attrs: { type: "button" },
  43699. on: {
  43700. click: function($event) {
  43701. return _vm.getRandomPassword(_vm.data.credid)
  43702. }
  43703. }
  43704. },
  43705. [_vm._v("Generate Random")]
  43706. )
  43707. ]),
  43708. _vm._v(" "),
  43709. _c("div", { staticClass: "form-group" })
  43710. ]),
  43711. _vm._v(" "),
  43712. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43713. _c(
  43714. "button",
  43715. {
  43716. staticClass: "btn btn-secondary",
  43717. attrs: { type: "button", "data-dismiss": "modal" }
  43718. },
  43719. [_vm._v("Close")]
  43720. ),
  43721. _vm._v(" "),
  43722. _c(
  43723. "button",
  43724. {
  43725. staticClass: "btn btn-primary",
  43726. attrs: { type: "button" },
  43727. on: {
  43728. click: function($event) {
  43729. return _vm.updateCredential()
  43730. }
  43731. }
  43732. },
  43733. [_vm._v("Save")]
  43734. )
  43735. ])
  43736. ]
  43737. )
  43738. }
  43739. var staticRenderFns = []
  43740. render._withStripped = true
  43741. /***/ }),
  43742. /***/ "./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&":
  43743. /*!******************************************************************************************************************************************************************************************************************!*\
  43744. !*** ./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& ***!
  43745. \******************************************************************************************************************************************************************************************************************/
  43746. /*! exports provided: render, staticRenderFns */
  43747. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43748. "use strict";
  43749. __webpack_require__.r(__webpack_exports__);
  43750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43752. var render = function() {
  43753. var _vm = this
  43754. var _h = _vm.$createElement
  43755. var _c = _vm._self._c || _h
  43756. return _c(
  43757. "div",
  43758. [
  43759. _c("credential-form-modal", {
  43760. attrs: {
  43761. "modal-id": "newCredentialModal",
  43762. descriptions: _vm.creddescList,
  43763. create: true,
  43764. pcid: _vm.pcid
  43765. }
  43766. }),
  43767. _vm._v(" "),
  43768. _c(
  43769. "button",
  43770. {
  43771. staticClass: "btn btn-primary",
  43772. attrs: {
  43773. type: "button",
  43774. "data-toggle": "modal",
  43775. "data-target": "#newCredentialModal"
  43776. }
  43777. },
  43778. [_vm._v("New Credential")]
  43779. ),
  43780. _vm._v(" "),
  43781. _vm._l(_vm.credentials, function(credential) {
  43782. return _c(
  43783. "div",
  43784. { key: credential.credid },
  43785. [
  43786. _c("credential", {
  43787. attrs: { credential: credential, descriptions: _vm.creddescList }
  43788. })
  43789. ],
  43790. 1
  43791. )
  43792. })
  43793. ],
  43794. 2
  43795. )
  43796. }
  43797. var staticRenderFns = []
  43798. render._withStripped = true
  43799. /***/ }),
  43800. /***/ "./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&":
  43801. /*!*************************************************************************************************************************************************************************************************************!*\
  43802. !*** ./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& ***!
  43803. \*************************************************************************************************************************************************************************************************************/
  43804. /*! exports provided: render, staticRenderFns */
  43805. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43806. "use strict";
  43807. __webpack_require__.r(__webpack_exports__);
  43808. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43809. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43810. var render = function() {
  43811. var _vm = this
  43812. var _h = _vm.$createElement
  43813. var _c = _vm._self._c || _h
  43814. return _c(
  43815. "div",
  43816. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43817. [
  43818. _c("credential-form-modal", {
  43819. attrs: {
  43820. descriptions: _vm.creddescList,
  43821. "modal-id": "credential" + this.data.credid + "editModal",
  43822. populateWith: this.data
  43823. }
  43824. }),
  43825. _vm._v(" "),
  43826. _c(
  43827. "modal",
  43828. {
  43829. attrs: {
  43830. id: "credential" + this.data.credid + "deleteModal",
  43831. tabindex: "-1"
  43832. }
  43833. },
  43834. [
  43835. _c(
  43836. "h5",
  43837. {
  43838. staticClass: "modal-title",
  43839. attrs: {
  43840. slot: "header",
  43841. id: "credential" + this.data.credid + "deleteModalLabel"
  43842. },
  43843. slot: "header"
  43844. },
  43845. [_vm._v("\r\n Delete Credential\r\n ")]
  43846. ),
  43847. _vm._v(" "),
  43848. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43849. _vm._v("\r\n Are you sure?\r\n ")
  43850. ]),
  43851. _vm._v(" "),
  43852. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43853. _c(
  43854. "button",
  43855. {
  43856. staticClass: "btn btn-secondary",
  43857. attrs: { type: "button", "data-dismiss": "modal" }
  43858. },
  43859. [_vm._v("Cancel")]
  43860. ),
  43861. _vm._v(" "),
  43862. _c(
  43863. "button",
  43864. {
  43865. staticClass: "btn btn-danger",
  43866. attrs: { type: "button" },
  43867. on: {
  43868. click: function($event) {
  43869. return _vm.deleteCredential()
  43870. }
  43871. }
  43872. },
  43873. [_vm._v("Confirm")]
  43874. )
  43875. ])
  43876. ]
  43877. ),
  43878. _vm._v(" "),
  43879. _c("div", { staticClass: "row no-gutters" }, [
  43880. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43881. _vm._v(_vm._s(this.data.creddesc))
  43882. ]),
  43883. _vm._v(" "),
  43884. _c("div", { staticClass: "col-9 text-right" }, [
  43885. _vm._v(_vm._s(this.data.creddate))
  43886. ])
  43887. ]),
  43888. _vm._v(" "),
  43889. _c("div", { staticClass: "row" }, [
  43890. _c("div", { staticClass: "col-lg-9" }, [
  43891. _c("div", [
  43892. _vm._m(0),
  43893. _vm._v(" "),
  43894. _c("input", {
  43895. staticClass: "border-0 credential",
  43896. attrs: {
  43897. type: "text",
  43898. id: "username" + this.data.credid,
  43899. readonly: ""
  43900. },
  43901. domProps: { value: this.data.creduser }
  43902. }),
  43903. _vm._v(" "),
  43904. _c(
  43905. "button",
  43906. {
  43907. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43908. attrs: {
  43909. id: "btn-username" + this.data.credid,
  43910. "data-clipboard-target": "#username" + this.data.credid
  43911. }
  43912. },
  43913. [_c("i", { staticClass: "far fa-clone" })]
  43914. )
  43915. ]),
  43916. _vm._v(" "),
  43917. _c("div", [
  43918. _vm._m(1),
  43919. _vm._v(" "),
  43920. _c("input", {
  43921. staticClass: "border-0 credential",
  43922. attrs: {
  43923. type: "text",
  43924. id: "password" + this.data.credid,
  43925. readonly: ""
  43926. },
  43927. domProps: { value: this.data.credpass }
  43928. }),
  43929. _vm._v(" "),
  43930. _c(
  43931. "button",
  43932. {
  43933. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43934. attrs: {
  43935. id: "btn-password" + this.data.credid,
  43936. "data-clipboard-target": "#password" + this.data.credid
  43937. }
  43938. },
  43939. [_c("i", { staticClass: "far fa-clone" })]
  43940. )
  43941. ])
  43942. ]),
  43943. _vm._v(" "),
  43944. _c(
  43945. "div",
  43946. {
  43947. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43948. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43949. },
  43950. [
  43951. _c(
  43952. "button",
  43953. {
  43954. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43955. attrs: {
  43956. type: "button",
  43957. "data-toggle": "modal",
  43958. "data-target": "#credential" + this.data.credid + "editModal"
  43959. }
  43960. },
  43961. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43962. ),
  43963. _vm._v(" "),
  43964. _c(
  43965. "button",
  43966. {
  43967. staticClass: "btn btn-sm btn-danger p-lg-1",
  43968. attrs: {
  43969. type: "button",
  43970. "data-toggle": "modal",
  43971. "data-target":
  43972. "#credential" + this.data.credid + "deleteModal"
  43973. }
  43974. },
  43975. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43976. )
  43977. ]
  43978. )
  43979. ])
  43980. ],
  43981. 1
  43982. )
  43983. }
  43984. var staticRenderFns = [
  43985. function() {
  43986. var _vm = this
  43987. var _h = _vm.$createElement
  43988. var _c = _vm._self._c || _h
  43989. return _c("label", { attrs: { for: "username" } }, [
  43990. _c("i", { staticClass: "fas fa-fw fa-user" })
  43991. ])
  43992. },
  43993. function() {
  43994. var _vm = this
  43995. var _h = _vm.$createElement
  43996. var _c = _vm._self._c || _h
  43997. return _c("label", { attrs: { for: "password" } }, [
  43998. _c("i", { staticClass: "fas fa-fw fa-key" })
  43999. ])
  44000. }
  44001. ]
  44002. render._withStripped = true
  44003. /***/ }),
  44004. /***/ "./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&":
  44005. /*!************************************************************************************************************************************************************************************************************!*\
  44006. !*** ./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& ***!
  44007. \************************************************************************************************************************************************************************************************************/
  44008. /*! exports provided: render, staticRenderFns */
  44009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44010. "use strict";
  44011. __webpack_require__.r(__webpack_exports__);
  44012. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44013. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44014. var render = function() {
  44015. var _vm = this
  44016. var _h = _vm.$createElement
  44017. var _c = _vm._self._c || _h
  44018. return _c(
  44019. "ul",
  44020. { staticClass: "list-unstyled" },
  44021. _vm._l(_vm.errorList, function(error) {
  44022. return _c("li", { key: error, staticClass: "text-danger" }, [
  44023. _vm._v(" " + _vm._s(error) + " ")
  44024. ])
  44025. }),
  44026. 0
  44027. )
  44028. }
  44029. var staticRenderFns = []
  44030. render._withStripped = true
  44031. /***/ }),
  44032. /***/ "./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&":
  44033. /*!********************************************************************************************************************************************************************************************************!*\
  44034. !*** ./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& ***!
  44035. \********************************************************************************************************************************************************************************************************/
  44036. /*! exports provided: render, staticRenderFns */
  44037. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44038. "use strict";
  44039. __webpack_require__.r(__webpack_exports__);
  44040. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44041. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44042. var render = function() {
  44043. var _vm = this
  44044. var _h = _vm.$createElement
  44045. var _c = _vm._self._c || _h
  44046. return _c("div", { staticClass: "modal fade" }, [
  44047. _c(
  44048. "div",
  44049. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44050. [
  44051. _c("div", { staticClass: "modal-content" }, [
  44052. _c(
  44053. "div",
  44054. { staticClass: "modal-header" },
  44055. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44056. 2
  44057. ),
  44058. _vm._v(" "),
  44059. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44060. _vm._v(" "),
  44061. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44062. ])
  44063. ]
  44064. )
  44065. ])
  44066. }
  44067. var staticRenderFns = [
  44068. function() {
  44069. var _vm = this
  44070. var _h = _vm.$createElement
  44071. var _c = _vm._self._c || _h
  44072. return _c(
  44073. "button",
  44074. {
  44075. staticClass: "close",
  44076. attrs: {
  44077. type: "button",
  44078. "data-dismiss": "modal",
  44079. "aria-label": "Close"
  44080. }
  44081. },
  44082. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44083. )
  44084. }
  44085. ]
  44086. render._withStripped = true
  44087. /***/ }),
  44088. /***/ "./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&":
  44089. /*!******************************************************************************************************************************************************************************************************************!*\
  44090. !*** ./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& ***!
  44091. \******************************************************************************************************************************************************************************************************************/
  44092. /*! exports provided: render, staticRenderFns */
  44093. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44094. "use strict";
  44095. __webpack_require__.r(__webpack_exports__);
  44096. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44098. var render = function() {
  44099. var _vm = this
  44100. var _h = _vm.$createElement
  44101. var _c = _vm._self._c || _h
  44102. return _c(
  44103. "modal",
  44104. {
  44105. attrs: {
  44106. id: _vm.modalId,
  44107. tabindex: "-1",
  44108. role: "dialog",
  44109. "aria-labelledby": _vm.modalId + "Label"
  44110. }
  44111. },
  44112. [
  44113. _c(
  44114. "h5",
  44115. {
  44116. staticClass: "modal-title",
  44117. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44118. slot: "header"
  44119. },
  44120. [_vm._v("\n Edit Note\n ")]
  44121. ),
  44122. _vm._v(" "),
  44123. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44124. _c("div", { staticClass: "form-group" }, [
  44125. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44126. _vm._v(" "),
  44127. _c("textarea", {
  44128. directives: [
  44129. {
  44130. name: "model",
  44131. rawName: "v-model",
  44132. value: _vm.note.thenote,
  44133. expression: "note.thenote"
  44134. }
  44135. ],
  44136. staticClass: "form-control",
  44137. attrs: {
  44138. name: "content" + _vm.note.noteid,
  44139. id: "content" + _vm.note.noteid
  44140. },
  44141. domProps: { value: _vm.note.thenote },
  44142. on: {
  44143. input: function($event) {
  44144. if ($event.target.composing) {
  44145. return
  44146. }
  44147. _vm.$set(_vm.note, "thenote", $event.target.value)
  44148. }
  44149. }
  44150. })
  44151. ])
  44152. ]),
  44153. _vm._v(" "),
  44154. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44155. _c(
  44156. "button",
  44157. {
  44158. staticClass: "btn btn-secondary",
  44159. attrs: { type: "button", "data-dismiss": "modal" }
  44160. },
  44161. [_vm._v("Close")]
  44162. ),
  44163. _vm._v(" "),
  44164. _c(
  44165. "button",
  44166. {
  44167. staticClass: "btn btn-primary",
  44168. attrs: { type: "button" },
  44169. on: {
  44170. click: function($event) {
  44171. return _vm.updateNote(_vm.note)
  44172. }
  44173. }
  44174. },
  44175. [_vm._v("Save")]
  44176. )
  44177. ])
  44178. ]
  44179. )
  44180. }
  44181. var staticRenderFns = []
  44182. render._withStripped = true
  44183. /***/ }),
  44184. /***/ "./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&":
  44185. /*!********************************************************************************************************************************************************************************************************!*\
  44186. !*** ./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& ***!
  44187. \********************************************************************************************************************************************************************************************************/
  44188. /*! exports provided: render, staticRenderFns */
  44189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44190. "use strict";
  44191. __webpack_require__.r(__webpack_exports__);
  44192. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44193. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44194. var render = function() {
  44195. var _vm = this
  44196. var _h = _vm.$createElement
  44197. var _c = _vm._self._c || _h
  44198. return _c(
  44199. "ul",
  44200. { staticClass: "list-unstyled" },
  44201. [
  44202. _c("div", { staticClass: "row" }, [
  44203. _c(
  44204. "div",
  44205. {
  44206. staticClass:
  44207. "col-md-2 d-flex justify-content-center justify-content-md-start"
  44208. },
  44209. [
  44210. _c(
  44211. "button",
  44212. {
  44213. staticClass: "btn btn-primary m-2",
  44214. attrs: {
  44215. type: "button",
  44216. "data-toggle": "collapse",
  44217. "data-target": "#note" + _vm.noteType + "add"
  44218. }
  44219. },
  44220. [
  44221. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  44222. _vm._v(" Add New Note")
  44223. ]
  44224. )
  44225. ]
  44226. ),
  44227. _vm._v(" "),
  44228. _c("div", { staticClass: "col-md-10" }, [
  44229. _c(
  44230. "div",
  44231. {
  44232. staticClass: "collapse",
  44233. attrs: { id: "note" + _vm.noteType + "add" }
  44234. },
  44235. [
  44236. _c(
  44237. "div",
  44238. {
  44239. staticClass:
  44240. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  44241. },
  44242. [
  44243. _c("textarea", {
  44244. directives: [
  44245. {
  44246. name: "model",
  44247. rawName: "v-model",
  44248. value: _vm.newNote.thenote,
  44249. expression: "newNote.thenote"
  44250. }
  44251. ],
  44252. staticClass: "form-control",
  44253. attrs: {
  44254. name: "newnote" + _vm.noteType,
  44255. id: "newnote" + _vm.noteType
  44256. },
  44257. domProps: { value: _vm.newNote.thenote },
  44258. on: {
  44259. input: function($event) {
  44260. if ($event.target.composing) {
  44261. return
  44262. }
  44263. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  44264. }
  44265. }
  44266. }),
  44267. _vm._v(" "),
  44268. _c(
  44269. "button",
  44270. {
  44271. staticClass: "btn btn-secondary m-2",
  44272. attrs: { type: "button" },
  44273. on: {
  44274. click: function($event) {
  44275. return _vm.createNote()
  44276. }
  44277. }
  44278. },
  44279. [_vm._v("Save")]
  44280. )
  44281. ]
  44282. )
  44283. ]
  44284. )
  44285. ])
  44286. ]),
  44287. _vm._v(" "),
  44288. _vm._l(this.notes, function(note, index) {
  44289. return _c(
  44290. "li",
  44291. { key: index, staticClass: "row no-gutters mb-2" },
  44292. [
  44293. _c("note-form-modal", {
  44294. attrs: {
  44295. "modal-id": "note" + note.noteid + "editModal",
  44296. "populate-with": note
  44297. }
  44298. }),
  44299. _vm._v(" "),
  44300. _c(
  44301. "div",
  44302. {
  44303. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44304. class: _vm.noteOrders[index]
  44305. },
  44306. [
  44307. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44308. _vm._v(_vm._s(note.noteuser))
  44309. ]),
  44310. _vm._v(" "),
  44311. _c(
  44312. "div",
  44313. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44314. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44315. ),
  44316. _vm._v(" "),
  44317. _c(
  44318. "div",
  44319. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44320. [
  44321. _vm.authusername === note.noteuser ||
  44322. _vm.authusername === "admin"
  44323. ? [
  44324. _c(
  44325. "button",
  44326. {
  44327. staticClass: "btn btn-sm btn-primary m-1",
  44328. attrs: {
  44329. "data-toggle": "modal",
  44330. "data-target":
  44331. "#note" + note.noteid + "editModal"
  44332. }
  44333. },
  44334. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44335. ),
  44336. _vm._v(" "),
  44337. _vm._m(0, true),
  44338. _vm._v(" "),
  44339. _vm._m(1, true)
  44340. ]
  44341. : _vm._e()
  44342. ],
  44343. 2
  44344. )
  44345. ]
  44346. ),
  44347. _vm._v(" "),
  44348. _c("div", { staticClass: "col-md-10" }, [
  44349. _c("div", { staticClass: "card m-2" }, [
  44350. _c("div", { staticClass: "card-body p-2" }, [
  44351. _vm._v(
  44352. "\n " +
  44353. _vm._s(note.thenote) +
  44354. "\n "
  44355. )
  44356. ])
  44357. ])
  44358. ])
  44359. ],
  44360. 1
  44361. )
  44362. })
  44363. ],
  44364. 2
  44365. )
  44366. }
  44367. var staticRenderFns = [
  44368. function() {
  44369. var _vm = this
  44370. var _h = _vm.$createElement
  44371. var _c = _vm._self._c || _h
  44372. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44373. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44374. ])
  44375. },
  44376. function() {
  44377. var _vm = this
  44378. var _h = _vm.$createElement
  44379. var _c = _vm._self._c || _h
  44380. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44381. _c("i", { staticClass: "fa fa-fw fa-random" })
  44382. ])
  44383. }
  44384. ]
  44385. render._withStripped = true
  44386. /***/ }),
  44387. /***/ "./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&":
  44388. /*!********************************************************************************************************************************************************************************************************************!*\
  44389. !*** ./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& ***!
  44390. \********************************************************************************************************************************************************************************************************************/
  44391. /*! exports provided: render, staticRenderFns */
  44392. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44393. "use strict";
  44394. __webpack_require__.r(__webpack_exports__);
  44395. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44396. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44397. var render = function() {
  44398. var _vm = this
  44399. var _h = _vm.$createElement
  44400. var _c = _vm._self._c || _h
  44401. return _c(
  44402. "modal",
  44403. {
  44404. attrs: {
  44405. id: _vm.id,
  44406. tabindex: "-1",
  44407. role: "dialog",
  44408. "aria-labelledby": _vm.id + "Label"
  44409. }
  44410. },
  44411. [
  44412. _c(
  44413. "h5",
  44414. {
  44415. staticClass: "modal-title",
  44416. attrs: { slot: "header", id: _vm.id + "Label" },
  44417. slot: "header"
  44418. },
  44419. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44420. ),
  44421. _vm._v(" "),
  44422. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44423. _c(
  44424. "div",
  44425. { staticClass: "form-group" },
  44426. [
  44427. _c("label", { attrs: { for: "probdesc" } }, [
  44428. _vm._v("Problem Description")
  44429. ]),
  44430. _vm._v(" "),
  44431. _c("textarea", {
  44432. directives: [
  44433. {
  44434. name: "model",
  44435. rawName: "v-model",
  44436. value: _vm.data.probdesc,
  44437. expression: "data.probdesc"
  44438. }
  44439. ],
  44440. class: {
  44441. "form-control": true,
  44442. "is-invalid": _vm.errors.probdesc
  44443. },
  44444. attrs: { id: "probdesc", name: "probdesc" },
  44445. domProps: { value: _vm.data.probdesc },
  44446. on: {
  44447. input: function($event) {
  44448. if ($event.target.composing) {
  44449. return
  44450. }
  44451. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44452. }
  44453. }
  44454. }),
  44455. _vm._v(" "),
  44456. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44457. ],
  44458. 1
  44459. ),
  44460. _vm._v(" "),
  44461. _c(
  44462. "div",
  44463. { staticClass: "form-group" },
  44464. [
  44465. _c("label", { attrs: { for: "suggested" } }, [
  44466. _vm._v("Suggested Solution")
  44467. ]),
  44468. _vm._v(" "),
  44469. _c("textarea", {
  44470. directives: [
  44471. {
  44472. name: "model",
  44473. rawName: "v-model",
  44474. value: _vm.data.suggested,
  44475. expression: "data.suggested"
  44476. }
  44477. ],
  44478. class: {
  44479. "form-control": true,
  44480. "is-invalid": _vm.errors.suggested
  44481. },
  44482. attrs: { id: "suggested", name: "suggested" },
  44483. domProps: { value: _vm.data.suggested },
  44484. on: {
  44485. input: function($event) {
  44486. if ($event.target.composing) {
  44487. return
  44488. }
  44489. _vm.$set(_vm.data, "suggested", $event.target.value)
  44490. }
  44491. }
  44492. }),
  44493. _vm._v(" "),
  44494. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44495. ],
  44496. 1
  44497. ),
  44498. _vm._v(" "),
  44499. _c(
  44500. "div",
  44501. { staticClass: "form-group" },
  44502. [
  44503. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44504. _vm._v(" "),
  44505. _c("autocomplete-custom-dropdown", {
  44506. attrs: { options: _vm.storeList, value: this.store },
  44507. model: {
  44508. value: _vm.store,
  44509. callback: function($$v) {
  44510. _vm.store = $$v
  44511. },
  44512. expression: "store"
  44513. }
  44514. })
  44515. ],
  44516. 1
  44517. )
  44518. ]),
  44519. _vm._v(" "),
  44520. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44521. _c(
  44522. "button",
  44523. {
  44524. staticClass: "btn btn-secondary",
  44525. attrs: { type: "button", "data-dismiss": "modal" }
  44526. },
  44527. [_vm._v("Close")]
  44528. ),
  44529. _vm._v(" "),
  44530. _c(
  44531. "button",
  44532. {
  44533. staticClass: "btn btn-primary",
  44534. attrs: { type: "button" },
  44535. on: {
  44536. click: function($event) {
  44537. return _vm.updateWorkOrder()
  44538. }
  44539. }
  44540. },
  44541. [_vm._v("Save")]
  44542. )
  44543. ])
  44544. ]
  44545. )
  44546. }
  44547. var staticRenderFns = []
  44548. render._withStripped = true
  44549. /***/ }),
  44550. /***/ "./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&":
  44551. /*!*********************************************************************************************************************************************************************************************************!*\
  44552. !*** ./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& ***!
  44553. \*********************************************************************************************************************************************************************************************************/
  44554. /*! exports provided: render, staticRenderFns */
  44555. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44556. "use strict";
  44557. __webpack_require__.r(__webpack_exports__);
  44558. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44559. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44560. var render = function() {
  44561. var _vm = this
  44562. var _h = _vm.$createElement
  44563. var _c = _vm._self._c || _h
  44564. return _c(
  44565. "div",
  44566. [
  44567. _c("woinfo-edit-modal", {
  44568. attrs: {
  44569. "modal-id": "workordereditModal",
  44570. "populate-with": this.data,
  44571. "store-list": this.storeList
  44572. }
  44573. }),
  44574. _vm._v(" "),
  44575. _c("p", [
  44576. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44577. _vm._v(" "),
  44578. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44579. ]),
  44580. _vm._v(" "),
  44581. _c("p", [
  44582. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44583. _vm._v(" "),
  44584. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44585. ]),
  44586. _vm._v(" "),
  44587. _c("p", [
  44588. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44589. _vm._v(" "),
  44590. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44591. ]),
  44592. _vm._v(" "),
  44593. _c("p", [
  44594. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44595. _vm._v(" "),
  44596. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44597. ]),
  44598. _vm._v(" "),
  44599. _c("p", [
  44600. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44601. _vm._v(" "),
  44602. _c(
  44603. "span",
  44604. {
  44605. staticClass: "dashed-underline",
  44606. attrs: {
  44607. "data-toggle": "tooltip",
  44608. "data-placement": "bottom",
  44609. title: this.getHRDate(this.data.dropdate)
  44610. }
  44611. },
  44612. [
  44613. _vm._v(
  44614. "\n " +
  44615. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44616. " days ago\n "
  44617. )
  44618. ]
  44619. )
  44620. ]),
  44621. _vm._v(" "),
  44622. _c("p", [
  44623. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44624. _vm._v(" "),
  44625. !this.isZero(this.data.pickupdate)
  44626. ? _c(
  44627. "span",
  44628. {
  44629. staticClass: "dashed-underline",
  44630. attrs: {
  44631. "data-toggle": "tooltip",
  44632. "data-placement": "bottom",
  44633. title: this.getHRDate(this.data.pickupdate)
  44634. }
  44635. },
  44636. [
  44637. _vm._v(
  44638. "\n " +
  44639. _vm._s(
  44640. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44641. ) +
  44642. " days ago\n "
  44643. )
  44644. ]
  44645. )
  44646. : _vm._e()
  44647. ]),
  44648. _vm._v(" "),
  44649. _c(
  44650. "button",
  44651. {
  44652. staticClass: "btn btn-primary",
  44653. attrs: {
  44654. type: "button",
  44655. "data-toggle": "modal",
  44656. "data-target": "#workordereditModal"
  44657. }
  44658. },
  44659. [_vm._v("Edit")]
  44660. )
  44661. ],
  44662. 1
  44663. )
  44664. }
  44665. var staticRenderFns = []
  44666. render._withStripped = true
  44667. /***/ }),
  44668. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44669. /*!********************************************************************!*\
  44670. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44671. \********************************************************************/
  44672. /*! exports provided: default */
  44673. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44674. "use strict";
  44675. __webpack_require__.r(__webpack_exports__);
  44676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44677. /* globals __VUE_SSR_CONTEXT__ */
  44678. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44679. // This module is a runtime utility for cleaner component module output and will
  44680. // be included in the final webpack user bundle.
  44681. function normalizeComponent (
  44682. scriptExports,
  44683. render,
  44684. staticRenderFns,
  44685. functionalTemplate,
  44686. injectStyles,
  44687. scopeId,
  44688. moduleIdentifier, /* server only */
  44689. shadowMode /* vue-cli only */
  44690. ) {
  44691. // Vue.extend constructor export interop
  44692. var options = typeof scriptExports === 'function'
  44693. ? scriptExports.options
  44694. : scriptExports
  44695. // render functions
  44696. if (render) {
  44697. options.render = render
  44698. options.staticRenderFns = staticRenderFns
  44699. options._compiled = true
  44700. }
  44701. // functional template
  44702. if (functionalTemplate) {
  44703. options.functional = true
  44704. }
  44705. // scopedId
  44706. if (scopeId) {
  44707. options._scopeId = 'data-v-' + scopeId
  44708. }
  44709. var hook
  44710. if (moduleIdentifier) { // server build
  44711. hook = function (context) {
  44712. // 2.3 injection
  44713. context =
  44714. context || // cached call
  44715. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44716. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44717. // 2.2 with runInNewContext: true
  44718. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44719. context = __VUE_SSR_CONTEXT__
  44720. }
  44721. // inject component styles
  44722. if (injectStyles) {
  44723. injectStyles.call(this, context)
  44724. }
  44725. // register component module identifier for async chunk inferrence
  44726. if (context && context._registeredComponents) {
  44727. context._registeredComponents.add(moduleIdentifier)
  44728. }
  44729. }
  44730. // used by ssr in case component is cached and beforeCreate
  44731. // never gets called
  44732. options._ssrRegister = hook
  44733. } else if (injectStyles) {
  44734. hook = shadowMode
  44735. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44736. : injectStyles
  44737. }
  44738. if (hook) {
  44739. if (options.functional) {
  44740. // for template-only hot-reload because in that case the render fn doesn't
  44741. // go through the normalizer
  44742. options._injectStyles = hook
  44743. // register for functioal component in vue file
  44744. var originalRender = options.render
  44745. options.render = function renderWithStyleInjection (h, context) {
  44746. hook.call(context)
  44747. return originalRender(h, context)
  44748. }
  44749. } else {
  44750. // inject component registration as beforeCreate hook
  44751. var existing = options.beforeCreate
  44752. options.beforeCreate = existing
  44753. ? [].concat(existing, hook)
  44754. : [hook]
  44755. }
  44756. }
  44757. return {
  44758. exports: scriptExports,
  44759. options: options
  44760. }
  44761. }
  44762. /***/ }),
  44763. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44764. /*!*************************************************!*\
  44765. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44766. \*************************************************/
  44767. /*! no static exports found */
  44768. /***/ (function(module, exports, __webpack_require__) {
  44769. "use strict";
  44770. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44771. * Vue.js v2.6.11
  44772. * (c) 2014-2019 Evan You
  44773. * Released under the MIT License.
  44774. */
  44775. /* */
  44776. var emptyObject = Object.freeze({});
  44777. // These helpers produce better VM code in JS engines due to their
  44778. // explicitness and function inlining.
  44779. function isUndef (v) {
  44780. return v === undefined || v === null
  44781. }
  44782. function isDef (v) {
  44783. return v !== undefined && v !== null
  44784. }
  44785. function isTrue (v) {
  44786. return v === true
  44787. }
  44788. function isFalse (v) {
  44789. return v === false
  44790. }
  44791. /**
  44792. * Check if value is primitive.
  44793. */
  44794. function isPrimitive (value) {
  44795. return (
  44796. typeof value === 'string' ||
  44797. typeof value === 'number' ||
  44798. // $flow-disable-line
  44799. typeof value === 'symbol' ||
  44800. typeof value === 'boolean'
  44801. )
  44802. }
  44803. /**
  44804. * Quick object check - this is primarily used to tell
  44805. * Objects from primitive values when we know the value
  44806. * is a JSON-compliant type.
  44807. */
  44808. function isObject (obj) {
  44809. return obj !== null && typeof obj === 'object'
  44810. }
  44811. /**
  44812. * Get the raw type string of a value, e.g., [object Object].
  44813. */
  44814. var _toString = Object.prototype.toString;
  44815. function toRawType (value) {
  44816. return _toString.call(value).slice(8, -1)
  44817. }
  44818. /**
  44819. * Strict object type check. Only returns true
  44820. * for plain JavaScript objects.
  44821. */
  44822. function isPlainObject (obj) {
  44823. return _toString.call(obj) === '[object Object]'
  44824. }
  44825. function isRegExp (v) {
  44826. return _toString.call(v) === '[object RegExp]'
  44827. }
  44828. /**
  44829. * Check if val is a valid array index.
  44830. */
  44831. function isValidArrayIndex (val) {
  44832. var n = parseFloat(String(val));
  44833. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44834. }
  44835. function isPromise (val) {
  44836. return (
  44837. isDef(val) &&
  44838. typeof val.then === 'function' &&
  44839. typeof val.catch === 'function'
  44840. )
  44841. }
  44842. /**
  44843. * Convert a value to a string that is actually rendered.
  44844. */
  44845. function toString (val) {
  44846. return val == null
  44847. ? ''
  44848. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44849. ? JSON.stringify(val, null, 2)
  44850. : String(val)
  44851. }
  44852. /**
  44853. * Convert an input value to a number for persistence.
  44854. * If the conversion fails, return original string.
  44855. */
  44856. function toNumber (val) {
  44857. var n = parseFloat(val);
  44858. return isNaN(n) ? val : n
  44859. }
  44860. /**
  44861. * Make a map and return a function for checking if a key
  44862. * is in that map.
  44863. */
  44864. function makeMap (
  44865. str,
  44866. expectsLowerCase
  44867. ) {
  44868. var map = Object.create(null);
  44869. var list = str.split(',');
  44870. for (var i = 0; i < list.length; i++) {
  44871. map[list[i]] = true;
  44872. }
  44873. return expectsLowerCase
  44874. ? function (val) { return map[val.toLowerCase()]; }
  44875. : function (val) { return map[val]; }
  44876. }
  44877. /**
  44878. * Check if a tag is a built-in tag.
  44879. */
  44880. var isBuiltInTag = makeMap('slot,component', true);
  44881. /**
  44882. * Check if an attribute is a reserved attribute.
  44883. */
  44884. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44885. /**
  44886. * Remove an item from an array.
  44887. */
  44888. function remove (arr, item) {
  44889. if (arr.length) {
  44890. var index = arr.indexOf(item);
  44891. if (index > -1) {
  44892. return arr.splice(index, 1)
  44893. }
  44894. }
  44895. }
  44896. /**
  44897. * Check whether an object has the property.
  44898. */
  44899. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44900. function hasOwn (obj, key) {
  44901. return hasOwnProperty.call(obj, key)
  44902. }
  44903. /**
  44904. * Create a cached version of a pure function.
  44905. */
  44906. function cached (fn) {
  44907. var cache = Object.create(null);
  44908. return (function cachedFn (str) {
  44909. var hit = cache[str];
  44910. return hit || (cache[str] = fn(str))
  44911. })
  44912. }
  44913. /**
  44914. * Camelize a hyphen-delimited string.
  44915. */
  44916. var camelizeRE = /-(\w)/g;
  44917. var camelize = cached(function (str) {
  44918. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44919. });
  44920. /**
  44921. * Capitalize a string.
  44922. */
  44923. var capitalize = cached(function (str) {
  44924. return str.charAt(0).toUpperCase() + str.slice(1)
  44925. });
  44926. /**
  44927. * Hyphenate a camelCase string.
  44928. */
  44929. var hyphenateRE = /\B([A-Z])/g;
  44930. var hyphenate = cached(function (str) {
  44931. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44932. });
  44933. /**
  44934. * Simple bind polyfill for environments that do not support it,
  44935. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44936. * since native bind is now performant enough in most browsers.
  44937. * But removing it would mean breaking code that was able to run in
  44938. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44939. */
  44940. /* istanbul ignore next */
  44941. function polyfillBind (fn, ctx) {
  44942. function boundFn (a) {
  44943. var l = arguments.length;
  44944. return l
  44945. ? l > 1
  44946. ? fn.apply(ctx, arguments)
  44947. : fn.call(ctx, a)
  44948. : fn.call(ctx)
  44949. }
  44950. boundFn._length = fn.length;
  44951. return boundFn
  44952. }
  44953. function nativeBind (fn, ctx) {
  44954. return fn.bind(ctx)
  44955. }
  44956. var bind = Function.prototype.bind
  44957. ? nativeBind
  44958. : polyfillBind;
  44959. /**
  44960. * Convert an Array-like object to a real Array.
  44961. */
  44962. function toArray (list, start) {
  44963. start = start || 0;
  44964. var i = list.length - start;
  44965. var ret = new Array(i);
  44966. while (i--) {
  44967. ret[i] = list[i + start];
  44968. }
  44969. return ret
  44970. }
  44971. /**
  44972. * Mix properties into target object.
  44973. */
  44974. function extend (to, _from) {
  44975. for (var key in _from) {
  44976. to[key] = _from[key];
  44977. }
  44978. return to
  44979. }
  44980. /**
  44981. * Merge an Array of Objects into a single Object.
  44982. */
  44983. function toObject (arr) {
  44984. var res = {};
  44985. for (var i = 0; i < arr.length; i++) {
  44986. if (arr[i]) {
  44987. extend(res, arr[i]);
  44988. }
  44989. }
  44990. return res
  44991. }
  44992. /* eslint-disable no-unused-vars */
  44993. /**
  44994. * Perform no operation.
  44995. * Stubbing args to make Flow happy without leaving useless transpiled code
  44996. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44997. */
  44998. function noop (a, b, c) {}
  44999. /**
  45000. * Always return false.
  45001. */
  45002. var no = function (a, b, c) { return false; };
  45003. /* eslint-enable no-unused-vars */
  45004. /**
  45005. * Return the same value.
  45006. */
  45007. var identity = function (_) { return _; };
  45008. /**
  45009. * Generate a string containing static keys from compiler modules.
  45010. */
  45011. function genStaticKeys (modules) {
  45012. return modules.reduce(function (keys, m) {
  45013. return keys.concat(m.staticKeys || [])
  45014. }, []).join(',')
  45015. }
  45016. /**
  45017. * Check if two values are loosely equal - that is,
  45018. * if they are plain objects, do they have the same shape?
  45019. */
  45020. function looseEqual (a, b) {
  45021. if (a === b) { return true }
  45022. var isObjectA = isObject(a);
  45023. var isObjectB = isObject(b);
  45024. if (isObjectA && isObjectB) {
  45025. try {
  45026. var isArrayA = Array.isArray(a);
  45027. var isArrayB = Array.isArray(b);
  45028. if (isArrayA && isArrayB) {
  45029. return a.length === b.length && a.every(function (e, i) {
  45030. return looseEqual(e, b[i])
  45031. })
  45032. } else if (a instanceof Date && b instanceof Date) {
  45033. return a.getTime() === b.getTime()
  45034. } else if (!isArrayA && !isArrayB) {
  45035. var keysA = Object.keys(a);
  45036. var keysB = Object.keys(b);
  45037. return keysA.length === keysB.length && keysA.every(function (key) {
  45038. return looseEqual(a[key], b[key])
  45039. })
  45040. } else {
  45041. /* istanbul ignore next */
  45042. return false
  45043. }
  45044. } catch (e) {
  45045. /* istanbul ignore next */
  45046. return false
  45047. }
  45048. } else if (!isObjectA && !isObjectB) {
  45049. return String(a) === String(b)
  45050. } else {
  45051. return false
  45052. }
  45053. }
  45054. /**
  45055. * Return the first index at which a loosely equal value can be
  45056. * found in the array (if value is a plain object, the array must
  45057. * contain an object of the same shape), or -1 if it is not present.
  45058. */
  45059. function looseIndexOf (arr, val) {
  45060. for (var i = 0; i < arr.length; i++) {
  45061. if (looseEqual(arr[i], val)) { return i }
  45062. }
  45063. return -1
  45064. }
  45065. /**
  45066. * Ensure a function is called only once.
  45067. */
  45068. function once (fn) {
  45069. var called = false;
  45070. return function () {
  45071. if (!called) {
  45072. called = true;
  45073. fn.apply(this, arguments);
  45074. }
  45075. }
  45076. }
  45077. var SSR_ATTR = 'data-server-rendered';
  45078. var ASSET_TYPES = [
  45079. 'component',
  45080. 'directive',
  45081. 'filter'
  45082. ];
  45083. var LIFECYCLE_HOOKS = [
  45084. 'beforeCreate',
  45085. 'created',
  45086. 'beforeMount',
  45087. 'mounted',
  45088. 'beforeUpdate',
  45089. 'updated',
  45090. 'beforeDestroy',
  45091. 'destroyed',
  45092. 'activated',
  45093. 'deactivated',
  45094. 'errorCaptured',
  45095. 'serverPrefetch'
  45096. ];
  45097. /* */
  45098. var config = ({
  45099. /**
  45100. * Option merge strategies (used in core/util/options)
  45101. */
  45102. // $flow-disable-line
  45103. optionMergeStrategies: Object.create(null),
  45104. /**
  45105. * Whether to suppress warnings.
  45106. */
  45107. silent: false,
  45108. /**
  45109. * Show production mode tip message on boot?
  45110. */
  45111. productionTip: "development" !== 'production',
  45112. /**
  45113. * Whether to enable devtools
  45114. */
  45115. devtools: "development" !== 'production',
  45116. /**
  45117. * Whether to record perf
  45118. */
  45119. performance: false,
  45120. /**
  45121. * Error handler for watcher errors
  45122. */
  45123. errorHandler: null,
  45124. /**
  45125. * Warn handler for watcher warns
  45126. */
  45127. warnHandler: null,
  45128. /**
  45129. * Ignore certain custom elements
  45130. */
  45131. ignoredElements: [],
  45132. /**
  45133. * Custom user key aliases for v-on
  45134. */
  45135. // $flow-disable-line
  45136. keyCodes: Object.create(null),
  45137. /**
  45138. * Check if a tag is reserved so that it cannot be registered as a
  45139. * component. This is platform-dependent and may be overwritten.
  45140. */
  45141. isReservedTag: no,
  45142. /**
  45143. * Check if an attribute is reserved so that it cannot be used as a component
  45144. * prop. This is platform-dependent and may be overwritten.
  45145. */
  45146. isReservedAttr: no,
  45147. /**
  45148. * Check if a tag is an unknown element.
  45149. * Platform-dependent.
  45150. */
  45151. isUnknownElement: no,
  45152. /**
  45153. * Get the namespace of an element
  45154. */
  45155. getTagNamespace: noop,
  45156. /**
  45157. * Parse the real tag name for the specific platform.
  45158. */
  45159. parsePlatformTagName: identity,
  45160. /**
  45161. * Check if an attribute must be bound using property, e.g. value
  45162. * Platform-dependent.
  45163. */
  45164. mustUseProp: no,
  45165. /**
  45166. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45167. * This will significantly reduce performance if set to false.
  45168. */
  45169. async: true,
  45170. /**
  45171. * Exposed for legacy reasons
  45172. */
  45173. _lifecycleHooks: LIFECYCLE_HOOKS
  45174. });
  45175. /* */
  45176. /**
  45177. * unicode letters used for parsing html tags, component names and property paths.
  45178. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45179. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45180. */
  45181. 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/;
  45182. /**
  45183. * Check if a string starts with $ or _
  45184. */
  45185. function isReserved (str) {
  45186. var c = (str + '').charCodeAt(0);
  45187. return c === 0x24 || c === 0x5F
  45188. }
  45189. /**
  45190. * Define a property.
  45191. */
  45192. function def (obj, key, val, enumerable) {
  45193. Object.defineProperty(obj, key, {
  45194. value: val,
  45195. enumerable: !!enumerable,
  45196. writable: true,
  45197. configurable: true
  45198. });
  45199. }
  45200. /**
  45201. * Parse simple path.
  45202. */
  45203. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45204. function parsePath (path) {
  45205. if (bailRE.test(path)) {
  45206. return
  45207. }
  45208. var segments = path.split('.');
  45209. return function (obj) {
  45210. for (var i = 0; i < segments.length; i++) {
  45211. if (!obj) { return }
  45212. obj = obj[segments[i]];
  45213. }
  45214. return obj
  45215. }
  45216. }
  45217. /* */
  45218. // can we use __proto__?
  45219. var hasProto = '__proto__' in {};
  45220. // Browser environment sniffing
  45221. var inBrowser = typeof window !== 'undefined';
  45222. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45223. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45224. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45225. var isIE = UA && /msie|trident/.test(UA);
  45226. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45227. var isEdge = UA && UA.indexOf('edge/') > 0;
  45228. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45229. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45230. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45231. var isPhantomJS = UA && /phantomjs/.test(UA);
  45232. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45233. // Firefox has a "watch" function on Object.prototype...
  45234. var nativeWatch = ({}).watch;
  45235. var supportsPassive = false;
  45236. if (inBrowser) {
  45237. try {
  45238. var opts = {};
  45239. Object.defineProperty(opts, 'passive', ({
  45240. get: function get () {
  45241. /* istanbul ignore next */
  45242. supportsPassive = true;
  45243. }
  45244. })); // https://github.com/facebook/flow/issues/285
  45245. window.addEventListener('test-passive', null, opts);
  45246. } catch (e) {}
  45247. }
  45248. // this needs to be lazy-evaled because vue may be required before
  45249. // vue-server-renderer can set VUE_ENV
  45250. var _isServer;
  45251. var isServerRendering = function () {
  45252. if (_isServer === undefined) {
  45253. /* istanbul ignore if */
  45254. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45255. // detect presence of vue-server-renderer and avoid
  45256. // Webpack shimming the process
  45257. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45258. } else {
  45259. _isServer = false;
  45260. }
  45261. }
  45262. return _isServer
  45263. };
  45264. // detect devtools
  45265. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45266. /* istanbul ignore next */
  45267. function isNative (Ctor) {
  45268. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45269. }
  45270. var hasSymbol =
  45271. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45272. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45273. var _Set;
  45274. /* istanbul ignore if */ // $flow-disable-line
  45275. if (typeof Set !== 'undefined' && isNative(Set)) {
  45276. // use native Set when available.
  45277. _Set = Set;
  45278. } else {
  45279. // a non-standard Set polyfill that only works with primitive keys.
  45280. _Set = /*@__PURE__*/(function () {
  45281. function Set () {
  45282. this.set = Object.create(null);
  45283. }
  45284. Set.prototype.has = function has (key) {
  45285. return this.set[key] === true
  45286. };
  45287. Set.prototype.add = function add (key) {
  45288. this.set[key] = true;
  45289. };
  45290. Set.prototype.clear = function clear () {
  45291. this.set = Object.create(null);
  45292. };
  45293. return Set;
  45294. }());
  45295. }
  45296. /* */
  45297. var warn = noop;
  45298. var tip = noop;
  45299. var generateComponentTrace = (noop); // work around flow check
  45300. var formatComponentName = (noop);
  45301. {
  45302. var hasConsole = typeof console !== 'undefined';
  45303. var classifyRE = /(?:^|[-_])(\w)/g;
  45304. var classify = function (str) { return str
  45305. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45306. .replace(/[-_]/g, ''); };
  45307. warn = function (msg, vm) {
  45308. var trace = vm ? generateComponentTrace(vm) : '';
  45309. if (config.warnHandler) {
  45310. config.warnHandler.call(null, msg, vm, trace);
  45311. } else if (hasConsole && (!config.silent)) {
  45312. console.error(("[Vue warn]: " + msg + trace));
  45313. }
  45314. };
  45315. tip = function (msg, vm) {
  45316. if (hasConsole && (!config.silent)) {
  45317. console.warn("[Vue tip]: " + msg + (
  45318. vm ? generateComponentTrace(vm) : ''
  45319. ));
  45320. }
  45321. };
  45322. formatComponentName = function (vm, includeFile) {
  45323. if (vm.$root === vm) {
  45324. return '<Root>'
  45325. }
  45326. var options = typeof vm === 'function' && vm.cid != null
  45327. ? vm.options
  45328. : vm._isVue
  45329. ? vm.$options || vm.constructor.options
  45330. : vm;
  45331. var name = options.name || options._componentTag;
  45332. var file = options.__file;
  45333. if (!name && file) {
  45334. var match = file.match(/([^/\\]+)\.vue$/);
  45335. name = match && match[1];
  45336. }
  45337. return (
  45338. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45339. (file && includeFile !== false ? (" at " + file) : '')
  45340. )
  45341. };
  45342. var repeat = function (str, n) {
  45343. var res = '';
  45344. while (n) {
  45345. if (n % 2 === 1) { res += str; }
  45346. if (n > 1) { str += str; }
  45347. n >>= 1;
  45348. }
  45349. return res
  45350. };
  45351. generateComponentTrace = function (vm) {
  45352. if (vm._isVue && vm.$parent) {
  45353. var tree = [];
  45354. var currentRecursiveSequence = 0;
  45355. while (vm) {
  45356. if (tree.length > 0) {
  45357. var last = tree[tree.length - 1];
  45358. if (last.constructor === vm.constructor) {
  45359. currentRecursiveSequence++;
  45360. vm = vm.$parent;
  45361. continue
  45362. } else if (currentRecursiveSequence > 0) {
  45363. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45364. currentRecursiveSequence = 0;
  45365. }
  45366. }
  45367. tree.push(vm);
  45368. vm = vm.$parent;
  45369. }
  45370. return '\n\nfound in\n\n' + tree
  45371. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45372. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45373. : formatComponentName(vm))); })
  45374. .join('\n')
  45375. } else {
  45376. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45377. }
  45378. };
  45379. }
  45380. /* */
  45381. var uid = 0;
  45382. /**
  45383. * A dep is an observable that can have multiple
  45384. * directives subscribing to it.
  45385. */
  45386. var Dep = function Dep () {
  45387. this.id = uid++;
  45388. this.subs = [];
  45389. };
  45390. Dep.prototype.addSub = function addSub (sub) {
  45391. this.subs.push(sub);
  45392. };
  45393. Dep.prototype.removeSub = function removeSub (sub) {
  45394. remove(this.subs, sub);
  45395. };
  45396. Dep.prototype.depend = function depend () {
  45397. if (Dep.target) {
  45398. Dep.target.addDep(this);
  45399. }
  45400. };
  45401. Dep.prototype.notify = function notify () {
  45402. // stabilize the subscriber list first
  45403. var subs = this.subs.slice();
  45404. if (!config.async) {
  45405. // subs aren't sorted in scheduler if not running async
  45406. // we need to sort them now to make sure they fire in correct
  45407. // order
  45408. subs.sort(function (a, b) { return a.id - b.id; });
  45409. }
  45410. for (var i = 0, l = subs.length; i < l; i++) {
  45411. subs[i].update();
  45412. }
  45413. };
  45414. // The current target watcher being evaluated.
  45415. // This is globally unique because only one watcher
  45416. // can be evaluated at a time.
  45417. Dep.target = null;
  45418. var targetStack = [];
  45419. function pushTarget (target) {
  45420. targetStack.push(target);
  45421. Dep.target = target;
  45422. }
  45423. function popTarget () {
  45424. targetStack.pop();
  45425. Dep.target = targetStack[targetStack.length - 1];
  45426. }
  45427. /* */
  45428. var VNode = function VNode (
  45429. tag,
  45430. data,
  45431. children,
  45432. text,
  45433. elm,
  45434. context,
  45435. componentOptions,
  45436. asyncFactory
  45437. ) {
  45438. this.tag = tag;
  45439. this.data = data;
  45440. this.children = children;
  45441. this.text = text;
  45442. this.elm = elm;
  45443. this.ns = undefined;
  45444. this.context = context;
  45445. this.fnContext = undefined;
  45446. this.fnOptions = undefined;
  45447. this.fnScopeId = undefined;
  45448. this.key = data && data.key;
  45449. this.componentOptions = componentOptions;
  45450. this.componentInstance = undefined;
  45451. this.parent = undefined;
  45452. this.raw = false;
  45453. this.isStatic = false;
  45454. this.isRootInsert = true;
  45455. this.isComment = false;
  45456. this.isCloned = false;
  45457. this.isOnce = false;
  45458. this.asyncFactory = asyncFactory;
  45459. this.asyncMeta = undefined;
  45460. this.isAsyncPlaceholder = false;
  45461. };
  45462. var prototypeAccessors = { child: { configurable: true } };
  45463. // DEPRECATED: alias for componentInstance for backwards compat.
  45464. /* istanbul ignore next */
  45465. prototypeAccessors.child.get = function () {
  45466. return this.componentInstance
  45467. };
  45468. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45469. var createEmptyVNode = function (text) {
  45470. if ( text === void 0 ) text = '';
  45471. var node = new VNode();
  45472. node.text = text;
  45473. node.isComment = true;
  45474. return node
  45475. };
  45476. function createTextVNode (val) {
  45477. return new VNode(undefined, undefined, undefined, String(val))
  45478. }
  45479. // optimized shallow clone
  45480. // used for static nodes and slot nodes because they may be reused across
  45481. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45482. // on their elm reference.
  45483. function cloneVNode (vnode) {
  45484. var cloned = new VNode(
  45485. vnode.tag,
  45486. vnode.data,
  45487. // #7975
  45488. // clone children array to avoid mutating original in case of cloning
  45489. // a child.
  45490. vnode.children && vnode.children.slice(),
  45491. vnode.text,
  45492. vnode.elm,
  45493. vnode.context,
  45494. vnode.componentOptions,
  45495. vnode.asyncFactory
  45496. );
  45497. cloned.ns = vnode.ns;
  45498. cloned.isStatic = vnode.isStatic;
  45499. cloned.key = vnode.key;
  45500. cloned.isComment = vnode.isComment;
  45501. cloned.fnContext = vnode.fnContext;
  45502. cloned.fnOptions = vnode.fnOptions;
  45503. cloned.fnScopeId = vnode.fnScopeId;
  45504. cloned.asyncMeta = vnode.asyncMeta;
  45505. cloned.isCloned = true;
  45506. return cloned
  45507. }
  45508. /*
  45509. * not type checking this file because flow doesn't play well with
  45510. * dynamically accessing methods on Array prototype
  45511. */
  45512. var arrayProto = Array.prototype;
  45513. var arrayMethods = Object.create(arrayProto);
  45514. var methodsToPatch = [
  45515. 'push',
  45516. 'pop',
  45517. 'shift',
  45518. 'unshift',
  45519. 'splice',
  45520. 'sort',
  45521. 'reverse'
  45522. ];
  45523. /**
  45524. * Intercept mutating methods and emit events
  45525. */
  45526. methodsToPatch.forEach(function (method) {
  45527. // cache original method
  45528. var original = arrayProto[method];
  45529. def(arrayMethods, method, function mutator () {
  45530. var args = [], len = arguments.length;
  45531. while ( len-- ) args[ len ] = arguments[ len ];
  45532. var result = original.apply(this, args);
  45533. var ob = this.__ob__;
  45534. var inserted;
  45535. switch (method) {
  45536. case 'push':
  45537. case 'unshift':
  45538. inserted = args;
  45539. break
  45540. case 'splice':
  45541. inserted = args.slice(2);
  45542. break
  45543. }
  45544. if (inserted) { ob.observeArray(inserted); }
  45545. // notify change
  45546. ob.dep.notify();
  45547. return result
  45548. });
  45549. });
  45550. /* */
  45551. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45552. /**
  45553. * In some cases we may want to disable observation inside a component's
  45554. * update computation.
  45555. */
  45556. var shouldObserve = true;
  45557. function toggleObserving (value) {
  45558. shouldObserve = value;
  45559. }
  45560. /**
  45561. * Observer class that is attached to each observed
  45562. * object. Once attached, the observer converts the target
  45563. * object's property keys into getter/setters that
  45564. * collect dependencies and dispatch updates.
  45565. */
  45566. var Observer = function Observer (value) {
  45567. this.value = value;
  45568. this.dep = new Dep();
  45569. this.vmCount = 0;
  45570. def(value, '__ob__', this);
  45571. if (Array.isArray(value)) {
  45572. if (hasProto) {
  45573. protoAugment(value, arrayMethods);
  45574. } else {
  45575. copyAugment(value, arrayMethods, arrayKeys);
  45576. }
  45577. this.observeArray(value);
  45578. } else {
  45579. this.walk(value);
  45580. }
  45581. };
  45582. /**
  45583. * Walk through all properties and convert them into
  45584. * getter/setters. This method should only be called when
  45585. * value type is Object.
  45586. */
  45587. Observer.prototype.walk = function walk (obj) {
  45588. var keys = Object.keys(obj);
  45589. for (var i = 0; i < keys.length; i++) {
  45590. defineReactive$$1(obj, keys[i]);
  45591. }
  45592. };
  45593. /**
  45594. * Observe a list of Array items.
  45595. */
  45596. Observer.prototype.observeArray = function observeArray (items) {
  45597. for (var i = 0, l = items.length; i < l; i++) {
  45598. observe(items[i]);
  45599. }
  45600. };
  45601. // helpers
  45602. /**
  45603. * Augment a target Object or Array by intercepting
  45604. * the prototype chain using __proto__
  45605. */
  45606. function protoAugment (target, src) {
  45607. /* eslint-disable no-proto */
  45608. target.__proto__ = src;
  45609. /* eslint-enable no-proto */
  45610. }
  45611. /**
  45612. * Augment a target Object or Array by defining
  45613. * hidden properties.
  45614. */
  45615. /* istanbul ignore next */
  45616. function copyAugment (target, src, keys) {
  45617. for (var i = 0, l = keys.length; i < l; i++) {
  45618. var key = keys[i];
  45619. def(target, key, src[key]);
  45620. }
  45621. }
  45622. /**
  45623. * Attempt to create an observer instance for a value,
  45624. * returns the new observer if successfully observed,
  45625. * or the existing observer if the value already has one.
  45626. */
  45627. function observe (value, asRootData) {
  45628. if (!isObject(value) || value instanceof VNode) {
  45629. return
  45630. }
  45631. var ob;
  45632. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45633. ob = value.__ob__;
  45634. } else if (
  45635. shouldObserve &&
  45636. !isServerRendering() &&
  45637. (Array.isArray(value) || isPlainObject(value)) &&
  45638. Object.isExtensible(value) &&
  45639. !value._isVue
  45640. ) {
  45641. ob = new Observer(value);
  45642. }
  45643. if (asRootData && ob) {
  45644. ob.vmCount++;
  45645. }
  45646. return ob
  45647. }
  45648. /**
  45649. * Define a reactive property on an Object.
  45650. */
  45651. function defineReactive$$1 (
  45652. obj,
  45653. key,
  45654. val,
  45655. customSetter,
  45656. shallow
  45657. ) {
  45658. var dep = new Dep();
  45659. var property = Object.getOwnPropertyDescriptor(obj, key);
  45660. if (property && property.configurable === false) {
  45661. return
  45662. }
  45663. // cater for pre-defined getter/setters
  45664. var getter = property && property.get;
  45665. var setter = property && property.set;
  45666. if ((!getter || setter) && arguments.length === 2) {
  45667. val = obj[key];
  45668. }
  45669. var childOb = !shallow && observe(val);
  45670. Object.defineProperty(obj, key, {
  45671. enumerable: true,
  45672. configurable: true,
  45673. get: function reactiveGetter () {
  45674. var value = getter ? getter.call(obj) : val;
  45675. if (Dep.target) {
  45676. dep.depend();
  45677. if (childOb) {
  45678. childOb.dep.depend();
  45679. if (Array.isArray(value)) {
  45680. dependArray(value);
  45681. }
  45682. }
  45683. }
  45684. return value
  45685. },
  45686. set: function reactiveSetter (newVal) {
  45687. var value = getter ? getter.call(obj) : val;
  45688. /* eslint-disable no-self-compare */
  45689. if (newVal === value || (newVal !== newVal && value !== value)) {
  45690. return
  45691. }
  45692. /* eslint-enable no-self-compare */
  45693. if (customSetter) {
  45694. customSetter();
  45695. }
  45696. // #7981: for accessor properties without setter
  45697. if (getter && !setter) { return }
  45698. if (setter) {
  45699. setter.call(obj, newVal);
  45700. } else {
  45701. val = newVal;
  45702. }
  45703. childOb = !shallow && observe(newVal);
  45704. dep.notify();
  45705. }
  45706. });
  45707. }
  45708. /**
  45709. * Set a property on an object. Adds the new property and
  45710. * triggers change notification if the property doesn't
  45711. * already exist.
  45712. */
  45713. function set (target, key, val) {
  45714. if (isUndef(target) || isPrimitive(target)
  45715. ) {
  45716. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45717. }
  45718. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45719. target.length = Math.max(target.length, key);
  45720. target.splice(key, 1, val);
  45721. return val
  45722. }
  45723. if (key in target && !(key in Object.prototype)) {
  45724. target[key] = val;
  45725. return val
  45726. }
  45727. var ob = (target).__ob__;
  45728. if (target._isVue || (ob && ob.vmCount)) {
  45729. warn(
  45730. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45731. 'at runtime - declare it upfront in the data option.'
  45732. );
  45733. return val
  45734. }
  45735. if (!ob) {
  45736. target[key] = val;
  45737. return val
  45738. }
  45739. defineReactive$$1(ob.value, key, val);
  45740. ob.dep.notify();
  45741. return val
  45742. }
  45743. /**
  45744. * Delete a property and trigger change if necessary.
  45745. */
  45746. function del (target, key) {
  45747. if (isUndef(target) || isPrimitive(target)
  45748. ) {
  45749. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45750. }
  45751. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45752. target.splice(key, 1);
  45753. return
  45754. }
  45755. var ob = (target).__ob__;
  45756. if (target._isVue || (ob && ob.vmCount)) {
  45757. warn(
  45758. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45759. '- just set it to null.'
  45760. );
  45761. return
  45762. }
  45763. if (!hasOwn(target, key)) {
  45764. return
  45765. }
  45766. delete target[key];
  45767. if (!ob) {
  45768. return
  45769. }
  45770. ob.dep.notify();
  45771. }
  45772. /**
  45773. * Collect dependencies on array elements when the array is touched, since
  45774. * we cannot intercept array element access like property getters.
  45775. */
  45776. function dependArray (value) {
  45777. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45778. e = value[i];
  45779. e && e.__ob__ && e.__ob__.dep.depend();
  45780. if (Array.isArray(e)) {
  45781. dependArray(e);
  45782. }
  45783. }
  45784. }
  45785. /* */
  45786. /**
  45787. * Option overwriting strategies are functions that handle
  45788. * how to merge a parent option value and a child option
  45789. * value into the final value.
  45790. */
  45791. var strats = config.optionMergeStrategies;
  45792. /**
  45793. * Options with restrictions
  45794. */
  45795. {
  45796. strats.el = strats.propsData = function (parent, child, vm, key) {
  45797. if (!vm) {
  45798. warn(
  45799. "option \"" + key + "\" can only be used during instance " +
  45800. 'creation with the `new` keyword.'
  45801. );
  45802. }
  45803. return defaultStrat(parent, child)
  45804. };
  45805. }
  45806. /**
  45807. * Helper that recursively merges two data objects together.
  45808. */
  45809. function mergeData (to, from) {
  45810. if (!from) { return to }
  45811. var key, toVal, fromVal;
  45812. var keys = hasSymbol
  45813. ? Reflect.ownKeys(from)
  45814. : Object.keys(from);
  45815. for (var i = 0; i < keys.length; i++) {
  45816. key = keys[i];
  45817. // in case the object is already observed...
  45818. if (key === '__ob__') { continue }
  45819. toVal = to[key];
  45820. fromVal = from[key];
  45821. if (!hasOwn(to, key)) {
  45822. set(to, key, fromVal);
  45823. } else if (
  45824. toVal !== fromVal &&
  45825. isPlainObject(toVal) &&
  45826. isPlainObject(fromVal)
  45827. ) {
  45828. mergeData(toVal, fromVal);
  45829. }
  45830. }
  45831. return to
  45832. }
  45833. /**
  45834. * Data
  45835. */
  45836. function mergeDataOrFn (
  45837. parentVal,
  45838. childVal,
  45839. vm
  45840. ) {
  45841. if (!vm) {
  45842. // in a Vue.extend merge, both should be functions
  45843. if (!childVal) {
  45844. return parentVal
  45845. }
  45846. if (!parentVal) {
  45847. return childVal
  45848. }
  45849. // when parentVal & childVal are both present,
  45850. // we need to return a function that returns the
  45851. // merged result of both functions... no need to
  45852. // check if parentVal is a function here because
  45853. // it has to be a function to pass previous merges.
  45854. return function mergedDataFn () {
  45855. return mergeData(
  45856. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45857. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45858. )
  45859. }
  45860. } else {
  45861. return function mergedInstanceDataFn () {
  45862. // instance merge
  45863. var instanceData = typeof childVal === 'function'
  45864. ? childVal.call(vm, vm)
  45865. : childVal;
  45866. var defaultData = typeof parentVal === 'function'
  45867. ? parentVal.call(vm, vm)
  45868. : parentVal;
  45869. if (instanceData) {
  45870. return mergeData(instanceData, defaultData)
  45871. } else {
  45872. return defaultData
  45873. }
  45874. }
  45875. }
  45876. }
  45877. strats.data = function (
  45878. parentVal,
  45879. childVal,
  45880. vm
  45881. ) {
  45882. if (!vm) {
  45883. if (childVal && typeof childVal !== 'function') {
  45884. warn(
  45885. 'The "data" option should be a function ' +
  45886. 'that returns a per-instance value in component ' +
  45887. 'definitions.',
  45888. vm
  45889. );
  45890. return parentVal
  45891. }
  45892. return mergeDataOrFn(parentVal, childVal)
  45893. }
  45894. return mergeDataOrFn(parentVal, childVal, vm)
  45895. };
  45896. /**
  45897. * Hooks and props are merged as arrays.
  45898. */
  45899. function mergeHook (
  45900. parentVal,
  45901. childVal
  45902. ) {
  45903. var res = childVal
  45904. ? parentVal
  45905. ? parentVal.concat(childVal)
  45906. : Array.isArray(childVal)
  45907. ? childVal
  45908. : [childVal]
  45909. : parentVal;
  45910. return res
  45911. ? dedupeHooks(res)
  45912. : res
  45913. }
  45914. function dedupeHooks (hooks) {
  45915. var res = [];
  45916. for (var i = 0; i < hooks.length; i++) {
  45917. if (res.indexOf(hooks[i]) === -1) {
  45918. res.push(hooks[i]);
  45919. }
  45920. }
  45921. return res
  45922. }
  45923. LIFECYCLE_HOOKS.forEach(function (hook) {
  45924. strats[hook] = mergeHook;
  45925. });
  45926. /**
  45927. * Assets
  45928. *
  45929. * When a vm is present (instance creation), we need to do
  45930. * a three-way merge between constructor options, instance
  45931. * options and parent options.
  45932. */
  45933. function mergeAssets (
  45934. parentVal,
  45935. childVal,
  45936. vm,
  45937. key
  45938. ) {
  45939. var res = Object.create(parentVal || null);
  45940. if (childVal) {
  45941. assertObjectType(key, childVal, vm);
  45942. return extend(res, childVal)
  45943. } else {
  45944. return res
  45945. }
  45946. }
  45947. ASSET_TYPES.forEach(function (type) {
  45948. strats[type + 's'] = mergeAssets;
  45949. });
  45950. /**
  45951. * Watchers.
  45952. *
  45953. * Watchers hashes should not overwrite one
  45954. * another, so we merge them as arrays.
  45955. */
  45956. strats.watch = function (
  45957. parentVal,
  45958. childVal,
  45959. vm,
  45960. key
  45961. ) {
  45962. // work around Firefox's Object.prototype.watch...
  45963. if (parentVal === nativeWatch) { parentVal = undefined; }
  45964. if (childVal === nativeWatch) { childVal = undefined; }
  45965. /* istanbul ignore if */
  45966. if (!childVal) { return Object.create(parentVal || null) }
  45967. {
  45968. assertObjectType(key, childVal, vm);
  45969. }
  45970. if (!parentVal) { return childVal }
  45971. var ret = {};
  45972. extend(ret, parentVal);
  45973. for (var key$1 in childVal) {
  45974. var parent = ret[key$1];
  45975. var child = childVal[key$1];
  45976. if (parent && !Array.isArray(parent)) {
  45977. parent = [parent];
  45978. }
  45979. ret[key$1] = parent
  45980. ? parent.concat(child)
  45981. : Array.isArray(child) ? child : [child];
  45982. }
  45983. return ret
  45984. };
  45985. /**
  45986. * Other object hashes.
  45987. */
  45988. strats.props =
  45989. strats.methods =
  45990. strats.inject =
  45991. strats.computed = function (
  45992. parentVal,
  45993. childVal,
  45994. vm,
  45995. key
  45996. ) {
  45997. if (childVal && "development" !== 'production') {
  45998. assertObjectType(key, childVal, vm);
  45999. }
  46000. if (!parentVal) { return childVal }
  46001. var ret = Object.create(null);
  46002. extend(ret, parentVal);
  46003. if (childVal) { extend(ret, childVal); }
  46004. return ret
  46005. };
  46006. strats.provide = mergeDataOrFn;
  46007. /**
  46008. * Default strategy.
  46009. */
  46010. var defaultStrat = function (parentVal, childVal) {
  46011. return childVal === undefined
  46012. ? parentVal
  46013. : childVal
  46014. };
  46015. /**
  46016. * Validate component names
  46017. */
  46018. function checkComponents (options) {
  46019. for (var key in options.components) {
  46020. validateComponentName(key);
  46021. }
  46022. }
  46023. function validateComponentName (name) {
  46024. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  46025. warn(
  46026. 'Invalid component name: "' + name + '". Component names ' +
  46027. 'should conform to valid custom element name in html5 specification.'
  46028. );
  46029. }
  46030. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  46031. warn(
  46032. 'Do not use built-in or reserved HTML elements as component ' +
  46033. 'id: ' + name
  46034. );
  46035. }
  46036. }
  46037. /**
  46038. * Ensure all props option syntax are normalized into the
  46039. * Object-based format.
  46040. */
  46041. function normalizeProps (options, vm) {
  46042. var props = options.props;
  46043. if (!props) { return }
  46044. var res = {};
  46045. var i, val, name;
  46046. if (Array.isArray(props)) {
  46047. i = props.length;
  46048. while (i--) {
  46049. val = props[i];
  46050. if (typeof val === 'string') {
  46051. name = camelize(val);
  46052. res[name] = { type: null };
  46053. } else {
  46054. warn('props must be strings when using array syntax.');
  46055. }
  46056. }
  46057. } else if (isPlainObject(props)) {
  46058. for (var key in props) {
  46059. val = props[key];
  46060. name = camelize(key);
  46061. res[name] = isPlainObject(val)
  46062. ? val
  46063. : { type: val };
  46064. }
  46065. } else {
  46066. warn(
  46067. "Invalid value for option \"props\": expected an Array or an Object, " +
  46068. "but got " + (toRawType(props)) + ".",
  46069. vm
  46070. );
  46071. }
  46072. options.props = res;
  46073. }
  46074. /**
  46075. * Normalize all injections into Object-based format
  46076. */
  46077. function normalizeInject (options, vm) {
  46078. var inject = options.inject;
  46079. if (!inject) { return }
  46080. var normalized = options.inject = {};
  46081. if (Array.isArray(inject)) {
  46082. for (var i = 0; i < inject.length; i++) {
  46083. normalized[inject[i]] = { from: inject[i] };
  46084. }
  46085. } else if (isPlainObject(inject)) {
  46086. for (var key in inject) {
  46087. var val = inject[key];
  46088. normalized[key] = isPlainObject(val)
  46089. ? extend({ from: key }, val)
  46090. : { from: val };
  46091. }
  46092. } else {
  46093. warn(
  46094. "Invalid value for option \"inject\": expected an Array or an Object, " +
  46095. "but got " + (toRawType(inject)) + ".",
  46096. vm
  46097. );
  46098. }
  46099. }
  46100. /**
  46101. * Normalize raw function directives into object format.
  46102. */
  46103. function normalizeDirectives (options) {
  46104. var dirs = options.directives;
  46105. if (dirs) {
  46106. for (var key in dirs) {
  46107. var def$$1 = dirs[key];
  46108. if (typeof def$$1 === 'function') {
  46109. dirs[key] = { bind: def$$1, update: def$$1 };
  46110. }
  46111. }
  46112. }
  46113. }
  46114. function assertObjectType (name, value, vm) {
  46115. if (!isPlainObject(value)) {
  46116. warn(
  46117. "Invalid value for option \"" + name + "\": expected an Object, " +
  46118. "but got " + (toRawType(value)) + ".",
  46119. vm
  46120. );
  46121. }
  46122. }
  46123. /**
  46124. * Merge two option objects into a new one.
  46125. * Core utility used in both instantiation and inheritance.
  46126. */
  46127. function mergeOptions (
  46128. parent,
  46129. child,
  46130. vm
  46131. ) {
  46132. {
  46133. checkComponents(child);
  46134. }
  46135. if (typeof child === 'function') {
  46136. child = child.options;
  46137. }
  46138. normalizeProps(child, vm);
  46139. normalizeInject(child, vm);
  46140. normalizeDirectives(child);
  46141. // Apply extends and mixins on the child options,
  46142. // but only if it is a raw options object that isn't
  46143. // the result of another mergeOptions call.
  46144. // Only merged options has the _base property.
  46145. if (!child._base) {
  46146. if (child.extends) {
  46147. parent = mergeOptions(parent, child.extends, vm);
  46148. }
  46149. if (child.mixins) {
  46150. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46151. parent = mergeOptions(parent, child.mixins[i], vm);
  46152. }
  46153. }
  46154. }
  46155. var options = {};
  46156. var key;
  46157. for (key in parent) {
  46158. mergeField(key);
  46159. }
  46160. for (key in child) {
  46161. if (!hasOwn(parent, key)) {
  46162. mergeField(key);
  46163. }
  46164. }
  46165. function mergeField (key) {
  46166. var strat = strats[key] || defaultStrat;
  46167. options[key] = strat(parent[key], child[key], vm, key);
  46168. }
  46169. return options
  46170. }
  46171. /**
  46172. * Resolve an asset.
  46173. * This function is used because child instances need access
  46174. * to assets defined in its ancestor chain.
  46175. */
  46176. function resolveAsset (
  46177. options,
  46178. type,
  46179. id,
  46180. warnMissing
  46181. ) {
  46182. /* istanbul ignore if */
  46183. if (typeof id !== 'string') {
  46184. return
  46185. }
  46186. var assets = options[type];
  46187. // check local registration variations first
  46188. if (hasOwn(assets, id)) { return assets[id] }
  46189. var camelizedId = camelize(id);
  46190. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46191. var PascalCaseId = capitalize(camelizedId);
  46192. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46193. // fallback to prototype chain
  46194. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46195. if (warnMissing && !res) {
  46196. warn(
  46197. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46198. options
  46199. );
  46200. }
  46201. return res
  46202. }
  46203. /* */
  46204. function validateProp (
  46205. key,
  46206. propOptions,
  46207. propsData,
  46208. vm
  46209. ) {
  46210. var prop = propOptions[key];
  46211. var absent = !hasOwn(propsData, key);
  46212. var value = propsData[key];
  46213. // boolean casting
  46214. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46215. if (booleanIndex > -1) {
  46216. if (absent && !hasOwn(prop, 'default')) {
  46217. value = false;
  46218. } else if (value === '' || value === hyphenate(key)) {
  46219. // only cast empty string / same name to boolean if
  46220. // boolean has higher priority
  46221. var stringIndex = getTypeIndex(String, prop.type);
  46222. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46223. value = true;
  46224. }
  46225. }
  46226. }
  46227. // check default value
  46228. if (value === undefined) {
  46229. value = getPropDefaultValue(vm, prop, key);
  46230. // since the default value is a fresh copy,
  46231. // make sure to observe it.
  46232. var prevShouldObserve = shouldObserve;
  46233. toggleObserving(true);
  46234. observe(value);
  46235. toggleObserving(prevShouldObserve);
  46236. }
  46237. {
  46238. assertProp(prop, key, value, vm, absent);
  46239. }
  46240. return value
  46241. }
  46242. /**
  46243. * Get the default value of a prop.
  46244. */
  46245. function getPropDefaultValue (vm, prop, key) {
  46246. // no default, return undefined
  46247. if (!hasOwn(prop, 'default')) {
  46248. return undefined
  46249. }
  46250. var def = prop.default;
  46251. // warn against non-factory defaults for Object & Array
  46252. if (isObject(def)) {
  46253. warn(
  46254. 'Invalid default value for prop "' + key + '": ' +
  46255. 'Props with type Object/Array must use a factory function ' +
  46256. 'to return the default value.',
  46257. vm
  46258. );
  46259. }
  46260. // the raw prop value was also undefined from previous render,
  46261. // return previous default value to avoid unnecessary watcher trigger
  46262. if (vm && vm.$options.propsData &&
  46263. vm.$options.propsData[key] === undefined &&
  46264. vm._props[key] !== undefined
  46265. ) {
  46266. return vm._props[key]
  46267. }
  46268. // call factory function for non-Function types
  46269. // a value is Function if its prototype is function even across different execution context
  46270. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46271. ? def.call(vm)
  46272. : def
  46273. }
  46274. /**
  46275. * Assert whether a prop is valid.
  46276. */
  46277. function assertProp (
  46278. prop,
  46279. name,
  46280. value,
  46281. vm,
  46282. absent
  46283. ) {
  46284. if (prop.required && absent) {
  46285. warn(
  46286. 'Missing required prop: "' + name + '"',
  46287. vm
  46288. );
  46289. return
  46290. }
  46291. if (value == null && !prop.required) {
  46292. return
  46293. }
  46294. var type = prop.type;
  46295. var valid = !type || type === true;
  46296. var expectedTypes = [];
  46297. if (type) {
  46298. if (!Array.isArray(type)) {
  46299. type = [type];
  46300. }
  46301. for (var i = 0; i < type.length && !valid; i++) {
  46302. var assertedType = assertType(value, type[i]);
  46303. expectedTypes.push(assertedType.expectedType || '');
  46304. valid = assertedType.valid;
  46305. }
  46306. }
  46307. if (!valid) {
  46308. warn(
  46309. getInvalidTypeMessage(name, value, expectedTypes),
  46310. vm
  46311. );
  46312. return
  46313. }
  46314. var validator = prop.validator;
  46315. if (validator) {
  46316. if (!validator(value)) {
  46317. warn(
  46318. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46319. vm
  46320. );
  46321. }
  46322. }
  46323. }
  46324. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46325. function assertType (value, type) {
  46326. var valid;
  46327. var expectedType = getType(type);
  46328. if (simpleCheckRE.test(expectedType)) {
  46329. var t = typeof value;
  46330. valid = t === expectedType.toLowerCase();
  46331. // for primitive wrapper objects
  46332. if (!valid && t === 'object') {
  46333. valid = value instanceof type;
  46334. }
  46335. } else if (expectedType === 'Object') {
  46336. valid = isPlainObject(value);
  46337. } else if (expectedType === 'Array') {
  46338. valid = Array.isArray(value);
  46339. } else {
  46340. valid = value instanceof type;
  46341. }
  46342. return {
  46343. valid: valid,
  46344. expectedType: expectedType
  46345. }
  46346. }
  46347. /**
  46348. * Use function string name to check built-in types,
  46349. * because a simple equality check will fail when running
  46350. * across different vms / iframes.
  46351. */
  46352. function getType (fn) {
  46353. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46354. return match ? match[1] : ''
  46355. }
  46356. function isSameType (a, b) {
  46357. return getType(a) === getType(b)
  46358. }
  46359. function getTypeIndex (type, expectedTypes) {
  46360. if (!Array.isArray(expectedTypes)) {
  46361. return isSameType(expectedTypes, type) ? 0 : -1
  46362. }
  46363. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46364. if (isSameType(expectedTypes[i], type)) {
  46365. return i
  46366. }
  46367. }
  46368. return -1
  46369. }
  46370. function getInvalidTypeMessage (name, value, expectedTypes) {
  46371. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46372. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46373. var expectedType = expectedTypes[0];
  46374. var receivedType = toRawType(value);
  46375. var expectedValue = styleValue(value, expectedType);
  46376. var receivedValue = styleValue(value, receivedType);
  46377. // check if we need to specify expected value
  46378. if (expectedTypes.length === 1 &&
  46379. isExplicable(expectedType) &&
  46380. !isBoolean(expectedType, receivedType)) {
  46381. message += " with value " + expectedValue;
  46382. }
  46383. message += ", got " + receivedType + " ";
  46384. // check if we need to specify received value
  46385. if (isExplicable(receivedType)) {
  46386. message += "with value " + receivedValue + ".";
  46387. }
  46388. return message
  46389. }
  46390. function styleValue (value, type) {
  46391. if (type === 'String') {
  46392. return ("\"" + value + "\"")
  46393. } else if (type === 'Number') {
  46394. return ("" + (Number(value)))
  46395. } else {
  46396. return ("" + value)
  46397. }
  46398. }
  46399. function isExplicable (value) {
  46400. var explicitTypes = ['string', 'number', 'boolean'];
  46401. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46402. }
  46403. function isBoolean () {
  46404. var args = [], len = arguments.length;
  46405. while ( len-- ) args[ len ] = arguments[ len ];
  46406. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46407. }
  46408. /* */
  46409. function handleError (err, vm, info) {
  46410. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46411. // See: https://github.com/vuejs/vuex/issues/1505
  46412. pushTarget();
  46413. try {
  46414. if (vm) {
  46415. var cur = vm;
  46416. while ((cur = cur.$parent)) {
  46417. var hooks = cur.$options.errorCaptured;
  46418. if (hooks) {
  46419. for (var i = 0; i < hooks.length; i++) {
  46420. try {
  46421. var capture = hooks[i].call(cur, err, vm, info) === false;
  46422. if (capture) { return }
  46423. } catch (e) {
  46424. globalHandleError(e, cur, 'errorCaptured hook');
  46425. }
  46426. }
  46427. }
  46428. }
  46429. }
  46430. globalHandleError(err, vm, info);
  46431. } finally {
  46432. popTarget();
  46433. }
  46434. }
  46435. function invokeWithErrorHandling (
  46436. handler,
  46437. context,
  46438. args,
  46439. vm,
  46440. info
  46441. ) {
  46442. var res;
  46443. try {
  46444. res = args ? handler.apply(context, args) : handler.call(context);
  46445. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46446. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46447. // issue #9511
  46448. // avoid catch triggering multiple times when nested calls
  46449. res._handled = true;
  46450. }
  46451. } catch (e) {
  46452. handleError(e, vm, info);
  46453. }
  46454. return res
  46455. }
  46456. function globalHandleError (err, vm, info) {
  46457. if (config.errorHandler) {
  46458. try {
  46459. return config.errorHandler.call(null, err, vm, info)
  46460. } catch (e) {
  46461. // if the user intentionally throws the original error in the handler,
  46462. // do not log it twice
  46463. if (e !== err) {
  46464. logError(e, null, 'config.errorHandler');
  46465. }
  46466. }
  46467. }
  46468. logError(err, vm, info);
  46469. }
  46470. function logError (err, vm, info) {
  46471. {
  46472. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46473. }
  46474. /* istanbul ignore else */
  46475. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46476. console.error(err);
  46477. } else {
  46478. throw err
  46479. }
  46480. }
  46481. /* */
  46482. var isUsingMicroTask = false;
  46483. var callbacks = [];
  46484. var pending = false;
  46485. function flushCallbacks () {
  46486. pending = false;
  46487. var copies = callbacks.slice(0);
  46488. callbacks.length = 0;
  46489. for (var i = 0; i < copies.length; i++) {
  46490. copies[i]();
  46491. }
  46492. }
  46493. // Here we have async deferring wrappers using microtasks.
  46494. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46495. // However, it has subtle problems when state is changed right before repaint
  46496. // (e.g. #6813, out-in transitions).
  46497. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46498. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46499. // So we now use microtasks everywhere, again.
  46500. // A major drawback of this tradeoff is that there are some scenarios
  46501. // where microtasks have too high a priority and fire in between supposedly
  46502. // sequential events (e.g. #4521, #6690, which have workarounds)
  46503. // or even between bubbling of the same event (#6566).
  46504. var timerFunc;
  46505. // The nextTick behavior leverages the microtask queue, which can be accessed
  46506. // via either native Promise.then or MutationObserver.
  46507. // MutationObserver has wider support, however it is seriously bugged in
  46508. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46509. // completely stops working after triggering a few times... so, if native
  46510. // Promise is available, we will use it:
  46511. /* istanbul ignore next, $flow-disable-line */
  46512. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46513. var p = Promise.resolve();
  46514. timerFunc = function () {
  46515. p.then(flushCallbacks);
  46516. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46517. // it can get stuck in a weird state where callbacks are pushed into the
  46518. // microtask queue but the queue isn't being flushed, until the browser
  46519. // needs to do some other work, e.g. handle a timer. Therefore we can
  46520. // "force" the microtask queue to be flushed by adding an empty timer.
  46521. if (isIOS) { setTimeout(noop); }
  46522. };
  46523. isUsingMicroTask = true;
  46524. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46525. isNative(MutationObserver) ||
  46526. // PhantomJS and iOS 7.x
  46527. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46528. )) {
  46529. // Use MutationObserver where native Promise is not available,
  46530. // e.g. PhantomJS, iOS7, Android 4.4
  46531. // (#6466 MutationObserver is unreliable in IE11)
  46532. var counter = 1;
  46533. var observer = new MutationObserver(flushCallbacks);
  46534. var textNode = document.createTextNode(String(counter));
  46535. observer.observe(textNode, {
  46536. characterData: true
  46537. });
  46538. timerFunc = function () {
  46539. counter = (counter + 1) % 2;
  46540. textNode.data = String(counter);
  46541. };
  46542. isUsingMicroTask = true;
  46543. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46544. // Fallback to setImmediate.
  46545. // Technically it leverages the (macro) task queue,
  46546. // but it is still a better choice than setTimeout.
  46547. timerFunc = function () {
  46548. setImmediate(flushCallbacks);
  46549. };
  46550. } else {
  46551. // Fallback to setTimeout.
  46552. timerFunc = function () {
  46553. setTimeout(flushCallbacks, 0);
  46554. };
  46555. }
  46556. function nextTick (cb, ctx) {
  46557. var _resolve;
  46558. callbacks.push(function () {
  46559. if (cb) {
  46560. try {
  46561. cb.call(ctx);
  46562. } catch (e) {
  46563. handleError(e, ctx, 'nextTick');
  46564. }
  46565. } else if (_resolve) {
  46566. _resolve(ctx);
  46567. }
  46568. });
  46569. if (!pending) {
  46570. pending = true;
  46571. timerFunc();
  46572. }
  46573. // $flow-disable-line
  46574. if (!cb && typeof Promise !== 'undefined') {
  46575. return new Promise(function (resolve) {
  46576. _resolve = resolve;
  46577. })
  46578. }
  46579. }
  46580. /* */
  46581. var mark;
  46582. var measure;
  46583. {
  46584. var perf = inBrowser && window.performance;
  46585. /* istanbul ignore if */
  46586. if (
  46587. perf &&
  46588. perf.mark &&
  46589. perf.measure &&
  46590. perf.clearMarks &&
  46591. perf.clearMeasures
  46592. ) {
  46593. mark = function (tag) { return perf.mark(tag); };
  46594. measure = function (name, startTag, endTag) {
  46595. perf.measure(name, startTag, endTag);
  46596. perf.clearMarks(startTag);
  46597. perf.clearMarks(endTag);
  46598. // perf.clearMeasures(name)
  46599. };
  46600. }
  46601. }
  46602. /* not type checking this file because flow doesn't play well with Proxy */
  46603. var initProxy;
  46604. {
  46605. var allowedGlobals = makeMap(
  46606. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46607. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46608. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46609. 'require' // for Webpack/Browserify
  46610. );
  46611. var warnNonPresent = function (target, key) {
  46612. warn(
  46613. "Property or method \"" + key + "\" is not defined on the instance but " +
  46614. 'referenced during render. Make sure that this property is reactive, ' +
  46615. 'either in the data option, or for class-based components, by ' +
  46616. 'initializing the property. ' +
  46617. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46618. target
  46619. );
  46620. };
  46621. var warnReservedPrefix = function (target, key) {
  46622. warn(
  46623. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46624. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46625. 'prevent conflicts with Vue internals. ' +
  46626. 'See: https://vuejs.org/v2/api/#data',
  46627. target
  46628. );
  46629. };
  46630. var hasProxy =
  46631. typeof Proxy !== 'undefined' && isNative(Proxy);
  46632. if (hasProxy) {
  46633. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46634. config.keyCodes = new Proxy(config.keyCodes, {
  46635. set: function set (target, key, value) {
  46636. if (isBuiltInModifier(key)) {
  46637. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46638. return false
  46639. } else {
  46640. target[key] = value;
  46641. return true
  46642. }
  46643. }
  46644. });
  46645. }
  46646. var hasHandler = {
  46647. has: function has (target, key) {
  46648. var has = key in target;
  46649. var isAllowed = allowedGlobals(key) ||
  46650. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46651. if (!has && !isAllowed) {
  46652. if (key in target.$data) { warnReservedPrefix(target, key); }
  46653. else { warnNonPresent(target, key); }
  46654. }
  46655. return has || !isAllowed
  46656. }
  46657. };
  46658. var getHandler = {
  46659. get: function get (target, key) {
  46660. if (typeof key === 'string' && !(key in target)) {
  46661. if (key in target.$data) { warnReservedPrefix(target, key); }
  46662. else { warnNonPresent(target, key); }
  46663. }
  46664. return target[key]
  46665. }
  46666. };
  46667. initProxy = function initProxy (vm) {
  46668. if (hasProxy) {
  46669. // determine which proxy handler to use
  46670. var options = vm.$options;
  46671. var handlers = options.render && options.render._withStripped
  46672. ? getHandler
  46673. : hasHandler;
  46674. vm._renderProxy = new Proxy(vm, handlers);
  46675. } else {
  46676. vm._renderProxy = vm;
  46677. }
  46678. };
  46679. }
  46680. /* */
  46681. var seenObjects = new _Set();
  46682. /**
  46683. * Recursively traverse an object to evoke all converted
  46684. * getters, so that every nested property inside the object
  46685. * is collected as a "deep" dependency.
  46686. */
  46687. function traverse (val) {
  46688. _traverse(val, seenObjects);
  46689. seenObjects.clear();
  46690. }
  46691. function _traverse (val, seen) {
  46692. var i, keys;
  46693. var isA = Array.isArray(val);
  46694. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46695. return
  46696. }
  46697. if (val.__ob__) {
  46698. var depId = val.__ob__.dep.id;
  46699. if (seen.has(depId)) {
  46700. return
  46701. }
  46702. seen.add(depId);
  46703. }
  46704. if (isA) {
  46705. i = val.length;
  46706. while (i--) { _traverse(val[i], seen); }
  46707. } else {
  46708. keys = Object.keys(val);
  46709. i = keys.length;
  46710. while (i--) { _traverse(val[keys[i]], seen); }
  46711. }
  46712. }
  46713. /* */
  46714. var normalizeEvent = cached(function (name) {
  46715. var passive = name.charAt(0) === '&';
  46716. name = passive ? name.slice(1) : name;
  46717. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46718. name = once$$1 ? name.slice(1) : name;
  46719. var capture = name.charAt(0) === '!';
  46720. name = capture ? name.slice(1) : name;
  46721. return {
  46722. name: name,
  46723. once: once$$1,
  46724. capture: capture,
  46725. passive: passive
  46726. }
  46727. });
  46728. function createFnInvoker (fns, vm) {
  46729. function invoker () {
  46730. var arguments$1 = arguments;
  46731. var fns = invoker.fns;
  46732. if (Array.isArray(fns)) {
  46733. var cloned = fns.slice();
  46734. for (var i = 0; i < cloned.length; i++) {
  46735. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46736. }
  46737. } else {
  46738. // return handler return value for single handlers
  46739. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46740. }
  46741. }
  46742. invoker.fns = fns;
  46743. return invoker
  46744. }
  46745. function updateListeners (
  46746. on,
  46747. oldOn,
  46748. add,
  46749. remove$$1,
  46750. createOnceHandler,
  46751. vm
  46752. ) {
  46753. var name, def$$1, cur, old, event;
  46754. for (name in on) {
  46755. def$$1 = cur = on[name];
  46756. old = oldOn[name];
  46757. event = normalizeEvent(name);
  46758. if (isUndef(cur)) {
  46759. warn(
  46760. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46761. vm
  46762. );
  46763. } else if (isUndef(old)) {
  46764. if (isUndef(cur.fns)) {
  46765. cur = on[name] = createFnInvoker(cur, vm);
  46766. }
  46767. if (isTrue(event.once)) {
  46768. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46769. }
  46770. add(event.name, cur, event.capture, event.passive, event.params);
  46771. } else if (cur !== old) {
  46772. old.fns = cur;
  46773. on[name] = old;
  46774. }
  46775. }
  46776. for (name in oldOn) {
  46777. if (isUndef(on[name])) {
  46778. event = normalizeEvent(name);
  46779. remove$$1(event.name, oldOn[name], event.capture);
  46780. }
  46781. }
  46782. }
  46783. /* */
  46784. function mergeVNodeHook (def, hookKey, hook) {
  46785. if (def instanceof VNode) {
  46786. def = def.data.hook || (def.data.hook = {});
  46787. }
  46788. var invoker;
  46789. var oldHook = def[hookKey];
  46790. function wrappedHook () {
  46791. hook.apply(this, arguments);
  46792. // important: remove merged hook to ensure it's called only once
  46793. // and prevent memory leak
  46794. remove(invoker.fns, wrappedHook);
  46795. }
  46796. if (isUndef(oldHook)) {
  46797. // no existing hook
  46798. invoker = createFnInvoker([wrappedHook]);
  46799. } else {
  46800. /* istanbul ignore if */
  46801. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46802. // already a merged invoker
  46803. invoker = oldHook;
  46804. invoker.fns.push(wrappedHook);
  46805. } else {
  46806. // existing plain hook
  46807. invoker = createFnInvoker([oldHook, wrappedHook]);
  46808. }
  46809. }
  46810. invoker.merged = true;
  46811. def[hookKey] = invoker;
  46812. }
  46813. /* */
  46814. function extractPropsFromVNodeData (
  46815. data,
  46816. Ctor,
  46817. tag
  46818. ) {
  46819. // we are only extracting raw values here.
  46820. // validation and default values are handled in the child
  46821. // component itself.
  46822. var propOptions = Ctor.options.props;
  46823. if (isUndef(propOptions)) {
  46824. return
  46825. }
  46826. var res = {};
  46827. var attrs = data.attrs;
  46828. var props = data.props;
  46829. if (isDef(attrs) || isDef(props)) {
  46830. for (var key in propOptions) {
  46831. var altKey = hyphenate(key);
  46832. {
  46833. var keyInLowerCase = key.toLowerCase();
  46834. if (
  46835. key !== keyInLowerCase &&
  46836. attrs && hasOwn(attrs, keyInLowerCase)
  46837. ) {
  46838. tip(
  46839. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46840. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46841. " \"" + key + "\". " +
  46842. "Note that HTML attributes are case-insensitive and camelCased " +
  46843. "props need to use their kebab-case equivalents when using in-DOM " +
  46844. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46845. );
  46846. }
  46847. }
  46848. checkProp(res, props, key, altKey, true) ||
  46849. checkProp(res, attrs, key, altKey, false);
  46850. }
  46851. }
  46852. return res
  46853. }
  46854. function checkProp (
  46855. res,
  46856. hash,
  46857. key,
  46858. altKey,
  46859. preserve
  46860. ) {
  46861. if (isDef(hash)) {
  46862. if (hasOwn(hash, key)) {
  46863. res[key] = hash[key];
  46864. if (!preserve) {
  46865. delete hash[key];
  46866. }
  46867. return true
  46868. } else if (hasOwn(hash, altKey)) {
  46869. res[key] = hash[altKey];
  46870. if (!preserve) {
  46871. delete hash[altKey];
  46872. }
  46873. return true
  46874. }
  46875. }
  46876. return false
  46877. }
  46878. /* */
  46879. // The template compiler attempts to minimize the need for normalization by
  46880. // statically analyzing the template at compile time.
  46881. //
  46882. // For plain HTML markup, normalization can be completely skipped because the
  46883. // generated render function is guaranteed to return Array<VNode>. There are
  46884. // two cases where extra normalization is needed:
  46885. // 1. When the children contains components - because a functional component
  46886. // may return an Array instead of a single root. In this case, just a simple
  46887. // normalization is needed - if any child is an Array, we flatten the whole
  46888. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46889. // because functional components already normalize their own children.
  46890. function simpleNormalizeChildren (children) {
  46891. for (var i = 0; i < children.length; i++) {
  46892. if (Array.isArray(children[i])) {
  46893. return Array.prototype.concat.apply([], children)
  46894. }
  46895. }
  46896. return children
  46897. }
  46898. // 2. When the children contains constructs that always generated nested Arrays,
  46899. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46900. // with hand-written render functions / JSX. In such cases a full normalization
  46901. // is needed to cater to all possible types of children values.
  46902. function normalizeChildren (children) {
  46903. return isPrimitive(children)
  46904. ? [createTextVNode(children)]
  46905. : Array.isArray(children)
  46906. ? normalizeArrayChildren(children)
  46907. : undefined
  46908. }
  46909. function isTextNode (node) {
  46910. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46911. }
  46912. function normalizeArrayChildren (children, nestedIndex) {
  46913. var res = [];
  46914. var i, c, lastIndex, last;
  46915. for (i = 0; i < children.length; i++) {
  46916. c = children[i];
  46917. if (isUndef(c) || typeof c === 'boolean') { continue }
  46918. lastIndex = res.length - 1;
  46919. last = res[lastIndex];
  46920. // nested
  46921. if (Array.isArray(c)) {
  46922. if (c.length > 0) {
  46923. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46924. // merge adjacent text nodes
  46925. if (isTextNode(c[0]) && isTextNode(last)) {
  46926. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46927. c.shift();
  46928. }
  46929. res.push.apply(res, c);
  46930. }
  46931. } else if (isPrimitive(c)) {
  46932. if (isTextNode(last)) {
  46933. // merge adjacent text nodes
  46934. // this is necessary for SSR hydration because text nodes are
  46935. // essentially merged when rendered to HTML strings
  46936. res[lastIndex] = createTextVNode(last.text + c);
  46937. } else if (c !== '') {
  46938. // convert primitive to vnode
  46939. res.push(createTextVNode(c));
  46940. }
  46941. } else {
  46942. if (isTextNode(c) && isTextNode(last)) {
  46943. // merge adjacent text nodes
  46944. res[lastIndex] = createTextVNode(last.text + c.text);
  46945. } else {
  46946. // default key for nested array children (likely generated by v-for)
  46947. if (isTrue(children._isVList) &&
  46948. isDef(c.tag) &&
  46949. isUndef(c.key) &&
  46950. isDef(nestedIndex)) {
  46951. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46952. }
  46953. res.push(c);
  46954. }
  46955. }
  46956. }
  46957. return res
  46958. }
  46959. /* */
  46960. function initProvide (vm) {
  46961. var provide = vm.$options.provide;
  46962. if (provide) {
  46963. vm._provided = typeof provide === 'function'
  46964. ? provide.call(vm)
  46965. : provide;
  46966. }
  46967. }
  46968. function initInjections (vm) {
  46969. var result = resolveInject(vm.$options.inject, vm);
  46970. if (result) {
  46971. toggleObserving(false);
  46972. Object.keys(result).forEach(function (key) {
  46973. /* istanbul ignore else */
  46974. {
  46975. defineReactive$$1(vm, key, result[key], function () {
  46976. warn(
  46977. "Avoid mutating an injected value directly since the changes will be " +
  46978. "overwritten whenever the provided component re-renders. " +
  46979. "injection being mutated: \"" + key + "\"",
  46980. vm
  46981. );
  46982. });
  46983. }
  46984. });
  46985. toggleObserving(true);
  46986. }
  46987. }
  46988. function resolveInject (inject, vm) {
  46989. if (inject) {
  46990. // inject is :any because flow is not smart enough to figure out cached
  46991. var result = Object.create(null);
  46992. var keys = hasSymbol
  46993. ? Reflect.ownKeys(inject)
  46994. : Object.keys(inject);
  46995. for (var i = 0; i < keys.length; i++) {
  46996. var key = keys[i];
  46997. // #6574 in case the inject object is observed...
  46998. if (key === '__ob__') { continue }
  46999. var provideKey = inject[key].from;
  47000. var source = vm;
  47001. while (source) {
  47002. if (source._provided && hasOwn(source._provided, provideKey)) {
  47003. result[key] = source._provided[provideKey];
  47004. break
  47005. }
  47006. source = source.$parent;
  47007. }
  47008. if (!source) {
  47009. if ('default' in inject[key]) {
  47010. var provideDefault = inject[key].default;
  47011. result[key] = typeof provideDefault === 'function'
  47012. ? provideDefault.call(vm)
  47013. : provideDefault;
  47014. } else {
  47015. warn(("Injection \"" + key + "\" not found"), vm);
  47016. }
  47017. }
  47018. }
  47019. return result
  47020. }
  47021. }
  47022. /* */
  47023. /**
  47024. * Runtime helper for resolving raw children VNodes into a slot object.
  47025. */
  47026. function resolveSlots (
  47027. children,
  47028. context
  47029. ) {
  47030. if (!children || !children.length) {
  47031. return {}
  47032. }
  47033. var slots = {};
  47034. for (var i = 0, l = children.length; i < l; i++) {
  47035. var child = children[i];
  47036. var data = child.data;
  47037. // remove slot attribute if the node is resolved as a Vue slot node
  47038. if (data && data.attrs && data.attrs.slot) {
  47039. delete data.attrs.slot;
  47040. }
  47041. // named slots should only be respected if the vnode was rendered in the
  47042. // same context.
  47043. if ((child.context === context || child.fnContext === context) &&
  47044. data && data.slot != null
  47045. ) {
  47046. var name = data.slot;
  47047. var slot = (slots[name] || (slots[name] = []));
  47048. if (child.tag === 'template') {
  47049. slot.push.apply(slot, child.children || []);
  47050. } else {
  47051. slot.push(child);
  47052. }
  47053. } else {
  47054. (slots.default || (slots.default = [])).push(child);
  47055. }
  47056. }
  47057. // ignore slots that contains only whitespace
  47058. for (var name$1 in slots) {
  47059. if (slots[name$1].every(isWhitespace)) {
  47060. delete slots[name$1];
  47061. }
  47062. }
  47063. return slots
  47064. }
  47065. function isWhitespace (node) {
  47066. return (node.isComment && !node.asyncFactory) || node.text === ' '
  47067. }
  47068. /* */
  47069. function normalizeScopedSlots (
  47070. slots,
  47071. normalSlots,
  47072. prevSlots
  47073. ) {
  47074. var res;
  47075. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  47076. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  47077. var key = slots && slots.$key;
  47078. if (!slots) {
  47079. res = {};
  47080. } else if (slots._normalized) {
  47081. // fast path 1: child component re-render only, parent did not change
  47082. return slots._normalized
  47083. } else if (
  47084. isStable &&
  47085. prevSlots &&
  47086. prevSlots !== emptyObject &&
  47087. key === prevSlots.$key &&
  47088. !hasNormalSlots &&
  47089. !prevSlots.$hasNormal
  47090. ) {
  47091. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  47092. // only need to normalize once
  47093. return prevSlots
  47094. } else {
  47095. res = {};
  47096. for (var key$1 in slots) {
  47097. if (slots[key$1] && key$1[0] !== '$') {
  47098. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  47099. }
  47100. }
  47101. }
  47102. // expose normal slots on scopedSlots
  47103. for (var key$2 in normalSlots) {
  47104. if (!(key$2 in res)) {
  47105. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  47106. }
  47107. }
  47108. // avoriaz seems to mock a non-extensible $scopedSlots object
  47109. // and when that is passed down this would cause an error
  47110. if (slots && Object.isExtensible(slots)) {
  47111. (slots)._normalized = res;
  47112. }
  47113. def(res, '$stable', isStable);
  47114. def(res, '$key', key);
  47115. def(res, '$hasNormal', hasNormalSlots);
  47116. return res
  47117. }
  47118. function normalizeScopedSlot(normalSlots, key, fn) {
  47119. var normalized = function () {
  47120. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47121. res = res && typeof res === 'object' && !Array.isArray(res)
  47122. ? [res] // single vnode
  47123. : normalizeChildren(res);
  47124. return res && (
  47125. res.length === 0 ||
  47126. (res.length === 1 && res[0].isComment) // #9658
  47127. ) ? undefined
  47128. : res
  47129. };
  47130. // this is a slot using the new v-slot syntax without scope. although it is
  47131. // compiled as a scoped slot, render fn users would expect it to be present
  47132. // on this.$slots because the usage is semantically a normal slot.
  47133. if (fn.proxy) {
  47134. Object.defineProperty(normalSlots, key, {
  47135. get: normalized,
  47136. enumerable: true,
  47137. configurable: true
  47138. });
  47139. }
  47140. return normalized
  47141. }
  47142. function proxyNormalSlot(slots, key) {
  47143. return function () { return slots[key]; }
  47144. }
  47145. /* */
  47146. /**
  47147. * Runtime helper for rendering v-for lists.
  47148. */
  47149. function renderList (
  47150. val,
  47151. render
  47152. ) {
  47153. var ret, i, l, keys, key;
  47154. if (Array.isArray(val) || typeof val === 'string') {
  47155. ret = new Array(val.length);
  47156. for (i = 0, l = val.length; i < l; i++) {
  47157. ret[i] = render(val[i], i);
  47158. }
  47159. } else if (typeof val === 'number') {
  47160. ret = new Array(val);
  47161. for (i = 0; i < val; i++) {
  47162. ret[i] = render(i + 1, i);
  47163. }
  47164. } else if (isObject(val)) {
  47165. if (hasSymbol && val[Symbol.iterator]) {
  47166. ret = [];
  47167. var iterator = val[Symbol.iterator]();
  47168. var result = iterator.next();
  47169. while (!result.done) {
  47170. ret.push(render(result.value, ret.length));
  47171. result = iterator.next();
  47172. }
  47173. } else {
  47174. keys = Object.keys(val);
  47175. ret = new Array(keys.length);
  47176. for (i = 0, l = keys.length; i < l; i++) {
  47177. key = keys[i];
  47178. ret[i] = render(val[key], key, i);
  47179. }
  47180. }
  47181. }
  47182. if (!isDef(ret)) {
  47183. ret = [];
  47184. }
  47185. (ret)._isVList = true;
  47186. return ret
  47187. }
  47188. /* */
  47189. /**
  47190. * Runtime helper for rendering <slot>
  47191. */
  47192. function renderSlot (
  47193. name,
  47194. fallback,
  47195. props,
  47196. bindObject
  47197. ) {
  47198. var scopedSlotFn = this.$scopedSlots[name];
  47199. var nodes;
  47200. if (scopedSlotFn) { // scoped slot
  47201. props = props || {};
  47202. if (bindObject) {
  47203. if (!isObject(bindObject)) {
  47204. warn(
  47205. 'slot v-bind without argument expects an Object',
  47206. this
  47207. );
  47208. }
  47209. props = extend(extend({}, bindObject), props);
  47210. }
  47211. nodes = scopedSlotFn(props) || fallback;
  47212. } else {
  47213. nodes = this.$slots[name] || fallback;
  47214. }
  47215. var target = props && props.slot;
  47216. if (target) {
  47217. return this.$createElement('template', { slot: target }, nodes)
  47218. } else {
  47219. return nodes
  47220. }
  47221. }
  47222. /* */
  47223. /**
  47224. * Runtime helper for resolving filters
  47225. */
  47226. function resolveFilter (id) {
  47227. return resolveAsset(this.$options, 'filters', id, true) || identity
  47228. }
  47229. /* */
  47230. function isKeyNotMatch (expect, actual) {
  47231. if (Array.isArray(expect)) {
  47232. return expect.indexOf(actual) === -1
  47233. } else {
  47234. return expect !== actual
  47235. }
  47236. }
  47237. /**
  47238. * Runtime helper for checking keyCodes from config.
  47239. * exposed as Vue.prototype._k
  47240. * passing in eventKeyName as last argument separately for backwards compat
  47241. */
  47242. function checkKeyCodes (
  47243. eventKeyCode,
  47244. key,
  47245. builtInKeyCode,
  47246. eventKeyName,
  47247. builtInKeyName
  47248. ) {
  47249. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47250. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47251. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47252. } else if (mappedKeyCode) {
  47253. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47254. } else if (eventKeyName) {
  47255. return hyphenate(eventKeyName) !== key
  47256. }
  47257. }
  47258. /* */
  47259. /**
  47260. * Runtime helper for merging v-bind="object" into a VNode's data.
  47261. */
  47262. function bindObjectProps (
  47263. data,
  47264. tag,
  47265. value,
  47266. asProp,
  47267. isSync
  47268. ) {
  47269. if (value) {
  47270. if (!isObject(value)) {
  47271. warn(
  47272. 'v-bind without argument expects an Object or Array value',
  47273. this
  47274. );
  47275. } else {
  47276. if (Array.isArray(value)) {
  47277. value = toObject(value);
  47278. }
  47279. var hash;
  47280. var loop = function ( key ) {
  47281. if (
  47282. key === 'class' ||
  47283. key === 'style' ||
  47284. isReservedAttribute(key)
  47285. ) {
  47286. hash = data;
  47287. } else {
  47288. var type = data.attrs && data.attrs.type;
  47289. hash = asProp || config.mustUseProp(tag, type, key)
  47290. ? data.domProps || (data.domProps = {})
  47291. : data.attrs || (data.attrs = {});
  47292. }
  47293. var camelizedKey = camelize(key);
  47294. var hyphenatedKey = hyphenate(key);
  47295. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47296. hash[key] = value[key];
  47297. if (isSync) {
  47298. var on = data.on || (data.on = {});
  47299. on[("update:" + key)] = function ($event) {
  47300. value[key] = $event;
  47301. };
  47302. }
  47303. }
  47304. };
  47305. for (var key in value) loop( key );
  47306. }
  47307. }
  47308. return data
  47309. }
  47310. /* */
  47311. /**
  47312. * Runtime helper for rendering static trees.
  47313. */
  47314. function renderStatic (
  47315. index,
  47316. isInFor
  47317. ) {
  47318. var cached = this._staticTrees || (this._staticTrees = []);
  47319. var tree = cached[index];
  47320. // if has already-rendered static tree and not inside v-for,
  47321. // we can reuse the same tree.
  47322. if (tree && !isInFor) {
  47323. return tree
  47324. }
  47325. // otherwise, render a fresh tree.
  47326. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47327. this._renderProxy,
  47328. null,
  47329. this // for render fns generated for functional component templates
  47330. );
  47331. markStatic(tree, ("__static__" + index), false);
  47332. return tree
  47333. }
  47334. /**
  47335. * Runtime helper for v-once.
  47336. * Effectively it means marking the node as static with a unique key.
  47337. */
  47338. function markOnce (
  47339. tree,
  47340. index,
  47341. key
  47342. ) {
  47343. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47344. return tree
  47345. }
  47346. function markStatic (
  47347. tree,
  47348. key,
  47349. isOnce
  47350. ) {
  47351. if (Array.isArray(tree)) {
  47352. for (var i = 0; i < tree.length; i++) {
  47353. if (tree[i] && typeof tree[i] !== 'string') {
  47354. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47355. }
  47356. }
  47357. } else {
  47358. markStaticNode(tree, key, isOnce);
  47359. }
  47360. }
  47361. function markStaticNode (node, key, isOnce) {
  47362. node.isStatic = true;
  47363. node.key = key;
  47364. node.isOnce = isOnce;
  47365. }
  47366. /* */
  47367. function bindObjectListeners (data, value) {
  47368. if (value) {
  47369. if (!isPlainObject(value)) {
  47370. warn(
  47371. 'v-on without argument expects an Object value',
  47372. this
  47373. );
  47374. } else {
  47375. var on = data.on = data.on ? extend({}, data.on) : {};
  47376. for (var key in value) {
  47377. var existing = on[key];
  47378. var ours = value[key];
  47379. on[key] = existing ? [].concat(existing, ours) : ours;
  47380. }
  47381. }
  47382. }
  47383. return data
  47384. }
  47385. /* */
  47386. function resolveScopedSlots (
  47387. fns, // see flow/vnode
  47388. res,
  47389. // the following are added in 2.6
  47390. hasDynamicKeys,
  47391. contentHashKey
  47392. ) {
  47393. res = res || { $stable: !hasDynamicKeys };
  47394. for (var i = 0; i < fns.length; i++) {
  47395. var slot = fns[i];
  47396. if (Array.isArray(slot)) {
  47397. resolveScopedSlots(slot, res, hasDynamicKeys);
  47398. } else if (slot) {
  47399. // marker for reverse proxying v-slot without scope on this.$slots
  47400. if (slot.proxy) {
  47401. slot.fn.proxy = true;
  47402. }
  47403. res[slot.key] = slot.fn;
  47404. }
  47405. }
  47406. if (contentHashKey) {
  47407. (res).$key = contentHashKey;
  47408. }
  47409. return res
  47410. }
  47411. /* */
  47412. function bindDynamicKeys (baseObj, values) {
  47413. for (var i = 0; i < values.length; i += 2) {
  47414. var key = values[i];
  47415. if (typeof key === 'string' && key) {
  47416. baseObj[values[i]] = values[i + 1];
  47417. } else if (key !== '' && key !== null) {
  47418. // null is a special value for explicitly removing a binding
  47419. warn(
  47420. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47421. this
  47422. );
  47423. }
  47424. }
  47425. return baseObj
  47426. }
  47427. // helper to dynamically append modifier runtime markers to event names.
  47428. // ensure only append when value is already string, otherwise it will be cast
  47429. // to string and cause the type check to miss.
  47430. function prependModifier (value, symbol) {
  47431. return typeof value === 'string' ? symbol + value : value
  47432. }
  47433. /* */
  47434. function installRenderHelpers (target) {
  47435. target._o = markOnce;
  47436. target._n = toNumber;
  47437. target._s = toString;
  47438. target._l = renderList;
  47439. target._t = renderSlot;
  47440. target._q = looseEqual;
  47441. target._i = looseIndexOf;
  47442. target._m = renderStatic;
  47443. target._f = resolveFilter;
  47444. target._k = checkKeyCodes;
  47445. target._b = bindObjectProps;
  47446. target._v = createTextVNode;
  47447. target._e = createEmptyVNode;
  47448. target._u = resolveScopedSlots;
  47449. target._g = bindObjectListeners;
  47450. target._d = bindDynamicKeys;
  47451. target._p = prependModifier;
  47452. }
  47453. /* */
  47454. function FunctionalRenderContext (
  47455. data,
  47456. props,
  47457. children,
  47458. parent,
  47459. Ctor
  47460. ) {
  47461. var this$1 = this;
  47462. var options = Ctor.options;
  47463. // ensure the createElement function in functional components
  47464. // gets a unique context - this is necessary for correct named slot check
  47465. var contextVm;
  47466. if (hasOwn(parent, '_uid')) {
  47467. contextVm = Object.create(parent);
  47468. // $flow-disable-line
  47469. contextVm._original = parent;
  47470. } else {
  47471. // the context vm passed in is a functional context as well.
  47472. // in this case we want to make sure we are able to get a hold to the
  47473. // real context instance.
  47474. contextVm = parent;
  47475. // $flow-disable-line
  47476. parent = parent._original;
  47477. }
  47478. var isCompiled = isTrue(options._compiled);
  47479. var needNormalization = !isCompiled;
  47480. this.data = data;
  47481. this.props = props;
  47482. this.children = children;
  47483. this.parent = parent;
  47484. this.listeners = data.on || emptyObject;
  47485. this.injections = resolveInject(options.inject, parent);
  47486. this.slots = function () {
  47487. if (!this$1.$slots) {
  47488. normalizeScopedSlots(
  47489. data.scopedSlots,
  47490. this$1.$slots = resolveSlots(children, parent)
  47491. );
  47492. }
  47493. return this$1.$slots
  47494. };
  47495. Object.defineProperty(this, 'scopedSlots', ({
  47496. enumerable: true,
  47497. get: function get () {
  47498. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47499. }
  47500. }));
  47501. // support for compiled functional template
  47502. if (isCompiled) {
  47503. // exposing $options for renderStatic()
  47504. this.$options = options;
  47505. // pre-resolve slots for renderSlot()
  47506. this.$slots = this.slots();
  47507. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47508. }
  47509. if (options._scopeId) {
  47510. this._c = function (a, b, c, d) {
  47511. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47512. if (vnode && !Array.isArray(vnode)) {
  47513. vnode.fnScopeId = options._scopeId;
  47514. vnode.fnContext = parent;
  47515. }
  47516. return vnode
  47517. };
  47518. } else {
  47519. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47520. }
  47521. }
  47522. installRenderHelpers(FunctionalRenderContext.prototype);
  47523. function createFunctionalComponent (
  47524. Ctor,
  47525. propsData,
  47526. data,
  47527. contextVm,
  47528. children
  47529. ) {
  47530. var options = Ctor.options;
  47531. var props = {};
  47532. var propOptions = options.props;
  47533. if (isDef(propOptions)) {
  47534. for (var key in propOptions) {
  47535. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47536. }
  47537. } else {
  47538. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47539. if (isDef(data.props)) { mergeProps(props, data.props); }
  47540. }
  47541. var renderContext = new FunctionalRenderContext(
  47542. data,
  47543. props,
  47544. children,
  47545. contextVm,
  47546. Ctor
  47547. );
  47548. var vnode = options.render.call(null, renderContext._c, renderContext);
  47549. if (vnode instanceof VNode) {
  47550. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47551. } else if (Array.isArray(vnode)) {
  47552. var vnodes = normalizeChildren(vnode) || [];
  47553. var res = new Array(vnodes.length);
  47554. for (var i = 0; i < vnodes.length; i++) {
  47555. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47556. }
  47557. return res
  47558. }
  47559. }
  47560. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47561. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47562. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47563. // that should not be matched to match.
  47564. var clone = cloneVNode(vnode);
  47565. clone.fnContext = contextVm;
  47566. clone.fnOptions = options;
  47567. {
  47568. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47569. }
  47570. if (data.slot) {
  47571. (clone.data || (clone.data = {})).slot = data.slot;
  47572. }
  47573. return clone
  47574. }
  47575. function mergeProps (to, from) {
  47576. for (var key in from) {
  47577. to[camelize(key)] = from[key];
  47578. }
  47579. }
  47580. /* */
  47581. /* */
  47582. /* */
  47583. /* */
  47584. // inline hooks to be invoked on component VNodes during patch
  47585. var componentVNodeHooks = {
  47586. init: function init (vnode, hydrating) {
  47587. if (
  47588. vnode.componentInstance &&
  47589. !vnode.componentInstance._isDestroyed &&
  47590. vnode.data.keepAlive
  47591. ) {
  47592. // kept-alive components, treat as a patch
  47593. var mountedNode = vnode; // work around flow
  47594. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47595. } else {
  47596. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47597. vnode,
  47598. activeInstance
  47599. );
  47600. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47601. }
  47602. },
  47603. prepatch: function prepatch (oldVnode, vnode) {
  47604. var options = vnode.componentOptions;
  47605. var child = vnode.componentInstance = oldVnode.componentInstance;
  47606. updateChildComponent(
  47607. child,
  47608. options.propsData, // updated props
  47609. options.listeners, // updated listeners
  47610. vnode, // new parent vnode
  47611. options.children // new children
  47612. );
  47613. },
  47614. insert: function insert (vnode) {
  47615. var context = vnode.context;
  47616. var componentInstance = vnode.componentInstance;
  47617. if (!componentInstance._isMounted) {
  47618. componentInstance._isMounted = true;
  47619. callHook(componentInstance, 'mounted');
  47620. }
  47621. if (vnode.data.keepAlive) {
  47622. if (context._isMounted) {
  47623. // vue-router#1212
  47624. // During updates, a kept-alive component's child components may
  47625. // change, so directly walking the tree here may call activated hooks
  47626. // on incorrect children. Instead we push them into a queue which will
  47627. // be processed after the whole patch process ended.
  47628. queueActivatedComponent(componentInstance);
  47629. } else {
  47630. activateChildComponent(componentInstance, true /* direct */);
  47631. }
  47632. }
  47633. },
  47634. destroy: function destroy (vnode) {
  47635. var componentInstance = vnode.componentInstance;
  47636. if (!componentInstance._isDestroyed) {
  47637. if (!vnode.data.keepAlive) {
  47638. componentInstance.$destroy();
  47639. } else {
  47640. deactivateChildComponent(componentInstance, true /* direct */);
  47641. }
  47642. }
  47643. }
  47644. };
  47645. var hooksToMerge = Object.keys(componentVNodeHooks);
  47646. function createComponent (
  47647. Ctor,
  47648. data,
  47649. context,
  47650. children,
  47651. tag
  47652. ) {
  47653. if (isUndef(Ctor)) {
  47654. return
  47655. }
  47656. var baseCtor = context.$options._base;
  47657. // plain options object: turn it into a constructor
  47658. if (isObject(Ctor)) {
  47659. Ctor = baseCtor.extend(Ctor);
  47660. }
  47661. // if at this stage it's not a constructor or an async component factory,
  47662. // reject.
  47663. if (typeof Ctor !== 'function') {
  47664. {
  47665. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47666. }
  47667. return
  47668. }
  47669. // async component
  47670. var asyncFactory;
  47671. if (isUndef(Ctor.cid)) {
  47672. asyncFactory = Ctor;
  47673. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47674. if (Ctor === undefined) {
  47675. // return a placeholder node for async component, which is rendered
  47676. // as a comment node but preserves all the raw information for the node.
  47677. // the information will be used for async server-rendering and hydration.
  47678. return createAsyncPlaceholder(
  47679. asyncFactory,
  47680. data,
  47681. context,
  47682. children,
  47683. tag
  47684. )
  47685. }
  47686. }
  47687. data = data || {};
  47688. // resolve constructor options in case global mixins are applied after
  47689. // component constructor creation
  47690. resolveConstructorOptions(Ctor);
  47691. // transform component v-model data into props & events
  47692. if (isDef(data.model)) {
  47693. transformModel(Ctor.options, data);
  47694. }
  47695. // extract props
  47696. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47697. // functional component
  47698. if (isTrue(Ctor.options.functional)) {
  47699. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47700. }
  47701. // extract listeners, since these needs to be treated as
  47702. // child component listeners instead of DOM listeners
  47703. var listeners = data.on;
  47704. // replace with listeners with .native modifier
  47705. // so it gets processed during parent component patch.
  47706. data.on = data.nativeOn;
  47707. if (isTrue(Ctor.options.abstract)) {
  47708. // abstract components do not keep anything
  47709. // other than props & listeners & slot
  47710. // work around flow
  47711. var slot = data.slot;
  47712. data = {};
  47713. if (slot) {
  47714. data.slot = slot;
  47715. }
  47716. }
  47717. // install component management hooks onto the placeholder node
  47718. installComponentHooks(data);
  47719. // return a placeholder vnode
  47720. var name = Ctor.options.name || tag;
  47721. var vnode = new VNode(
  47722. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47723. data, undefined, undefined, undefined, context,
  47724. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47725. asyncFactory
  47726. );
  47727. return vnode
  47728. }
  47729. function createComponentInstanceForVnode (
  47730. vnode, // we know it's MountedComponentVNode but flow doesn't
  47731. parent // activeInstance in lifecycle state
  47732. ) {
  47733. var options = {
  47734. _isComponent: true,
  47735. _parentVnode: vnode,
  47736. parent: parent
  47737. };
  47738. // check inline-template render functions
  47739. var inlineTemplate = vnode.data.inlineTemplate;
  47740. if (isDef(inlineTemplate)) {
  47741. options.render = inlineTemplate.render;
  47742. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47743. }
  47744. return new vnode.componentOptions.Ctor(options)
  47745. }
  47746. function installComponentHooks (data) {
  47747. var hooks = data.hook || (data.hook = {});
  47748. for (var i = 0; i < hooksToMerge.length; i++) {
  47749. var key = hooksToMerge[i];
  47750. var existing = hooks[key];
  47751. var toMerge = componentVNodeHooks[key];
  47752. if (existing !== toMerge && !(existing && existing._merged)) {
  47753. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47754. }
  47755. }
  47756. }
  47757. function mergeHook$1 (f1, f2) {
  47758. var merged = function (a, b) {
  47759. // flow complains about extra args which is why we use any
  47760. f1(a, b);
  47761. f2(a, b);
  47762. };
  47763. merged._merged = true;
  47764. return merged
  47765. }
  47766. // transform component v-model info (value and callback) into
  47767. // prop and event handler respectively.
  47768. function transformModel (options, data) {
  47769. var prop = (options.model && options.model.prop) || 'value';
  47770. var event = (options.model && options.model.event) || 'input'
  47771. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47772. var on = data.on || (data.on = {});
  47773. var existing = on[event];
  47774. var callback = data.model.callback;
  47775. if (isDef(existing)) {
  47776. if (
  47777. Array.isArray(existing)
  47778. ? existing.indexOf(callback) === -1
  47779. : existing !== callback
  47780. ) {
  47781. on[event] = [callback].concat(existing);
  47782. }
  47783. } else {
  47784. on[event] = callback;
  47785. }
  47786. }
  47787. /* */
  47788. var SIMPLE_NORMALIZE = 1;
  47789. var ALWAYS_NORMALIZE = 2;
  47790. // wrapper function for providing a more flexible interface
  47791. // without getting yelled at by flow
  47792. function createElement (
  47793. context,
  47794. tag,
  47795. data,
  47796. children,
  47797. normalizationType,
  47798. alwaysNormalize
  47799. ) {
  47800. if (Array.isArray(data) || isPrimitive(data)) {
  47801. normalizationType = children;
  47802. children = data;
  47803. data = undefined;
  47804. }
  47805. if (isTrue(alwaysNormalize)) {
  47806. normalizationType = ALWAYS_NORMALIZE;
  47807. }
  47808. return _createElement(context, tag, data, children, normalizationType)
  47809. }
  47810. function _createElement (
  47811. context,
  47812. tag,
  47813. data,
  47814. children,
  47815. normalizationType
  47816. ) {
  47817. if (isDef(data) && isDef((data).__ob__)) {
  47818. warn(
  47819. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47820. 'Always create fresh vnode data objects in each render!',
  47821. context
  47822. );
  47823. return createEmptyVNode()
  47824. }
  47825. // object syntax in v-bind
  47826. if (isDef(data) && isDef(data.is)) {
  47827. tag = data.is;
  47828. }
  47829. if (!tag) {
  47830. // in case of component :is set to falsy value
  47831. return createEmptyVNode()
  47832. }
  47833. // warn against non-primitive key
  47834. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47835. ) {
  47836. {
  47837. warn(
  47838. 'Avoid using non-primitive value as key, ' +
  47839. 'use string/number value instead.',
  47840. context
  47841. );
  47842. }
  47843. }
  47844. // support single function children as default scoped slot
  47845. if (Array.isArray(children) &&
  47846. typeof children[0] === 'function'
  47847. ) {
  47848. data = data || {};
  47849. data.scopedSlots = { default: children[0] };
  47850. children.length = 0;
  47851. }
  47852. if (normalizationType === ALWAYS_NORMALIZE) {
  47853. children = normalizeChildren(children);
  47854. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47855. children = simpleNormalizeChildren(children);
  47856. }
  47857. var vnode, ns;
  47858. if (typeof tag === 'string') {
  47859. var Ctor;
  47860. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47861. if (config.isReservedTag(tag)) {
  47862. // platform built-in elements
  47863. if (isDef(data) && isDef(data.nativeOn)) {
  47864. warn(
  47865. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47866. context
  47867. );
  47868. }
  47869. vnode = new VNode(
  47870. config.parsePlatformTagName(tag), data, children,
  47871. undefined, undefined, context
  47872. );
  47873. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47874. // component
  47875. vnode = createComponent(Ctor, data, context, children, tag);
  47876. } else {
  47877. // unknown or unlisted namespaced elements
  47878. // check at runtime because it may get assigned a namespace when its
  47879. // parent normalizes children
  47880. vnode = new VNode(
  47881. tag, data, children,
  47882. undefined, undefined, context
  47883. );
  47884. }
  47885. } else {
  47886. // direct component options / constructor
  47887. vnode = createComponent(tag, data, context, children);
  47888. }
  47889. if (Array.isArray(vnode)) {
  47890. return vnode
  47891. } else if (isDef(vnode)) {
  47892. if (isDef(ns)) { applyNS(vnode, ns); }
  47893. if (isDef(data)) { registerDeepBindings(data); }
  47894. return vnode
  47895. } else {
  47896. return createEmptyVNode()
  47897. }
  47898. }
  47899. function applyNS (vnode, ns, force) {
  47900. vnode.ns = ns;
  47901. if (vnode.tag === 'foreignObject') {
  47902. // use default namespace inside foreignObject
  47903. ns = undefined;
  47904. force = true;
  47905. }
  47906. if (isDef(vnode.children)) {
  47907. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47908. var child = vnode.children[i];
  47909. if (isDef(child.tag) && (
  47910. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47911. applyNS(child, ns, force);
  47912. }
  47913. }
  47914. }
  47915. }
  47916. // ref #5318
  47917. // necessary to ensure parent re-render when deep bindings like :style and
  47918. // :class are used on slot nodes
  47919. function registerDeepBindings (data) {
  47920. if (isObject(data.style)) {
  47921. traverse(data.style);
  47922. }
  47923. if (isObject(data.class)) {
  47924. traverse(data.class);
  47925. }
  47926. }
  47927. /* */
  47928. function initRender (vm) {
  47929. vm._vnode = null; // the root of the child tree
  47930. vm._staticTrees = null; // v-once cached trees
  47931. var options = vm.$options;
  47932. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47933. var renderContext = parentVnode && parentVnode.context;
  47934. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47935. vm.$scopedSlots = emptyObject;
  47936. // bind the createElement fn to this instance
  47937. // so that we get proper render context inside it.
  47938. // args order: tag, data, children, normalizationType, alwaysNormalize
  47939. // internal version is used by render functions compiled from templates
  47940. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47941. // normalization is always applied for the public version, used in
  47942. // user-written render functions.
  47943. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47944. // $attrs & $listeners are exposed for easier HOC creation.
  47945. // they need to be reactive so that HOCs using them are always updated
  47946. var parentData = parentVnode && parentVnode.data;
  47947. /* istanbul ignore else */
  47948. {
  47949. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47950. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47951. }, true);
  47952. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47953. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47954. }, true);
  47955. }
  47956. }
  47957. var currentRenderingInstance = null;
  47958. function renderMixin (Vue) {
  47959. // install runtime convenience helpers
  47960. installRenderHelpers(Vue.prototype);
  47961. Vue.prototype.$nextTick = function (fn) {
  47962. return nextTick(fn, this)
  47963. };
  47964. Vue.prototype._render = function () {
  47965. var vm = this;
  47966. var ref = vm.$options;
  47967. var render = ref.render;
  47968. var _parentVnode = ref._parentVnode;
  47969. if (_parentVnode) {
  47970. vm.$scopedSlots = normalizeScopedSlots(
  47971. _parentVnode.data.scopedSlots,
  47972. vm.$slots,
  47973. vm.$scopedSlots
  47974. );
  47975. }
  47976. // set parent vnode. this allows render functions to have access
  47977. // to the data on the placeholder node.
  47978. vm.$vnode = _parentVnode;
  47979. // render self
  47980. var vnode;
  47981. try {
  47982. // There's no need to maintain a stack because all render fns are called
  47983. // separately from one another. Nested component's render fns are called
  47984. // when parent component is patched.
  47985. currentRenderingInstance = vm;
  47986. vnode = render.call(vm._renderProxy, vm.$createElement);
  47987. } catch (e) {
  47988. handleError(e, vm, "render");
  47989. // return error render result,
  47990. // or previous vnode to prevent render error causing blank component
  47991. /* istanbul ignore else */
  47992. if (vm.$options.renderError) {
  47993. try {
  47994. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47995. } catch (e) {
  47996. handleError(e, vm, "renderError");
  47997. vnode = vm._vnode;
  47998. }
  47999. } else {
  48000. vnode = vm._vnode;
  48001. }
  48002. } finally {
  48003. currentRenderingInstance = null;
  48004. }
  48005. // if the returned array contains only a single node, allow it
  48006. if (Array.isArray(vnode) && vnode.length === 1) {
  48007. vnode = vnode[0];
  48008. }
  48009. // return empty vnode in case the render function errored out
  48010. if (!(vnode instanceof VNode)) {
  48011. if (Array.isArray(vnode)) {
  48012. warn(
  48013. 'Multiple root nodes returned from render function. Render function ' +
  48014. 'should return a single root node.',
  48015. vm
  48016. );
  48017. }
  48018. vnode = createEmptyVNode();
  48019. }
  48020. // set parent
  48021. vnode.parent = _parentVnode;
  48022. return vnode
  48023. };
  48024. }
  48025. /* */
  48026. function ensureCtor (comp, base) {
  48027. if (
  48028. comp.__esModule ||
  48029. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  48030. ) {
  48031. comp = comp.default;
  48032. }
  48033. return isObject(comp)
  48034. ? base.extend(comp)
  48035. : comp
  48036. }
  48037. function createAsyncPlaceholder (
  48038. factory,
  48039. data,
  48040. context,
  48041. children,
  48042. tag
  48043. ) {
  48044. var node = createEmptyVNode();
  48045. node.asyncFactory = factory;
  48046. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  48047. return node
  48048. }
  48049. function resolveAsyncComponent (
  48050. factory,
  48051. baseCtor
  48052. ) {
  48053. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  48054. return factory.errorComp
  48055. }
  48056. if (isDef(factory.resolved)) {
  48057. return factory.resolved
  48058. }
  48059. var owner = currentRenderingInstance;
  48060. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  48061. // already pending
  48062. factory.owners.push(owner);
  48063. }
  48064. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  48065. return factory.loadingComp
  48066. }
  48067. if (owner && !isDef(factory.owners)) {
  48068. var owners = factory.owners = [owner];
  48069. var sync = true;
  48070. var timerLoading = null;
  48071. var timerTimeout = null
  48072. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  48073. var forceRender = function (renderCompleted) {
  48074. for (var i = 0, l = owners.length; i < l; i++) {
  48075. (owners[i]).$forceUpdate();
  48076. }
  48077. if (renderCompleted) {
  48078. owners.length = 0;
  48079. if (timerLoading !== null) {
  48080. clearTimeout(timerLoading);
  48081. timerLoading = null;
  48082. }
  48083. if (timerTimeout !== null) {
  48084. clearTimeout(timerTimeout);
  48085. timerTimeout = null;
  48086. }
  48087. }
  48088. };
  48089. var resolve = once(function (res) {
  48090. // cache resolved
  48091. factory.resolved = ensureCtor(res, baseCtor);
  48092. // invoke callbacks only if this is not a synchronous resolve
  48093. // (async resolves are shimmed as synchronous during SSR)
  48094. if (!sync) {
  48095. forceRender(true);
  48096. } else {
  48097. owners.length = 0;
  48098. }
  48099. });
  48100. var reject = once(function (reason) {
  48101. warn(
  48102. "Failed to resolve async component: " + (String(factory)) +
  48103. (reason ? ("\nReason: " + reason) : '')
  48104. );
  48105. if (isDef(factory.errorComp)) {
  48106. factory.error = true;
  48107. forceRender(true);
  48108. }
  48109. });
  48110. var res = factory(resolve, reject);
  48111. if (isObject(res)) {
  48112. if (isPromise(res)) {
  48113. // () => Promise
  48114. if (isUndef(factory.resolved)) {
  48115. res.then(resolve, reject);
  48116. }
  48117. } else if (isPromise(res.component)) {
  48118. res.component.then(resolve, reject);
  48119. if (isDef(res.error)) {
  48120. factory.errorComp = ensureCtor(res.error, baseCtor);
  48121. }
  48122. if (isDef(res.loading)) {
  48123. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48124. if (res.delay === 0) {
  48125. factory.loading = true;
  48126. } else {
  48127. timerLoading = setTimeout(function () {
  48128. timerLoading = null;
  48129. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48130. factory.loading = true;
  48131. forceRender(false);
  48132. }
  48133. }, res.delay || 200);
  48134. }
  48135. }
  48136. if (isDef(res.timeout)) {
  48137. timerTimeout = setTimeout(function () {
  48138. timerTimeout = null;
  48139. if (isUndef(factory.resolved)) {
  48140. reject(
  48141. "timeout (" + (res.timeout) + "ms)"
  48142. );
  48143. }
  48144. }, res.timeout);
  48145. }
  48146. }
  48147. }
  48148. sync = false;
  48149. // return in case resolved synchronously
  48150. return factory.loading
  48151. ? factory.loadingComp
  48152. : factory.resolved
  48153. }
  48154. }
  48155. /* */
  48156. function isAsyncPlaceholder (node) {
  48157. return node.isComment && node.asyncFactory
  48158. }
  48159. /* */
  48160. function getFirstComponentChild (children) {
  48161. if (Array.isArray(children)) {
  48162. for (var i = 0; i < children.length; i++) {
  48163. var c = children[i];
  48164. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48165. return c
  48166. }
  48167. }
  48168. }
  48169. }
  48170. /* */
  48171. /* */
  48172. function initEvents (vm) {
  48173. vm._events = Object.create(null);
  48174. vm._hasHookEvent = false;
  48175. // init parent attached events
  48176. var listeners = vm.$options._parentListeners;
  48177. if (listeners) {
  48178. updateComponentListeners(vm, listeners);
  48179. }
  48180. }
  48181. var target;
  48182. function add (event, fn) {
  48183. target.$on(event, fn);
  48184. }
  48185. function remove$1 (event, fn) {
  48186. target.$off(event, fn);
  48187. }
  48188. function createOnceHandler (event, fn) {
  48189. var _target = target;
  48190. return function onceHandler () {
  48191. var res = fn.apply(null, arguments);
  48192. if (res !== null) {
  48193. _target.$off(event, onceHandler);
  48194. }
  48195. }
  48196. }
  48197. function updateComponentListeners (
  48198. vm,
  48199. listeners,
  48200. oldListeners
  48201. ) {
  48202. target = vm;
  48203. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48204. target = undefined;
  48205. }
  48206. function eventsMixin (Vue) {
  48207. var hookRE = /^hook:/;
  48208. Vue.prototype.$on = function (event, fn) {
  48209. var vm = this;
  48210. if (Array.isArray(event)) {
  48211. for (var i = 0, l = event.length; i < l; i++) {
  48212. vm.$on(event[i], fn);
  48213. }
  48214. } else {
  48215. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48216. // optimize hook:event cost by using a boolean flag marked at registration
  48217. // instead of a hash lookup
  48218. if (hookRE.test(event)) {
  48219. vm._hasHookEvent = true;
  48220. }
  48221. }
  48222. return vm
  48223. };
  48224. Vue.prototype.$once = function (event, fn) {
  48225. var vm = this;
  48226. function on () {
  48227. vm.$off(event, on);
  48228. fn.apply(vm, arguments);
  48229. }
  48230. on.fn = fn;
  48231. vm.$on(event, on);
  48232. return vm
  48233. };
  48234. Vue.prototype.$off = function (event, fn) {
  48235. var vm = this;
  48236. // all
  48237. if (!arguments.length) {
  48238. vm._events = Object.create(null);
  48239. return vm
  48240. }
  48241. // array of events
  48242. if (Array.isArray(event)) {
  48243. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48244. vm.$off(event[i$1], fn);
  48245. }
  48246. return vm
  48247. }
  48248. // specific event
  48249. var cbs = vm._events[event];
  48250. if (!cbs) {
  48251. return vm
  48252. }
  48253. if (!fn) {
  48254. vm._events[event] = null;
  48255. return vm
  48256. }
  48257. // specific handler
  48258. var cb;
  48259. var i = cbs.length;
  48260. while (i--) {
  48261. cb = cbs[i];
  48262. if (cb === fn || cb.fn === fn) {
  48263. cbs.splice(i, 1);
  48264. break
  48265. }
  48266. }
  48267. return vm
  48268. };
  48269. Vue.prototype.$emit = function (event) {
  48270. var vm = this;
  48271. {
  48272. var lowerCaseEvent = event.toLowerCase();
  48273. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48274. tip(
  48275. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48276. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48277. "Note that HTML attributes are case-insensitive and you cannot use " +
  48278. "v-on to listen to camelCase events when using in-DOM templates. " +
  48279. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48280. );
  48281. }
  48282. }
  48283. var cbs = vm._events[event];
  48284. if (cbs) {
  48285. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48286. var args = toArray(arguments, 1);
  48287. var info = "event handler for \"" + event + "\"";
  48288. for (var i = 0, l = cbs.length; i < l; i++) {
  48289. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48290. }
  48291. }
  48292. return vm
  48293. };
  48294. }
  48295. /* */
  48296. var activeInstance = null;
  48297. var isUpdatingChildComponent = false;
  48298. function setActiveInstance(vm) {
  48299. var prevActiveInstance = activeInstance;
  48300. activeInstance = vm;
  48301. return function () {
  48302. activeInstance = prevActiveInstance;
  48303. }
  48304. }
  48305. function initLifecycle (vm) {
  48306. var options = vm.$options;
  48307. // locate first non-abstract parent
  48308. var parent = options.parent;
  48309. if (parent && !options.abstract) {
  48310. while (parent.$options.abstract && parent.$parent) {
  48311. parent = parent.$parent;
  48312. }
  48313. parent.$children.push(vm);
  48314. }
  48315. vm.$parent = parent;
  48316. vm.$root = parent ? parent.$root : vm;
  48317. vm.$children = [];
  48318. vm.$refs = {};
  48319. vm._watcher = null;
  48320. vm._inactive = null;
  48321. vm._directInactive = false;
  48322. vm._isMounted = false;
  48323. vm._isDestroyed = false;
  48324. vm._isBeingDestroyed = false;
  48325. }
  48326. function lifecycleMixin (Vue) {
  48327. Vue.prototype._update = function (vnode, hydrating) {
  48328. var vm = this;
  48329. var prevEl = vm.$el;
  48330. var prevVnode = vm._vnode;
  48331. var restoreActiveInstance = setActiveInstance(vm);
  48332. vm._vnode = vnode;
  48333. // Vue.prototype.__patch__ is injected in entry points
  48334. // based on the rendering backend used.
  48335. if (!prevVnode) {
  48336. // initial render
  48337. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48338. } else {
  48339. // updates
  48340. vm.$el = vm.__patch__(prevVnode, vnode);
  48341. }
  48342. restoreActiveInstance();
  48343. // update __vue__ reference
  48344. if (prevEl) {
  48345. prevEl.__vue__ = null;
  48346. }
  48347. if (vm.$el) {
  48348. vm.$el.__vue__ = vm;
  48349. }
  48350. // if parent is an HOC, update its $el as well
  48351. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48352. vm.$parent.$el = vm.$el;
  48353. }
  48354. // updated hook is called by the scheduler to ensure that children are
  48355. // updated in a parent's updated hook.
  48356. };
  48357. Vue.prototype.$forceUpdate = function () {
  48358. var vm = this;
  48359. if (vm._watcher) {
  48360. vm._watcher.update();
  48361. }
  48362. };
  48363. Vue.prototype.$destroy = function () {
  48364. var vm = this;
  48365. if (vm._isBeingDestroyed) {
  48366. return
  48367. }
  48368. callHook(vm, 'beforeDestroy');
  48369. vm._isBeingDestroyed = true;
  48370. // remove self from parent
  48371. var parent = vm.$parent;
  48372. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48373. remove(parent.$children, vm);
  48374. }
  48375. // teardown watchers
  48376. if (vm._watcher) {
  48377. vm._watcher.teardown();
  48378. }
  48379. var i = vm._watchers.length;
  48380. while (i--) {
  48381. vm._watchers[i].teardown();
  48382. }
  48383. // remove reference from data ob
  48384. // frozen object may not have observer.
  48385. if (vm._data.__ob__) {
  48386. vm._data.__ob__.vmCount--;
  48387. }
  48388. // call the last hook...
  48389. vm._isDestroyed = true;
  48390. // invoke destroy hooks on current rendered tree
  48391. vm.__patch__(vm._vnode, null);
  48392. // fire destroyed hook
  48393. callHook(vm, 'destroyed');
  48394. // turn off all instance listeners.
  48395. vm.$off();
  48396. // remove __vue__ reference
  48397. if (vm.$el) {
  48398. vm.$el.__vue__ = null;
  48399. }
  48400. // release circular reference (#6759)
  48401. if (vm.$vnode) {
  48402. vm.$vnode.parent = null;
  48403. }
  48404. };
  48405. }
  48406. function mountComponent (
  48407. vm,
  48408. el,
  48409. hydrating
  48410. ) {
  48411. vm.$el = el;
  48412. if (!vm.$options.render) {
  48413. vm.$options.render = createEmptyVNode;
  48414. {
  48415. /* istanbul ignore if */
  48416. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48417. vm.$options.el || el) {
  48418. warn(
  48419. 'You are using the runtime-only build of Vue where the template ' +
  48420. 'compiler is not available. Either pre-compile the templates into ' +
  48421. 'render functions, or use the compiler-included build.',
  48422. vm
  48423. );
  48424. } else {
  48425. warn(
  48426. 'Failed to mount component: template or render function not defined.',
  48427. vm
  48428. );
  48429. }
  48430. }
  48431. }
  48432. callHook(vm, 'beforeMount');
  48433. var updateComponent;
  48434. /* istanbul ignore if */
  48435. if (config.performance && mark) {
  48436. updateComponent = function () {
  48437. var name = vm._name;
  48438. var id = vm._uid;
  48439. var startTag = "vue-perf-start:" + id;
  48440. var endTag = "vue-perf-end:" + id;
  48441. mark(startTag);
  48442. var vnode = vm._render();
  48443. mark(endTag);
  48444. measure(("vue " + name + " render"), startTag, endTag);
  48445. mark(startTag);
  48446. vm._update(vnode, hydrating);
  48447. mark(endTag);
  48448. measure(("vue " + name + " patch"), startTag, endTag);
  48449. };
  48450. } else {
  48451. updateComponent = function () {
  48452. vm._update(vm._render(), hydrating);
  48453. };
  48454. }
  48455. // we set this to vm._watcher inside the watcher's constructor
  48456. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48457. // component's mounted hook), which relies on vm._watcher being already defined
  48458. new Watcher(vm, updateComponent, noop, {
  48459. before: function before () {
  48460. if (vm._isMounted && !vm._isDestroyed) {
  48461. callHook(vm, 'beforeUpdate');
  48462. }
  48463. }
  48464. }, true /* isRenderWatcher */);
  48465. hydrating = false;
  48466. // manually mounted instance, call mounted on self
  48467. // mounted is called for render-created child components in its inserted hook
  48468. if (vm.$vnode == null) {
  48469. vm._isMounted = true;
  48470. callHook(vm, 'mounted');
  48471. }
  48472. return vm
  48473. }
  48474. function updateChildComponent (
  48475. vm,
  48476. propsData,
  48477. listeners,
  48478. parentVnode,
  48479. renderChildren
  48480. ) {
  48481. {
  48482. isUpdatingChildComponent = true;
  48483. }
  48484. // determine whether component has slot children
  48485. // we need to do this before overwriting $options._renderChildren.
  48486. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48487. // dynamic slot names). Static scoped slots compiled from template has the
  48488. // "$stable" marker.
  48489. var newScopedSlots = parentVnode.data.scopedSlots;
  48490. var oldScopedSlots = vm.$scopedSlots;
  48491. var hasDynamicScopedSlot = !!(
  48492. (newScopedSlots && !newScopedSlots.$stable) ||
  48493. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48494. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48495. );
  48496. // Any static slot children from the parent may have changed during parent's
  48497. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48498. // update is necessary to ensure correctness.
  48499. var needsForceUpdate = !!(
  48500. renderChildren || // has new static slots
  48501. vm.$options._renderChildren || // has old static slots
  48502. hasDynamicScopedSlot
  48503. );
  48504. vm.$options._parentVnode = parentVnode;
  48505. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48506. if (vm._vnode) { // update child tree's parent
  48507. vm._vnode.parent = parentVnode;
  48508. }
  48509. vm.$options._renderChildren = renderChildren;
  48510. // update $attrs and $listeners hash
  48511. // these are also reactive so they may trigger child update if the child
  48512. // used them during render
  48513. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48514. vm.$listeners = listeners || emptyObject;
  48515. // update props
  48516. if (propsData && vm.$options.props) {
  48517. toggleObserving(false);
  48518. var props = vm._props;
  48519. var propKeys = vm.$options._propKeys || [];
  48520. for (var i = 0; i < propKeys.length; i++) {
  48521. var key = propKeys[i];
  48522. var propOptions = vm.$options.props; // wtf flow?
  48523. props[key] = validateProp(key, propOptions, propsData, vm);
  48524. }
  48525. toggleObserving(true);
  48526. // keep a copy of raw propsData
  48527. vm.$options.propsData = propsData;
  48528. }
  48529. // update listeners
  48530. listeners = listeners || emptyObject;
  48531. var oldListeners = vm.$options._parentListeners;
  48532. vm.$options._parentListeners = listeners;
  48533. updateComponentListeners(vm, listeners, oldListeners);
  48534. // resolve slots + force update if has children
  48535. if (needsForceUpdate) {
  48536. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48537. vm.$forceUpdate();
  48538. }
  48539. {
  48540. isUpdatingChildComponent = false;
  48541. }
  48542. }
  48543. function isInInactiveTree (vm) {
  48544. while (vm && (vm = vm.$parent)) {
  48545. if (vm._inactive) { return true }
  48546. }
  48547. return false
  48548. }
  48549. function activateChildComponent (vm, direct) {
  48550. if (direct) {
  48551. vm._directInactive = false;
  48552. if (isInInactiveTree(vm)) {
  48553. return
  48554. }
  48555. } else if (vm._directInactive) {
  48556. return
  48557. }
  48558. if (vm._inactive || vm._inactive === null) {
  48559. vm._inactive = false;
  48560. for (var i = 0; i < vm.$children.length; i++) {
  48561. activateChildComponent(vm.$children[i]);
  48562. }
  48563. callHook(vm, 'activated');
  48564. }
  48565. }
  48566. function deactivateChildComponent (vm, direct) {
  48567. if (direct) {
  48568. vm._directInactive = true;
  48569. if (isInInactiveTree(vm)) {
  48570. return
  48571. }
  48572. }
  48573. if (!vm._inactive) {
  48574. vm._inactive = true;
  48575. for (var i = 0; i < vm.$children.length; i++) {
  48576. deactivateChildComponent(vm.$children[i]);
  48577. }
  48578. callHook(vm, 'deactivated');
  48579. }
  48580. }
  48581. function callHook (vm, hook) {
  48582. // #7573 disable dep collection when invoking lifecycle hooks
  48583. pushTarget();
  48584. var handlers = vm.$options[hook];
  48585. var info = hook + " hook";
  48586. if (handlers) {
  48587. for (var i = 0, j = handlers.length; i < j; i++) {
  48588. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48589. }
  48590. }
  48591. if (vm._hasHookEvent) {
  48592. vm.$emit('hook:' + hook);
  48593. }
  48594. popTarget();
  48595. }
  48596. /* */
  48597. var MAX_UPDATE_COUNT = 100;
  48598. var queue = [];
  48599. var activatedChildren = [];
  48600. var has = {};
  48601. var circular = {};
  48602. var waiting = false;
  48603. var flushing = false;
  48604. var index = 0;
  48605. /**
  48606. * Reset the scheduler's state.
  48607. */
  48608. function resetSchedulerState () {
  48609. index = queue.length = activatedChildren.length = 0;
  48610. has = {};
  48611. {
  48612. circular = {};
  48613. }
  48614. waiting = flushing = false;
  48615. }
  48616. // Async edge case #6566 requires saving the timestamp when event listeners are
  48617. // attached. However, calling performance.now() has a perf overhead especially
  48618. // if the page has thousands of event listeners. Instead, we take a timestamp
  48619. // every time the scheduler flushes and use that for all event listeners
  48620. // attached during that flush.
  48621. var currentFlushTimestamp = 0;
  48622. // Async edge case fix requires storing an event listener's attach timestamp.
  48623. var getNow = Date.now;
  48624. // Determine what event timestamp the browser is using. Annoyingly, the
  48625. // timestamp can either be hi-res (relative to page load) or low-res
  48626. // (relative to UNIX epoch), so in order to compare time we have to use the
  48627. // same timestamp type when saving the flush timestamp.
  48628. // All IE versions use low-res event timestamps, and have problematic clock
  48629. // implementations (#9632)
  48630. if (inBrowser && !isIE) {
  48631. var performance = window.performance;
  48632. if (
  48633. performance &&
  48634. typeof performance.now === 'function' &&
  48635. getNow() > document.createEvent('Event').timeStamp
  48636. ) {
  48637. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48638. // smaller than it, it means the event is using a hi-res timestamp,
  48639. // and we need to use the hi-res version for event listener timestamps as
  48640. // well.
  48641. getNow = function () { return performance.now(); };
  48642. }
  48643. }
  48644. /**
  48645. * Flush both queues and run the watchers.
  48646. */
  48647. function flushSchedulerQueue () {
  48648. currentFlushTimestamp = getNow();
  48649. flushing = true;
  48650. var watcher, id;
  48651. // Sort queue before flush.
  48652. // This ensures that:
  48653. // 1. Components are updated from parent to child. (because parent is always
  48654. // created before the child)
  48655. // 2. A component's user watchers are run before its render watcher (because
  48656. // user watchers are created before the render watcher)
  48657. // 3. If a component is destroyed during a parent component's watcher run,
  48658. // its watchers can be skipped.
  48659. queue.sort(function (a, b) { return a.id - b.id; });
  48660. // do not cache length because more watchers might be pushed
  48661. // as we run existing watchers
  48662. for (index = 0; index < queue.length; index++) {
  48663. watcher = queue[index];
  48664. if (watcher.before) {
  48665. watcher.before();
  48666. }
  48667. id = watcher.id;
  48668. has[id] = null;
  48669. watcher.run();
  48670. // in dev build, check and stop circular updates.
  48671. if (has[id] != null) {
  48672. circular[id] = (circular[id] || 0) + 1;
  48673. if (circular[id] > MAX_UPDATE_COUNT) {
  48674. warn(
  48675. 'You may have an infinite update loop ' + (
  48676. watcher.user
  48677. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48678. : "in a component render function."
  48679. ),
  48680. watcher.vm
  48681. );
  48682. break
  48683. }
  48684. }
  48685. }
  48686. // keep copies of post queues before resetting state
  48687. var activatedQueue = activatedChildren.slice();
  48688. var updatedQueue = queue.slice();
  48689. resetSchedulerState();
  48690. // call component updated and activated hooks
  48691. callActivatedHooks(activatedQueue);
  48692. callUpdatedHooks(updatedQueue);
  48693. // devtool hook
  48694. /* istanbul ignore if */
  48695. if (devtools && config.devtools) {
  48696. devtools.emit('flush');
  48697. }
  48698. }
  48699. function callUpdatedHooks (queue) {
  48700. var i = queue.length;
  48701. while (i--) {
  48702. var watcher = queue[i];
  48703. var vm = watcher.vm;
  48704. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48705. callHook(vm, 'updated');
  48706. }
  48707. }
  48708. }
  48709. /**
  48710. * Queue a kept-alive component that was activated during patch.
  48711. * The queue will be processed after the entire tree has been patched.
  48712. */
  48713. function queueActivatedComponent (vm) {
  48714. // setting _inactive to false here so that a render function can
  48715. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48716. vm._inactive = false;
  48717. activatedChildren.push(vm);
  48718. }
  48719. function callActivatedHooks (queue) {
  48720. for (var i = 0; i < queue.length; i++) {
  48721. queue[i]._inactive = true;
  48722. activateChildComponent(queue[i], true /* true */);
  48723. }
  48724. }
  48725. /**
  48726. * Push a watcher into the watcher queue.
  48727. * Jobs with duplicate IDs will be skipped unless it's
  48728. * pushed when the queue is being flushed.
  48729. */
  48730. function queueWatcher (watcher) {
  48731. var id = watcher.id;
  48732. if (has[id] == null) {
  48733. has[id] = true;
  48734. if (!flushing) {
  48735. queue.push(watcher);
  48736. } else {
  48737. // if already flushing, splice the watcher based on its id
  48738. // if already past its id, it will be run next immediately.
  48739. var i = queue.length - 1;
  48740. while (i > index && queue[i].id > watcher.id) {
  48741. i--;
  48742. }
  48743. queue.splice(i + 1, 0, watcher);
  48744. }
  48745. // queue the flush
  48746. if (!waiting) {
  48747. waiting = true;
  48748. if (!config.async) {
  48749. flushSchedulerQueue();
  48750. return
  48751. }
  48752. nextTick(flushSchedulerQueue);
  48753. }
  48754. }
  48755. }
  48756. /* */
  48757. var uid$2 = 0;
  48758. /**
  48759. * A watcher parses an expression, collects dependencies,
  48760. * and fires callback when the expression value changes.
  48761. * This is used for both the $watch() api and directives.
  48762. */
  48763. var Watcher = function Watcher (
  48764. vm,
  48765. expOrFn,
  48766. cb,
  48767. options,
  48768. isRenderWatcher
  48769. ) {
  48770. this.vm = vm;
  48771. if (isRenderWatcher) {
  48772. vm._watcher = this;
  48773. }
  48774. vm._watchers.push(this);
  48775. // options
  48776. if (options) {
  48777. this.deep = !!options.deep;
  48778. this.user = !!options.user;
  48779. this.lazy = !!options.lazy;
  48780. this.sync = !!options.sync;
  48781. this.before = options.before;
  48782. } else {
  48783. this.deep = this.user = this.lazy = this.sync = false;
  48784. }
  48785. this.cb = cb;
  48786. this.id = ++uid$2; // uid for batching
  48787. this.active = true;
  48788. this.dirty = this.lazy; // for lazy watchers
  48789. this.deps = [];
  48790. this.newDeps = [];
  48791. this.depIds = new _Set();
  48792. this.newDepIds = new _Set();
  48793. this.expression = expOrFn.toString();
  48794. // parse expression for getter
  48795. if (typeof expOrFn === 'function') {
  48796. this.getter = expOrFn;
  48797. } else {
  48798. this.getter = parsePath(expOrFn);
  48799. if (!this.getter) {
  48800. this.getter = noop;
  48801. warn(
  48802. "Failed watching path: \"" + expOrFn + "\" " +
  48803. 'Watcher only accepts simple dot-delimited paths. ' +
  48804. 'For full control, use a function instead.',
  48805. vm
  48806. );
  48807. }
  48808. }
  48809. this.value = this.lazy
  48810. ? undefined
  48811. : this.get();
  48812. };
  48813. /**
  48814. * Evaluate the getter, and re-collect dependencies.
  48815. */
  48816. Watcher.prototype.get = function get () {
  48817. pushTarget(this);
  48818. var value;
  48819. var vm = this.vm;
  48820. try {
  48821. value = this.getter.call(vm, vm);
  48822. } catch (e) {
  48823. if (this.user) {
  48824. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48825. } else {
  48826. throw e
  48827. }
  48828. } finally {
  48829. // "touch" every property so they are all tracked as
  48830. // dependencies for deep watching
  48831. if (this.deep) {
  48832. traverse(value);
  48833. }
  48834. popTarget();
  48835. this.cleanupDeps();
  48836. }
  48837. return value
  48838. };
  48839. /**
  48840. * Add a dependency to this directive.
  48841. */
  48842. Watcher.prototype.addDep = function addDep (dep) {
  48843. var id = dep.id;
  48844. if (!this.newDepIds.has(id)) {
  48845. this.newDepIds.add(id);
  48846. this.newDeps.push(dep);
  48847. if (!this.depIds.has(id)) {
  48848. dep.addSub(this);
  48849. }
  48850. }
  48851. };
  48852. /**
  48853. * Clean up for dependency collection.
  48854. */
  48855. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48856. var i = this.deps.length;
  48857. while (i--) {
  48858. var dep = this.deps[i];
  48859. if (!this.newDepIds.has(dep.id)) {
  48860. dep.removeSub(this);
  48861. }
  48862. }
  48863. var tmp = this.depIds;
  48864. this.depIds = this.newDepIds;
  48865. this.newDepIds = tmp;
  48866. this.newDepIds.clear();
  48867. tmp = this.deps;
  48868. this.deps = this.newDeps;
  48869. this.newDeps = tmp;
  48870. this.newDeps.length = 0;
  48871. };
  48872. /**
  48873. * Subscriber interface.
  48874. * Will be called when a dependency changes.
  48875. */
  48876. Watcher.prototype.update = function update () {
  48877. /* istanbul ignore else */
  48878. if (this.lazy) {
  48879. this.dirty = true;
  48880. } else if (this.sync) {
  48881. this.run();
  48882. } else {
  48883. queueWatcher(this);
  48884. }
  48885. };
  48886. /**
  48887. * Scheduler job interface.
  48888. * Will be called by the scheduler.
  48889. */
  48890. Watcher.prototype.run = function run () {
  48891. if (this.active) {
  48892. var value = this.get();
  48893. if (
  48894. value !== this.value ||
  48895. // Deep watchers and watchers on Object/Arrays should fire even
  48896. // when the value is the same, because the value may
  48897. // have mutated.
  48898. isObject(value) ||
  48899. this.deep
  48900. ) {
  48901. // set new value
  48902. var oldValue = this.value;
  48903. this.value = value;
  48904. if (this.user) {
  48905. try {
  48906. this.cb.call(this.vm, value, oldValue);
  48907. } catch (e) {
  48908. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48909. }
  48910. } else {
  48911. this.cb.call(this.vm, value, oldValue);
  48912. }
  48913. }
  48914. }
  48915. };
  48916. /**
  48917. * Evaluate the value of the watcher.
  48918. * This only gets called for lazy watchers.
  48919. */
  48920. Watcher.prototype.evaluate = function evaluate () {
  48921. this.value = this.get();
  48922. this.dirty = false;
  48923. };
  48924. /**
  48925. * Depend on all deps collected by this watcher.
  48926. */
  48927. Watcher.prototype.depend = function depend () {
  48928. var i = this.deps.length;
  48929. while (i--) {
  48930. this.deps[i].depend();
  48931. }
  48932. };
  48933. /**
  48934. * Remove self from all dependencies' subscriber list.
  48935. */
  48936. Watcher.prototype.teardown = function teardown () {
  48937. if (this.active) {
  48938. // remove self from vm's watcher list
  48939. // this is a somewhat expensive operation so we skip it
  48940. // if the vm is being destroyed.
  48941. if (!this.vm._isBeingDestroyed) {
  48942. remove(this.vm._watchers, this);
  48943. }
  48944. var i = this.deps.length;
  48945. while (i--) {
  48946. this.deps[i].removeSub(this);
  48947. }
  48948. this.active = false;
  48949. }
  48950. };
  48951. /* */
  48952. var sharedPropertyDefinition = {
  48953. enumerable: true,
  48954. configurable: true,
  48955. get: noop,
  48956. set: noop
  48957. };
  48958. function proxy (target, sourceKey, key) {
  48959. sharedPropertyDefinition.get = function proxyGetter () {
  48960. return this[sourceKey][key]
  48961. };
  48962. sharedPropertyDefinition.set = function proxySetter (val) {
  48963. this[sourceKey][key] = val;
  48964. };
  48965. Object.defineProperty(target, key, sharedPropertyDefinition);
  48966. }
  48967. function initState (vm) {
  48968. vm._watchers = [];
  48969. var opts = vm.$options;
  48970. if (opts.props) { initProps(vm, opts.props); }
  48971. if (opts.methods) { initMethods(vm, opts.methods); }
  48972. if (opts.data) {
  48973. initData(vm);
  48974. } else {
  48975. observe(vm._data = {}, true /* asRootData */);
  48976. }
  48977. if (opts.computed) { initComputed(vm, opts.computed); }
  48978. if (opts.watch && opts.watch !== nativeWatch) {
  48979. initWatch(vm, opts.watch);
  48980. }
  48981. }
  48982. function initProps (vm, propsOptions) {
  48983. var propsData = vm.$options.propsData || {};
  48984. var props = vm._props = {};
  48985. // cache prop keys so that future props updates can iterate using Array
  48986. // instead of dynamic object key enumeration.
  48987. var keys = vm.$options._propKeys = [];
  48988. var isRoot = !vm.$parent;
  48989. // root instance props should be converted
  48990. if (!isRoot) {
  48991. toggleObserving(false);
  48992. }
  48993. var loop = function ( key ) {
  48994. keys.push(key);
  48995. var value = validateProp(key, propsOptions, propsData, vm);
  48996. /* istanbul ignore else */
  48997. {
  48998. var hyphenatedKey = hyphenate(key);
  48999. if (isReservedAttribute(hyphenatedKey) ||
  49000. config.isReservedAttr(hyphenatedKey)) {
  49001. warn(
  49002. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  49003. vm
  49004. );
  49005. }
  49006. defineReactive$$1(props, key, value, function () {
  49007. if (!isRoot && !isUpdatingChildComponent) {
  49008. warn(
  49009. "Avoid mutating a prop directly since the value will be " +
  49010. "overwritten whenever the parent component re-renders. " +
  49011. "Instead, use a data or computed property based on the prop's " +
  49012. "value. Prop being mutated: \"" + key + "\"",
  49013. vm
  49014. );
  49015. }
  49016. });
  49017. }
  49018. // static props are already proxied on the component's prototype
  49019. // during Vue.extend(). We only need to proxy props defined at
  49020. // instantiation here.
  49021. if (!(key in vm)) {
  49022. proxy(vm, "_props", key);
  49023. }
  49024. };
  49025. for (var key in propsOptions) loop( key );
  49026. toggleObserving(true);
  49027. }
  49028. function initData (vm) {
  49029. var data = vm.$options.data;
  49030. data = vm._data = typeof data === 'function'
  49031. ? getData(data, vm)
  49032. : data || {};
  49033. if (!isPlainObject(data)) {
  49034. data = {};
  49035. warn(
  49036. 'data functions should return an object:\n' +
  49037. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  49038. vm
  49039. );
  49040. }
  49041. // proxy data on instance
  49042. var keys = Object.keys(data);
  49043. var props = vm.$options.props;
  49044. var methods = vm.$options.methods;
  49045. var i = keys.length;
  49046. while (i--) {
  49047. var key = keys[i];
  49048. {
  49049. if (methods && hasOwn(methods, key)) {
  49050. warn(
  49051. ("Method \"" + key + "\" has already been defined as a data property."),
  49052. vm
  49053. );
  49054. }
  49055. }
  49056. if (props && hasOwn(props, key)) {
  49057. warn(
  49058. "The data property \"" + key + "\" is already declared as a prop. " +
  49059. "Use prop default value instead.",
  49060. vm
  49061. );
  49062. } else if (!isReserved(key)) {
  49063. proxy(vm, "_data", key);
  49064. }
  49065. }
  49066. // observe data
  49067. observe(data, true /* asRootData */);
  49068. }
  49069. function getData (data, vm) {
  49070. // #7573 disable dep collection when invoking data getters
  49071. pushTarget();
  49072. try {
  49073. return data.call(vm, vm)
  49074. } catch (e) {
  49075. handleError(e, vm, "data()");
  49076. return {}
  49077. } finally {
  49078. popTarget();
  49079. }
  49080. }
  49081. var computedWatcherOptions = { lazy: true };
  49082. function initComputed (vm, computed) {
  49083. // $flow-disable-line
  49084. var watchers = vm._computedWatchers = Object.create(null);
  49085. // computed properties are just getters during SSR
  49086. var isSSR = isServerRendering();
  49087. for (var key in computed) {
  49088. var userDef = computed[key];
  49089. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  49090. if (getter == null) {
  49091. warn(
  49092. ("Getter is missing for computed property \"" + key + "\"."),
  49093. vm
  49094. );
  49095. }
  49096. if (!isSSR) {
  49097. // create internal watcher for the computed property.
  49098. watchers[key] = new Watcher(
  49099. vm,
  49100. getter || noop,
  49101. noop,
  49102. computedWatcherOptions
  49103. );
  49104. }
  49105. // component-defined computed properties are already defined on the
  49106. // component prototype. We only need to define computed properties defined
  49107. // at instantiation here.
  49108. if (!(key in vm)) {
  49109. defineComputed(vm, key, userDef);
  49110. } else {
  49111. if (key in vm.$data) {
  49112. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49113. } else if (vm.$options.props && key in vm.$options.props) {
  49114. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49115. }
  49116. }
  49117. }
  49118. }
  49119. function defineComputed (
  49120. target,
  49121. key,
  49122. userDef
  49123. ) {
  49124. var shouldCache = !isServerRendering();
  49125. if (typeof userDef === 'function') {
  49126. sharedPropertyDefinition.get = shouldCache
  49127. ? createComputedGetter(key)
  49128. : createGetterInvoker(userDef);
  49129. sharedPropertyDefinition.set = noop;
  49130. } else {
  49131. sharedPropertyDefinition.get = userDef.get
  49132. ? shouldCache && userDef.cache !== false
  49133. ? createComputedGetter(key)
  49134. : createGetterInvoker(userDef.get)
  49135. : noop;
  49136. sharedPropertyDefinition.set = userDef.set || noop;
  49137. }
  49138. if (sharedPropertyDefinition.set === noop) {
  49139. sharedPropertyDefinition.set = function () {
  49140. warn(
  49141. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49142. this
  49143. );
  49144. };
  49145. }
  49146. Object.defineProperty(target, key, sharedPropertyDefinition);
  49147. }
  49148. function createComputedGetter (key) {
  49149. return function computedGetter () {
  49150. var watcher = this._computedWatchers && this._computedWatchers[key];
  49151. if (watcher) {
  49152. if (watcher.dirty) {
  49153. watcher.evaluate();
  49154. }
  49155. if (Dep.target) {
  49156. watcher.depend();
  49157. }
  49158. return watcher.value
  49159. }
  49160. }
  49161. }
  49162. function createGetterInvoker(fn) {
  49163. return function computedGetter () {
  49164. return fn.call(this, this)
  49165. }
  49166. }
  49167. function initMethods (vm, methods) {
  49168. var props = vm.$options.props;
  49169. for (var key in methods) {
  49170. {
  49171. if (typeof methods[key] !== 'function') {
  49172. warn(
  49173. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49174. "Did you reference the function correctly?",
  49175. vm
  49176. );
  49177. }
  49178. if (props && hasOwn(props, key)) {
  49179. warn(
  49180. ("Method \"" + key + "\" has already been defined as a prop."),
  49181. vm
  49182. );
  49183. }
  49184. if ((key in vm) && isReserved(key)) {
  49185. warn(
  49186. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49187. "Avoid defining component methods that start with _ or $."
  49188. );
  49189. }
  49190. }
  49191. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49192. }
  49193. }
  49194. function initWatch (vm, watch) {
  49195. for (var key in watch) {
  49196. var handler = watch[key];
  49197. if (Array.isArray(handler)) {
  49198. for (var i = 0; i < handler.length; i++) {
  49199. createWatcher(vm, key, handler[i]);
  49200. }
  49201. } else {
  49202. createWatcher(vm, key, handler);
  49203. }
  49204. }
  49205. }
  49206. function createWatcher (
  49207. vm,
  49208. expOrFn,
  49209. handler,
  49210. options
  49211. ) {
  49212. if (isPlainObject(handler)) {
  49213. options = handler;
  49214. handler = handler.handler;
  49215. }
  49216. if (typeof handler === 'string') {
  49217. handler = vm[handler];
  49218. }
  49219. return vm.$watch(expOrFn, handler, options)
  49220. }
  49221. function stateMixin (Vue) {
  49222. // flow somehow has problems with directly declared definition object
  49223. // when using Object.defineProperty, so we have to procedurally build up
  49224. // the object here.
  49225. var dataDef = {};
  49226. dataDef.get = function () { return this._data };
  49227. var propsDef = {};
  49228. propsDef.get = function () { return this._props };
  49229. {
  49230. dataDef.set = function () {
  49231. warn(
  49232. 'Avoid replacing instance root $data. ' +
  49233. 'Use nested data properties instead.',
  49234. this
  49235. );
  49236. };
  49237. propsDef.set = function () {
  49238. warn("$props is readonly.", this);
  49239. };
  49240. }
  49241. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49242. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49243. Vue.prototype.$set = set;
  49244. Vue.prototype.$delete = del;
  49245. Vue.prototype.$watch = function (
  49246. expOrFn,
  49247. cb,
  49248. options
  49249. ) {
  49250. var vm = this;
  49251. if (isPlainObject(cb)) {
  49252. return createWatcher(vm, expOrFn, cb, options)
  49253. }
  49254. options = options || {};
  49255. options.user = true;
  49256. var watcher = new Watcher(vm, expOrFn, cb, options);
  49257. if (options.immediate) {
  49258. try {
  49259. cb.call(vm, watcher.value);
  49260. } catch (error) {
  49261. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49262. }
  49263. }
  49264. return function unwatchFn () {
  49265. watcher.teardown();
  49266. }
  49267. };
  49268. }
  49269. /* */
  49270. var uid$3 = 0;
  49271. function initMixin (Vue) {
  49272. Vue.prototype._init = function (options) {
  49273. var vm = this;
  49274. // a uid
  49275. vm._uid = uid$3++;
  49276. var startTag, endTag;
  49277. /* istanbul ignore if */
  49278. if (config.performance && mark) {
  49279. startTag = "vue-perf-start:" + (vm._uid);
  49280. endTag = "vue-perf-end:" + (vm._uid);
  49281. mark(startTag);
  49282. }
  49283. // a flag to avoid this being observed
  49284. vm._isVue = true;
  49285. // merge options
  49286. if (options && options._isComponent) {
  49287. // optimize internal component instantiation
  49288. // since dynamic options merging is pretty slow, and none of the
  49289. // internal component options needs special treatment.
  49290. initInternalComponent(vm, options);
  49291. } else {
  49292. vm.$options = mergeOptions(
  49293. resolveConstructorOptions(vm.constructor),
  49294. options || {},
  49295. vm
  49296. );
  49297. }
  49298. /* istanbul ignore else */
  49299. {
  49300. initProxy(vm);
  49301. }
  49302. // expose real self
  49303. vm._self = vm;
  49304. initLifecycle(vm);
  49305. initEvents(vm);
  49306. initRender(vm);
  49307. callHook(vm, 'beforeCreate');
  49308. initInjections(vm); // resolve injections before data/props
  49309. initState(vm);
  49310. initProvide(vm); // resolve provide after data/props
  49311. callHook(vm, 'created');
  49312. /* istanbul ignore if */
  49313. if (config.performance && mark) {
  49314. vm._name = formatComponentName(vm, false);
  49315. mark(endTag);
  49316. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49317. }
  49318. if (vm.$options.el) {
  49319. vm.$mount(vm.$options.el);
  49320. }
  49321. };
  49322. }
  49323. function initInternalComponent (vm, options) {
  49324. var opts = vm.$options = Object.create(vm.constructor.options);
  49325. // doing this because it's faster than dynamic enumeration.
  49326. var parentVnode = options._parentVnode;
  49327. opts.parent = options.parent;
  49328. opts._parentVnode = parentVnode;
  49329. var vnodeComponentOptions = parentVnode.componentOptions;
  49330. opts.propsData = vnodeComponentOptions.propsData;
  49331. opts._parentListeners = vnodeComponentOptions.listeners;
  49332. opts._renderChildren = vnodeComponentOptions.children;
  49333. opts._componentTag = vnodeComponentOptions.tag;
  49334. if (options.render) {
  49335. opts.render = options.render;
  49336. opts.staticRenderFns = options.staticRenderFns;
  49337. }
  49338. }
  49339. function resolveConstructorOptions (Ctor) {
  49340. var options = Ctor.options;
  49341. if (Ctor.super) {
  49342. var superOptions = resolveConstructorOptions(Ctor.super);
  49343. var cachedSuperOptions = Ctor.superOptions;
  49344. if (superOptions !== cachedSuperOptions) {
  49345. // super option changed,
  49346. // need to resolve new options.
  49347. Ctor.superOptions = superOptions;
  49348. // check if there are any late-modified/attached options (#4976)
  49349. var modifiedOptions = resolveModifiedOptions(Ctor);
  49350. // update base extend options
  49351. if (modifiedOptions) {
  49352. extend(Ctor.extendOptions, modifiedOptions);
  49353. }
  49354. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49355. if (options.name) {
  49356. options.components[options.name] = Ctor;
  49357. }
  49358. }
  49359. }
  49360. return options
  49361. }
  49362. function resolveModifiedOptions (Ctor) {
  49363. var modified;
  49364. var latest = Ctor.options;
  49365. var sealed = Ctor.sealedOptions;
  49366. for (var key in latest) {
  49367. if (latest[key] !== sealed[key]) {
  49368. if (!modified) { modified = {}; }
  49369. modified[key] = latest[key];
  49370. }
  49371. }
  49372. return modified
  49373. }
  49374. function Vue (options) {
  49375. if (!(this instanceof Vue)
  49376. ) {
  49377. warn('Vue is a constructor and should be called with the `new` keyword');
  49378. }
  49379. this._init(options);
  49380. }
  49381. initMixin(Vue);
  49382. stateMixin(Vue);
  49383. eventsMixin(Vue);
  49384. lifecycleMixin(Vue);
  49385. renderMixin(Vue);
  49386. /* */
  49387. function initUse (Vue) {
  49388. Vue.use = function (plugin) {
  49389. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49390. if (installedPlugins.indexOf(plugin) > -1) {
  49391. return this
  49392. }
  49393. // additional parameters
  49394. var args = toArray(arguments, 1);
  49395. args.unshift(this);
  49396. if (typeof plugin.install === 'function') {
  49397. plugin.install.apply(plugin, args);
  49398. } else if (typeof plugin === 'function') {
  49399. plugin.apply(null, args);
  49400. }
  49401. installedPlugins.push(plugin);
  49402. return this
  49403. };
  49404. }
  49405. /* */
  49406. function initMixin$1 (Vue) {
  49407. Vue.mixin = function (mixin) {
  49408. this.options = mergeOptions(this.options, mixin);
  49409. return this
  49410. };
  49411. }
  49412. /* */
  49413. function initExtend (Vue) {
  49414. /**
  49415. * Each instance constructor, including Vue, has a unique
  49416. * cid. This enables us to create wrapped "child
  49417. * constructors" for prototypal inheritance and cache them.
  49418. */
  49419. Vue.cid = 0;
  49420. var cid = 1;
  49421. /**
  49422. * Class inheritance
  49423. */
  49424. Vue.extend = function (extendOptions) {
  49425. extendOptions = extendOptions || {};
  49426. var Super = this;
  49427. var SuperId = Super.cid;
  49428. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49429. if (cachedCtors[SuperId]) {
  49430. return cachedCtors[SuperId]
  49431. }
  49432. var name = extendOptions.name || Super.options.name;
  49433. if (name) {
  49434. validateComponentName(name);
  49435. }
  49436. var Sub = function VueComponent (options) {
  49437. this._init(options);
  49438. };
  49439. Sub.prototype = Object.create(Super.prototype);
  49440. Sub.prototype.constructor = Sub;
  49441. Sub.cid = cid++;
  49442. Sub.options = mergeOptions(
  49443. Super.options,
  49444. extendOptions
  49445. );
  49446. Sub['super'] = Super;
  49447. // For props and computed properties, we define the proxy getters on
  49448. // the Vue instances at extension time, on the extended prototype. This
  49449. // avoids Object.defineProperty calls for each instance created.
  49450. if (Sub.options.props) {
  49451. initProps$1(Sub);
  49452. }
  49453. if (Sub.options.computed) {
  49454. initComputed$1(Sub);
  49455. }
  49456. // allow further extension/mixin/plugin usage
  49457. Sub.extend = Super.extend;
  49458. Sub.mixin = Super.mixin;
  49459. Sub.use = Super.use;
  49460. // create asset registers, so extended classes
  49461. // can have their private assets too.
  49462. ASSET_TYPES.forEach(function (type) {
  49463. Sub[type] = Super[type];
  49464. });
  49465. // enable recursive self-lookup
  49466. if (name) {
  49467. Sub.options.components[name] = Sub;
  49468. }
  49469. // keep a reference to the super options at extension time.
  49470. // later at instantiation we can check if Super's options have
  49471. // been updated.
  49472. Sub.superOptions = Super.options;
  49473. Sub.extendOptions = extendOptions;
  49474. Sub.sealedOptions = extend({}, Sub.options);
  49475. // cache constructor
  49476. cachedCtors[SuperId] = Sub;
  49477. return Sub
  49478. };
  49479. }
  49480. function initProps$1 (Comp) {
  49481. var props = Comp.options.props;
  49482. for (var key in props) {
  49483. proxy(Comp.prototype, "_props", key);
  49484. }
  49485. }
  49486. function initComputed$1 (Comp) {
  49487. var computed = Comp.options.computed;
  49488. for (var key in computed) {
  49489. defineComputed(Comp.prototype, key, computed[key]);
  49490. }
  49491. }
  49492. /* */
  49493. function initAssetRegisters (Vue) {
  49494. /**
  49495. * Create asset registration methods.
  49496. */
  49497. ASSET_TYPES.forEach(function (type) {
  49498. Vue[type] = function (
  49499. id,
  49500. definition
  49501. ) {
  49502. if (!definition) {
  49503. return this.options[type + 's'][id]
  49504. } else {
  49505. /* istanbul ignore if */
  49506. if (type === 'component') {
  49507. validateComponentName(id);
  49508. }
  49509. if (type === 'component' && isPlainObject(definition)) {
  49510. definition.name = definition.name || id;
  49511. definition = this.options._base.extend(definition);
  49512. }
  49513. if (type === 'directive' && typeof definition === 'function') {
  49514. definition = { bind: definition, update: definition };
  49515. }
  49516. this.options[type + 's'][id] = definition;
  49517. return definition
  49518. }
  49519. };
  49520. });
  49521. }
  49522. /* */
  49523. function getComponentName (opts) {
  49524. return opts && (opts.Ctor.options.name || opts.tag)
  49525. }
  49526. function matches (pattern, name) {
  49527. if (Array.isArray(pattern)) {
  49528. return pattern.indexOf(name) > -1
  49529. } else if (typeof pattern === 'string') {
  49530. return pattern.split(',').indexOf(name) > -1
  49531. } else if (isRegExp(pattern)) {
  49532. return pattern.test(name)
  49533. }
  49534. /* istanbul ignore next */
  49535. return false
  49536. }
  49537. function pruneCache (keepAliveInstance, filter) {
  49538. var cache = keepAliveInstance.cache;
  49539. var keys = keepAliveInstance.keys;
  49540. var _vnode = keepAliveInstance._vnode;
  49541. for (var key in cache) {
  49542. var cachedNode = cache[key];
  49543. if (cachedNode) {
  49544. var name = getComponentName(cachedNode.componentOptions);
  49545. if (name && !filter(name)) {
  49546. pruneCacheEntry(cache, key, keys, _vnode);
  49547. }
  49548. }
  49549. }
  49550. }
  49551. function pruneCacheEntry (
  49552. cache,
  49553. key,
  49554. keys,
  49555. current
  49556. ) {
  49557. var cached$$1 = cache[key];
  49558. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49559. cached$$1.componentInstance.$destroy();
  49560. }
  49561. cache[key] = null;
  49562. remove(keys, key);
  49563. }
  49564. var patternTypes = [String, RegExp, Array];
  49565. var KeepAlive = {
  49566. name: 'keep-alive',
  49567. abstract: true,
  49568. props: {
  49569. include: patternTypes,
  49570. exclude: patternTypes,
  49571. max: [String, Number]
  49572. },
  49573. created: function created () {
  49574. this.cache = Object.create(null);
  49575. this.keys = [];
  49576. },
  49577. destroyed: function destroyed () {
  49578. for (var key in this.cache) {
  49579. pruneCacheEntry(this.cache, key, this.keys);
  49580. }
  49581. },
  49582. mounted: function mounted () {
  49583. var this$1 = this;
  49584. this.$watch('include', function (val) {
  49585. pruneCache(this$1, function (name) { return matches(val, name); });
  49586. });
  49587. this.$watch('exclude', function (val) {
  49588. pruneCache(this$1, function (name) { return !matches(val, name); });
  49589. });
  49590. },
  49591. render: function render () {
  49592. var slot = this.$slots.default;
  49593. var vnode = getFirstComponentChild(slot);
  49594. var componentOptions = vnode && vnode.componentOptions;
  49595. if (componentOptions) {
  49596. // check pattern
  49597. var name = getComponentName(componentOptions);
  49598. var ref = this;
  49599. var include = ref.include;
  49600. var exclude = ref.exclude;
  49601. if (
  49602. // not included
  49603. (include && (!name || !matches(include, name))) ||
  49604. // excluded
  49605. (exclude && name && matches(exclude, name))
  49606. ) {
  49607. return vnode
  49608. }
  49609. var ref$1 = this;
  49610. var cache = ref$1.cache;
  49611. var keys = ref$1.keys;
  49612. var key = vnode.key == null
  49613. // same constructor may get registered as different local components
  49614. // so cid alone is not enough (#3269)
  49615. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49616. : vnode.key;
  49617. if (cache[key]) {
  49618. vnode.componentInstance = cache[key].componentInstance;
  49619. // make current key freshest
  49620. remove(keys, key);
  49621. keys.push(key);
  49622. } else {
  49623. cache[key] = vnode;
  49624. keys.push(key);
  49625. // prune oldest entry
  49626. if (this.max && keys.length > parseInt(this.max)) {
  49627. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49628. }
  49629. }
  49630. vnode.data.keepAlive = true;
  49631. }
  49632. return vnode || (slot && slot[0])
  49633. }
  49634. };
  49635. var builtInComponents = {
  49636. KeepAlive: KeepAlive
  49637. };
  49638. /* */
  49639. function initGlobalAPI (Vue) {
  49640. // config
  49641. var configDef = {};
  49642. configDef.get = function () { return config; };
  49643. {
  49644. configDef.set = function () {
  49645. warn(
  49646. 'Do not replace the Vue.config object, set individual fields instead.'
  49647. );
  49648. };
  49649. }
  49650. Object.defineProperty(Vue, 'config', configDef);
  49651. // exposed util methods.
  49652. // NOTE: these are not considered part of the public API - avoid relying on
  49653. // them unless you are aware of the risk.
  49654. Vue.util = {
  49655. warn: warn,
  49656. extend: extend,
  49657. mergeOptions: mergeOptions,
  49658. defineReactive: defineReactive$$1
  49659. };
  49660. Vue.set = set;
  49661. Vue.delete = del;
  49662. Vue.nextTick = nextTick;
  49663. // 2.6 explicit observable API
  49664. Vue.observable = function (obj) {
  49665. observe(obj);
  49666. return obj
  49667. };
  49668. Vue.options = Object.create(null);
  49669. ASSET_TYPES.forEach(function (type) {
  49670. Vue.options[type + 's'] = Object.create(null);
  49671. });
  49672. // this is used to identify the "base" constructor to extend all plain-object
  49673. // components with in Weex's multi-instance scenarios.
  49674. Vue.options._base = Vue;
  49675. extend(Vue.options.components, builtInComponents);
  49676. initUse(Vue);
  49677. initMixin$1(Vue);
  49678. initExtend(Vue);
  49679. initAssetRegisters(Vue);
  49680. }
  49681. initGlobalAPI(Vue);
  49682. Object.defineProperty(Vue.prototype, '$isServer', {
  49683. get: isServerRendering
  49684. });
  49685. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49686. get: function get () {
  49687. /* istanbul ignore next */
  49688. return this.$vnode && this.$vnode.ssrContext
  49689. }
  49690. });
  49691. // expose FunctionalRenderContext for ssr runtime helper installation
  49692. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49693. value: FunctionalRenderContext
  49694. });
  49695. Vue.version = '2.6.11';
  49696. /* */
  49697. // these are reserved for web because they are directly compiled away
  49698. // during template compilation
  49699. var isReservedAttr = makeMap('style,class');
  49700. // attributes that should be using props for binding
  49701. var acceptValue = makeMap('input,textarea,option,select,progress');
  49702. var mustUseProp = function (tag, type, attr) {
  49703. return (
  49704. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49705. (attr === 'selected' && tag === 'option') ||
  49706. (attr === 'checked' && tag === 'input') ||
  49707. (attr === 'muted' && tag === 'video')
  49708. )
  49709. };
  49710. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49711. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49712. var convertEnumeratedValue = function (key, value) {
  49713. return isFalsyAttrValue(value) || value === 'false'
  49714. ? 'false'
  49715. // allow arbitrary string value for contenteditable
  49716. : key === 'contenteditable' && isValidContentEditableValue(value)
  49717. ? value
  49718. : 'true'
  49719. };
  49720. var isBooleanAttr = makeMap(
  49721. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49722. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49723. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49724. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49725. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49726. 'truespeed,typemustmatch,visible'
  49727. );
  49728. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49729. var isXlink = function (name) {
  49730. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49731. };
  49732. var getXlinkProp = function (name) {
  49733. return isXlink(name) ? name.slice(6, name.length) : ''
  49734. };
  49735. var isFalsyAttrValue = function (val) {
  49736. return val == null || val === false
  49737. };
  49738. /* */
  49739. function genClassForVnode (vnode) {
  49740. var data = vnode.data;
  49741. var parentNode = vnode;
  49742. var childNode = vnode;
  49743. while (isDef(childNode.componentInstance)) {
  49744. childNode = childNode.componentInstance._vnode;
  49745. if (childNode && childNode.data) {
  49746. data = mergeClassData(childNode.data, data);
  49747. }
  49748. }
  49749. while (isDef(parentNode = parentNode.parent)) {
  49750. if (parentNode && parentNode.data) {
  49751. data = mergeClassData(data, parentNode.data);
  49752. }
  49753. }
  49754. return renderClass(data.staticClass, data.class)
  49755. }
  49756. function mergeClassData (child, parent) {
  49757. return {
  49758. staticClass: concat(child.staticClass, parent.staticClass),
  49759. class: isDef(child.class)
  49760. ? [child.class, parent.class]
  49761. : parent.class
  49762. }
  49763. }
  49764. function renderClass (
  49765. staticClass,
  49766. dynamicClass
  49767. ) {
  49768. if (isDef(staticClass) || isDef(dynamicClass)) {
  49769. return concat(staticClass, stringifyClass(dynamicClass))
  49770. }
  49771. /* istanbul ignore next */
  49772. return ''
  49773. }
  49774. function concat (a, b) {
  49775. return a ? b ? (a + ' ' + b) : a : (b || '')
  49776. }
  49777. function stringifyClass (value) {
  49778. if (Array.isArray(value)) {
  49779. return stringifyArray(value)
  49780. }
  49781. if (isObject(value)) {
  49782. return stringifyObject(value)
  49783. }
  49784. if (typeof value === 'string') {
  49785. return value
  49786. }
  49787. /* istanbul ignore next */
  49788. return ''
  49789. }
  49790. function stringifyArray (value) {
  49791. var res = '';
  49792. var stringified;
  49793. for (var i = 0, l = value.length; i < l; i++) {
  49794. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49795. if (res) { res += ' '; }
  49796. res += stringified;
  49797. }
  49798. }
  49799. return res
  49800. }
  49801. function stringifyObject (value) {
  49802. var res = '';
  49803. for (var key in value) {
  49804. if (value[key]) {
  49805. if (res) { res += ' '; }
  49806. res += key;
  49807. }
  49808. }
  49809. return res
  49810. }
  49811. /* */
  49812. var namespaceMap = {
  49813. svg: 'http://www.w3.org/2000/svg',
  49814. math: 'http://www.w3.org/1998/Math/MathML'
  49815. };
  49816. var isHTMLTag = makeMap(
  49817. 'html,body,base,head,link,meta,style,title,' +
  49818. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49819. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49820. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49821. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49822. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49823. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49824. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49825. 'output,progress,select,textarea,' +
  49826. 'details,dialog,menu,menuitem,summary,' +
  49827. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49828. );
  49829. // this map is intentionally selective, only covering SVG elements that may
  49830. // contain child elements.
  49831. var isSVG = makeMap(
  49832. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49833. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49834. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49835. true
  49836. );
  49837. var isPreTag = function (tag) { return tag === 'pre'; };
  49838. var isReservedTag = function (tag) {
  49839. return isHTMLTag(tag) || isSVG(tag)
  49840. };
  49841. function getTagNamespace (tag) {
  49842. if (isSVG(tag)) {
  49843. return 'svg'
  49844. }
  49845. // basic support for MathML
  49846. // note it doesn't support other MathML elements being component roots
  49847. if (tag === 'math') {
  49848. return 'math'
  49849. }
  49850. }
  49851. var unknownElementCache = Object.create(null);
  49852. function isUnknownElement (tag) {
  49853. /* istanbul ignore if */
  49854. if (!inBrowser) {
  49855. return true
  49856. }
  49857. if (isReservedTag(tag)) {
  49858. return false
  49859. }
  49860. tag = tag.toLowerCase();
  49861. /* istanbul ignore if */
  49862. if (unknownElementCache[tag] != null) {
  49863. return unknownElementCache[tag]
  49864. }
  49865. var el = document.createElement(tag);
  49866. if (tag.indexOf('-') > -1) {
  49867. // http://stackoverflow.com/a/28210364/1070244
  49868. return (unknownElementCache[tag] = (
  49869. el.constructor === window.HTMLUnknownElement ||
  49870. el.constructor === window.HTMLElement
  49871. ))
  49872. } else {
  49873. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49874. }
  49875. }
  49876. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49877. /* */
  49878. /**
  49879. * Query an element selector if it's not an element already.
  49880. */
  49881. function query (el) {
  49882. if (typeof el === 'string') {
  49883. var selected = document.querySelector(el);
  49884. if (!selected) {
  49885. warn(
  49886. 'Cannot find element: ' + el
  49887. );
  49888. return document.createElement('div')
  49889. }
  49890. return selected
  49891. } else {
  49892. return el
  49893. }
  49894. }
  49895. /* */
  49896. function createElement$1 (tagName, vnode) {
  49897. var elm = document.createElement(tagName);
  49898. if (tagName !== 'select') {
  49899. return elm
  49900. }
  49901. // false or null will remove the attribute but undefined will not
  49902. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49903. elm.setAttribute('multiple', 'multiple');
  49904. }
  49905. return elm
  49906. }
  49907. function createElementNS (namespace, tagName) {
  49908. return document.createElementNS(namespaceMap[namespace], tagName)
  49909. }
  49910. function createTextNode (text) {
  49911. return document.createTextNode(text)
  49912. }
  49913. function createComment (text) {
  49914. return document.createComment(text)
  49915. }
  49916. function insertBefore (parentNode, newNode, referenceNode) {
  49917. parentNode.insertBefore(newNode, referenceNode);
  49918. }
  49919. function removeChild (node, child) {
  49920. node.removeChild(child);
  49921. }
  49922. function appendChild (node, child) {
  49923. node.appendChild(child);
  49924. }
  49925. function parentNode (node) {
  49926. return node.parentNode
  49927. }
  49928. function nextSibling (node) {
  49929. return node.nextSibling
  49930. }
  49931. function tagName (node) {
  49932. return node.tagName
  49933. }
  49934. function setTextContent (node, text) {
  49935. node.textContent = text;
  49936. }
  49937. function setStyleScope (node, scopeId) {
  49938. node.setAttribute(scopeId, '');
  49939. }
  49940. var nodeOps = /*#__PURE__*/Object.freeze({
  49941. createElement: createElement$1,
  49942. createElementNS: createElementNS,
  49943. createTextNode: createTextNode,
  49944. createComment: createComment,
  49945. insertBefore: insertBefore,
  49946. removeChild: removeChild,
  49947. appendChild: appendChild,
  49948. parentNode: parentNode,
  49949. nextSibling: nextSibling,
  49950. tagName: tagName,
  49951. setTextContent: setTextContent,
  49952. setStyleScope: setStyleScope
  49953. });
  49954. /* */
  49955. var ref = {
  49956. create: function create (_, vnode) {
  49957. registerRef(vnode);
  49958. },
  49959. update: function update (oldVnode, vnode) {
  49960. if (oldVnode.data.ref !== vnode.data.ref) {
  49961. registerRef(oldVnode, true);
  49962. registerRef(vnode);
  49963. }
  49964. },
  49965. destroy: function destroy (vnode) {
  49966. registerRef(vnode, true);
  49967. }
  49968. };
  49969. function registerRef (vnode, isRemoval) {
  49970. var key = vnode.data.ref;
  49971. if (!isDef(key)) { return }
  49972. var vm = vnode.context;
  49973. var ref = vnode.componentInstance || vnode.elm;
  49974. var refs = vm.$refs;
  49975. if (isRemoval) {
  49976. if (Array.isArray(refs[key])) {
  49977. remove(refs[key], ref);
  49978. } else if (refs[key] === ref) {
  49979. refs[key] = undefined;
  49980. }
  49981. } else {
  49982. if (vnode.data.refInFor) {
  49983. if (!Array.isArray(refs[key])) {
  49984. refs[key] = [ref];
  49985. } else if (refs[key].indexOf(ref) < 0) {
  49986. // $flow-disable-line
  49987. refs[key].push(ref);
  49988. }
  49989. } else {
  49990. refs[key] = ref;
  49991. }
  49992. }
  49993. }
  49994. /**
  49995. * Virtual DOM patching algorithm based on Snabbdom by
  49996. * Simon Friis Vindum (@paldepind)
  49997. * Licensed under the MIT License
  49998. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49999. *
  50000. * modified by Evan You (@yyx990803)
  50001. *
  50002. * Not type-checking this because this file is perf-critical and the cost
  50003. * of making flow understand it is not worth it.
  50004. */
  50005. var emptyNode = new VNode('', {}, []);
  50006. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  50007. function sameVnode (a, b) {
  50008. return (
  50009. a.key === b.key && (
  50010. (
  50011. a.tag === b.tag &&
  50012. a.isComment === b.isComment &&
  50013. isDef(a.data) === isDef(b.data) &&
  50014. sameInputType(a, b)
  50015. ) || (
  50016. isTrue(a.isAsyncPlaceholder) &&
  50017. a.asyncFactory === b.asyncFactory &&
  50018. isUndef(b.asyncFactory.error)
  50019. )
  50020. )
  50021. )
  50022. }
  50023. function sameInputType (a, b) {
  50024. if (a.tag !== 'input') { return true }
  50025. var i;
  50026. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  50027. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  50028. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  50029. }
  50030. function createKeyToOldIdx (children, beginIdx, endIdx) {
  50031. var i, key;
  50032. var map = {};
  50033. for (i = beginIdx; i <= endIdx; ++i) {
  50034. key = children[i].key;
  50035. if (isDef(key)) { map[key] = i; }
  50036. }
  50037. return map
  50038. }
  50039. function createPatchFunction (backend) {
  50040. var i, j;
  50041. var cbs = {};
  50042. var modules = backend.modules;
  50043. var nodeOps = backend.nodeOps;
  50044. for (i = 0; i < hooks.length; ++i) {
  50045. cbs[hooks[i]] = [];
  50046. for (j = 0; j < modules.length; ++j) {
  50047. if (isDef(modules[j][hooks[i]])) {
  50048. cbs[hooks[i]].push(modules[j][hooks[i]]);
  50049. }
  50050. }
  50051. }
  50052. function emptyNodeAt (elm) {
  50053. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  50054. }
  50055. function createRmCb (childElm, listeners) {
  50056. function remove$$1 () {
  50057. if (--remove$$1.listeners === 0) {
  50058. removeNode(childElm);
  50059. }
  50060. }
  50061. remove$$1.listeners = listeners;
  50062. return remove$$1
  50063. }
  50064. function removeNode (el) {
  50065. var parent = nodeOps.parentNode(el);
  50066. // element may have already been removed due to v-html / v-text
  50067. if (isDef(parent)) {
  50068. nodeOps.removeChild(parent, el);
  50069. }
  50070. }
  50071. function isUnknownElement$$1 (vnode, inVPre) {
  50072. return (
  50073. !inVPre &&
  50074. !vnode.ns &&
  50075. !(
  50076. config.ignoredElements.length &&
  50077. config.ignoredElements.some(function (ignore) {
  50078. return isRegExp(ignore)
  50079. ? ignore.test(vnode.tag)
  50080. : ignore === vnode.tag
  50081. })
  50082. ) &&
  50083. config.isUnknownElement(vnode.tag)
  50084. )
  50085. }
  50086. var creatingElmInVPre = 0;
  50087. function createElm (
  50088. vnode,
  50089. insertedVnodeQueue,
  50090. parentElm,
  50091. refElm,
  50092. nested,
  50093. ownerArray,
  50094. index
  50095. ) {
  50096. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50097. // This vnode was used in a previous render!
  50098. // now it's used as a new node, overwriting its elm would cause
  50099. // potential patch errors down the road when it's used as an insertion
  50100. // reference node. Instead, we clone the node on-demand before creating
  50101. // associated DOM element for it.
  50102. vnode = ownerArray[index] = cloneVNode(vnode);
  50103. }
  50104. vnode.isRootInsert = !nested; // for transition enter check
  50105. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  50106. return
  50107. }
  50108. var data = vnode.data;
  50109. var children = vnode.children;
  50110. var tag = vnode.tag;
  50111. if (isDef(tag)) {
  50112. {
  50113. if (data && data.pre) {
  50114. creatingElmInVPre++;
  50115. }
  50116. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50117. warn(
  50118. 'Unknown custom element: <' + tag + '> - did you ' +
  50119. 'register the component correctly? For recursive components, ' +
  50120. 'make sure to provide the "name" option.',
  50121. vnode.context
  50122. );
  50123. }
  50124. }
  50125. vnode.elm = vnode.ns
  50126. ? nodeOps.createElementNS(vnode.ns, tag)
  50127. : nodeOps.createElement(tag, vnode);
  50128. setScope(vnode);
  50129. /* istanbul ignore if */
  50130. {
  50131. createChildren(vnode, children, insertedVnodeQueue);
  50132. if (isDef(data)) {
  50133. invokeCreateHooks(vnode, insertedVnodeQueue);
  50134. }
  50135. insert(parentElm, vnode.elm, refElm);
  50136. }
  50137. if (data && data.pre) {
  50138. creatingElmInVPre--;
  50139. }
  50140. } else if (isTrue(vnode.isComment)) {
  50141. vnode.elm = nodeOps.createComment(vnode.text);
  50142. insert(parentElm, vnode.elm, refElm);
  50143. } else {
  50144. vnode.elm = nodeOps.createTextNode(vnode.text);
  50145. insert(parentElm, vnode.elm, refElm);
  50146. }
  50147. }
  50148. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50149. var i = vnode.data;
  50150. if (isDef(i)) {
  50151. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50152. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50153. i(vnode, false /* hydrating */);
  50154. }
  50155. // after calling the init hook, if the vnode is a child component
  50156. // it should've created a child instance and mounted it. the child
  50157. // component also has set the placeholder vnode's elm.
  50158. // in that case we can just return the element and be done.
  50159. if (isDef(vnode.componentInstance)) {
  50160. initComponent(vnode, insertedVnodeQueue);
  50161. insert(parentElm, vnode.elm, refElm);
  50162. if (isTrue(isReactivated)) {
  50163. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50164. }
  50165. return true
  50166. }
  50167. }
  50168. }
  50169. function initComponent (vnode, insertedVnodeQueue) {
  50170. if (isDef(vnode.data.pendingInsert)) {
  50171. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50172. vnode.data.pendingInsert = null;
  50173. }
  50174. vnode.elm = vnode.componentInstance.$el;
  50175. if (isPatchable(vnode)) {
  50176. invokeCreateHooks(vnode, insertedVnodeQueue);
  50177. setScope(vnode);
  50178. } else {
  50179. // empty component root.
  50180. // skip all element-related modules except for ref (#3455)
  50181. registerRef(vnode);
  50182. // make sure to invoke the insert hook
  50183. insertedVnodeQueue.push(vnode);
  50184. }
  50185. }
  50186. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50187. var i;
  50188. // hack for #4339: a reactivated component with inner transition
  50189. // does not trigger because the inner node's created hooks are not called
  50190. // again. It's not ideal to involve module-specific logic in here but
  50191. // there doesn't seem to be a better way to do it.
  50192. var innerNode = vnode;
  50193. while (innerNode.componentInstance) {
  50194. innerNode = innerNode.componentInstance._vnode;
  50195. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50196. for (i = 0; i < cbs.activate.length; ++i) {
  50197. cbs.activate[i](emptyNode, innerNode);
  50198. }
  50199. insertedVnodeQueue.push(innerNode);
  50200. break
  50201. }
  50202. }
  50203. // unlike a newly created component,
  50204. // a reactivated keep-alive component doesn't insert itself
  50205. insert(parentElm, vnode.elm, refElm);
  50206. }
  50207. function insert (parent, elm, ref$$1) {
  50208. if (isDef(parent)) {
  50209. if (isDef(ref$$1)) {
  50210. if (nodeOps.parentNode(ref$$1) === parent) {
  50211. nodeOps.insertBefore(parent, elm, ref$$1);
  50212. }
  50213. } else {
  50214. nodeOps.appendChild(parent, elm);
  50215. }
  50216. }
  50217. }
  50218. function createChildren (vnode, children, insertedVnodeQueue) {
  50219. if (Array.isArray(children)) {
  50220. {
  50221. checkDuplicateKeys(children);
  50222. }
  50223. for (var i = 0; i < children.length; ++i) {
  50224. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50225. }
  50226. } else if (isPrimitive(vnode.text)) {
  50227. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50228. }
  50229. }
  50230. function isPatchable (vnode) {
  50231. while (vnode.componentInstance) {
  50232. vnode = vnode.componentInstance._vnode;
  50233. }
  50234. return isDef(vnode.tag)
  50235. }
  50236. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50237. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50238. cbs.create[i$1](emptyNode, vnode);
  50239. }
  50240. i = vnode.data.hook; // Reuse variable
  50241. if (isDef(i)) {
  50242. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50243. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50244. }
  50245. }
  50246. // set scope id attribute for scoped CSS.
  50247. // this is implemented as a special case to avoid the overhead
  50248. // of going through the normal attribute patching process.
  50249. function setScope (vnode) {
  50250. var i;
  50251. if (isDef(i = vnode.fnScopeId)) {
  50252. nodeOps.setStyleScope(vnode.elm, i);
  50253. } else {
  50254. var ancestor = vnode;
  50255. while (ancestor) {
  50256. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50257. nodeOps.setStyleScope(vnode.elm, i);
  50258. }
  50259. ancestor = ancestor.parent;
  50260. }
  50261. }
  50262. // for slot content they should also get the scopeId from the host instance.
  50263. if (isDef(i = activeInstance) &&
  50264. i !== vnode.context &&
  50265. i !== vnode.fnContext &&
  50266. isDef(i = i.$options._scopeId)
  50267. ) {
  50268. nodeOps.setStyleScope(vnode.elm, i);
  50269. }
  50270. }
  50271. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50272. for (; startIdx <= endIdx; ++startIdx) {
  50273. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50274. }
  50275. }
  50276. function invokeDestroyHook (vnode) {
  50277. var i, j;
  50278. var data = vnode.data;
  50279. if (isDef(data)) {
  50280. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50281. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50282. }
  50283. if (isDef(i = vnode.children)) {
  50284. for (j = 0; j < vnode.children.length; ++j) {
  50285. invokeDestroyHook(vnode.children[j]);
  50286. }
  50287. }
  50288. }
  50289. function removeVnodes (vnodes, startIdx, endIdx) {
  50290. for (; startIdx <= endIdx; ++startIdx) {
  50291. var ch = vnodes[startIdx];
  50292. if (isDef(ch)) {
  50293. if (isDef(ch.tag)) {
  50294. removeAndInvokeRemoveHook(ch);
  50295. invokeDestroyHook(ch);
  50296. } else { // Text node
  50297. removeNode(ch.elm);
  50298. }
  50299. }
  50300. }
  50301. }
  50302. function removeAndInvokeRemoveHook (vnode, rm) {
  50303. if (isDef(rm) || isDef(vnode.data)) {
  50304. var i;
  50305. var listeners = cbs.remove.length + 1;
  50306. if (isDef(rm)) {
  50307. // we have a recursively passed down rm callback
  50308. // increase the listeners count
  50309. rm.listeners += listeners;
  50310. } else {
  50311. // directly removing
  50312. rm = createRmCb(vnode.elm, listeners);
  50313. }
  50314. // recursively invoke hooks on child component root node
  50315. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50316. removeAndInvokeRemoveHook(i, rm);
  50317. }
  50318. for (i = 0; i < cbs.remove.length; ++i) {
  50319. cbs.remove[i](vnode, rm);
  50320. }
  50321. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50322. i(vnode, rm);
  50323. } else {
  50324. rm();
  50325. }
  50326. } else {
  50327. removeNode(vnode.elm);
  50328. }
  50329. }
  50330. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50331. var oldStartIdx = 0;
  50332. var newStartIdx = 0;
  50333. var oldEndIdx = oldCh.length - 1;
  50334. var oldStartVnode = oldCh[0];
  50335. var oldEndVnode = oldCh[oldEndIdx];
  50336. var newEndIdx = newCh.length - 1;
  50337. var newStartVnode = newCh[0];
  50338. var newEndVnode = newCh[newEndIdx];
  50339. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50340. // removeOnly is a special flag used only by <transition-group>
  50341. // to ensure removed elements stay in correct relative positions
  50342. // during leaving transitions
  50343. var canMove = !removeOnly;
  50344. {
  50345. checkDuplicateKeys(newCh);
  50346. }
  50347. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50348. if (isUndef(oldStartVnode)) {
  50349. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50350. } else if (isUndef(oldEndVnode)) {
  50351. oldEndVnode = oldCh[--oldEndIdx];
  50352. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50353. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50354. oldStartVnode = oldCh[++oldStartIdx];
  50355. newStartVnode = newCh[++newStartIdx];
  50356. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50357. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50358. oldEndVnode = oldCh[--oldEndIdx];
  50359. newEndVnode = newCh[--newEndIdx];
  50360. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50361. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50362. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50363. oldStartVnode = oldCh[++oldStartIdx];
  50364. newEndVnode = newCh[--newEndIdx];
  50365. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50366. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50367. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50368. oldEndVnode = oldCh[--oldEndIdx];
  50369. newStartVnode = newCh[++newStartIdx];
  50370. } else {
  50371. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50372. idxInOld = isDef(newStartVnode.key)
  50373. ? oldKeyToIdx[newStartVnode.key]
  50374. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50375. if (isUndef(idxInOld)) { // New element
  50376. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50377. } else {
  50378. vnodeToMove = oldCh[idxInOld];
  50379. if (sameVnode(vnodeToMove, newStartVnode)) {
  50380. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50381. oldCh[idxInOld] = undefined;
  50382. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50383. } else {
  50384. // same key but different element. treat as new element
  50385. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50386. }
  50387. }
  50388. newStartVnode = newCh[++newStartIdx];
  50389. }
  50390. }
  50391. if (oldStartIdx > oldEndIdx) {
  50392. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50393. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50394. } else if (newStartIdx > newEndIdx) {
  50395. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50396. }
  50397. }
  50398. function checkDuplicateKeys (children) {
  50399. var seenKeys = {};
  50400. for (var i = 0; i < children.length; i++) {
  50401. var vnode = children[i];
  50402. var key = vnode.key;
  50403. if (isDef(key)) {
  50404. if (seenKeys[key]) {
  50405. warn(
  50406. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50407. vnode.context
  50408. );
  50409. } else {
  50410. seenKeys[key] = true;
  50411. }
  50412. }
  50413. }
  50414. }
  50415. function findIdxInOld (node, oldCh, start, end) {
  50416. for (var i = start; i < end; i++) {
  50417. var c = oldCh[i];
  50418. if (isDef(c) && sameVnode(node, c)) { return i }
  50419. }
  50420. }
  50421. function patchVnode (
  50422. oldVnode,
  50423. vnode,
  50424. insertedVnodeQueue,
  50425. ownerArray,
  50426. index,
  50427. removeOnly
  50428. ) {
  50429. if (oldVnode === vnode) {
  50430. return
  50431. }
  50432. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50433. // clone reused vnode
  50434. vnode = ownerArray[index] = cloneVNode(vnode);
  50435. }
  50436. var elm = vnode.elm = oldVnode.elm;
  50437. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50438. if (isDef(vnode.asyncFactory.resolved)) {
  50439. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50440. } else {
  50441. vnode.isAsyncPlaceholder = true;
  50442. }
  50443. return
  50444. }
  50445. // reuse element for static trees.
  50446. // note we only do this if the vnode is cloned -
  50447. // if the new node is not cloned it means the render functions have been
  50448. // reset by the hot-reload-api and we need to do a proper re-render.
  50449. if (isTrue(vnode.isStatic) &&
  50450. isTrue(oldVnode.isStatic) &&
  50451. vnode.key === oldVnode.key &&
  50452. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50453. ) {
  50454. vnode.componentInstance = oldVnode.componentInstance;
  50455. return
  50456. }
  50457. var i;
  50458. var data = vnode.data;
  50459. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50460. i(oldVnode, vnode);
  50461. }
  50462. var oldCh = oldVnode.children;
  50463. var ch = vnode.children;
  50464. if (isDef(data) && isPatchable(vnode)) {
  50465. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50466. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50467. }
  50468. if (isUndef(vnode.text)) {
  50469. if (isDef(oldCh) && isDef(ch)) {
  50470. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50471. } else if (isDef(ch)) {
  50472. {
  50473. checkDuplicateKeys(ch);
  50474. }
  50475. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50476. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50477. } else if (isDef(oldCh)) {
  50478. removeVnodes(oldCh, 0, oldCh.length - 1);
  50479. } else if (isDef(oldVnode.text)) {
  50480. nodeOps.setTextContent(elm, '');
  50481. }
  50482. } else if (oldVnode.text !== vnode.text) {
  50483. nodeOps.setTextContent(elm, vnode.text);
  50484. }
  50485. if (isDef(data)) {
  50486. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50487. }
  50488. }
  50489. function invokeInsertHook (vnode, queue, initial) {
  50490. // delay insert hooks for component root nodes, invoke them after the
  50491. // element is really inserted
  50492. if (isTrue(initial) && isDef(vnode.parent)) {
  50493. vnode.parent.data.pendingInsert = queue;
  50494. } else {
  50495. for (var i = 0; i < queue.length; ++i) {
  50496. queue[i].data.hook.insert(queue[i]);
  50497. }
  50498. }
  50499. }
  50500. var hydrationBailed = false;
  50501. // list of modules that can skip create hook during hydration because they
  50502. // are already rendered on the client or has no need for initialization
  50503. // Note: style is excluded because it relies on initial clone for future
  50504. // deep updates (#7063).
  50505. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50506. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50507. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50508. var i;
  50509. var tag = vnode.tag;
  50510. var data = vnode.data;
  50511. var children = vnode.children;
  50512. inVPre = inVPre || (data && data.pre);
  50513. vnode.elm = elm;
  50514. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50515. vnode.isAsyncPlaceholder = true;
  50516. return true
  50517. }
  50518. // assert node match
  50519. {
  50520. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50521. return false
  50522. }
  50523. }
  50524. if (isDef(data)) {
  50525. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50526. if (isDef(i = vnode.componentInstance)) {
  50527. // child component. it should have hydrated its own tree.
  50528. initComponent(vnode, insertedVnodeQueue);
  50529. return true
  50530. }
  50531. }
  50532. if (isDef(tag)) {
  50533. if (isDef(children)) {
  50534. // empty element, allow client to pick up and populate children
  50535. if (!elm.hasChildNodes()) {
  50536. createChildren(vnode, children, insertedVnodeQueue);
  50537. } else {
  50538. // v-html and domProps: innerHTML
  50539. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50540. if (i !== elm.innerHTML) {
  50541. /* istanbul ignore if */
  50542. if (typeof console !== 'undefined' &&
  50543. !hydrationBailed
  50544. ) {
  50545. hydrationBailed = true;
  50546. console.warn('Parent: ', elm);
  50547. console.warn('server innerHTML: ', i);
  50548. console.warn('client innerHTML: ', elm.innerHTML);
  50549. }
  50550. return false
  50551. }
  50552. } else {
  50553. // iterate and compare children lists
  50554. var childrenMatch = true;
  50555. var childNode = elm.firstChild;
  50556. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50557. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50558. childrenMatch = false;
  50559. break
  50560. }
  50561. childNode = childNode.nextSibling;
  50562. }
  50563. // if childNode is not null, it means the actual childNodes list is
  50564. // longer than the virtual children list.
  50565. if (!childrenMatch || childNode) {
  50566. /* istanbul ignore if */
  50567. if (typeof console !== 'undefined' &&
  50568. !hydrationBailed
  50569. ) {
  50570. hydrationBailed = true;
  50571. console.warn('Parent: ', elm);
  50572. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50573. }
  50574. return false
  50575. }
  50576. }
  50577. }
  50578. }
  50579. if (isDef(data)) {
  50580. var fullInvoke = false;
  50581. for (var key in data) {
  50582. if (!isRenderedModule(key)) {
  50583. fullInvoke = true;
  50584. invokeCreateHooks(vnode, insertedVnodeQueue);
  50585. break
  50586. }
  50587. }
  50588. if (!fullInvoke && data['class']) {
  50589. // ensure collecting deps for deep class bindings for future updates
  50590. traverse(data['class']);
  50591. }
  50592. }
  50593. } else if (elm.data !== vnode.text) {
  50594. elm.data = vnode.text;
  50595. }
  50596. return true
  50597. }
  50598. function assertNodeMatch (node, vnode, inVPre) {
  50599. if (isDef(vnode.tag)) {
  50600. return vnode.tag.indexOf('vue-component') === 0 || (
  50601. !isUnknownElement$$1(vnode, inVPre) &&
  50602. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50603. )
  50604. } else {
  50605. return node.nodeType === (vnode.isComment ? 8 : 3)
  50606. }
  50607. }
  50608. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50609. if (isUndef(vnode)) {
  50610. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50611. return
  50612. }
  50613. var isInitialPatch = false;
  50614. var insertedVnodeQueue = [];
  50615. if (isUndef(oldVnode)) {
  50616. // empty mount (likely as component), create new root element
  50617. isInitialPatch = true;
  50618. createElm(vnode, insertedVnodeQueue);
  50619. } else {
  50620. var isRealElement = isDef(oldVnode.nodeType);
  50621. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50622. // patch existing root node
  50623. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50624. } else {
  50625. if (isRealElement) {
  50626. // mounting to a real element
  50627. // check if this is server-rendered content and if we can perform
  50628. // a successful hydration.
  50629. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50630. oldVnode.removeAttribute(SSR_ATTR);
  50631. hydrating = true;
  50632. }
  50633. if (isTrue(hydrating)) {
  50634. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50635. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50636. return oldVnode
  50637. } else {
  50638. warn(
  50639. 'The client-side rendered virtual DOM tree is not matching ' +
  50640. 'server-rendered content. This is likely caused by incorrect ' +
  50641. 'HTML markup, for example nesting block-level elements inside ' +
  50642. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50643. 'full client-side render.'
  50644. );
  50645. }
  50646. }
  50647. // either not server-rendered, or hydration failed.
  50648. // create an empty node and replace it
  50649. oldVnode = emptyNodeAt(oldVnode);
  50650. }
  50651. // replacing existing element
  50652. var oldElm = oldVnode.elm;
  50653. var parentElm = nodeOps.parentNode(oldElm);
  50654. // create new node
  50655. createElm(
  50656. vnode,
  50657. insertedVnodeQueue,
  50658. // extremely rare edge case: do not insert if old element is in a
  50659. // leaving transition. Only happens when combining transition +
  50660. // keep-alive + HOCs. (#4590)
  50661. oldElm._leaveCb ? null : parentElm,
  50662. nodeOps.nextSibling(oldElm)
  50663. );
  50664. // update parent placeholder node element, recursively
  50665. if (isDef(vnode.parent)) {
  50666. var ancestor = vnode.parent;
  50667. var patchable = isPatchable(vnode);
  50668. while (ancestor) {
  50669. for (var i = 0; i < cbs.destroy.length; ++i) {
  50670. cbs.destroy[i](ancestor);
  50671. }
  50672. ancestor.elm = vnode.elm;
  50673. if (patchable) {
  50674. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50675. cbs.create[i$1](emptyNode, ancestor);
  50676. }
  50677. // #6513
  50678. // invoke insert hooks that may have been merged by create hooks.
  50679. // e.g. for directives that uses the "inserted" hook.
  50680. var insert = ancestor.data.hook.insert;
  50681. if (insert.merged) {
  50682. // start at index 1 to avoid re-invoking component mounted hook
  50683. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50684. insert.fns[i$2]();
  50685. }
  50686. }
  50687. } else {
  50688. registerRef(ancestor);
  50689. }
  50690. ancestor = ancestor.parent;
  50691. }
  50692. }
  50693. // destroy old node
  50694. if (isDef(parentElm)) {
  50695. removeVnodes([oldVnode], 0, 0);
  50696. } else if (isDef(oldVnode.tag)) {
  50697. invokeDestroyHook(oldVnode);
  50698. }
  50699. }
  50700. }
  50701. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50702. return vnode.elm
  50703. }
  50704. }
  50705. /* */
  50706. var directives = {
  50707. create: updateDirectives,
  50708. update: updateDirectives,
  50709. destroy: function unbindDirectives (vnode) {
  50710. updateDirectives(vnode, emptyNode);
  50711. }
  50712. };
  50713. function updateDirectives (oldVnode, vnode) {
  50714. if (oldVnode.data.directives || vnode.data.directives) {
  50715. _update(oldVnode, vnode);
  50716. }
  50717. }
  50718. function _update (oldVnode, vnode) {
  50719. var isCreate = oldVnode === emptyNode;
  50720. var isDestroy = vnode === emptyNode;
  50721. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50722. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50723. var dirsWithInsert = [];
  50724. var dirsWithPostpatch = [];
  50725. var key, oldDir, dir;
  50726. for (key in newDirs) {
  50727. oldDir = oldDirs[key];
  50728. dir = newDirs[key];
  50729. if (!oldDir) {
  50730. // new directive, bind
  50731. callHook$1(dir, 'bind', vnode, oldVnode);
  50732. if (dir.def && dir.def.inserted) {
  50733. dirsWithInsert.push(dir);
  50734. }
  50735. } else {
  50736. // existing directive, update
  50737. dir.oldValue = oldDir.value;
  50738. dir.oldArg = oldDir.arg;
  50739. callHook$1(dir, 'update', vnode, oldVnode);
  50740. if (dir.def && dir.def.componentUpdated) {
  50741. dirsWithPostpatch.push(dir);
  50742. }
  50743. }
  50744. }
  50745. if (dirsWithInsert.length) {
  50746. var callInsert = function () {
  50747. for (var i = 0; i < dirsWithInsert.length; i++) {
  50748. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50749. }
  50750. };
  50751. if (isCreate) {
  50752. mergeVNodeHook(vnode, 'insert', callInsert);
  50753. } else {
  50754. callInsert();
  50755. }
  50756. }
  50757. if (dirsWithPostpatch.length) {
  50758. mergeVNodeHook(vnode, 'postpatch', function () {
  50759. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50760. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50761. }
  50762. });
  50763. }
  50764. if (!isCreate) {
  50765. for (key in oldDirs) {
  50766. if (!newDirs[key]) {
  50767. // no longer present, unbind
  50768. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50769. }
  50770. }
  50771. }
  50772. }
  50773. var emptyModifiers = Object.create(null);
  50774. function normalizeDirectives$1 (
  50775. dirs,
  50776. vm
  50777. ) {
  50778. var res = Object.create(null);
  50779. if (!dirs) {
  50780. // $flow-disable-line
  50781. return res
  50782. }
  50783. var i, dir;
  50784. for (i = 0; i < dirs.length; i++) {
  50785. dir = dirs[i];
  50786. if (!dir.modifiers) {
  50787. // $flow-disable-line
  50788. dir.modifiers = emptyModifiers;
  50789. }
  50790. res[getRawDirName(dir)] = dir;
  50791. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50792. }
  50793. // $flow-disable-line
  50794. return res
  50795. }
  50796. function getRawDirName (dir) {
  50797. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50798. }
  50799. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50800. var fn = dir.def && dir.def[hook];
  50801. if (fn) {
  50802. try {
  50803. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50804. } catch (e) {
  50805. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50806. }
  50807. }
  50808. }
  50809. var baseModules = [
  50810. ref,
  50811. directives
  50812. ];
  50813. /* */
  50814. function updateAttrs (oldVnode, vnode) {
  50815. var opts = vnode.componentOptions;
  50816. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50817. return
  50818. }
  50819. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50820. return
  50821. }
  50822. var key, cur, old;
  50823. var elm = vnode.elm;
  50824. var oldAttrs = oldVnode.data.attrs || {};
  50825. var attrs = vnode.data.attrs || {};
  50826. // clone observed objects, as the user probably wants to mutate it
  50827. if (isDef(attrs.__ob__)) {
  50828. attrs = vnode.data.attrs = extend({}, attrs);
  50829. }
  50830. for (key in attrs) {
  50831. cur = attrs[key];
  50832. old = oldAttrs[key];
  50833. if (old !== cur) {
  50834. setAttr(elm, key, cur);
  50835. }
  50836. }
  50837. // #4391: in IE9, setting type can reset value for input[type=radio]
  50838. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50839. /* istanbul ignore if */
  50840. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50841. setAttr(elm, 'value', attrs.value);
  50842. }
  50843. for (key in oldAttrs) {
  50844. if (isUndef(attrs[key])) {
  50845. if (isXlink(key)) {
  50846. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50847. } else if (!isEnumeratedAttr(key)) {
  50848. elm.removeAttribute(key);
  50849. }
  50850. }
  50851. }
  50852. }
  50853. function setAttr (el, key, value) {
  50854. if (el.tagName.indexOf('-') > -1) {
  50855. baseSetAttr(el, key, value);
  50856. } else if (isBooleanAttr(key)) {
  50857. // set attribute for blank value
  50858. // e.g. <option disabled>Select one</option>
  50859. if (isFalsyAttrValue(value)) {
  50860. el.removeAttribute(key);
  50861. } else {
  50862. // technically allowfullscreen is a boolean attribute for <iframe>,
  50863. // but Flash expects a value of "true" when used on <embed> tag
  50864. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50865. ? 'true'
  50866. : key;
  50867. el.setAttribute(key, value);
  50868. }
  50869. } else if (isEnumeratedAttr(key)) {
  50870. el.setAttribute(key, convertEnumeratedValue(key, value));
  50871. } else if (isXlink(key)) {
  50872. if (isFalsyAttrValue(value)) {
  50873. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50874. } else {
  50875. el.setAttributeNS(xlinkNS, key, value);
  50876. }
  50877. } else {
  50878. baseSetAttr(el, key, value);
  50879. }
  50880. }
  50881. function baseSetAttr (el, key, value) {
  50882. if (isFalsyAttrValue(value)) {
  50883. el.removeAttribute(key);
  50884. } else {
  50885. // #7138: IE10 & 11 fires input event when setting placeholder on
  50886. // <textarea>... block the first input event and remove the blocker
  50887. // immediately.
  50888. /* istanbul ignore if */
  50889. if (
  50890. isIE && !isIE9 &&
  50891. el.tagName === 'TEXTAREA' &&
  50892. key === 'placeholder' && value !== '' && !el.__ieph
  50893. ) {
  50894. var blocker = function (e) {
  50895. e.stopImmediatePropagation();
  50896. el.removeEventListener('input', blocker);
  50897. };
  50898. el.addEventListener('input', blocker);
  50899. // $flow-disable-line
  50900. el.__ieph = true; /* IE placeholder patched */
  50901. }
  50902. el.setAttribute(key, value);
  50903. }
  50904. }
  50905. var attrs = {
  50906. create: updateAttrs,
  50907. update: updateAttrs
  50908. };
  50909. /* */
  50910. function updateClass (oldVnode, vnode) {
  50911. var el = vnode.elm;
  50912. var data = vnode.data;
  50913. var oldData = oldVnode.data;
  50914. if (
  50915. isUndef(data.staticClass) &&
  50916. isUndef(data.class) && (
  50917. isUndef(oldData) || (
  50918. isUndef(oldData.staticClass) &&
  50919. isUndef(oldData.class)
  50920. )
  50921. )
  50922. ) {
  50923. return
  50924. }
  50925. var cls = genClassForVnode(vnode);
  50926. // handle transition classes
  50927. var transitionClass = el._transitionClasses;
  50928. if (isDef(transitionClass)) {
  50929. cls = concat(cls, stringifyClass(transitionClass));
  50930. }
  50931. // set the class
  50932. if (cls !== el._prevClass) {
  50933. el.setAttribute('class', cls);
  50934. el._prevClass = cls;
  50935. }
  50936. }
  50937. var klass = {
  50938. create: updateClass,
  50939. update: updateClass
  50940. };
  50941. /* */
  50942. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50943. function parseFilters (exp) {
  50944. var inSingle = false;
  50945. var inDouble = false;
  50946. var inTemplateString = false;
  50947. var inRegex = false;
  50948. var curly = 0;
  50949. var square = 0;
  50950. var paren = 0;
  50951. var lastFilterIndex = 0;
  50952. var c, prev, i, expression, filters;
  50953. for (i = 0; i < exp.length; i++) {
  50954. prev = c;
  50955. c = exp.charCodeAt(i);
  50956. if (inSingle) {
  50957. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50958. } else if (inDouble) {
  50959. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50960. } else if (inTemplateString) {
  50961. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50962. } else if (inRegex) {
  50963. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50964. } else if (
  50965. c === 0x7C && // pipe
  50966. exp.charCodeAt(i + 1) !== 0x7C &&
  50967. exp.charCodeAt(i - 1) !== 0x7C &&
  50968. !curly && !square && !paren
  50969. ) {
  50970. if (expression === undefined) {
  50971. // first filter, end of expression
  50972. lastFilterIndex = i + 1;
  50973. expression = exp.slice(0, i).trim();
  50974. } else {
  50975. pushFilter();
  50976. }
  50977. } else {
  50978. switch (c) {
  50979. case 0x22: inDouble = true; break // "
  50980. case 0x27: inSingle = true; break // '
  50981. case 0x60: inTemplateString = true; break // `
  50982. case 0x28: paren++; break // (
  50983. case 0x29: paren--; break // )
  50984. case 0x5B: square++; break // [
  50985. case 0x5D: square--; break // ]
  50986. case 0x7B: curly++; break // {
  50987. case 0x7D: curly--; break // }
  50988. }
  50989. if (c === 0x2f) { // /
  50990. var j = i - 1;
  50991. var p = (void 0);
  50992. // find first non-whitespace prev char
  50993. for (; j >= 0; j--) {
  50994. p = exp.charAt(j);
  50995. if (p !== ' ') { break }
  50996. }
  50997. if (!p || !validDivisionCharRE.test(p)) {
  50998. inRegex = true;
  50999. }
  51000. }
  51001. }
  51002. }
  51003. if (expression === undefined) {
  51004. expression = exp.slice(0, i).trim();
  51005. } else if (lastFilterIndex !== 0) {
  51006. pushFilter();
  51007. }
  51008. function pushFilter () {
  51009. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  51010. lastFilterIndex = i + 1;
  51011. }
  51012. if (filters) {
  51013. for (i = 0; i < filters.length; i++) {
  51014. expression = wrapFilter(expression, filters[i]);
  51015. }
  51016. }
  51017. return expression
  51018. }
  51019. function wrapFilter (exp, filter) {
  51020. var i = filter.indexOf('(');
  51021. if (i < 0) {
  51022. // _f: resolveFilter
  51023. return ("_f(\"" + filter + "\")(" + exp + ")")
  51024. } else {
  51025. var name = filter.slice(0, i);
  51026. var args = filter.slice(i + 1);
  51027. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  51028. }
  51029. }
  51030. /* */
  51031. /* eslint-disable no-unused-vars */
  51032. function baseWarn (msg, range) {
  51033. console.error(("[Vue compiler]: " + msg));
  51034. }
  51035. /* eslint-enable no-unused-vars */
  51036. function pluckModuleFunction (
  51037. modules,
  51038. key
  51039. ) {
  51040. return modules
  51041. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  51042. : []
  51043. }
  51044. function addProp (el, name, value, range, dynamic) {
  51045. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51046. el.plain = false;
  51047. }
  51048. function addAttr (el, name, value, range, dynamic) {
  51049. var attrs = dynamic
  51050. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  51051. : (el.attrs || (el.attrs = []));
  51052. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51053. el.plain = false;
  51054. }
  51055. // add a raw attr (use this in preTransforms)
  51056. function addRawAttr (el, name, value, range) {
  51057. el.attrsMap[name] = value;
  51058. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  51059. }
  51060. function addDirective (
  51061. el,
  51062. name,
  51063. rawName,
  51064. value,
  51065. arg,
  51066. isDynamicArg,
  51067. modifiers,
  51068. range
  51069. ) {
  51070. (el.directives || (el.directives = [])).push(rangeSetItem({
  51071. name: name,
  51072. rawName: rawName,
  51073. value: value,
  51074. arg: arg,
  51075. isDynamicArg: isDynamicArg,
  51076. modifiers: modifiers
  51077. }, range));
  51078. el.plain = false;
  51079. }
  51080. function prependModifierMarker (symbol, name, dynamic) {
  51081. return dynamic
  51082. ? ("_p(" + name + ",\"" + symbol + "\")")
  51083. : symbol + name // mark the event as captured
  51084. }
  51085. function addHandler (
  51086. el,
  51087. name,
  51088. value,
  51089. modifiers,
  51090. important,
  51091. warn,
  51092. range,
  51093. dynamic
  51094. ) {
  51095. modifiers = modifiers || emptyObject;
  51096. // warn prevent and passive modifier
  51097. /* istanbul ignore if */
  51098. if (
  51099. warn &&
  51100. modifiers.prevent && modifiers.passive
  51101. ) {
  51102. warn(
  51103. 'passive and prevent can\'t be used together. ' +
  51104. 'Passive handler can\'t prevent default event.',
  51105. range
  51106. );
  51107. }
  51108. // normalize click.right and click.middle since they don't actually fire
  51109. // this is technically browser-specific, but at least for now browsers are
  51110. // the only target envs that have right/middle clicks.
  51111. if (modifiers.right) {
  51112. if (dynamic) {
  51113. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51114. } else if (name === 'click') {
  51115. name = 'contextmenu';
  51116. delete modifiers.right;
  51117. }
  51118. } else if (modifiers.middle) {
  51119. if (dynamic) {
  51120. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51121. } else if (name === 'click') {
  51122. name = 'mouseup';
  51123. }
  51124. }
  51125. // check capture modifier
  51126. if (modifiers.capture) {
  51127. delete modifiers.capture;
  51128. name = prependModifierMarker('!', name, dynamic);
  51129. }
  51130. if (modifiers.once) {
  51131. delete modifiers.once;
  51132. name = prependModifierMarker('~', name, dynamic);
  51133. }
  51134. /* istanbul ignore if */
  51135. if (modifiers.passive) {
  51136. delete modifiers.passive;
  51137. name = prependModifierMarker('&', name, dynamic);
  51138. }
  51139. var events;
  51140. if (modifiers.native) {
  51141. delete modifiers.native;
  51142. events = el.nativeEvents || (el.nativeEvents = {});
  51143. } else {
  51144. events = el.events || (el.events = {});
  51145. }
  51146. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51147. if (modifiers !== emptyObject) {
  51148. newHandler.modifiers = modifiers;
  51149. }
  51150. var handlers = events[name];
  51151. /* istanbul ignore if */
  51152. if (Array.isArray(handlers)) {
  51153. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51154. } else if (handlers) {
  51155. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51156. } else {
  51157. events[name] = newHandler;
  51158. }
  51159. el.plain = false;
  51160. }
  51161. function getRawBindingAttr (
  51162. el,
  51163. name
  51164. ) {
  51165. return el.rawAttrsMap[':' + name] ||
  51166. el.rawAttrsMap['v-bind:' + name] ||
  51167. el.rawAttrsMap[name]
  51168. }
  51169. function getBindingAttr (
  51170. el,
  51171. name,
  51172. getStatic
  51173. ) {
  51174. var dynamicValue =
  51175. getAndRemoveAttr(el, ':' + name) ||
  51176. getAndRemoveAttr(el, 'v-bind:' + name);
  51177. if (dynamicValue != null) {
  51178. return parseFilters(dynamicValue)
  51179. } else if (getStatic !== false) {
  51180. var staticValue = getAndRemoveAttr(el, name);
  51181. if (staticValue != null) {
  51182. return JSON.stringify(staticValue)
  51183. }
  51184. }
  51185. }
  51186. // note: this only removes the attr from the Array (attrsList) so that it
  51187. // doesn't get processed by processAttrs.
  51188. // By default it does NOT remove it from the map (attrsMap) because the map is
  51189. // needed during codegen.
  51190. function getAndRemoveAttr (
  51191. el,
  51192. name,
  51193. removeFromMap
  51194. ) {
  51195. var val;
  51196. if ((val = el.attrsMap[name]) != null) {
  51197. var list = el.attrsList;
  51198. for (var i = 0, l = list.length; i < l; i++) {
  51199. if (list[i].name === name) {
  51200. list.splice(i, 1);
  51201. break
  51202. }
  51203. }
  51204. }
  51205. if (removeFromMap) {
  51206. delete el.attrsMap[name];
  51207. }
  51208. return val
  51209. }
  51210. function getAndRemoveAttrByRegex (
  51211. el,
  51212. name
  51213. ) {
  51214. var list = el.attrsList;
  51215. for (var i = 0, l = list.length; i < l; i++) {
  51216. var attr = list[i];
  51217. if (name.test(attr.name)) {
  51218. list.splice(i, 1);
  51219. return attr
  51220. }
  51221. }
  51222. }
  51223. function rangeSetItem (
  51224. item,
  51225. range
  51226. ) {
  51227. if (range) {
  51228. if (range.start != null) {
  51229. item.start = range.start;
  51230. }
  51231. if (range.end != null) {
  51232. item.end = range.end;
  51233. }
  51234. }
  51235. return item
  51236. }
  51237. /* */
  51238. /**
  51239. * Cross-platform code generation for component v-model
  51240. */
  51241. function genComponentModel (
  51242. el,
  51243. value,
  51244. modifiers
  51245. ) {
  51246. var ref = modifiers || {};
  51247. var number = ref.number;
  51248. var trim = ref.trim;
  51249. var baseValueExpression = '$$v';
  51250. var valueExpression = baseValueExpression;
  51251. if (trim) {
  51252. valueExpression =
  51253. "(typeof " + baseValueExpression + " === 'string'" +
  51254. "? " + baseValueExpression + ".trim()" +
  51255. ": " + baseValueExpression + ")";
  51256. }
  51257. if (number) {
  51258. valueExpression = "_n(" + valueExpression + ")";
  51259. }
  51260. var assignment = genAssignmentCode(value, valueExpression);
  51261. el.model = {
  51262. value: ("(" + value + ")"),
  51263. expression: JSON.stringify(value),
  51264. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51265. };
  51266. }
  51267. /**
  51268. * Cross-platform codegen helper for generating v-model value assignment code.
  51269. */
  51270. function genAssignmentCode (
  51271. value,
  51272. assignment
  51273. ) {
  51274. var res = parseModel(value);
  51275. if (res.key === null) {
  51276. return (value + "=" + assignment)
  51277. } else {
  51278. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51279. }
  51280. }
  51281. /**
  51282. * Parse a v-model expression into a base path and a final key segment.
  51283. * Handles both dot-path and possible square brackets.
  51284. *
  51285. * Possible cases:
  51286. *
  51287. * - test
  51288. * - test[key]
  51289. * - test[test1[key]]
  51290. * - test["a"][key]
  51291. * - xxx.test[a[a].test1[key]]
  51292. * - test.xxx.a["asa"][test1[key]]
  51293. *
  51294. */
  51295. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51296. function parseModel (val) {
  51297. // Fix https://github.com/vuejs/vue/pull/7730
  51298. // allow v-model="obj.val " (trailing whitespace)
  51299. val = val.trim();
  51300. len = val.length;
  51301. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51302. index$1 = val.lastIndexOf('.');
  51303. if (index$1 > -1) {
  51304. return {
  51305. exp: val.slice(0, index$1),
  51306. key: '"' + val.slice(index$1 + 1) + '"'
  51307. }
  51308. } else {
  51309. return {
  51310. exp: val,
  51311. key: null
  51312. }
  51313. }
  51314. }
  51315. str = val;
  51316. index$1 = expressionPos = expressionEndPos = 0;
  51317. while (!eof()) {
  51318. chr = next();
  51319. /* istanbul ignore if */
  51320. if (isStringStart(chr)) {
  51321. parseString(chr);
  51322. } else if (chr === 0x5B) {
  51323. parseBracket(chr);
  51324. }
  51325. }
  51326. return {
  51327. exp: val.slice(0, expressionPos),
  51328. key: val.slice(expressionPos + 1, expressionEndPos)
  51329. }
  51330. }
  51331. function next () {
  51332. return str.charCodeAt(++index$1)
  51333. }
  51334. function eof () {
  51335. return index$1 >= len
  51336. }
  51337. function isStringStart (chr) {
  51338. return chr === 0x22 || chr === 0x27
  51339. }
  51340. function parseBracket (chr) {
  51341. var inBracket = 1;
  51342. expressionPos = index$1;
  51343. while (!eof()) {
  51344. chr = next();
  51345. if (isStringStart(chr)) {
  51346. parseString(chr);
  51347. continue
  51348. }
  51349. if (chr === 0x5B) { inBracket++; }
  51350. if (chr === 0x5D) { inBracket--; }
  51351. if (inBracket === 0) {
  51352. expressionEndPos = index$1;
  51353. break
  51354. }
  51355. }
  51356. }
  51357. function parseString (chr) {
  51358. var stringQuote = chr;
  51359. while (!eof()) {
  51360. chr = next();
  51361. if (chr === stringQuote) {
  51362. break
  51363. }
  51364. }
  51365. }
  51366. /* */
  51367. var warn$1;
  51368. // in some cases, the event used has to be determined at runtime
  51369. // so we used some reserved tokens during compile.
  51370. var RANGE_TOKEN = '__r';
  51371. var CHECKBOX_RADIO_TOKEN = '__c';
  51372. function model (
  51373. el,
  51374. dir,
  51375. _warn
  51376. ) {
  51377. warn$1 = _warn;
  51378. var value = dir.value;
  51379. var modifiers = dir.modifiers;
  51380. var tag = el.tag;
  51381. var type = el.attrsMap.type;
  51382. {
  51383. // inputs with type="file" are read only and setting the input's
  51384. // value will throw an error.
  51385. if (tag === 'input' && type === 'file') {
  51386. warn$1(
  51387. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51388. "File inputs are read only. Use a v-on:change listener instead.",
  51389. el.rawAttrsMap['v-model']
  51390. );
  51391. }
  51392. }
  51393. if (el.component) {
  51394. genComponentModel(el, value, modifiers);
  51395. // component v-model doesn't need extra runtime
  51396. return false
  51397. } else if (tag === 'select') {
  51398. genSelect(el, value, modifiers);
  51399. } else if (tag === 'input' && type === 'checkbox') {
  51400. genCheckboxModel(el, value, modifiers);
  51401. } else if (tag === 'input' && type === 'radio') {
  51402. genRadioModel(el, value, modifiers);
  51403. } else if (tag === 'input' || tag === 'textarea') {
  51404. genDefaultModel(el, value, modifiers);
  51405. } else if (!config.isReservedTag(tag)) {
  51406. genComponentModel(el, value, modifiers);
  51407. // component v-model doesn't need extra runtime
  51408. return false
  51409. } else {
  51410. warn$1(
  51411. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51412. "v-model is not supported on this element type. " +
  51413. 'If you are working with contenteditable, it\'s recommended to ' +
  51414. 'wrap a library dedicated for that purpose inside a custom component.',
  51415. el.rawAttrsMap['v-model']
  51416. );
  51417. }
  51418. // ensure runtime directive metadata
  51419. return true
  51420. }
  51421. function genCheckboxModel (
  51422. el,
  51423. value,
  51424. modifiers
  51425. ) {
  51426. var number = modifiers && modifiers.number;
  51427. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51428. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51429. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51430. addProp(el, 'checked',
  51431. "Array.isArray(" + value + ")" +
  51432. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51433. trueValueBinding === 'true'
  51434. ? (":(" + value + ")")
  51435. : (":_q(" + value + "," + trueValueBinding + ")")
  51436. )
  51437. );
  51438. addHandler(el, 'change',
  51439. "var $$a=" + value + "," +
  51440. '$$el=$event.target,' +
  51441. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51442. 'if(Array.isArray($$a)){' +
  51443. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51444. '$$i=_i($$a,$$v);' +
  51445. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51446. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51447. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51448. null, true
  51449. );
  51450. }
  51451. function genRadioModel (
  51452. el,
  51453. value,
  51454. modifiers
  51455. ) {
  51456. var number = modifiers && modifiers.number;
  51457. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51458. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51459. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51460. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51461. }
  51462. function genSelect (
  51463. el,
  51464. value,
  51465. modifiers
  51466. ) {
  51467. var number = modifiers && modifiers.number;
  51468. var selectedVal = "Array.prototype.filter" +
  51469. ".call($event.target.options,function(o){return o.selected})" +
  51470. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51471. "return " + (number ? '_n(val)' : 'val') + "})";
  51472. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51473. var code = "var $$selectedVal = " + selectedVal + ";";
  51474. code = code + " " + (genAssignmentCode(value, assignment));
  51475. addHandler(el, 'change', code, null, true);
  51476. }
  51477. function genDefaultModel (
  51478. el,
  51479. value,
  51480. modifiers
  51481. ) {
  51482. var type = el.attrsMap.type;
  51483. // warn if v-bind:value conflicts with v-model
  51484. // except for inputs with v-bind:type
  51485. {
  51486. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51487. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51488. if (value$1 && !typeBinding) {
  51489. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51490. warn$1(
  51491. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51492. 'because the latter already expands to a value binding internally',
  51493. el.rawAttrsMap[binding]
  51494. );
  51495. }
  51496. }
  51497. var ref = modifiers || {};
  51498. var lazy = ref.lazy;
  51499. var number = ref.number;
  51500. var trim = ref.trim;
  51501. var needCompositionGuard = !lazy && type !== 'range';
  51502. var event = lazy
  51503. ? 'change'
  51504. : type === 'range'
  51505. ? RANGE_TOKEN
  51506. : 'input';
  51507. var valueExpression = '$event.target.value';
  51508. if (trim) {
  51509. valueExpression = "$event.target.value.trim()";
  51510. }
  51511. if (number) {
  51512. valueExpression = "_n(" + valueExpression + ")";
  51513. }
  51514. var code = genAssignmentCode(value, valueExpression);
  51515. if (needCompositionGuard) {
  51516. code = "if($event.target.composing)return;" + code;
  51517. }
  51518. addProp(el, 'value', ("(" + value + ")"));
  51519. addHandler(el, event, code, null, true);
  51520. if (trim || number) {
  51521. addHandler(el, 'blur', '$forceUpdate()');
  51522. }
  51523. }
  51524. /* */
  51525. // normalize v-model event tokens that can only be determined at runtime.
  51526. // it's important to place the event as the first in the array because
  51527. // the whole point is ensuring the v-model callback gets called before
  51528. // user-attached handlers.
  51529. function normalizeEvents (on) {
  51530. /* istanbul ignore if */
  51531. if (isDef(on[RANGE_TOKEN])) {
  51532. // IE input[type=range] only supports `change` event
  51533. var event = isIE ? 'change' : 'input';
  51534. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51535. delete on[RANGE_TOKEN];
  51536. }
  51537. // This was originally intended to fix #4521 but no longer necessary
  51538. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51539. /* istanbul ignore if */
  51540. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51541. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51542. delete on[CHECKBOX_RADIO_TOKEN];
  51543. }
  51544. }
  51545. var target$1;
  51546. function createOnceHandler$1 (event, handler, capture) {
  51547. var _target = target$1; // save current target element in closure
  51548. return function onceHandler () {
  51549. var res = handler.apply(null, arguments);
  51550. if (res !== null) {
  51551. remove$2(event, onceHandler, capture, _target);
  51552. }
  51553. }
  51554. }
  51555. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51556. // implementation and does not fire microtasks in between event propagation, so
  51557. // safe to exclude.
  51558. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51559. function add$1 (
  51560. name,
  51561. handler,
  51562. capture,
  51563. passive
  51564. ) {
  51565. // async edge case #6566: inner click event triggers patch, event handler
  51566. // attached to outer element during patch, and triggered again. This
  51567. // happens because browsers fire microtask ticks between event propagation.
  51568. // the solution is simple: we save the timestamp when a handler is attached,
  51569. // and the handler would only fire if the event passed to it was fired
  51570. // AFTER it was attached.
  51571. if (useMicrotaskFix) {
  51572. var attachedTimestamp = currentFlushTimestamp;
  51573. var original = handler;
  51574. handler = original._wrapper = function (e) {
  51575. if (
  51576. // no bubbling, should always fire.
  51577. // this is just a safety net in case event.timeStamp is unreliable in
  51578. // certain weird environments...
  51579. e.target === e.currentTarget ||
  51580. // event is fired after handler attachment
  51581. e.timeStamp >= attachedTimestamp ||
  51582. // bail for environments that have buggy event.timeStamp implementations
  51583. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51584. // #9681 QtWebEngine event.timeStamp is negative value
  51585. e.timeStamp <= 0 ||
  51586. // #9448 bail if event is fired in another document in a multi-page
  51587. // electron/nw.js app, since event.timeStamp will be using a different
  51588. // starting reference
  51589. e.target.ownerDocument !== document
  51590. ) {
  51591. return original.apply(this, arguments)
  51592. }
  51593. };
  51594. }
  51595. target$1.addEventListener(
  51596. name,
  51597. handler,
  51598. supportsPassive
  51599. ? { capture: capture, passive: passive }
  51600. : capture
  51601. );
  51602. }
  51603. function remove$2 (
  51604. name,
  51605. handler,
  51606. capture,
  51607. _target
  51608. ) {
  51609. (_target || target$1).removeEventListener(
  51610. name,
  51611. handler._wrapper || handler,
  51612. capture
  51613. );
  51614. }
  51615. function updateDOMListeners (oldVnode, vnode) {
  51616. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51617. return
  51618. }
  51619. var on = vnode.data.on || {};
  51620. var oldOn = oldVnode.data.on || {};
  51621. target$1 = vnode.elm;
  51622. normalizeEvents(on);
  51623. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51624. target$1 = undefined;
  51625. }
  51626. var events = {
  51627. create: updateDOMListeners,
  51628. update: updateDOMListeners
  51629. };
  51630. /* */
  51631. var svgContainer;
  51632. function updateDOMProps (oldVnode, vnode) {
  51633. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51634. return
  51635. }
  51636. var key, cur;
  51637. var elm = vnode.elm;
  51638. var oldProps = oldVnode.data.domProps || {};
  51639. var props = vnode.data.domProps || {};
  51640. // clone observed objects, as the user probably wants to mutate it
  51641. if (isDef(props.__ob__)) {
  51642. props = vnode.data.domProps = extend({}, props);
  51643. }
  51644. for (key in oldProps) {
  51645. if (!(key in props)) {
  51646. elm[key] = '';
  51647. }
  51648. }
  51649. for (key in props) {
  51650. cur = props[key];
  51651. // ignore children if the node has textContent or innerHTML,
  51652. // as these will throw away existing DOM nodes and cause removal errors
  51653. // on subsequent patches (#3360)
  51654. if (key === 'textContent' || key === 'innerHTML') {
  51655. if (vnode.children) { vnode.children.length = 0; }
  51656. if (cur === oldProps[key]) { continue }
  51657. // #6601 work around Chrome version <= 55 bug where single textNode
  51658. // replaced by innerHTML/textContent retains its parentNode property
  51659. if (elm.childNodes.length === 1) {
  51660. elm.removeChild(elm.childNodes[0]);
  51661. }
  51662. }
  51663. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51664. // store value as _value as well since
  51665. // non-string values will be stringified
  51666. elm._value = cur;
  51667. // avoid resetting cursor position when value is the same
  51668. var strCur = isUndef(cur) ? '' : String(cur);
  51669. if (shouldUpdateValue(elm, strCur)) {
  51670. elm.value = strCur;
  51671. }
  51672. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51673. // IE doesn't support innerHTML for SVG elements
  51674. svgContainer = svgContainer || document.createElement('div');
  51675. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51676. var svg = svgContainer.firstChild;
  51677. while (elm.firstChild) {
  51678. elm.removeChild(elm.firstChild);
  51679. }
  51680. while (svg.firstChild) {
  51681. elm.appendChild(svg.firstChild);
  51682. }
  51683. } else if (
  51684. // skip the update if old and new VDOM state is the same.
  51685. // `value` is handled separately because the DOM value may be temporarily
  51686. // out of sync with VDOM state due to focus, composition and modifiers.
  51687. // This #4521 by skipping the unnecesarry `checked` update.
  51688. cur !== oldProps[key]
  51689. ) {
  51690. // some property updates can throw
  51691. // e.g. `value` on <progress> w/ non-finite value
  51692. try {
  51693. elm[key] = cur;
  51694. } catch (e) {}
  51695. }
  51696. }
  51697. }
  51698. // check platforms/web/util/attrs.js acceptValue
  51699. function shouldUpdateValue (elm, checkVal) {
  51700. return (!elm.composing && (
  51701. elm.tagName === 'OPTION' ||
  51702. isNotInFocusAndDirty(elm, checkVal) ||
  51703. isDirtyWithModifiers(elm, checkVal)
  51704. ))
  51705. }
  51706. function isNotInFocusAndDirty (elm, checkVal) {
  51707. // return true when textbox (.number and .trim) loses focus and its value is
  51708. // not equal to the updated value
  51709. var notInFocus = true;
  51710. // #6157
  51711. // work around IE bug when accessing document.activeElement in an iframe
  51712. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51713. return notInFocus && elm.value !== checkVal
  51714. }
  51715. function isDirtyWithModifiers (elm, newVal) {
  51716. var value = elm.value;
  51717. var modifiers = elm._vModifiers; // injected by v-model runtime
  51718. if (isDef(modifiers)) {
  51719. if (modifiers.number) {
  51720. return toNumber(value) !== toNumber(newVal)
  51721. }
  51722. if (modifiers.trim) {
  51723. return value.trim() !== newVal.trim()
  51724. }
  51725. }
  51726. return value !== newVal
  51727. }
  51728. var domProps = {
  51729. create: updateDOMProps,
  51730. update: updateDOMProps
  51731. };
  51732. /* */
  51733. var parseStyleText = cached(function (cssText) {
  51734. var res = {};
  51735. var listDelimiter = /;(?![^(]*\))/g;
  51736. var propertyDelimiter = /:(.+)/;
  51737. cssText.split(listDelimiter).forEach(function (item) {
  51738. if (item) {
  51739. var tmp = item.split(propertyDelimiter);
  51740. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51741. }
  51742. });
  51743. return res
  51744. });
  51745. // merge static and dynamic style data on the same vnode
  51746. function normalizeStyleData (data) {
  51747. var style = normalizeStyleBinding(data.style);
  51748. // static style is pre-processed into an object during compilation
  51749. // and is always a fresh object, so it's safe to merge into it
  51750. return data.staticStyle
  51751. ? extend(data.staticStyle, style)
  51752. : style
  51753. }
  51754. // normalize possible array / string values into Object
  51755. function normalizeStyleBinding (bindingStyle) {
  51756. if (Array.isArray(bindingStyle)) {
  51757. return toObject(bindingStyle)
  51758. }
  51759. if (typeof bindingStyle === 'string') {
  51760. return parseStyleText(bindingStyle)
  51761. }
  51762. return bindingStyle
  51763. }
  51764. /**
  51765. * parent component style should be after child's
  51766. * so that parent component's style could override it
  51767. */
  51768. function getStyle (vnode, checkChild) {
  51769. var res = {};
  51770. var styleData;
  51771. if (checkChild) {
  51772. var childNode = vnode;
  51773. while (childNode.componentInstance) {
  51774. childNode = childNode.componentInstance._vnode;
  51775. if (
  51776. childNode && childNode.data &&
  51777. (styleData = normalizeStyleData(childNode.data))
  51778. ) {
  51779. extend(res, styleData);
  51780. }
  51781. }
  51782. }
  51783. if ((styleData = normalizeStyleData(vnode.data))) {
  51784. extend(res, styleData);
  51785. }
  51786. var parentNode = vnode;
  51787. while ((parentNode = parentNode.parent)) {
  51788. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51789. extend(res, styleData);
  51790. }
  51791. }
  51792. return res
  51793. }
  51794. /* */
  51795. var cssVarRE = /^--/;
  51796. var importantRE = /\s*!important$/;
  51797. var setProp = function (el, name, val) {
  51798. /* istanbul ignore if */
  51799. if (cssVarRE.test(name)) {
  51800. el.style.setProperty(name, val);
  51801. } else if (importantRE.test(val)) {
  51802. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51803. } else {
  51804. var normalizedName = normalize(name);
  51805. if (Array.isArray(val)) {
  51806. // Support values array created by autoprefixer, e.g.
  51807. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51808. // Set them one by one, and the browser will only set those it can recognize
  51809. for (var i = 0, len = val.length; i < len; i++) {
  51810. el.style[normalizedName] = val[i];
  51811. }
  51812. } else {
  51813. el.style[normalizedName] = val;
  51814. }
  51815. }
  51816. };
  51817. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51818. var emptyStyle;
  51819. var normalize = cached(function (prop) {
  51820. emptyStyle = emptyStyle || document.createElement('div').style;
  51821. prop = camelize(prop);
  51822. if (prop !== 'filter' && (prop in emptyStyle)) {
  51823. return prop
  51824. }
  51825. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51826. for (var i = 0; i < vendorNames.length; i++) {
  51827. var name = vendorNames[i] + capName;
  51828. if (name in emptyStyle) {
  51829. return name
  51830. }
  51831. }
  51832. });
  51833. function updateStyle (oldVnode, vnode) {
  51834. var data = vnode.data;
  51835. var oldData = oldVnode.data;
  51836. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51837. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51838. ) {
  51839. return
  51840. }
  51841. var cur, name;
  51842. var el = vnode.elm;
  51843. var oldStaticStyle = oldData.staticStyle;
  51844. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51845. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51846. var oldStyle = oldStaticStyle || oldStyleBinding;
  51847. var style = normalizeStyleBinding(vnode.data.style) || {};
  51848. // store normalized style under a different key for next diff
  51849. // make sure to clone it if it's reactive, since the user likely wants
  51850. // to mutate it.
  51851. vnode.data.normalizedStyle = isDef(style.__ob__)
  51852. ? extend({}, style)
  51853. : style;
  51854. var newStyle = getStyle(vnode, true);
  51855. for (name in oldStyle) {
  51856. if (isUndef(newStyle[name])) {
  51857. setProp(el, name, '');
  51858. }
  51859. }
  51860. for (name in newStyle) {
  51861. cur = newStyle[name];
  51862. if (cur !== oldStyle[name]) {
  51863. // ie9 setting to null has no effect, must use empty string
  51864. setProp(el, name, cur == null ? '' : cur);
  51865. }
  51866. }
  51867. }
  51868. var style = {
  51869. create: updateStyle,
  51870. update: updateStyle
  51871. };
  51872. /* */
  51873. var whitespaceRE = /\s+/;
  51874. /**
  51875. * Add class with compatibility for SVG since classList is not supported on
  51876. * SVG elements in IE
  51877. */
  51878. function addClass (el, cls) {
  51879. /* istanbul ignore if */
  51880. if (!cls || !(cls = cls.trim())) {
  51881. return
  51882. }
  51883. /* istanbul ignore else */
  51884. if (el.classList) {
  51885. if (cls.indexOf(' ') > -1) {
  51886. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51887. } else {
  51888. el.classList.add(cls);
  51889. }
  51890. } else {
  51891. var cur = " " + (el.getAttribute('class') || '') + " ";
  51892. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51893. el.setAttribute('class', (cur + cls).trim());
  51894. }
  51895. }
  51896. }
  51897. /**
  51898. * Remove class with compatibility for SVG since classList is not supported on
  51899. * SVG elements in IE
  51900. */
  51901. function removeClass (el, cls) {
  51902. /* istanbul ignore if */
  51903. if (!cls || !(cls = cls.trim())) {
  51904. return
  51905. }
  51906. /* istanbul ignore else */
  51907. if (el.classList) {
  51908. if (cls.indexOf(' ') > -1) {
  51909. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51910. } else {
  51911. el.classList.remove(cls);
  51912. }
  51913. if (!el.classList.length) {
  51914. el.removeAttribute('class');
  51915. }
  51916. } else {
  51917. var cur = " " + (el.getAttribute('class') || '') + " ";
  51918. var tar = ' ' + cls + ' ';
  51919. while (cur.indexOf(tar) >= 0) {
  51920. cur = cur.replace(tar, ' ');
  51921. }
  51922. cur = cur.trim();
  51923. if (cur) {
  51924. el.setAttribute('class', cur);
  51925. } else {
  51926. el.removeAttribute('class');
  51927. }
  51928. }
  51929. }
  51930. /* */
  51931. function resolveTransition (def$$1) {
  51932. if (!def$$1) {
  51933. return
  51934. }
  51935. /* istanbul ignore else */
  51936. if (typeof def$$1 === 'object') {
  51937. var res = {};
  51938. if (def$$1.css !== false) {
  51939. extend(res, autoCssTransition(def$$1.name || 'v'));
  51940. }
  51941. extend(res, def$$1);
  51942. return res
  51943. } else if (typeof def$$1 === 'string') {
  51944. return autoCssTransition(def$$1)
  51945. }
  51946. }
  51947. var autoCssTransition = cached(function (name) {
  51948. return {
  51949. enterClass: (name + "-enter"),
  51950. enterToClass: (name + "-enter-to"),
  51951. enterActiveClass: (name + "-enter-active"),
  51952. leaveClass: (name + "-leave"),
  51953. leaveToClass: (name + "-leave-to"),
  51954. leaveActiveClass: (name + "-leave-active")
  51955. }
  51956. });
  51957. var hasTransition = inBrowser && !isIE9;
  51958. var TRANSITION = 'transition';
  51959. var ANIMATION = 'animation';
  51960. // Transition property/event sniffing
  51961. var transitionProp = 'transition';
  51962. var transitionEndEvent = 'transitionend';
  51963. var animationProp = 'animation';
  51964. var animationEndEvent = 'animationend';
  51965. if (hasTransition) {
  51966. /* istanbul ignore if */
  51967. if (window.ontransitionend === undefined &&
  51968. window.onwebkittransitionend !== undefined
  51969. ) {
  51970. transitionProp = 'WebkitTransition';
  51971. transitionEndEvent = 'webkitTransitionEnd';
  51972. }
  51973. if (window.onanimationend === undefined &&
  51974. window.onwebkitanimationend !== undefined
  51975. ) {
  51976. animationProp = 'WebkitAnimation';
  51977. animationEndEvent = 'webkitAnimationEnd';
  51978. }
  51979. }
  51980. // binding to window is necessary to make hot reload work in IE in strict mode
  51981. var raf = inBrowser
  51982. ? window.requestAnimationFrame
  51983. ? window.requestAnimationFrame.bind(window)
  51984. : setTimeout
  51985. : /* istanbul ignore next */ function (fn) { return fn(); };
  51986. function nextFrame (fn) {
  51987. raf(function () {
  51988. raf(fn);
  51989. });
  51990. }
  51991. function addTransitionClass (el, cls) {
  51992. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51993. if (transitionClasses.indexOf(cls) < 0) {
  51994. transitionClasses.push(cls);
  51995. addClass(el, cls);
  51996. }
  51997. }
  51998. function removeTransitionClass (el, cls) {
  51999. if (el._transitionClasses) {
  52000. remove(el._transitionClasses, cls);
  52001. }
  52002. removeClass(el, cls);
  52003. }
  52004. function whenTransitionEnds (
  52005. el,
  52006. expectedType,
  52007. cb
  52008. ) {
  52009. var ref = getTransitionInfo(el, expectedType);
  52010. var type = ref.type;
  52011. var timeout = ref.timeout;
  52012. var propCount = ref.propCount;
  52013. if (!type) { return cb() }
  52014. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  52015. var ended = 0;
  52016. var end = function () {
  52017. el.removeEventListener(event, onEnd);
  52018. cb();
  52019. };
  52020. var onEnd = function (e) {
  52021. if (e.target === el) {
  52022. if (++ended >= propCount) {
  52023. end();
  52024. }
  52025. }
  52026. };
  52027. setTimeout(function () {
  52028. if (ended < propCount) {
  52029. end();
  52030. }
  52031. }, timeout + 1);
  52032. el.addEventListener(event, onEnd);
  52033. }
  52034. var transformRE = /\b(transform|all)(,|$)/;
  52035. function getTransitionInfo (el, expectedType) {
  52036. var styles = window.getComputedStyle(el);
  52037. // JSDOM may return undefined for transition properties
  52038. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  52039. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  52040. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  52041. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  52042. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  52043. var animationTimeout = getTimeout(animationDelays, animationDurations);
  52044. var type;
  52045. var timeout = 0;
  52046. var propCount = 0;
  52047. /* istanbul ignore if */
  52048. if (expectedType === TRANSITION) {
  52049. if (transitionTimeout > 0) {
  52050. type = TRANSITION;
  52051. timeout = transitionTimeout;
  52052. propCount = transitionDurations.length;
  52053. }
  52054. } else if (expectedType === ANIMATION) {
  52055. if (animationTimeout > 0) {
  52056. type = ANIMATION;
  52057. timeout = animationTimeout;
  52058. propCount = animationDurations.length;
  52059. }
  52060. } else {
  52061. timeout = Math.max(transitionTimeout, animationTimeout);
  52062. type = timeout > 0
  52063. ? transitionTimeout > animationTimeout
  52064. ? TRANSITION
  52065. : ANIMATION
  52066. : null;
  52067. propCount = type
  52068. ? type === TRANSITION
  52069. ? transitionDurations.length
  52070. : animationDurations.length
  52071. : 0;
  52072. }
  52073. var hasTransform =
  52074. type === TRANSITION &&
  52075. transformRE.test(styles[transitionProp + 'Property']);
  52076. return {
  52077. type: type,
  52078. timeout: timeout,
  52079. propCount: propCount,
  52080. hasTransform: hasTransform
  52081. }
  52082. }
  52083. function getTimeout (delays, durations) {
  52084. /* istanbul ignore next */
  52085. while (delays.length < durations.length) {
  52086. delays = delays.concat(delays);
  52087. }
  52088. return Math.max.apply(null, durations.map(function (d, i) {
  52089. return toMs(d) + toMs(delays[i])
  52090. }))
  52091. }
  52092. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  52093. // in a locale-dependent way, using a comma instead of a dot.
  52094. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  52095. // as a floor function) causing unexpected behaviors
  52096. function toMs (s) {
  52097. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  52098. }
  52099. /* */
  52100. function enter (vnode, toggleDisplay) {
  52101. var el = vnode.elm;
  52102. // call leave callback now
  52103. if (isDef(el._leaveCb)) {
  52104. el._leaveCb.cancelled = true;
  52105. el._leaveCb();
  52106. }
  52107. var data = resolveTransition(vnode.data.transition);
  52108. if (isUndef(data)) {
  52109. return
  52110. }
  52111. /* istanbul ignore if */
  52112. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52113. return
  52114. }
  52115. var css = data.css;
  52116. var type = data.type;
  52117. var enterClass = data.enterClass;
  52118. var enterToClass = data.enterToClass;
  52119. var enterActiveClass = data.enterActiveClass;
  52120. var appearClass = data.appearClass;
  52121. var appearToClass = data.appearToClass;
  52122. var appearActiveClass = data.appearActiveClass;
  52123. var beforeEnter = data.beforeEnter;
  52124. var enter = data.enter;
  52125. var afterEnter = data.afterEnter;
  52126. var enterCancelled = data.enterCancelled;
  52127. var beforeAppear = data.beforeAppear;
  52128. var appear = data.appear;
  52129. var afterAppear = data.afterAppear;
  52130. var appearCancelled = data.appearCancelled;
  52131. var duration = data.duration;
  52132. // activeInstance will always be the <transition> component managing this
  52133. // transition. One edge case to check is when the <transition> is placed
  52134. // as the root node of a child component. In that case we need to check
  52135. // <transition>'s parent for appear check.
  52136. var context = activeInstance;
  52137. var transitionNode = activeInstance.$vnode;
  52138. while (transitionNode && transitionNode.parent) {
  52139. context = transitionNode.context;
  52140. transitionNode = transitionNode.parent;
  52141. }
  52142. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52143. if (isAppear && !appear && appear !== '') {
  52144. return
  52145. }
  52146. var startClass = isAppear && appearClass
  52147. ? appearClass
  52148. : enterClass;
  52149. var activeClass = isAppear && appearActiveClass
  52150. ? appearActiveClass
  52151. : enterActiveClass;
  52152. var toClass = isAppear && appearToClass
  52153. ? appearToClass
  52154. : enterToClass;
  52155. var beforeEnterHook = isAppear
  52156. ? (beforeAppear || beforeEnter)
  52157. : beforeEnter;
  52158. var enterHook = isAppear
  52159. ? (typeof appear === 'function' ? appear : enter)
  52160. : enter;
  52161. var afterEnterHook = isAppear
  52162. ? (afterAppear || afterEnter)
  52163. : afterEnter;
  52164. var enterCancelledHook = isAppear
  52165. ? (appearCancelled || enterCancelled)
  52166. : enterCancelled;
  52167. var explicitEnterDuration = toNumber(
  52168. isObject(duration)
  52169. ? duration.enter
  52170. : duration
  52171. );
  52172. if (explicitEnterDuration != null) {
  52173. checkDuration(explicitEnterDuration, 'enter', vnode);
  52174. }
  52175. var expectsCSS = css !== false && !isIE9;
  52176. var userWantsControl = getHookArgumentsLength(enterHook);
  52177. var cb = el._enterCb = once(function () {
  52178. if (expectsCSS) {
  52179. removeTransitionClass(el, toClass);
  52180. removeTransitionClass(el, activeClass);
  52181. }
  52182. if (cb.cancelled) {
  52183. if (expectsCSS) {
  52184. removeTransitionClass(el, startClass);
  52185. }
  52186. enterCancelledHook && enterCancelledHook(el);
  52187. } else {
  52188. afterEnterHook && afterEnterHook(el);
  52189. }
  52190. el._enterCb = null;
  52191. });
  52192. if (!vnode.data.show) {
  52193. // remove pending leave element on enter by injecting an insert hook
  52194. mergeVNodeHook(vnode, 'insert', function () {
  52195. var parent = el.parentNode;
  52196. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52197. if (pendingNode &&
  52198. pendingNode.tag === vnode.tag &&
  52199. pendingNode.elm._leaveCb
  52200. ) {
  52201. pendingNode.elm._leaveCb();
  52202. }
  52203. enterHook && enterHook(el, cb);
  52204. });
  52205. }
  52206. // start enter transition
  52207. beforeEnterHook && beforeEnterHook(el);
  52208. if (expectsCSS) {
  52209. addTransitionClass(el, startClass);
  52210. addTransitionClass(el, activeClass);
  52211. nextFrame(function () {
  52212. removeTransitionClass(el, startClass);
  52213. if (!cb.cancelled) {
  52214. addTransitionClass(el, toClass);
  52215. if (!userWantsControl) {
  52216. if (isValidDuration(explicitEnterDuration)) {
  52217. setTimeout(cb, explicitEnterDuration);
  52218. } else {
  52219. whenTransitionEnds(el, type, cb);
  52220. }
  52221. }
  52222. }
  52223. });
  52224. }
  52225. if (vnode.data.show) {
  52226. toggleDisplay && toggleDisplay();
  52227. enterHook && enterHook(el, cb);
  52228. }
  52229. if (!expectsCSS && !userWantsControl) {
  52230. cb();
  52231. }
  52232. }
  52233. function leave (vnode, rm) {
  52234. var el = vnode.elm;
  52235. // call enter callback now
  52236. if (isDef(el._enterCb)) {
  52237. el._enterCb.cancelled = true;
  52238. el._enterCb();
  52239. }
  52240. var data = resolveTransition(vnode.data.transition);
  52241. if (isUndef(data) || el.nodeType !== 1) {
  52242. return rm()
  52243. }
  52244. /* istanbul ignore if */
  52245. if (isDef(el._leaveCb)) {
  52246. return
  52247. }
  52248. var css = data.css;
  52249. var type = data.type;
  52250. var leaveClass = data.leaveClass;
  52251. var leaveToClass = data.leaveToClass;
  52252. var leaveActiveClass = data.leaveActiveClass;
  52253. var beforeLeave = data.beforeLeave;
  52254. var leave = data.leave;
  52255. var afterLeave = data.afterLeave;
  52256. var leaveCancelled = data.leaveCancelled;
  52257. var delayLeave = data.delayLeave;
  52258. var duration = data.duration;
  52259. var expectsCSS = css !== false && !isIE9;
  52260. var userWantsControl = getHookArgumentsLength(leave);
  52261. var explicitLeaveDuration = toNumber(
  52262. isObject(duration)
  52263. ? duration.leave
  52264. : duration
  52265. );
  52266. if (isDef(explicitLeaveDuration)) {
  52267. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52268. }
  52269. var cb = el._leaveCb = once(function () {
  52270. if (el.parentNode && el.parentNode._pending) {
  52271. el.parentNode._pending[vnode.key] = null;
  52272. }
  52273. if (expectsCSS) {
  52274. removeTransitionClass(el, leaveToClass);
  52275. removeTransitionClass(el, leaveActiveClass);
  52276. }
  52277. if (cb.cancelled) {
  52278. if (expectsCSS) {
  52279. removeTransitionClass(el, leaveClass);
  52280. }
  52281. leaveCancelled && leaveCancelled(el);
  52282. } else {
  52283. rm();
  52284. afterLeave && afterLeave(el);
  52285. }
  52286. el._leaveCb = null;
  52287. });
  52288. if (delayLeave) {
  52289. delayLeave(performLeave);
  52290. } else {
  52291. performLeave();
  52292. }
  52293. function performLeave () {
  52294. // the delayed leave may have already been cancelled
  52295. if (cb.cancelled) {
  52296. return
  52297. }
  52298. // record leaving element
  52299. if (!vnode.data.show && el.parentNode) {
  52300. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52301. }
  52302. beforeLeave && beforeLeave(el);
  52303. if (expectsCSS) {
  52304. addTransitionClass(el, leaveClass);
  52305. addTransitionClass(el, leaveActiveClass);
  52306. nextFrame(function () {
  52307. removeTransitionClass(el, leaveClass);
  52308. if (!cb.cancelled) {
  52309. addTransitionClass(el, leaveToClass);
  52310. if (!userWantsControl) {
  52311. if (isValidDuration(explicitLeaveDuration)) {
  52312. setTimeout(cb, explicitLeaveDuration);
  52313. } else {
  52314. whenTransitionEnds(el, type, cb);
  52315. }
  52316. }
  52317. }
  52318. });
  52319. }
  52320. leave && leave(el, cb);
  52321. if (!expectsCSS && !userWantsControl) {
  52322. cb();
  52323. }
  52324. }
  52325. }
  52326. // only used in dev mode
  52327. function checkDuration (val, name, vnode) {
  52328. if (typeof val !== 'number') {
  52329. warn(
  52330. "<transition> explicit " + name + " duration is not a valid number - " +
  52331. "got " + (JSON.stringify(val)) + ".",
  52332. vnode.context
  52333. );
  52334. } else if (isNaN(val)) {
  52335. warn(
  52336. "<transition> explicit " + name + " duration is NaN - " +
  52337. 'the duration expression might be incorrect.',
  52338. vnode.context
  52339. );
  52340. }
  52341. }
  52342. function isValidDuration (val) {
  52343. return typeof val === 'number' && !isNaN(val)
  52344. }
  52345. /**
  52346. * Normalize a transition hook's argument length. The hook may be:
  52347. * - a merged hook (invoker) with the original in .fns
  52348. * - a wrapped component method (check ._length)
  52349. * - a plain function (.length)
  52350. */
  52351. function getHookArgumentsLength (fn) {
  52352. if (isUndef(fn)) {
  52353. return false
  52354. }
  52355. var invokerFns = fn.fns;
  52356. if (isDef(invokerFns)) {
  52357. // invoker
  52358. return getHookArgumentsLength(
  52359. Array.isArray(invokerFns)
  52360. ? invokerFns[0]
  52361. : invokerFns
  52362. )
  52363. } else {
  52364. return (fn._length || fn.length) > 1
  52365. }
  52366. }
  52367. function _enter (_, vnode) {
  52368. if (vnode.data.show !== true) {
  52369. enter(vnode);
  52370. }
  52371. }
  52372. var transition = inBrowser ? {
  52373. create: _enter,
  52374. activate: _enter,
  52375. remove: function remove$$1 (vnode, rm) {
  52376. /* istanbul ignore else */
  52377. if (vnode.data.show !== true) {
  52378. leave(vnode, rm);
  52379. } else {
  52380. rm();
  52381. }
  52382. }
  52383. } : {};
  52384. var platformModules = [
  52385. attrs,
  52386. klass,
  52387. events,
  52388. domProps,
  52389. style,
  52390. transition
  52391. ];
  52392. /* */
  52393. // the directive module should be applied last, after all
  52394. // built-in modules have been applied.
  52395. var modules = platformModules.concat(baseModules);
  52396. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52397. /**
  52398. * Not type checking this file because flow doesn't like attaching
  52399. * properties to Elements.
  52400. */
  52401. /* istanbul ignore if */
  52402. if (isIE9) {
  52403. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52404. document.addEventListener('selectionchange', function () {
  52405. var el = document.activeElement;
  52406. if (el && el.vmodel) {
  52407. trigger(el, 'input');
  52408. }
  52409. });
  52410. }
  52411. var directive = {
  52412. inserted: function inserted (el, binding, vnode, oldVnode) {
  52413. if (vnode.tag === 'select') {
  52414. // #6903
  52415. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52416. mergeVNodeHook(vnode, 'postpatch', function () {
  52417. directive.componentUpdated(el, binding, vnode);
  52418. });
  52419. } else {
  52420. setSelected(el, binding, vnode.context);
  52421. }
  52422. el._vOptions = [].map.call(el.options, getValue);
  52423. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52424. el._vModifiers = binding.modifiers;
  52425. if (!binding.modifiers.lazy) {
  52426. el.addEventListener('compositionstart', onCompositionStart);
  52427. el.addEventListener('compositionend', onCompositionEnd);
  52428. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52429. // switching focus before confirming composition choice
  52430. // this also fixes the issue where some browsers e.g. iOS Chrome
  52431. // fires "change" instead of "input" on autocomplete.
  52432. el.addEventListener('change', onCompositionEnd);
  52433. /* istanbul ignore if */
  52434. if (isIE9) {
  52435. el.vmodel = true;
  52436. }
  52437. }
  52438. }
  52439. },
  52440. componentUpdated: function componentUpdated (el, binding, vnode) {
  52441. if (vnode.tag === 'select') {
  52442. setSelected(el, binding, vnode.context);
  52443. // in case the options rendered by v-for have changed,
  52444. // it's possible that the value is out-of-sync with the rendered options.
  52445. // detect such cases and filter out values that no longer has a matching
  52446. // option in the DOM.
  52447. var prevOptions = el._vOptions;
  52448. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52449. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52450. // trigger change event if
  52451. // no matching option found for at least one value
  52452. var needReset = el.multiple
  52453. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52454. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52455. if (needReset) {
  52456. trigger(el, 'change');
  52457. }
  52458. }
  52459. }
  52460. }
  52461. };
  52462. function setSelected (el, binding, vm) {
  52463. actuallySetSelected(el, binding, vm);
  52464. /* istanbul ignore if */
  52465. if (isIE || isEdge) {
  52466. setTimeout(function () {
  52467. actuallySetSelected(el, binding, vm);
  52468. }, 0);
  52469. }
  52470. }
  52471. function actuallySetSelected (el, binding, vm) {
  52472. var value = binding.value;
  52473. var isMultiple = el.multiple;
  52474. if (isMultiple && !Array.isArray(value)) {
  52475. warn(
  52476. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52477. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52478. vm
  52479. );
  52480. return
  52481. }
  52482. var selected, option;
  52483. for (var i = 0, l = el.options.length; i < l; i++) {
  52484. option = el.options[i];
  52485. if (isMultiple) {
  52486. selected = looseIndexOf(value, getValue(option)) > -1;
  52487. if (option.selected !== selected) {
  52488. option.selected = selected;
  52489. }
  52490. } else {
  52491. if (looseEqual(getValue(option), value)) {
  52492. if (el.selectedIndex !== i) {
  52493. el.selectedIndex = i;
  52494. }
  52495. return
  52496. }
  52497. }
  52498. }
  52499. if (!isMultiple) {
  52500. el.selectedIndex = -1;
  52501. }
  52502. }
  52503. function hasNoMatchingOption (value, options) {
  52504. return options.every(function (o) { return !looseEqual(o, value); })
  52505. }
  52506. function getValue (option) {
  52507. return '_value' in option
  52508. ? option._value
  52509. : option.value
  52510. }
  52511. function onCompositionStart (e) {
  52512. e.target.composing = true;
  52513. }
  52514. function onCompositionEnd (e) {
  52515. // prevent triggering an input event for no reason
  52516. if (!e.target.composing) { return }
  52517. e.target.composing = false;
  52518. trigger(e.target, 'input');
  52519. }
  52520. function trigger (el, type) {
  52521. var e = document.createEvent('HTMLEvents');
  52522. e.initEvent(type, true, true);
  52523. el.dispatchEvent(e);
  52524. }
  52525. /* */
  52526. // recursively search for possible transition defined inside the component root
  52527. function locateNode (vnode) {
  52528. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52529. ? locateNode(vnode.componentInstance._vnode)
  52530. : vnode
  52531. }
  52532. var show = {
  52533. bind: function bind (el, ref, vnode) {
  52534. var value = ref.value;
  52535. vnode = locateNode(vnode);
  52536. var transition$$1 = vnode.data && vnode.data.transition;
  52537. var originalDisplay = el.__vOriginalDisplay =
  52538. el.style.display === 'none' ? '' : el.style.display;
  52539. if (value && transition$$1) {
  52540. vnode.data.show = true;
  52541. enter(vnode, function () {
  52542. el.style.display = originalDisplay;
  52543. });
  52544. } else {
  52545. el.style.display = value ? originalDisplay : 'none';
  52546. }
  52547. },
  52548. update: function update (el, ref, vnode) {
  52549. var value = ref.value;
  52550. var oldValue = ref.oldValue;
  52551. /* istanbul ignore if */
  52552. if (!value === !oldValue) { return }
  52553. vnode = locateNode(vnode);
  52554. var transition$$1 = vnode.data && vnode.data.transition;
  52555. if (transition$$1) {
  52556. vnode.data.show = true;
  52557. if (value) {
  52558. enter(vnode, function () {
  52559. el.style.display = el.__vOriginalDisplay;
  52560. });
  52561. } else {
  52562. leave(vnode, function () {
  52563. el.style.display = 'none';
  52564. });
  52565. }
  52566. } else {
  52567. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52568. }
  52569. },
  52570. unbind: function unbind (
  52571. el,
  52572. binding,
  52573. vnode,
  52574. oldVnode,
  52575. isDestroy
  52576. ) {
  52577. if (!isDestroy) {
  52578. el.style.display = el.__vOriginalDisplay;
  52579. }
  52580. }
  52581. };
  52582. var platformDirectives = {
  52583. model: directive,
  52584. show: show
  52585. };
  52586. /* */
  52587. var transitionProps = {
  52588. name: String,
  52589. appear: Boolean,
  52590. css: Boolean,
  52591. mode: String,
  52592. type: String,
  52593. enterClass: String,
  52594. leaveClass: String,
  52595. enterToClass: String,
  52596. leaveToClass: String,
  52597. enterActiveClass: String,
  52598. leaveActiveClass: String,
  52599. appearClass: String,
  52600. appearActiveClass: String,
  52601. appearToClass: String,
  52602. duration: [Number, String, Object]
  52603. };
  52604. // in case the child is also an abstract component, e.g. <keep-alive>
  52605. // we want to recursively retrieve the real component to be rendered
  52606. function getRealChild (vnode) {
  52607. var compOptions = vnode && vnode.componentOptions;
  52608. if (compOptions && compOptions.Ctor.options.abstract) {
  52609. return getRealChild(getFirstComponentChild(compOptions.children))
  52610. } else {
  52611. return vnode
  52612. }
  52613. }
  52614. function extractTransitionData (comp) {
  52615. var data = {};
  52616. var options = comp.$options;
  52617. // props
  52618. for (var key in options.propsData) {
  52619. data[key] = comp[key];
  52620. }
  52621. // events.
  52622. // extract listeners and pass them directly to the transition methods
  52623. var listeners = options._parentListeners;
  52624. for (var key$1 in listeners) {
  52625. data[camelize(key$1)] = listeners[key$1];
  52626. }
  52627. return data
  52628. }
  52629. function placeholder (h, rawChild) {
  52630. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52631. return h('keep-alive', {
  52632. props: rawChild.componentOptions.propsData
  52633. })
  52634. }
  52635. }
  52636. function hasParentTransition (vnode) {
  52637. while ((vnode = vnode.parent)) {
  52638. if (vnode.data.transition) {
  52639. return true
  52640. }
  52641. }
  52642. }
  52643. function isSameChild (child, oldChild) {
  52644. return oldChild.key === child.key && oldChild.tag === child.tag
  52645. }
  52646. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52647. var isVShowDirective = function (d) { return d.name === 'show'; };
  52648. var Transition = {
  52649. name: 'transition',
  52650. props: transitionProps,
  52651. abstract: true,
  52652. render: function render (h) {
  52653. var this$1 = this;
  52654. var children = this.$slots.default;
  52655. if (!children) {
  52656. return
  52657. }
  52658. // filter out text nodes (possible whitespaces)
  52659. children = children.filter(isNotTextNode);
  52660. /* istanbul ignore if */
  52661. if (!children.length) {
  52662. return
  52663. }
  52664. // warn multiple elements
  52665. if (children.length > 1) {
  52666. warn(
  52667. '<transition> can only be used on a single element. Use ' +
  52668. '<transition-group> for lists.',
  52669. this.$parent
  52670. );
  52671. }
  52672. var mode = this.mode;
  52673. // warn invalid mode
  52674. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52675. ) {
  52676. warn(
  52677. 'invalid <transition> mode: ' + mode,
  52678. this.$parent
  52679. );
  52680. }
  52681. var rawChild = children[0];
  52682. // if this is a component root node and the component's
  52683. // parent container node also has transition, skip.
  52684. if (hasParentTransition(this.$vnode)) {
  52685. return rawChild
  52686. }
  52687. // apply transition data to child
  52688. // use getRealChild() to ignore abstract components e.g. keep-alive
  52689. var child = getRealChild(rawChild);
  52690. /* istanbul ignore if */
  52691. if (!child) {
  52692. return rawChild
  52693. }
  52694. if (this._leaving) {
  52695. return placeholder(h, rawChild)
  52696. }
  52697. // ensure a key that is unique to the vnode type and to this transition
  52698. // component instance. This key will be used to remove pending leaving nodes
  52699. // during entering.
  52700. var id = "__transition-" + (this._uid) + "-";
  52701. child.key = child.key == null
  52702. ? child.isComment
  52703. ? id + 'comment'
  52704. : id + child.tag
  52705. : isPrimitive(child.key)
  52706. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52707. : child.key;
  52708. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52709. var oldRawChild = this._vnode;
  52710. var oldChild = getRealChild(oldRawChild);
  52711. // mark v-show
  52712. // so that the transition module can hand over the control to the directive
  52713. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52714. child.data.show = true;
  52715. }
  52716. if (
  52717. oldChild &&
  52718. oldChild.data &&
  52719. !isSameChild(child, oldChild) &&
  52720. !isAsyncPlaceholder(oldChild) &&
  52721. // #6687 component root is a comment node
  52722. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52723. ) {
  52724. // replace old child transition data with fresh one
  52725. // important for dynamic transitions!
  52726. var oldData = oldChild.data.transition = extend({}, data);
  52727. // handle transition mode
  52728. if (mode === 'out-in') {
  52729. // return placeholder node and queue update when leave finishes
  52730. this._leaving = true;
  52731. mergeVNodeHook(oldData, 'afterLeave', function () {
  52732. this$1._leaving = false;
  52733. this$1.$forceUpdate();
  52734. });
  52735. return placeholder(h, rawChild)
  52736. } else if (mode === 'in-out') {
  52737. if (isAsyncPlaceholder(child)) {
  52738. return oldRawChild
  52739. }
  52740. var delayedLeave;
  52741. var performLeave = function () { delayedLeave(); };
  52742. mergeVNodeHook(data, 'afterEnter', performLeave);
  52743. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52744. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52745. }
  52746. }
  52747. return rawChild
  52748. }
  52749. };
  52750. /* */
  52751. var props = extend({
  52752. tag: String,
  52753. moveClass: String
  52754. }, transitionProps);
  52755. delete props.mode;
  52756. var TransitionGroup = {
  52757. props: props,
  52758. beforeMount: function beforeMount () {
  52759. var this$1 = this;
  52760. var update = this._update;
  52761. this._update = function (vnode, hydrating) {
  52762. var restoreActiveInstance = setActiveInstance(this$1);
  52763. // force removing pass
  52764. this$1.__patch__(
  52765. this$1._vnode,
  52766. this$1.kept,
  52767. false, // hydrating
  52768. true // removeOnly (!important, avoids unnecessary moves)
  52769. );
  52770. this$1._vnode = this$1.kept;
  52771. restoreActiveInstance();
  52772. update.call(this$1, vnode, hydrating);
  52773. };
  52774. },
  52775. render: function render (h) {
  52776. var tag = this.tag || this.$vnode.data.tag || 'span';
  52777. var map = Object.create(null);
  52778. var prevChildren = this.prevChildren = this.children;
  52779. var rawChildren = this.$slots.default || [];
  52780. var children = this.children = [];
  52781. var transitionData = extractTransitionData(this);
  52782. for (var i = 0; i < rawChildren.length; i++) {
  52783. var c = rawChildren[i];
  52784. if (c.tag) {
  52785. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52786. children.push(c);
  52787. map[c.key] = c
  52788. ;(c.data || (c.data = {})).transition = transitionData;
  52789. } else {
  52790. var opts = c.componentOptions;
  52791. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52792. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52793. }
  52794. }
  52795. }
  52796. if (prevChildren) {
  52797. var kept = [];
  52798. var removed = [];
  52799. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52800. var c$1 = prevChildren[i$1];
  52801. c$1.data.transition = transitionData;
  52802. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52803. if (map[c$1.key]) {
  52804. kept.push(c$1);
  52805. } else {
  52806. removed.push(c$1);
  52807. }
  52808. }
  52809. this.kept = h(tag, null, kept);
  52810. this.removed = removed;
  52811. }
  52812. return h(tag, null, children)
  52813. },
  52814. updated: function updated () {
  52815. var children = this.prevChildren;
  52816. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52817. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52818. return
  52819. }
  52820. // we divide the work into three loops to avoid mixing DOM reads and writes
  52821. // in each iteration - which helps prevent layout thrashing.
  52822. children.forEach(callPendingCbs);
  52823. children.forEach(recordPosition);
  52824. children.forEach(applyTranslation);
  52825. // force reflow to put everything in position
  52826. // assign to this to avoid being removed in tree-shaking
  52827. // $flow-disable-line
  52828. this._reflow = document.body.offsetHeight;
  52829. children.forEach(function (c) {
  52830. if (c.data.moved) {
  52831. var el = c.elm;
  52832. var s = el.style;
  52833. addTransitionClass(el, moveClass);
  52834. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52835. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52836. if (e && e.target !== el) {
  52837. return
  52838. }
  52839. if (!e || /transform$/.test(e.propertyName)) {
  52840. el.removeEventListener(transitionEndEvent, cb);
  52841. el._moveCb = null;
  52842. removeTransitionClass(el, moveClass);
  52843. }
  52844. });
  52845. }
  52846. });
  52847. },
  52848. methods: {
  52849. hasMove: function hasMove (el, moveClass) {
  52850. /* istanbul ignore if */
  52851. if (!hasTransition) {
  52852. return false
  52853. }
  52854. /* istanbul ignore if */
  52855. if (this._hasMove) {
  52856. return this._hasMove
  52857. }
  52858. // Detect whether an element with the move class applied has
  52859. // CSS transitions. Since the element may be inside an entering
  52860. // transition at this very moment, we make a clone of it and remove
  52861. // all other transition classes applied to ensure only the move class
  52862. // is applied.
  52863. var clone = el.cloneNode();
  52864. if (el._transitionClasses) {
  52865. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52866. }
  52867. addClass(clone, moveClass);
  52868. clone.style.display = 'none';
  52869. this.$el.appendChild(clone);
  52870. var info = getTransitionInfo(clone);
  52871. this.$el.removeChild(clone);
  52872. return (this._hasMove = info.hasTransform)
  52873. }
  52874. }
  52875. };
  52876. function callPendingCbs (c) {
  52877. /* istanbul ignore if */
  52878. if (c.elm._moveCb) {
  52879. c.elm._moveCb();
  52880. }
  52881. /* istanbul ignore if */
  52882. if (c.elm._enterCb) {
  52883. c.elm._enterCb();
  52884. }
  52885. }
  52886. function recordPosition (c) {
  52887. c.data.newPos = c.elm.getBoundingClientRect();
  52888. }
  52889. function applyTranslation (c) {
  52890. var oldPos = c.data.pos;
  52891. var newPos = c.data.newPos;
  52892. var dx = oldPos.left - newPos.left;
  52893. var dy = oldPos.top - newPos.top;
  52894. if (dx || dy) {
  52895. c.data.moved = true;
  52896. var s = c.elm.style;
  52897. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52898. s.transitionDuration = '0s';
  52899. }
  52900. }
  52901. var platformComponents = {
  52902. Transition: Transition,
  52903. TransitionGroup: TransitionGroup
  52904. };
  52905. /* */
  52906. // install platform specific utils
  52907. Vue.config.mustUseProp = mustUseProp;
  52908. Vue.config.isReservedTag = isReservedTag;
  52909. Vue.config.isReservedAttr = isReservedAttr;
  52910. Vue.config.getTagNamespace = getTagNamespace;
  52911. Vue.config.isUnknownElement = isUnknownElement;
  52912. // install platform runtime directives & components
  52913. extend(Vue.options.directives, platformDirectives);
  52914. extend(Vue.options.components, platformComponents);
  52915. // install platform patch function
  52916. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52917. // public mount method
  52918. Vue.prototype.$mount = function (
  52919. el,
  52920. hydrating
  52921. ) {
  52922. el = el && inBrowser ? query(el) : undefined;
  52923. return mountComponent(this, el, hydrating)
  52924. };
  52925. // devtools global hook
  52926. /* istanbul ignore next */
  52927. if (inBrowser) {
  52928. setTimeout(function () {
  52929. if (config.devtools) {
  52930. if (devtools) {
  52931. devtools.emit('init', Vue);
  52932. } else {
  52933. console[console.info ? 'info' : 'log'](
  52934. 'Download the Vue Devtools extension for a better development experience:\n' +
  52935. 'https://github.com/vuejs/vue-devtools'
  52936. );
  52937. }
  52938. }
  52939. if (config.productionTip !== false &&
  52940. typeof console !== 'undefined'
  52941. ) {
  52942. console[console.info ? 'info' : 'log'](
  52943. "You are running Vue in development mode.\n" +
  52944. "Make sure to turn on production mode when deploying for production.\n" +
  52945. "See more tips at https://vuejs.org/guide/deployment.html"
  52946. );
  52947. }
  52948. }, 0);
  52949. }
  52950. /* */
  52951. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52952. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52953. var buildRegex = cached(function (delimiters) {
  52954. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52955. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52956. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52957. });
  52958. function parseText (
  52959. text,
  52960. delimiters
  52961. ) {
  52962. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52963. if (!tagRE.test(text)) {
  52964. return
  52965. }
  52966. var tokens = [];
  52967. var rawTokens = [];
  52968. var lastIndex = tagRE.lastIndex = 0;
  52969. var match, index, tokenValue;
  52970. while ((match = tagRE.exec(text))) {
  52971. index = match.index;
  52972. // push text token
  52973. if (index > lastIndex) {
  52974. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52975. tokens.push(JSON.stringify(tokenValue));
  52976. }
  52977. // tag token
  52978. var exp = parseFilters(match[1].trim());
  52979. tokens.push(("_s(" + exp + ")"));
  52980. rawTokens.push({ '@binding': exp });
  52981. lastIndex = index + match[0].length;
  52982. }
  52983. if (lastIndex < text.length) {
  52984. rawTokens.push(tokenValue = text.slice(lastIndex));
  52985. tokens.push(JSON.stringify(tokenValue));
  52986. }
  52987. return {
  52988. expression: tokens.join('+'),
  52989. tokens: rawTokens
  52990. }
  52991. }
  52992. /* */
  52993. function transformNode (el, options) {
  52994. var warn = options.warn || baseWarn;
  52995. var staticClass = getAndRemoveAttr(el, 'class');
  52996. if (staticClass) {
  52997. var res = parseText(staticClass, options.delimiters);
  52998. if (res) {
  52999. warn(
  53000. "class=\"" + staticClass + "\": " +
  53001. 'Interpolation inside attributes has been removed. ' +
  53002. 'Use v-bind or the colon shorthand instead. For example, ' +
  53003. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  53004. el.rawAttrsMap['class']
  53005. );
  53006. }
  53007. }
  53008. if (staticClass) {
  53009. el.staticClass = JSON.stringify(staticClass);
  53010. }
  53011. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  53012. if (classBinding) {
  53013. el.classBinding = classBinding;
  53014. }
  53015. }
  53016. function genData (el) {
  53017. var data = '';
  53018. if (el.staticClass) {
  53019. data += "staticClass:" + (el.staticClass) + ",";
  53020. }
  53021. if (el.classBinding) {
  53022. data += "class:" + (el.classBinding) + ",";
  53023. }
  53024. return data
  53025. }
  53026. var klass$1 = {
  53027. staticKeys: ['staticClass'],
  53028. transformNode: transformNode,
  53029. genData: genData
  53030. };
  53031. /* */
  53032. function transformNode$1 (el, options) {
  53033. var warn = options.warn || baseWarn;
  53034. var staticStyle = getAndRemoveAttr(el, 'style');
  53035. if (staticStyle) {
  53036. /* istanbul ignore if */
  53037. {
  53038. var res = parseText(staticStyle, options.delimiters);
  53039. if (res) {
  53040. warn(
  53041. "style=\"" + staticStyle + "\": " +
  53042. 'Interpolation inside attributes has been removed. ' +
  53043. 'Use v-bind or the colon shorthand instead. For example, ' +
  53044. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  53045. el.rawAttrsMap['style']
  53046. );
  53047. }
  53048. }
  53049. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  53050. }
  53051. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  53052. if (styleBinding) {
  53053. el.styleBinding = styleBinding;
  53054. }
  53055. }
  53056. function genData$1 (el) {
  53057. var data = '';
  53058. if (el.staticStyle) {
  53059. data += "staticStyle:" + (el.staticStyle) + ",";
  53060. }
  53061. if (el.styleBinding) {
  53062. data += "style:(" + (el.styleBinding) + "),";
  53063. }
  53064. return data
  53065. }
  53066. var style$1 = {
  53067. staticKeys: ['staticStyle'],
  53068. transformNode: transformNode$1,
  53069. genData: genData$1
  53070. };
  53071. /* */
  53072. var decoder;
  53073. var he = {
  53074. decode: function decode (html) {
  53075. decoder = decoder || document.createElement('div');
  53076. decoder.innerHTML = html;
  53077. return decoder.textContent
  53078. }
  53079. };
  53080. /* */
  53081. var isUnaryTag = makeMap(
  53082. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  53083. 'link,meta,param,source,track,wbr'
  53084. );
  53085. // Elements that you can, intentionally, leave open
  53086. // (and which close themselves)
  53087. var canBeLeftOpenTag = makeMap(
  53088. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  53089. );
  53090. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  53091. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  53092. var isNonPhrasingTag = makeMap(
  53093. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  53094. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  53095. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  53096. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  53097. 'title,tr,track'
  53098. );
  53099. /**
  53100. * Not type-checking this file because it's mostly vendor code.
  53101. */
  53102. // Regular Expressions for parsing tags and attributes
  53103. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53104. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53105. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  53106. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  53107. var startTagOpen = new RegExp(("^<" + qnameCapture));
  53108. var startTagClose = /^\s*(\/?)>/;
  53109. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  53110. var doctype = /^<!DOCTYPE [^>]+>/i;
  53111. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53112. var comment = /^<!\--/;
  53113. var conditionalComment = /^<!\[/;
  53114. // Special Elements (can contain anything)
  53115. var isPlainTextElement = makeMap('script,style,textarea', true);
  53116. var reCache = {};
  53117. var decodingMap = {
  53118. '&lt;': '<',
  53119. '&gt;': '>',
  53120. '&quot;': '"',
  53121. '&amp;': '&',
  53122. '&#10;': '\n',
  53123. '&#9;': '\t',
  53124. '&#39;': "'"
  53125. };
  53126. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53127. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53128. // #5992
  53129. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53130. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53131. function decodeAttr (value, shouldDecodeNewlines) {
  53132. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53133. return value.replace(re, function (match) { return decodingMap[match]; })
  53134. }
  53135. function parseHTML (html, options) {
  53136. var stack = [];
  53137. var expectHTML = options.expectHTML;
  53138. var isUnaryTag$$1 = options.isUnaryTag || no;
  53139. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53140. var index = 0;
  53141. var last, lastTag;
  53142. while (html) {
  53143. last = html;
  53144. // Make sure we're not in a plaintext content element like script/style
  53145. if (!lastTag || !isPlainTextElement(lastTag)) {
  53146. var textEnd = html.indexOf('<');
  53147. if (textEnd === 0) {
  53148. // Comment:
  53149. if (comment.test(html)) {
  53150. var commentEnd = html.indexOf('-->');
  53151. if (commentEnd >= 0) {
  53152. if (options.shouldKeepComment) {
  53153. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53154. }
  53155. advance(commentEnd + 3);
  53156. continue
  53157. }
  53158. }
  53159. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53160. if (conditionalComment.test(html)) {
  53161. var conditionalEnd = html.indexOf(']>');
  53162. if (conditionalEnd >= 0) {
  53163. advance(conditionalEnd + 2);
  53164. continue
  53165. }
  53166. }
  53167. // Doctype:
  53168. var doctypeMatch = html.match(doctype);
  53169. if (doctypeMatch) {
  53170. advance(doctypeMatch[0].length);
  53171. continue
  53172. }
  53173. // End tag:
  53174. var endTagMatch = html.match(endTag);
  53175. if (endTagMatch) {
  53176. var curIndex = index;
  53177. advance(endTagMatch[0].length);
  53178. parseEndTag(endTagMatch[1], curIndex, index);
  53179. continue
  53180. }
  53181. // Start tag:
  53182. var startTagMatch = parseStartTag();
  53183. if (startTagMatch) {
  53184. handleStartTag(startTagMatch);
  53185. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53186. advance(1);
  53187. }
  53188. continue
  53189. }
  53190. }
  53191. var text = (void 0), rest = (void 0), next = (void 0);
  53192. if (textEnd >= 0) {
  53193. rest = html.slice(textEnd);
  53194. while (
  53195. !endTag.test(rest) &&
  53196. !startTagOpen.test(rest) &&
  53197. !comment.test(rest) &&
  53198. !conditionalComment.test(rest)
  53199. ) {
  53200. // < in plain text, be forgiving and treat it as text
  53201. next = rest.indexOf('<', 1);
  53202. if (next < 0) { break }
  53203. textEnd += next;
  53204. rest = html.slice(textEnd);
  53205. }
  53206. text = html.substring(0, textEnd);
  53207. }
  53208. if (textEnd < 0) {
  53209. text = html;
  53210. }
  53211. if (text) {
  53212. advance(text.length);
  53213. }
  53214. if (options.chars && text) {
  53215. options.chars(text, index - text.length, index);
  53216. }
  53217. } else {
  53218. var endTagLength = 0;
  53219. var stackedTag = lastTag.toLowerCase();
  53220. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53221. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53222. endTagLength = endTag.length;
  53223. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53224. text = text
  53225. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53226. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53227. }
  53228. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53229. text = text.slice(1);
  53230. }
  53231. if (options.chars) {
  53232. options.chars(text);
  53233. }
  53234. return ''
  53235. });
  53236. index += html.length - rest$1.length;
  53237. html = rest$1;
  53238. parseEndTag(stackedTag, index - endTagLength, index);
  53239. }
  53240. if (html === last) {
  53241. options.chars && options.chars(html);
  53242. if (!stack.length && options.warn) {
  53243. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53244. }
  53245. break
  53246. }
  53247. }
  53248. // Clean up any remaining tags
  53249. parseEndTag();
  53250. function advance (n) {
  53251. index += n;
  53252. html = html.substring(n);
  53253. }
  53254. function parseStartTag () {
  53255. var start = html.match(startTagOpen);
  53256. if (start) {
  53257. var match = {
  53258. tagName: start[1],
  53259. attrs: [],
  53260. start: index
  53261. };
  53262. advance(start[0].length);
  53263. var end, attr;
  53264. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53265. attr.start = index;
  53266. advance(attr[0].length);
  53267. attr.end = index;
  53268. match.attrs.push(attr);
  53269. }
  53270. if (end) {
  53271. match.unarySlash = end[1];
  53272. advance(end[0].length);
  53273. match.end = index;
  53274. return match
  53275. }
  53276. }
  53277. }
  53278. function handleStartTag (match) {
  53279. var tagName = match.tagName;
  53280. var unarySlash = match.unarySlash;
  53281. if (expectHTML) {
  53282. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53283. parseEndTag(lastTag);
  53284. }
  53285. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53286. parseEndTag(tagName);
  53287. }
  53288. }
  53289. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53290. var l = match.attrs.length;
  53291. var attrs = new Array(l);
  53292. for (var i = 0; i < l; i++) {
  53293. var args = match.attrs[i];
  53294. var value = args[3] || args[4] || args[5] || '';
  53295. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53296. ? options.shouldDecodeNewlinesForHref
  53297. : options.shouldDecodeNewlines;
  53298. attrs[i] = {
  53299. name: args[1],
  53300. value: decodeAttr(value, shouldDecodeNewlines)
  53301. };
  53302. if (options.outputSourceRange) {
  53303. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53304. attrs[i].end = args.end;
  53305. }
  53306. }
  53307. if (!unary) {
  53308. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53309. lastTag = tagName;
  53310. }
  53311. if (options.start) {
  53312. options.start(tagName, attrs, unary, match.start, match.end);
  53313. }
  53314. }
  53315. function parseEndTag (tagName, start, end) {
  53316. var pos, lowerCasedTagName;
  53317. if (start == null) { start = index; }
  53318. if (end == null) { end = index; }
  53319. // Find the closest opened tag of the same type
  53320. if (tagName) {
  53321. lowerCasedTagName = tagName.toLowerCase();
  53322. for (pos = stack.length - 1; pos >= 0; pos--) {
  53323. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53324. break
  53325. }
  53326. }
  53327. } else {
  53328. // If no tag name is provided, clean shop
  53329. pos = 0;
  53330. }
  53331. if (pos >= 0) {
  53332. // Close all the open elements, up the stack
  53333. for (var i = stack.length - 1; i >= pos; i--) {
  53334. if (i > pos || !tagName &&
  53335. options.warn
  53336. ) {
  53337. options.warn(
  53338. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53339. { start: stack[i].start, end: stack[i].end }
  53340. );
  53341. }
  53342. if (options.end) {
  53343. options.end(stack[i].tag, start, end);
  53344. }
  53345. }
  53346. // Remove the open elements from the stack
  53347. stack.length = pos;
  53348. lastTag = pos && stack[pos - 1].tag;
  53349. } else if (lowerCasedTagName === 'br') {
  53350. if (options.start) {
  53351. options.start(tagName, [], true, start, end);
  53352. }
  53353. } else if (lowerCasedTagName === 'p') {
  53354. if (options.start) {
  53355. options.start(tagName, [], false, start, end);
  53356. }
  53357. if (options.end) {
  53358. options.end(tagName, start, end);
  53359. }
  53360. }
  53361. }
  53362. }
  53363. /* */
  53364. var onRE = /^@|^v-on:/;
  53365. var dirRE = /^v-|^@|^:|^#/;
  53366. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53367. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53368. var stripParensRE = /^\(|\)$/g;
  53369. var dynamicArgRE = /^\[.*\]$/;
  53370. var argRE = /:(.*)$/;
  53371. var bindRE = /^:|^\.|^v-bind:/;
  53372. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53373. var slotRE = /^v-slot(:|$)|^#/;
  53374. var lineBreakRE = /[\r\n]/;
  53375. var whitespaceRE$1 = /\s+/g;
  53376. var invalidAttributeRE = /[\s"'<>\/=]/;
  53377. var decodeHTMLCached = cached(he.decode);
  53378. var emptySlotScopeToken = "_empty_";
  53379. // configurable state
  53380. var warn$2;
  53381. var delimiters;
  53382. var transforms;
  53383. var preTransforms;
  53384. var postTransforms;
  53385. var platformIsPreTag;
  53386. var platformMustUseProp;
  53387. var platformGetTagNamespace;
  53388. var maybeComponent;
  53389. function createASTElement (
  53390. tag,
  53391. attrs,
  53392. parent
  53393. ) {
  53394. return {
  53395. type: 1,
  53396. tag: tag,
  53397. attrsList: attrs,
  53398. attrsMap: makeAttrsMap(attrs),
  53399. rawAttrsMap: {},
  53400. parent: parent,
  53401. children: []
  53402. }
  53403. }
  53404. /**
  53405. * Convert HTML string to AST.
  53406. */
  53407. function parse (
  53408. template,
  53409. options
  53410. ) {
  53411. warn$2 = options.warn || baseWarn;
  53412. platformIsPreTag = options.isPreTag || no;
  53413. platformMustUseProp = options.mustUseProp || no;
  53414. platformGetTagNamespace = options.getTagNamespace || no;
  53415. var isReservedTag = options.isReservedTag || no;
  53416. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53417. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53418. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53419. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53420. delimiters = options.delimiters;
  53421. var stack = [];
  53422. var preserveWhitespace = options.preserveWhitespace !== false;
  53423. var whitespaceOption = options.whitespace;
  53424. var root;
  53425. var currentParent;
  53426. var inVPre = false;
  53427. var inPre = false;
  53428. var warned = false;
  53429. function warnOnce (msg, range) {
  53430. if (!warned) {
  53431. warned = true;
  53432. warn$2(msg, range);
  53433. }
  53434. }
  53435. function closeElement (element) {
  53436. trimEndingWhitespace(element);
  53437. if (!inVPre && !element.processed) {
  53438. element = processElement(element, options);
  53439. }
  53440. // tree management
  53441. if (!stack.length && element !== root) {
  53442. // allow root elements with v-if, v-else-if and v-else
  53443. if (root.if && (element.elseif || element.else)) {
  53444. {
  53445. checkRootConstraints(element);
  53446. }
  53447. addIfCondition(root, {
  53448. exp: element.elseif,
  53449. block: element
  53450. });
  53451. } else {
  53452. warnOnce(
  53453. "Component template should contain exactly one root element. " +
  53454. "If you are using v-if on multiple elements, " +
  53455. "use v-else-if to chain them instead.",
  53456. { start: element.start }
  53457. );
  53458. }
  53459. }
  53460. if (currentParent && !element.forbidden) {
  53461. if (element.elseif || element.else) {
  53462. processIfConditions(element, currentParent);
  53463. } else {
  53464. if (element.slotScope) {
  53465. // scoped slot
  53466. // keep it in the children list so that v-else(-if) conditions can
  53467. // find it as the prev node.
  53468. var name = element.slotTarget || '"default"'
  53469. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53470. }
  53471. currentParent.children.push(element);
  53472. element.parent = currentParent;
  53473. }
  53474. }
  53475. // final children cleanup
  53476. // filter out scoped slots
  53477. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53478. // remove trailing whitespace node again
  53479. trimEndingWhitespace(element);
  53480. // check pre state
  53481. if (element.pre) {
  53482. inVPre = false;
  53483. }
  53484. if (platformIsPreTag(element.tag)) {
  53485. inPre = false;
  53486. }
  53487. // apply post-transforms
  53488. for (var i = 0; i < postTransforms.length; i++) {
  53489. postTransforms[i](element, options);
  53490. }
  53491. }
  53492. function trimEndingWhitespace (el) {
  53493. // remove trailing whitespace node
  53494. if (!inPre) {
  53495. var lastNode;
  53496. while (
  53497. (lastNode = el.children[el.children.length - 1]) &&
  53498. lastNode.type === 3 &&
  53499. lastNode.text === ' '
  53500. ) {
  53501. el.children.pop();
  53502. }
  53503. }
  53504. }
  53505. function checkRootConstraints (el) {
  53506. if (el.tag === 'slot' || el.tag === 'template') {
  53507. warnOnce(
  53508. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53509. 'contain multiple nodes.',
  53510. { start: el.start }
  53511. );
  53512. }
  53513. if (el.attrsMap.hasOwnProperty('v-for')) {
  53514. warnOnce(
  53515. 'Cannot use v-for on stateful component root element because ' +
  53516. 'it renders multiple elements.',
  53517. el.rawAttrsMap['v-for']
  53518. );
  53519. }
  53520. }
  53521. parseHTML(template, {
  53522. warn: warn$2,
  53523. expectHTML: options.expectHTML,
  53524. isUnaryTag: options.isUnaryTag,
  53525. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53526. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53527. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53528. shouldKeepComment: options.comments,
  53529. outputSourceRange: options.outputSourceRange,
  53530. start: function start (tag, attrs, unary, start$1, end) {
  53531. // check namespace.
  53532. // inherit parent ns if there is one
  53533. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53534. // handle IE svg bug
  53535. /* istanbul ignore if */
  53536. if (isIE && ns === 'svg') {
  53537. attrs = guardIESVGBug(attrs);
  53538. }
  53539. var element = createASTElement(tag, attrs, currentParent);
  53540. if (ns) {
  53541. element.ns = ns;
  53542. }
  53543. {
  53544. if (options.outputSourceRange) {
  53545. element.start = start$1;
  53546. element.end = end;
  53547. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53548. cumulated[attr.name] = attr;
  53549. return cumulated
  53550. }, {});
  53551. }
  53552. attrs.forEach(function (attr) {
  53553. if (invalidAttributeRE.test(attr.name)) {
  53554. warn$2(
  53555. "Invalid dynamic argument expression: attribute names cannot contain " +
  53556. "spaces, quotes, <, >, / or =.",
  53557. {
  53558. start: attr.start + attr.name.indexOf("["),
  53559. end: attr.start + attr.name.length
  53560. }
  53561. );
  53562. }
  53563. });
  53564. }
  53565. if (isForbiddenTag(element) && !isServerRendering()) {
  53566. element.forbidden = true;
  53567. warn$2(
  53568. 'Templates should only be responsible for mapping the state to the ' +
  53569. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53570. "<" + tag + ">" + ', as they will not be parsed.',
  53571. { start: element.start }
  53572. );
  53573. }
  53574. // apply pre-transforms
  53575. for (var i = 0; i < preTransforms.length; i++) {
  53576. element = preTransforms[i](element, options) || element;
  53577. }
  53578. if (!inVPre) {
  53579. processPre(element);
  53580. if (element.pre) {
  53581. inVPre = true;
  53582. }
  53583. }
  53584. if (platformIsPreTag(element.tag)) {
  53585. inPre = true;
  53586. }
  53587. if (inVPre) {
  53588. processRawAttrs(element);
  53589. } else if (!element.processed) {
  53590. // structural directives
  53591. processFor(element);
  53592. processIf(element);
  53593. processOnce(element);
  53594. }
  53595. if (!root) {
  53596. root = element;
  53597. {
  53598. checkRootConstraints(root);
  53599. }
  53600. }
  53601. if (!unary) {
  53602. currentParent = element;
  53603. stack.push(element);
  53604. } else {
  53605. closeElement(element);
  53606. }
  53607. },
  53608. end: function end (tag, start, end$1) {
  53609. var element = stack[stack.length - 1];
  53610. // pop stack
  53611. stack.length -= 1;
  53612. currentParent = stack[stack.length - 1];
  53613. if (options.outputSourceRange) {
  53614. element.end = end$1;
  53615. }
  53616. closeElement(element);
  53617. },
  53618. chars: function chars (text, start, end) {
  53619. if (!currentParent) {
  53620. {
  53621. if (text === template) {
  53622. warnOnce(
  53623. 'Component template requires a root element, rather than just text.',
  53624. { start: start }
  53625. );
  53626. } else if ((text = text.trim())) {
  53627. warnOnce(
  53628. ("text \"" + text + "\" outside root element will be ignored."),
  53629. { start: start }
  53630. );
  53631. }
  53632. }
  53633. return
  53634. }
  53635. // IE textarea placeholder bug
  53636. /* istanbul ignore if */
  53637. if (isIE &&
  53638. currentParent.tag === 'textarea' &&
  53639. currentParent.attrsMap.placeholder === text
  53640. ) {
  53641. return
  53642. }
  53643. var children = currentParent.children;
  53644. if (inPre || text.trim()) {
  53645. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53646. } else if (!children.length) {
  53647. // remove the whitespace-only node right after an opening tag
  53648. text = '';
  53649. } else if (whitespaceOption) {
  53650. if (whitespaceOption === 'condense') {
  53651. // in condense mode, remove the whitespace node if it contains
  53652. // line break, otherwise condense to a single space
  53653. text = lineBreakRE.test(text) ? '' : ' ';
  53654. } else {
  53655. text = ' ';
  53656. }
  53657. } else {
  53658. text = preserveWhitespace ? ' ' : '';
  53659. }
  53660. if (text) {
  53661. if (!inPre && whitespaceOption === 'condense') {
  53662. // condense consecutive whitespaces into single space
  53663. text = text.replace(whitespaceRE$1, ' ');
  53664. }
  53665. var res;
  53666. var child;
  53667. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53668. child = {
  53669. type: 2,
  53670. expression: res.expression,
  53671. tokens: res.tokens,
  53672. text: text
  53673. };
  53674. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53675. child = {
  53676. type: 3,
  53677. text: text
  53678. };
  53679. }
  53680. if (child) {
  53681. if (options.outputSourceRange) {
  53682. child.start = start;
  53683. child.end = end;
  53684. }
  53685. children.push(child);
  53686. }
  53687. }
  53688. },
  53689. comment: function comment (text, start, end) {
  53690. // adding anyting as a sibling to the root node is forbidden
  53691. // comments should still be allowed, but ignored
  53692. if (currentParent) {
  53693. var child = {
  53694. type: 3,
  53695. text: text,
  53696. isComment: true
  53697. };
  53698. if (options.outputSourceRange) {
  53699. child.start = start;
  53700. child.end = end;
  53701. }
  53702. currentParent.children.push(child);
  53703. }
  53704. }
  53705. });
  53706. return root
  53707. }
  53708. function processPre (el) {
  53709. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53710. el.pre = true;
  53711. }
  53712. }
  53713. function processRawAttrs (el) {
  53714. var list = el.attrsList;
  53715. var len = list.length;
  53716. if (len) {
  53717. var attrs = el.attrs = new Array(len);
  53718. for (var i = 0; i < len; i++) {
  53719. attrs[i] = {
  53720. name: list[i].name,
  53721. value: JSON.stringify(list[i].value)
  53722. };
  53723. if (list[i].start != null) {
  53724. attrs[i].start = list[i].start;
  53725. attrs[i].end = list[i].end;
  53726. }
  53727. }
  53728. } else if (!el.pre) {
  53729. // non root node in pre blocks with no attributes
  53730. el.plain = true;
  53731. }
  53732. }
  53733. function processElement (
  53734. element,
  53735. options
  53736. ) {
  53737. processKey(element);
  53738. // determine whether this is a plain element after
  53739. // removing structural attributes
  53740. element.plain = (
  53741. !element.key &&
  53742. !element.scopedSlots &&
  53743. !element.attrsList.length
  53744. );
  53745. processRef(element);
  53746. processSlotContent(element);
  53747. processSlotOutlet(element);
  53748. processComponent(element);
  53749. for (var i = 0; i < transforms.length; i++) {
  53750. element = transforms[i](element, options) || element;
  53751. }
  53752. processAttrs(element);
  53753. return element
  53754. }
  53755. function processKey (el) {
  53756. var exp = getBindingAttr(el, 'key');
  53757. if (exp) {
  53758. {
  53759. if (el.tag === 'template') {
  53760. warn$2(
  53761. "<template> cannot be keyed. Place the key on real elements instead.",
  53762. getRawBindingAttr(el, 'key')
  53763. );
  53764. }
  53765. if (el.for) {
  53766. var iterator = el.iterator2 || el.iterator1;
  53767. var parent = el.parent;
  53768. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53769. warn$2(
  53770. "Do not use v-for index as key on <transition-group> children, " +
  53771. "this is the same as not using keys.",
  53772. getRawBindingAttr(el, 'key'),
  53773. true /* tip */
  53774. );
  53775. }
  53776. }
  53777. }
  53778. el.key = exp;
  53779. }
  53780. }
  53781. function processRef (el) {
  53782. var ref = getBindingAttr(el, 'ref');
  53783. if (ref) {
  53784. el.ref = ref;
  53785. el.refInFor = checkInFor(el);
  53786. }
  53787. }
  53788. function processFor (el) {
  53789. var exp;
  53790. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53791. var res = parseFor(exp);
  53792. if (res) {
  53793. extend(el, res);
  53794. } else {
  53795. warn$2(
  53796. ("Invalid v-for expression: " + exp),
  53797. el.rawAttrsMap['v-for']
  53798. );
  53799. }
  53800. }
  53801. }
  53802. function parseFor (exp) {
  53803. var inMatch = exp.match(forAliasRE);
  53804. if (!inMatch) { return }
  53805. var res = {};
  53806. res.for = inMatch[2].trim();
  53807. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53808. var iteratorMatch = alias.match(forIteratorRE);
  53809. if (iteratorMatch) {
  53810. res.alias = alias.replace(forIteratorRE, '').trim();
  53811. res.iterator1 = iteratorMatch[1].trim();
  53812. if (iteratorMatch[2]) {
  53813. res.iterator2 = iteratorMatch[2].trim();
  53814. }
  53815. } else {
  53816. res.alias = alias;
  53817. }
  53818. return res
  53819. }
  53820. function processIf (el) {
  53821. var exp = getAndRemoveAttr(el, 'v-if');
  53822. if (exp) {
  53823. el.if = exp;
  53824. addIfCondition(el, {
  53825. exp: exp,
  53826. block: el
  53827. });
  53828. } else {
  53829. if (getAndRemoveAttr(el, 'v-else') != null) {
  53830. el.else = true;
  53831. }
  53832. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53833. if (elseif) {
  53834. el.elseif = elseif;
  53835. }
  53836. }
  53837. }
  53838. function processIfConditions (el, parent) {
  53839. var prev = findPrevElement(parent.children);
  53840. if (prev && prev.if) {
  53841. addIfCondition(prev, {
  53842. exp: el.elseif,
  53843. block: el
  53844. });
  53845. } else {
  53846. warn$2(
  53847. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53848. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53849. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53850. );
  53851. }
  53852. }
  53853. function findPrevElement (children) {
  53854. var i = children.length;
  53855. while (i--) {
  53856. if (children[i].type === 1) {
  53857. return children[i]
  53858. } else {
  53859. if (children[i].text !== ' ') {
  53860. warn$2(
  53861. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53862. "will be ignored.",
  53863. children[i]
  53864. );
  53865. }
  53866. children.pop();
  53867. }
  53868. }
  53869. }
  53870. function addIfCondition (el, condition) {
  53871. if (!el.ifConditions) {
  53872. el.ifConditions = [];
  53873. }
  53874. el.ifConditions.push(condition);
  53875. }
  53876. function processOnce (el) {
  53877. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53878. if (once$$1 != null) {
  53879. el.once = true;
  53880. }
  53881. }
  53882. // handle content being passed to a component as slot,
  53883. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53884. function processSlotContent (el) {
  53885. var slotScope;
  53886. if (el.tag === 'template') {
  53887. slotScope = getAndRemoveAttr(el, 'scope');
  53888. /* istanbul ignore if */
  53889. if (slotScope) {
  53890. warn$2(
  53891. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53892. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53893. "can also be used on plain elements in addition to <template> to " +
  53894. "denote scoped slots.",
  53895. el.rawAttrsMap['scope'],
  53896. true
  53897. );
  53898. }
  53899. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53900. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53901. /* istanbul ignore if */
  53902. if (el.attrsMap['v-for']) {
  53903. warn$2(
  53904. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53905. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53906. "scoped slot to make it clearer.",
  53907. el.rawAttrsMap['slot-scope'],
  53908. true
  53909. );
  53910. }
  53911. el.slotScope = slotScope;
  53912. }
  53913. // slot="xxx"
  53914. var slotTarget = getBindingAttr(el, 'slot');
  53915. if (slotTarget) {
  53916. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53917. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53918. // preserve slot as an attribute for native shadow DOM compat
  53919. // only for non-scoped slots.
  53920. if (el.tag !== 'template' && !el.slotScope) {
  53921. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53922. }
  53923. }
  53924. // 2.6 v-slot syntax
  53925. {
  53926. if (el.tag === 'template') {
  53927. // v-slot on <template>
  53928. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53929. if (slotBinding) {
  53930. {
  53931. if (el.slotTarget || el.slotScope) {
  53932. warn$2(
  53933. "Unexpected mixed usage of different slot syntaxes.",
  53934. el
  53935. );
  53936. }
  53937. if (el.parent && !maybeComponent(el.parent)) {
  53938. warn$2(
  53939. "<template v-slot> can only appear at the root level inside " +
  53940. "the receiving component",
  53941. el
  53942. );
  53943. }
  53944. }
  53945. var ref = getSlotName(slotBinding);
  53946. var name = ref.name;
  53947. var dynamic = ref.dynamic;
  53948. el.slotTarget = name;
  53949. el.slotTargetDynamic = dynamic;
  53950. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53951. }
  53952. } else {
  53953. // v-slot on component, denotes default slot
  53954. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53955. if (slotBinding$1) {
  53956. {
  53957. if (!maybeComponent(el)) {
  53958. warn$2(
  53959. "v-slot can only be used on components or <template>.",
  53960. slotBinding$1
  53961. );
  53962. }
  53963. if (el.slotScope || el.slotTarget) {
  53964. warn$2(
  53965. "Unexpected mixed usage of different slot syntaxes.",
  53966. el
  53967. );
  53968. }
  53969. if (el.scopedSlots) {
  53970. warn$2(
  53971. "To avoid scope ambiguity, the default slot should also use " +
  53972. "<template> syntax when there are other named slots.",
  53973. slotBinding$1
  53974. );
  53975. }
  53976. }
  53977. // add the component's children to its default slot
  53978. var slots = el.scopedSlots || (el.scopedSlots = {});
  53979. var ref$1 = getSlotName(slotBinding$1);
  53980. var name$1 = ref$1.name;
  53981. var dynamic$1 = ref$1.dynamic;
  53982. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53983. slotContainer.slotTarget = name$1;
  53984. slotContainer.slotTargetDynamic = dynamic$1;
  53985. slotContainer.children = el.children.filter(function (c) {
  53986. if (!c.slotScope) {
  53987. c.parent = slotContainer;
  53988. return true
  53989. }
  53990. });
  53991. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53992. // remove children as they are returned from scopedSlots now
  53993. el.children = [];
  53994. // mark el non-plain so data gets generated
  53995. el.plain = false;
  53996. }
  53997. }
  53998. }
  53999. }
  54000. function getSlotName (binding) {
  54001. var name = binding.name.replace(slotRE, '');
  54002. if (!name) {
  54003. if (binding.name[0] !== '#') {
  54004. name = 'default';
  54005. } else {
  54006. warn$2(
  54007. "v-slot shorthand syntax requires a slot name.",
  54008. binding
  54009. );
  54010. }
  54011. }
  54012. return dynamicArgRE.test(name)
  54013. // dynamic [name]
  54014. ? { name: name.slice(1, -1), dynamic: true }
  54015. // static name
  54016. : { name: ("\"" + name + "\""), dynamic: false }
  54017. }
  54018. // handle <slot/> outlets
  54019. function processSlotOutlet (el) {
  54020. if (el.tag === 'slot') {
  54021. el.slotName = getBindingAttr(el, 'name');
  54022. if (el.key) {
  54023. warn$2(
  54024. "`key` does not work on <slot> because slots are abstract outlets " +
  54025. "and can possibly expand into multiple elements. " +
  54026. "Use the key on a wrapping element instead.",
  54027. getRawBindingAttr(el, 'key')
  54028. );
  54029. }
  54030. }
  54031. }
  54032. function processComponent (el) {
  54033. var binding;
  54034. if ((binding = getBindingAttr(el, 'is'))) {
  54035. el.component = binding;
  54036. }
  54037. if (getAndRemoveAttr(el, 'inline-template') != null) {
  54038. el.inlineTemplate = true;
  54039. }
  54040. }
  54041. function processAttrs (el) {
  54042. var list = el.attrsList;
  54043. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  54044. for (i = 0, l = list.length; i < l; i++) {
  54045. name = rawName = list[i].name;
  54046. value = list[i].value;
  54047. if (dirRE.test(name)) {
  54048. // mark element as dynamic
  54049. el.hasBindings = true;
  54050. // modifiers
  54051. modifiers = parseModifiers(name.replace(dirRE, ''));
  54052. // support .foo shorthand syntax for the .prop modifier
  54053. if (modifiers) {
  54054. name = name.replace(modifierRE, '');
  54055. }
  54056. if (bindRE.test(name)) { // v-bind
  54057. name = name.replace(bindRE, '');
  54058. value = parseFilters(value);
  54059. isDynamic = dynamicArgRE.test(name);
  54060. if (isDynamic) {
  54061. name = name.slice(1, -1);
  54062. }
  54063. if (
  54064. value.trim().length === 0
  54065. ) {
  54066. warn$2(
  54067. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  54068. );
  54069. }
  54070. if (modifiers) {
  54071. if (modifiers.prop && !isDynamic) {
  54072. name = camelize(name);
  54073. if (name === 'innerHtml') { name = 'innerHTML'; }
  54074. }
  54075. if (modifiers.camel && !isDynamic) {
  54076. name = camelize(name);
  54077. }
  54078. if (modifiers.sync) {
  54079. syncGen = genAssignmentCode(value, "$event");
  54080. if (!isDynamic) {
  54081. addHandler(
  54082. el,
  54083. ("update:" + (camelize(name))),
  54084. syncGen,
  54085. null,
  54086. false,
  54087. warn$2,
  54088. list[i]
  54089. );
  54090. if (hyphenate(name) !== camelize(name)) {
  54091. addHandler(
  54092. el,
  54093. ("update:" + (hyphenate(name))),
  54094. syncGen,
  54095. null,
  54096. false,
  54097. warn$2,
  54098. list[i]
  54099. );
  54100. }
  54101. } else {
  54102. // handler w/ dynamic event name
  54103. addHandler(
  54104. el,
  54105. ("\"update:\"+(" + name + ")"),
  54106. syncGen,
  54107. null,
  54108. false,
  54109. warn$2,
  54110. list[i],
  54111. true // dynamic
  54112. );
  54113. }
  54114. }
  54115. }
  54116. if ((modifiers && modifiers.prop) || (
  54117. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54118. )) {
  54119. addProp(el, name, value, list[i], isDynamic);
  54120. } else {
  54121. addAttr(el, name, value, list[i], isDynamic);
  54122. }
  54123. } else if (onRE.test(name)) { // v-on
  54124. name = name.replace(onRE, '');
  54125. isDynamic = dynamicArgRE.test(name);
  54126. if (isDynamic) {
  54127. name = name.slice(1, -1);
  54128. }
  54129. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54130. } else { // normal directives
  54131. name = name.replace(dirRE, '');
  54132. // parse arg
  54133. var argMatch = name.match(argRE);
  54134. var arg = argMatch && argMatch[1];
  54135. isDynamic = false;
  54136. if (arg) {
  54137. name = name.slice(0, -(arg.length + 1));
  54138. if (dynamicArgRE.test(arg)) {
  54139. arg = arg.slice(1, -1);
  54140. isDynamic = true;
  54141. }
  54142. }
  54143. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54144. if (name === 'model') {
  54145. checkForAliasModel(el, value);
  54146. }
  54147. }
  54148. } else {
  54149. // literal attribute
  54150. {
  54151. var res = parseText(value, delimiters);
  54152. if (res) {
  54153. warn$2(
  54154. name + "=\"" + value + "\": " +
  54155. 'Interpolation inside attributes has been removed. ' +
  54156. 'Use v-bind or the colon shorthand instead. For example, ' +
  54157. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54158. list[i]
  54159. );
  54160. }
  54161. }
  54162. addAttr(el, name, JSON.stringify(value), list[i]);
  54163. // #6887 firefox doesn't update muted state if set via attribute
  54164. // even immediately after element creation
  54165. if (!el.component &&
  54166. name === 'muted' &&
  54167. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54168. addProp(el, name, 'true', list[i]);
  54169. }
  54170. }
  54171. }
  54172. }
  54173. function checkInFor (el) {
  54174. var parent = el;
  54175. while (parent) {
  54176. if (parent.for !== undefined) {
  54177. return true
  54178. }
  54179. parent = parent.parent;
  54180. }
  54181. return false
  54182. }
  54183. function parseModifiers (name) {
  54184. var match = name.match(modifierRE);
  54185. if (match) {
  54186. var ret = {};
  54187. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54188. return ret
  54189. }
  54190. }
  54191. function makeAttrsMap (attrs) {
  54192. var map = {};
  54193. for (var i = 0, l = attrs.length; i < l; i++) {
  54194. if (
  54195. map[attrs[i].name] && !isIE && !isEdge
  54196. ) {
  54197. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54198. }
  54199. map[attrs[i].name] = attrs[i].value;
  54200. }
  54201. return map
  54202. }
  54203. // for script (e.g. type="x/template") or style, do not decode content
  54204. function isTextTag (el) {
  54205. return el.tag === 'script' || el.tag === 'style'
  54206. }
  54207. function isForbiddenTag (el) {
  54208. return (
  54209. el.tag === 'style' ||
  54210. (el.tag === 'script' && (
  54211. !el.attrsMap.type ||
  54212. el.attrsMap.type === 'text/javascript'
  54213. ))
  54214. )
  54215. }
  54216. var ieNSBug = /^xmlns:NS\d+/;
  54217. var ieNSPrefix = /^NS\d+:/;
  54218. /* istanbul ignore next */
  54219. function guardIESVGBug (attrs) {
  54220. var res = [];
  54221. for (var i = 0; i < attrs.length; i++) {
  54222. var attr = attrs[i];
  54223. if (!ieNSBug.test(attr.name)) {
  54224. attr.name = attr.name.replace(ieNSPrefix, '');
  54225. res.push(attr);
  54226. }
  54227. }
  54228. return res
  54229. }
  54230. function checkForAliasModel (el, value) {
  54231. var _el = el;
  54232. while (_el) {
  54233. if (_el.for && _el.alias === value) {
  54234. warn$2(
  54235. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54236. "You are binding v-model directly to a v-for iteration alias. " +
  54237. "This will not be able to modify the v-for source array because " +
  54238. "writing to the alias is like modifying a function local variable. " +
  54239. "Consider using an array of objects and use v-model on an object property instead.",
  54240. el.rawAttrsMap['v-model']
  54241. );
  54242. }
  54243. _el = _el.parent;
  54244. }
  54245. }
  54246. /* */
  54247. function preTransformNode (el, options) {
  54248. if (el.tag === 'input') {
  54249. var map = el.attrsMap;
  54250. if (!map['v-model']) {
  54251. return
  54252. }
  54253. var typeBinding;
  54254. if (map[':type'] || map['v-bind:type']) {
  54255. typeBinding = getBindingAttr(el, 'type');
  54256. }
  54257. if (!map.type && !typeBinding && map['v-bind']) {
  54258. typeBinding = "(" + (map['v-bind']) + ").type";
  54259. }
  54260. if (typeBinding) {
  54261. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54262. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54263. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54264. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54265. // 1. checkbox
  54266. var branch0 = cloneASTElement(el);
  54267. // process for on the main node
  54268. processFor(branch0);
  54269. addRawAttr(branch0, 'type', 'checkbox');
  54270. processElement(branch0, options);
  54271. branch0.processed = true; // prevent it from double-processed
  54272. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54273. addIfCondition(branch0, {
  54274. exp: branch0.if,
  54275. block: branch0
  54276. });
  54277. // 2. add radio else-if condition
  54278. var branch1 = cloneASTElement(el);
  54279. getAndRemoveAttr(branch1, 'v-for', true);
  54280. addRawAttr(branch1, 'type', 'radio');
  54281. processElement(branch1, options);
  54282. addIfCondition(branch0, {
  54283. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54284. block: branch1
  54285. });
  54286. // 3. other
  54287. var branch2 = cloneASTElement(el);
  54288. getAndRemoveAttr(branch2, 'v-for', true);
  54289. addRawAttr(branch2, ':type', typeBinding);
  54290. processElement(branch2, options);
  54291. addIfCondition(branch0, {
  54292. exp: ifCondition,
  54293. block: branch2
  54294. });
  54295. if (hasElse) {
  54296. branch0.else = true;
  54297. } else if (elseIfCondition) {
  54298. branch0.elseif = elseIfCondition;
  54299. }
  54300. return branch0
  54301. }
  54302. }
  54303. }
  54304. function cloneASTElement (el) {
  54305. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54306. }
  54307. var model$1 = {
  54308. preTransformNode: preTransformNode
  54309. };
  54310. var modules$1 = [
  54311. klass$1,
  54312. style$1,
  54313. model$1
  54314. ];
  54315. /* */
  54316. function text (el, dir) {
  54317. if (dir.value) {
  54318. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54319. }
  54320. }
  54321. /* */
  54322. function html (el, dir) {
  54323. if (dir.value) {
  54324. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54325. }
  54326. }
  54327. var directives$1 = {
  54328. model: model,
  54329. text: text,
  54330. html: html
  54331. };
  54332. /* */
  54333. var baseOptions = {
  54334. expectHTML: true,
  54335. modules: modules$1,
  54336. directives: directives$1,
  54337. isPreTag: isPreTag,
  54338. isUnaryTag: isUnaryTag,
  54339. mustUseProp: mustUseProp,
  54340. canBeLeftOpenTag: canBeLeftOpenTag,
  54341. isReservedTag: isReservedTag,
  54342. getTagNamespace: getTagNamespace,
  54343. staticKeys: genStaticKeys(modules$1)
  54344. };
  54345. /* */
  54346. var isStaticKey;
  54347. var isPlatformReservedTag;
  54348. var genStaticKeysCached = cached(genStaticKeys$1);
  54349. /**
  54350. * Goal of the optimizer: walk the generated template AST tree
  54351. * and detect sub-trees that are purely static, i.e. parts of
  54352. * the DOM that never needs to change.
  54353. *
  54354. * Once we detect these sub-trees, we can:
  54355. *
  54356. * 1. Hoist them into constants, so that we no longer need to
  54357. * create fresh nodes for them on each re-render;
  54358. * 2. Completely skip them in the patching process.
  54359. */
  54360. function optimize (root, options) {
  54361. if (!root) { return }
  54362. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54363. isPlatformReservedTag = options.isReservedTag || no;
  54364. // first pass: mark all non-static nodes.
  54365. markStatic$1(root);
  54366. // second pass: mark static roots.
  54367. markStaticRoots(root, false);
  54368. }
  54369. function genStaticKeys$1 (keys) {
  54370. return makeMap(
  54371. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54372. (keys ? ',' + keys : '')
  54373. )
  54374. }
  54375. function markStatic$1 (node) {
  54376. node.static = isStatic(node);
  54377. if (node.type === 1) {
  54378. // do not make component slot content static. this avoids
  54379. // 1. components not able to mutate slot nodes
  54380. // 2. static slot content fails for hot-reloading
  54381. if (
  54382. !isPlatformReservedTag(node.tag) &&
  54383. node.tag !== 'slot' &&
  54384. node.attrsMap['inline-template'] == null
  54385. ) {
  54386. return
  54387. }
  54388. for (var i = 0, l = node.children.length; i < l; i++) {
  54389. var child = node.children[i];
  54390. markStatic$1(child);
  54391. if (!child.static) {
  54392. node.static = false;
  54393. }
  54394. }
  54395. if (node.ifConditions) {
  54396. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54397. var block = node.ifConditions[i$1].block;
  54398. markStatic$1(block);
  54399. if (!block.static) {
  54400. node.static = false;
  54401. }
  54402. }
  54403. }
  54404. }
  54405. }
  54406. function markStaticRoots (node, isInFor) {
  54407. if (node.type === 1) {
  54408. if (node.static || node.once) {
  54409. node.staticInFor = isInFor;
  54410. }
  54411. // For a node to qualify as a static root, it should have children that
  54412. // are not just static text. Otherwise the cost of hoisting out will
  54413. // outweigh the benefits and it's better off to just always render it fresh.
  54414. if (node.static && node.children.length && !(
  54415. node.children.length === 1 &&
  54416. node.children[0].type === 3
  54417. )) {
  54418. node.staticRoot = true;
  54419. return
  54420. } else {
  54421. node.staticRoot = false;
  54422. }
  54423. if (node.children) {
  54424. for (var i = 0, l = node.children.length; i < l; i++) {
  54425. markStaticRoots(node.children[i], isInFor || !!node.for);
  54426. }
  54427. }
  54428. if (node.ifConditions) {
  54429. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54430. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54431. }
  54432. }
  54433. }
  54434. }
  54435. function isStatic (node) {
  54436. if (node.type === 2) { // expression
  54437. return false
  54438. }
  54439. if (node.type === 3) { // text
  54440. return true
  54441. }
  54442. return !!(node.pre || (
  54443. !node.hasBindings && // no dynamic bindings
  54444. !node.if && !node.for && // not v-if or v-for or v-else
  54445. !isBuiltInTag(node.tag) && // not a built-in
  54446. isPlatformReservedTag(node.tag) && // not a component
  54447. !isDirectChildOfTemplateFor(node) &&
  54448. Object.keys(node).every(isStaticKey)
  54449. ))
  54450. }
  54451. function isDirectChildOfTemplateFor (node) {
  54452. while (node.parent) {
  54453. node = node.parent;
  54454. if (node.tag !== 'template') {
  54455. return false
  54456. }
  54457. if (node.for) {
  54458. return true
  54459. }
  54460. }
  54461. return false
  54462. }
  54463. /* */
  54464. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54465. var fnInvokeRE = /\([^)]*?\);*$/;
  54466. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54467. // KeyboardEvent.keyCode aliases
  54468. var keyCodes = {
  54469. esc: 27,
  54470. tab: 9,
  54471. enter: 13,
  54472. space: 32,
  54473. up: 38,
  54474. left: 37,
  54475. right: 39,
  54476. down: 40,
  54477. 'delete': [8, 46]
  54478. };
  54479. // KeyboardEvent.key aliases
  54480. var keyNames = {
  54481. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54482. esc: ['Esc', 'Escape'],
  54483. tab: 'Tab',
  54484. enter: 'Enter',
  54485. // #9112: IE11 uses `Spacebar` for Space key name.
  54486. space: [' ', 'Spacebar'],
  54487. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54488. up: ['Up', 'ArrowUp'],
  54489. left: ['Left', 'ArrowLeft'],
  54490. right: ['Right', 'ArrowRight'],
  54491. down: ['Down', 'ArrowDown'],
  54492. // #9112: IE11 uses `Del` for Delete key name.
  54493. 'delete': ['Backspace', 'Delete', 'Del']
  54494. };
  54495. // #4868: modifiers that prevent the execution of the listener
  54496. // need to explicitly return null so that we can determine whether to remove
  54497. // the listener for .once
  54498. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54499. var modifierCode = {
  54500. stop: '$event.stopPropagation();',
  54501. prevent: '$event.preventDefault();',
  54502. self: genGuard("$event.target !== $event.currentTarget"),
  54503. ctrl: genGuard("!$event.ctrlKey"),
  54504. shift: genGuard("!$event.shiftKey"),
  54505. alt: genGuard("!$event.altKey"),
  54506. meta: genGuard("!$event.metaKey"),
  54507. left: genGuard("'button' in $event && $event.button !== 0"),
  54508. middle: genGuard("'button' in $event && $event.button !== 1"),
  54509. right: genGuard("'button' in $event && $event.button !== 2")
  54510. };
  54511. function genHandlers (
  54512. events,
  54513. isNative
  54514. ) {
  54515. var prefix = isNative ? 'nativeOn:' : 'on:';
  54516. var staticHandlers = "";
  54517. var dynamicHandlers = "";
  54518. for (var name in events) {
  54519. var handlerCode = genHandler(events[name]);
  54520. if (events[name] && events[name].dynamic) {
  54521. dynamicHandlers += name + "," + handlerCode + ",";
  54522. } else {
  54523. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54524. }
  54525. }
  54526. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54527. if (dynamicHandlers) {
  54528. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54529. } else {
  54530. return prefix + staticHandlers
  54531. }
  54532. }
  54533. function genHandler (handler) {
  54534. if (!handler) {
  54535. return 'function(){}'
  54536. }
  54537. if (Array.isArray(handler)) {
  54538. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54539. }
  54540. var isMethodPath = simplePathRE.test(handler.value);
  54541. var isFunctionExpression = fnExpRE.test(handler.value);
  54542. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54543. if (!handler.modifiers) {
  54544. if (isMethodPath || isFunctionExpression) {
  54545. return handler.value
  54546. }
  54547. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54548. } else {
  54549. var code = '';
  54550. var genModifierCode = '';
  54551. var keys = [];
  54552. for (var key in handler.modifiers) {
  54553. if (modifierCode[key]) {
  54554. genModifierCode += modifierCode[key];
  54555. // left/right
  54556. if (keyCodes[key]) {
  54557. keys.push(key);
  54558. }
  54559. } else if (key === 'exact') {
  54560. var modifiers = (handler.modifiers);
  54561. genModifierCode += genGuard(
  54562. ['ctrl', 'shift', 'alt', 'meta']
  54563. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54564. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54565. .join('||')
  54566. );
  54567. } else {
  54568. keys.push(key);
  54569. }
  54570. }
  54571. if (keys.length) {
  54572. code += genKeyFilter(keys);
  54573. }
  54574. // Make sure modifiers like prevent and stop get executed after key filtering
  54575. if (genModifierCode) {
  54576. code += genModifierCode;
  54577. }
  54578. var handlerCode = isMethodPath
  54579. ? ("return " + (handler.value) + "($event)")
  54580. : isFunctionExpression
  54581. ? ("return (" + (handler.value) + ")($event)")
  54582. : isFunctionInvocation
  54583. ? ("return " + (handler.value))
  54584. : handler.value;
  54585. return ("function($event){" + code + handlerCode + "}")
  54586. }
  54587. }
  54588. function genKeyFilter (keys) {
  54589. return (
  54590. // make sure the key filters only apply to KeyboardEvents
  54591. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54592. // key events that do not have keyCode property...
  54593. "if(!$event.type.indexOf('key')&&" +
  54594. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54595. )
  54596. }
  54597. function genFilterCode (key) {
  54598. var keyVal = parseInt(key, 10);
  54599. if (keyVal) {
  54600. return ("$event.keyCode!==" + keyVal)
  54601. }
  54602. var keyCode = keyCodes[key];
  54603. var keyName = keyNames[key];
  54604. return (
  54605. "_k($event.keyCode," +
  54606. (JSON.stringify(key)) + "," +
  54607. (JSON.stringify(keyCode)) + "," +
  54608. "$event.key," +
  54609. "" + (JSON.stringify(keyName)) +
  54610. ")"
  54611. )
  54612. }
  54613. /* */
  54614. function on (el, dir) {
  54615. if (dir.modifiers) {
  54616. warn("v-on without argument does not support modifiers.");
  54617. }
  54618. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54619. }
  54620. /* */
  54621. function bind$1 (el, dir) {
  54622. el.wrapData = function (code) {
  54623. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54624. };
  54625. }
  54626. /* */
  54627. var baseDirectives = {
  54628. on: on,
  54629. bind: bind$1,
  54630. cloak: noop
  54631. };
  54632. /* */
  54633. var CodegenState = function CodegenState (options) {
  54634. this.options = options;
  54635. this.warn = options.warn || baseWarn;
  54636. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54637. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54638. this.directives = extend(extend({}, baseDirectives), options.directives);
  54639. var isReservedTag = options.isReservedTag || no;
  54640. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54641. this.onceId = 0;
  54642. this.staticRenderFns = [];
  54643. this.pre = false;
  54644. };
  54645. function generate (
  54646. ast,
  54647. options
  54648. ) {
  54649. var state = new CodegenState(options);
  54650. var code = ast ? genElement(ast, state) : '_c("div")';
  54651. return {
  54652. render: ("with(this){return " + code + "}"),
  54653. staticRenderFns: state.staticRenderFns
  54654. }
  54655. }
  54656. function genElement (el, state) {
  54657. if (el.parent) {
  54658. el.pre = el.pre || el.parent.pre;
  54659. }
  54660. if (el.staticRoot && !el.staticProcessed) {
  54661. return genStatic(el, state)
  54662. } else if (el.once && !el.onceProcessed) {
  54663. return genOnce(el, state)
  54664. } else if (el.for && !el.forProcessed) {
  54665. return genFor(el, state)
  54666. } else if (el.if && !el.ifProcessed) {
  54667. return genIf(el, state)
  54668. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54669. return genChildren(el, state) || 'void 0'
  54670. } else if (el.tag === 'slot') {
  54671. return genSlot(el, state)
  54672. } else {
  54673. // component or element
  54674. var code;
  54675. if (el.component) {
  54676. code = genComponent(el.component, el, state);
  54677. } else {
  54678. var data;
  54679. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54680. data = genData$2(el, state);
  54681. }
  54682. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54683. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54684. }
  54685. // module transforms
  54686. for (var i = 0; i < state.transforms.length; i++) {
  54687. code = state.transforms[i](el, code);
  54688. }
  54689. return code
  54690. }
  54691. }
  54692. // hoist static sub-trees out
  54693. function genStatic (el, state) {
  54694. el.staticProcessed = true;
  54695. // Some elements (templates) need to behave differently inside of a v-pre
  54696. // node. All pre nodes are static roots, so we can use this as a location to
  54697. // wrap a state change and reset it upon exiting the pre node.
  54698. var originalPreState = state.pre;
  54699. if (el.pre) {
  54700. state.pre = el.pre;
  54701. }
  54702. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54703. state.pre = originalPreState;
  54704. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54705. }
  54706. // v-once
  54707. function genOnce (el, state) {
  54708. el.onceProcessed = true;
  54709. if (el.if && !el.ifProcessed) {
  54710. return genIf(el, state)
  54711. } else if (el.staticInFor) {
  54712. var key = '';
  54713. var parent = el.parent;
  54714. while (parent) {
  54715. if (parent.for) {
  54716. key = parent.key;
  54717. break
  54718. }
  54719. parent = parent.parent;
  54720. }
  54721. if (!key) {
  54722. state.warn(
  54723. "v-once can only be used inside v-for that is keyed. ",
  54724. el.rawAttrsMap['v-once']
  54725. );
  54726. return genElement(el, state)
  54727. }
  54728. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54729. } else {
  54730. return genStatic(el, state)
  54731. }
  54732. }
  54733. function genIf (
  54734. el,
  54735. state,
  54736. altGen,
  54737. altEmpty
  54738. ) {
  54739. el.ifProcessed = true; // avoid recursion
  54740. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54741. }
  54742. function genIfConditions (
  54743. conditions,
  54744. state,
  54745. altGen,
  54746. altEmpty
  54747. ) {
  54748. if (!conditions.length) {
  54749. return altEmpty || '_e()'
  54750. }
  54751. var condition = conditions.shift();
  54752. if (condition.exp) {
  54753. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54754. } else {
  54755. return ("" + (genTernaryExp(condition.block)))
  54756. }
  54757. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54758. function genTernaryExp (el) {
  54759. return altGen
  54760. ? altGen(el, state)
  54761. : el.once
  54762. ? genOnce(el, state)
  54763. : genElement(el, state)
  54764. }
  54765. }
  54766. function genFor (
  54767. el,
  54768. state,
  54769. altGen,
  54770. altHelper
  54771. ) {
  54772. var exp = el.for;
  54773. var alias = el.alias;
  54774. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54775. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54776. if (state.maybeComponent(el) &&
  54777. el.tag !== 'slot' &&
  54778. el.tag !== 'template' &&
  54779. !el.key
  54780. ) {
  54781. state.warn(
  54782. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54783. "v-for should have explicit keys. " +
  54784. "See https://vuejs.org/guide/list.html#key for more info.",
  54785. el.rawAttrsMap['v-for'],
  54786. true /* tip */
  54787. );
  54788. }
  54789. el.forProcessed = true; // avoid recursion
  54790. return (altHelper || '_l') + "((" + exp + ")," +
  54791. "function(" + alias + iterator1 + iterator2 + "){" +
  54792. "return " + ((altGen || genElement)(el, state)) +
  54793. '})'
  54794. }
  54795. function genData$2 (el, state) {
  54796. var data = '{';
  54797. // directives first.
  54798. // directives may mutate the el's other properties before they are generated.
  54799. var dirs = genDirectives(el, state);
  54800. if (dirs) { data += dirs + ','; }
  54801. // key
  54802. if (el.key) {
  54803. data += "key:" + (el.key) + ",";
  54804. }
  54805. // ref
  54806. if (el.ref) {
  54807. data += "ref:" + (el.ref) + ",";
  54808. }
  54809. if (el.refInFor) {
  54810. data += "refInFor:true,";
  54811. }
  54812. // pre
  54813. if (el.pre) {
  54814. data += "pre:true,";
  54815. }
  54816. // record original tag name for components using "is" attribute
  54817. if (el.component) {
  54818. data += "tag:\"" + (el.tag) + "\",";
  54819. }
  54820. // module data generation functions
  54821. for (var i = 0; i < state.dataGenFns.length; i++) {
  54822. data += state.dataGenFns[i](el);
  54823. }
  54824. // attributes
  54825. if (el.attrs) {
  54826. data += "attrs:" + (genProps(el.attrs)) + ",";
  54827. }
  54828. // DOM props
  54829. if (el.props) {
  54830. data += "domProps:" + (genProps(el.props)) + ",";
  54831. }
  54832. // event handlers
  54833. if (el.events) {
  54834. data += (genHandlers(el.events, false)) + ",";
  54835. }
  54836. if (el.nativeEvents) {
  54837. data += (genHandlers(el.nativeEvents, true)) + ",";
  54838. }
  54839. // slot target
  54840. // only for non-scoped slots
  54841. if (el.slotTarget && !el.slotScope) {
  54842. data += "slot:" + (el.slotTarget) + ",";
  54843. }
  54844. // scoped slots
  54845. if (el.scopedSlots) {
  54846. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54847. }
  54848. // component v-model
  54849. if (el.model) {
  54850. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54851. }
  54852. // inline-template
  54853. if (el.inlineTemplate) {
  54854. var inlineTemplate = genInlineTemplate(el, state);
  54855. if (inlineTemplate) {
  54856. data += inlineTemplate + ",";
  54857. }
  54858. }
  54859. data = data.replace(/,$/, '') + '}';
  54860. // v-bind dynamic argument wrap
  54861. // v-bind with dynamic arguments must be applied using the same v-bind object
  54862. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54863. if (el.dynamicAttrs) {
  54864. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54865. }
  54866. // v-bind data wrap
  54867. if (el.wrapData) {
  54868. data = el.wrapData(data);
  54869. }
  54870. // v-on data wrap
  54871. if (el.wrapListeners) {
  54872. data = el.wrapListeners(data);
  54873. }
  54874. return data
  54875. }
  54876. function genDirectives (el, state) {
  54877. var dirs = el.directives;
  54878. if (!dirs) { return }
  54879. var res = 'directives:[';
  54880. var hasRuntime = false;
  54881. var i, l, dir, needRuntime;
  54882. for (i = 0, l = dirs.length; i < l; i++) {
  54883. dir = dirs[i];
  54884. needRuntime = true;
  54885. var gen = state.directives[dir.name];
  54886. if (gen) {
  54887. // compile-time directive that manipulates AST.
  54888. // returns true if it also needs a runtime counterpart.
  54889. needRuntime = !!gen(el, dir, state.warn);
  54890. }
  54891. if (needRuntime) {
  54892. hasRuntime = true;
  54893. 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))) : '') + "},";
  54894. }
  54895. }
  54896. if (hasRuntime) {
  54897. return res.slice(0, -1) + ']'
  54898. }
  54899. }
  54900. function genInlineTemplate (el, state) {
  54901. var ast = el.children[0];
  54902. if (el.children.length !== 1 || ast.type !== 1) {
  54903. state.warn(
  54904. 'Inline-template components must have exactly one child element.',
  54905. { start: el.start }
  54906. );
  54907. }
  54908. if (ast && ast.type === 1) {
  54909. var inlineRenderFns = generate(ast, state.options);
  54910. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54911. }
  54912. }
  54913. function genScopedSlots (
  54914. el,
  54915. slots,
  54916. state
  54917. ) {
  54918. // by default scoped slots are considered "stable", this allows child
  54919. // components with only scoped slots to skip forced updates from parent.
  54920. // but in some cases we have to bail-out of this optimization
  54921. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54922. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54923. var slot = slots[key];
  54924. return (
  54925. slot.slotTargetDynamic ||
  54926. slot.if ||
  54927. slot.for ||
  54928. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54929. )
  54930. });
  54931. // #9534: if a component with scoped slots is inside a conditional branch,
  54932. // it's possible for the same component to be reused but with different
  54933. // compiled slot content. To avoid that, we generate a unique key based on
  54934. // the generated code of all the slot contents.
  54935. var needsKey = !!el.if;
  54936. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54937. // disconnected due to the intermediate scope variable)
  54938. // #9438, #9506
  54939. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54940. // and skip force updating ones that do not actually use scope variables.
  54941. if (!needsForceUpdate) {
  54942. var parent = el.parent;
  54943. while (parent) {
  54944. if (
  54945. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54946. parent.for
  54947. ) {
  54948. needsForceUpdate = true;
  54949. break
  54950. }
  54951. if (parent.if) {
  54952. needsKey = true;
  54953. }
  54954. parent = parent.parent;
  54955. }
  54956. }
  54957. var generatedSlots = Object.keys(slots)
  54958. .map(function (key) { return genScopedSlot(slots[key], state); })
  54959. .join(',');
  54960. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54961. }
  54962. function hash(str) {
  54963. var hash = 5381;
  54964. var i = str.length;
  54965. while(i) {
  54966. hash = (hash * 33) ^ str.charCodeAt(--i);
  54967. }
  54968. return hash >>> 0
  54969. }
  54970. function containsSlotChild (el) {
  54971. if (el.type === 1) {
  54972. if (el.tag === 'slot') {
  54973. return true
  54974. }
  54975. return el.children.some(containsSlotChild)
  54976. }
  54977. return false
  54978. }
  54979. function genScopedSlot (
  54980. el,
  54981. state
  54982. ) {
  54983. var isLegacySyntax = el.attrsMap['slot-scope'];
  54984. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54985. return genIf(el, state, genScopedSlot, "null")
  54986. }
  54987. if (el.for && !el.forProcessed) {
  54988. return genFor(el, state, genScopedSlot)
  54989. }
  54990. var slotScope = el.slotScope === emptySlotScopeToken
  54991. ? ""
  54992. : String(el.slotScope);
  54993. var fn = "function(" + slotScope + "){" +
  54994. "return " + (el.tag === 'template'
  54995. ? el.if && isLegacySyntax
  54996. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54997. : genChildren(el, state) || 'undefined'
  54998. : genElement(el, state)) + "}";
  54999. // reverse proxy v-slot without scope on this.$slots
  55000. var reverseProxy = slotScope ? "" : ",proxy:true";
  55001. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  55002. }
  55003. function genChildren (
  55004. el,
  55005. state,
  55006. checkSkip,
  55007. altGenElement,
  55008. altGenNode
  55009. ) {
  55010. var children = el.children;
  55011. if (children.length) {
  55012. var el$1 = children[0];
  55013. // optimize single v-for
  55014. if (children.length === 1 &&
  55015. el$1.for &&
  55016. el$1.tag !== 'template' &&
  55017. el$1.tag !== 'slot'
  55018. ) {
  55019. var normalizationType = checkSkip
  55020. ? state.maybeComponent(el$1) ? ",1" : ",0"
  55021. : "";
  55022. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  55023. }
  55024. var normalizationType$1 = checkSkip
  55025. ? getNormalizationType(children, state.maybeComponent)
  55026. : 0;
  55027. var gen = altGenNode || genNode;
  55028. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  55029. }
  55030. }
  55031. // determine the normalization needed for the children array.
  55032. // 0: no normalization needed
  55033. // 1: simple normalization needed (possible 1-level deep nested array)
  55034. // 2: full normalization needed
  55035. function getNormalizationType (
  55036. children,
  55037. maybeComponent
  55038. ) {
  55039. var res = 0;
  55040. for (var i = 0; i < children.length; i++) {
  55041. var el = children[i];
  55042. if (el.type !== 1) {
  55043. continue
  55044. }
  55045. if (needsNormalization(el) ||
  55046. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  55047. res = 2;
  55048. break
  55049. }
  55050. if (maybeComponent(el) ||
  55051. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  55052. res = 1;
  55053. }
  55054. }
  55055. return res
  55056. }
  55057. function needsNormalization (el) {
  55058. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  55059. }
  55060. function genNode (node, state) {
  55061. if (node.type === 1) {
  55062. return genElement(node, state)
  55063. } else if (node.type === 3 && node.isComment) {
  55064. return genComment(node)
  55065. } else {
  55066. return genText(node)
  55067. }
  55068. }
  55069. function genText (text) {
  55070. return ("_v(" + (text.type === 2
  55071. ? text.expression // no need for () because already wrapped in _s()
  55072. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  55073. }
  55074. function genComment (comment) {
  55075. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  55076. }
  55077. function genSlot (el, state) {
  55078. var slotName = el.slotName || '"default"';
  55079. var children = genChildren(el, state);
  55080. var res = "_t(" + slotName + (children ? ("," + children) : '');
  55081. var attrs = el.attrs || el.dynamicAttrs
  55082. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  55083. // slot props are camelized
  55084. name: camelize(attr.name),
  55085. value: attr.value,
  55086. dynamic: attr.dynamic
  55087. }); }))
  55088. : null;
  55089. var bind$$1 = el.attrsMap['v-bind'];
  55090. if ((attrs || bind$$1) && !children) {
  55091. res += ",null";
  55092. }
  55093. if (attrs) {
  55094. res += "," + attrs;
  55095. }
  55096. if (bind$$1) {
  55097. res += (attrs ? '' : ',null') + "," + bind$$1;
  55098. }
  55099. return res + ')'
  55100. }
  55101. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  55102. function genComponent (
  55103. componentName,
  55104. el,
  55105. state
  55106. ) {
  55107. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  55108. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  55109. }
  55110. function genProps (props) {
  55111. var staticProps = "";
  55112. var dynamicProps = "";
  55113. for (var i = 0; i < props.length; i++) {
  55114. var prop = props[i];
  55115. var value = transformSpecialNewlines(prop.value);
  55116. if (prop.dynamic) {
  55117. dynamicProps += (prop.name) + "," + value + ",";
  55118. } else {
  55119. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55120. }
  55121. }
  55122. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55123. if (dynamicProps) {
  55124. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55125. } else {
  55126. return staticProps
  55127. }
  55128. }
  55129. // #3895, #4268
  55130. function transformSpecialNewlines (text) {
  55131. return text
  55132. .replace(/\u2028/g, '\\u2028')
  55133. .replace(/\u2029/g, '\\u2029')
  55134. }
  55135. /* */
  55136. // these keywords should not appear inside expressions, but operators like
  55137. // typeof, instanceof and in are allowed
  55138. var prohibitedKeywordRE = new RegExp('\\b' + (
  55139. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55140. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55141. 'extends,finally,continue,debugger,function,arguments'
  55142. ).split(',').join('\\b|\\b') + '\\b');
  55143. // these unary operators should not be used as property/method names
  55144. var unaryOperatorsRE = new RegExp('\\b' + (
  55145. 'delete,typeof,void'
  55146. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55147. // strip strings in expressions
  55148. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55149. // detect problematic expressions in a template
  55150. function detectErrors (ast, warn) {
  55151. if (ast) {
  55152. checkNode(ast, warn);
  55153. }
  55154. }
  55155. function checkNode (node, warn) {
  55156. if (node.type === 1) {
  55157. for (var name in node.attrsMap) {
  55158. if (dirRE.test(name)) {
  55159. var value = node.attrsMap[name];
  55160. if (value) {
  55161. var range = node.rawAttrsMap[name];
  55162. if (name === 'v-for') {
  55163. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55164. } else if (name === 'v-slot' || name[0] === '#') {
  55165. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55166. } else if (onRE.test(name)) {
  55167. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55168. } else {
  55169. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55170. }
  55171. }
  55172. }
  55173. }
  55174. if (node.children) {
  55175. for (var i = 0; i < node.children.length; i++) {
  55176. checkNode(node.children[i], warn);
  55177. }
  55178. }
  55179. } else if (node.type === 2) {
  55180. checkExpression(node.expression, node.text, warn, node);
  55181. }
  55182. }
  55183. function checkEvent (exp, text, warn, range) {
  55184. var stripped = exp.replace(stripStringRE, '');
  55185. var keywordMatch = stripped.match(unaryOperatorsRE);
  55186. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55187. warn(
  55188. "avoid using JavaScript unary operator as property name: " +
  55189. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55190. range
  55191. );
  55192. }
  55193. checkExpression(exp, text, warn, range);
  55194. }
  55195. function checkFor (node, text, warn, range) {
  55196. checkExpression(node.for || '', text, warn, range);
  55197. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55198. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55199. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55200. }
  55201. function checkIdentifier (
  55202. ident,
  55203. type,
  55204. text,
  55205. warn,
  55206. range
  55207. ) {
  55208. if (typeof ident === 'string') {
  55209. try {
  55210. new Function(("var " + ident + "=_"));
  55211. } catch (e) {
  55212. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55213. }
  55214. }
  55215. }
  55216. function checkExpression (exp, text, warn, range) {
  55217. try {
  55218. new Function(("return " + exp));
  55219. } catch (e) {
  55220. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55221. if (keywordMatch) {
  55222. warn(
  55223. "avoid using JavaScript keyword as property name: " +
  55224. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55225. range
  55226. );
  55227. } else {
  55228. warn(
  55229. "invalid expression: " + (e.message) + " in\n\n" +
  55230. " " + exp + "\n\n" +
  55231. " Raw expression: " + (text.trim()) + "\n",
  55232. range
  55233. );
  55234. }
  55235. }
  55236. }
  55237. function checkFunctionParameterExpression (exp, text, warn, range) {
  55238. try {
  55239. new Function(exp, '');
  55240. } catch (e) {
  55241. warn(
  55242. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55243. " " + exp + "\n\n" +
  55244. " Raw expression: " + (text.trim()) + "\n",
  55245. range
  55246. );
  55247. }
  55248. }
  55249. /* */
  55250. var range = 2;
  55251. function generateCodeFrame (
  55252. source,
  55253. start,
  55254. end
  55255. ) {
  55256. if ( start === void 0 ) start = 0;
  55257. if ( end === void 0 ) end = source.length;
  55258. var lines = source.split(/\r?\n/);
  55259. var count = 0;
  55260. var res = [];
  55261. for (var i = 0; i < lines.length; i++) {
  55262. count += lines[i].length + 1;
  55263. if (count >= start) {
  55264. for (var j = i - range; j <= i + range || end > count; j++) {
  55265. if (j < 0 || j >= lines.length) { continue }
  55266. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55267. var lineLength = lines[j].length;
  55268. if (j === i) {
  55269. // push underline
  55270. var pad = start - (count - lineLength) + 1;
  55271. var length = end > count ? lineLength - pad : end - start;
  55272. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55273. } else if (j > i) {
  55274. if (end > count) {
  55275. var length$1 = Math.min(end - count, lineLength);
  55276. res.push(" | " + repeat$1("^", length$1));
  55277. }
  55278. count += lineLength + 1;
  55279. }
  55280. }
  55281. break
  55282. }
  55283. }
  55284. return res.join('\n')
  55285. }
  55286. function repeat$1 (str, n) {
  55287. var result = '';
  55288. if (n > 0) {
  55289. while (true) { // eslint-disable-line
  55290. if (n & 1) { result += str; }
  55291. n >>>= 1;
  55292. if (n <= 0) { break }
  55293. str += str;
  55294. }
  55295. }
  55296. return result
  55297. }
  55298. /* */
  55299. function createFunction (code, errors) {
  55300. try {
  55301. return new Function(code)
  55302. } catch (err) {
  55303. errors.push({ err: err, code: code });
  55304. return noop
  55305. }
  55306. }
  55307. function createCompileToFunctionFn (compile) {
  55308. var cache = Object.create(null);
  55309. return function compileToFunctions (
  55310. template,
  55311. options,
  55312. vm
  55313. ) {
  55314. options = extend({}, options);
  55315. var warn$$1 = options.warn || warn;
  55316. delete options.warn;
  55317. /* istanbul ignore if */
  55318. {
  55319. // detect possible CSP restriction
  55320. try {
  55321. new Function('return 1');
  55322. } catch (e) {
  55323. if (e.toString().match(/unsafe-eval|CSP/)) {
  55324. warn$$1(
  55325. 'It seems you are using the standalone build of Vue.js in an ' +
  55326. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55327. 'The template compiler cannot work in this environment. Consider ' +
  55328. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55329. 'templates into render functions.'
  55330. );
  55331. }
  55332. }
  55333. }
  55334. // check cache
  55335. var key = options.delimiters
  55336. ? String(options.delimiters) + template
  55337. : template;
  55338. if (cache[key]) {
  55339. return cache[key]
  55340. }
  55341. // compile
  55342. var compiled = compile(template, options);
  55343. // check compilation errors/tips
  55344. {
  55345. if (compiled.errors && compiled.errors.length) {
  55346. if (options.outputSourceRange) {
  55347. compiled.errors.forEach(function (e) {
  55348. warn$$1(
  55349. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55350. generateCodeFrame(template, e.start, e.end),
  55351. vm
  55352. );
  55353. });
  55354. } else {
  55355. warn$$1(
  55356. "Error compiling template:\n\n" + template + "\n\n" +
  55357. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55358. vm
  55359. );
  55360. }
  55361. }
  55362. if (compiled.tips && compiled.tips.length) {
  55363. if (options.outputSourceRange) {
  55364. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55365. } else {
  55366. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55367. }
  55368. }
  55369. }
  55370. // turn code into functions
  55371. var res = {};
  55372. var fnGenErrors = [];
  55373. res.render = createFunction(compiled.render, fnGenErrors);
  55374. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55375. return createFunction(code, fnGenErrors)
  55376. });
  55377. // check function generation errors.
  55378. // this should only happen if there is a bug in the compiler itself.
  55379. // mostly for codegen development use
  55380. /* istanbul ignore if */
  55381. {
  55382. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55383. warn$$1(
  55384. "Failed to generate render function:\n\n" +
  55385. fnGenErrors.map(function (ref) {
  55386. var err = ref.err;
  55387. var code = ref.code;
  55388. return ((err.toString()) + " in\n\n" + code + "\n");
  55389. }).join('\n'),
  55390. vm
  55391. );
  55392. }
  55393. }
  55394. return (cache[key] = res)
  55395. }
  55396. }
  55397. /* */
  55398. function createCompilerCreator (baseCompile) {
  55399. return function createCompiler (baseOptions) {
  55400. function compile (
  55401. template,
  55402. options
  55403. ) {
  55404. var finalOptions = Object.create(baseOptions);
  55405. var errors = [];
  55406. var tips = [];
  55407. var warn = function (msg, range, tip) {
  55408. (tip ? tips : errors).push(msg);
  55409. };
  55410. if (options) {
  55411. if (options.outputSourceRange) {
  55412. // $flow-disable-line
  55413. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55414. warn = function (msg, range, tip) {
  55415. var data = { msg: msg };
  55416. if (range) {
  55417. if (range.start != null) {
  55418. data.start = range.start + leadingSpaceLength;
  55419. }
  55420. if (range.end != null) {
  55421. data.end = range.end + leadingSpaceLength;
  55422. }
  55423. }
  55424. (tip ? tips : errors).push(data);
  55425. };
  55426. }
  55427. // merge custom modules
  55428. if (options.modules) {
  55429. finalOptions.modules =
  55430. (baseOptions.modules || []).concat(options.modules);
  55431. }
  55432. // merge custom directives
  55433. if (options.directives) {
  55434. finalOptions.directives = extend(
  55435. Object.create(baseOptions.directives || null),
  55436. options.directives
  55437. );
  55438. }
  55439. // copy other options
  55440. for (var key in options) {
  55441. if (key !== 'modules' && key !== 'directives') {
  55442. finalOptions[key] = options[key];
  55443. }
  55444. }
  55445. }
  55446. finalOptions.warn = warn;
  55447. var compiled = baseCompile(template.trim(), finalOptions);
  55448. {
  55449. detectErrors(compiled.ast, warn);
  55450. }
  55451. compiled.errors = errors;
  55452. compiled.tips = tips;
  55453. return compiled
  55454. }
  55455. return {
  55456. compile: compile,
  55457. compileToFunctions: createCompileToFunctionFn(compile)
  55458. }
  55459. }
  55460. }
  55461. /* */
  55462. // `createCompilerCreator` allows creating compilers that use alternative
  55463. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55464. // Here we just export a default compiler using the default parts.
  55465. var createCompiler = createCompilerCreator(function baseCompile (
  55466. template,
  55467. options
  55468. ) {
  55469. var ast = parse(template.trim(), options);
  55470. if (options.optimize !== false) {
  55471. optimize(ast, options);
  55472. }
  55473. var code = generate(ast, options);
  55474. return {
  55475. ast: ast,
  55476. render: code.render,
  55477. staticRenderFns: code.staticRenderFns
  55478. }
  55479. });
  55480. /* */
  55481. var ref$1 = createCompiler(baseOptions);
  55482. var compile = ref$1.compile;
  55483. var compileToFunctions = ref$1.compileToFunctions;
  55484. /* */
  55485. // check whether current browser encodes a char inside attribute values
  55486. var div;
  55487. function getShouldDecode (href) {
  55488. div = div || document.createElement('div');
  55489. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55490. return div.innerHTML.indexOf('&#10;') > 0
  55491. }
  55492. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55493. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55494. // #6828: chrome encodes content in a[href]
  55495. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55496. /* */
  55497. var idToTemplate = cached(function (id) {
  55498. var el = query(id);
  55499. return el && el.innerHTML
  55500. });
  55501. var mount = Vue.prototype.$mount;
  55502. Vue.prototype.$mount = function (
  55503. el,
  55504. hydrating
  55505. ) {
  55506. el = el && query(el);
  55507. /* istanbul ignore if */
  55508. if (el === document.body || el === document.documentElement) {
  55509. warn(
  55510. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55511. );
  55512. return this
  55513. }
  55514. var options = this.$options;
  55515. // resolve template/el and convert to render function
  55516. if (!options.render) {
  55517. var template = options.template;
  55518. if (template) {
  55519. if (typeof template === 'string') {
  55520. if (template.charAt(0) === '#') {
  55521. template = idToTemplate(template);
  55522. /* istanbul ignore if */
  55523. if (!template) {
  55524. warn(
  55525. ("Template element not found or is empty: " + (options.template)),
  55526. this
  55527. );
  55528. }
  55529. }
  55530. } else if (template.nodeType) {
  55531. template = template.innerHTML;
  55532. } else {
  55533. {
  55534. warn('invalid template option:' + template, this);
  55535. }
  55536. return this
  55537. }
  55538. } else if (el) {
  55539. template = getOuterHTML(el);
  55540. }
  55541. if (template) {
  55542. /* istanbul ignore if */
  55543. if (config.performance && mark) {
  55544. mark('compile');
  55545. }
  55546. var ref = compileToFunctions(template, {
  55547. outputSourceRange: "development" !== 'production',
  55548. shouldDecodeNewlines: shouldDecodeNewlines,
  55549. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55550. delimiters: options.delimiters,
  55551. comments: options.comments
  55552. }, this);
  55553. var render = ref.render;
  55554. var staticRenderFns = ref.staticRenderFns;
  55555. options.render = render;
  55556. options.staticRenderFns = staticRenderFns;
  55557. /* istanbul ignore if */
  55558. if (config.performance && mark) {
  55559. mark('compile end');
  55560. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55561. }
  55562. }
  55563. }
  55564. return mount.call(this, el, hydrating)
  55565. };
  55566. /**
  55567. * Get outerHTML of elements, taking care
  55568. * of SVG elements in IE as well.
  55569. */
  55570. function getOuterHTML (el) {
  55571. if (el.outerHTML) {
  55572. return el.outerHTML
  55573. } else {
  55574. var container = document.createElement('div');
  55575. container.appendChild(el.cloneNode(true));
  55576. return container.innerHTML
  55577. }
  55578. }
  55579. Vue.compile = compileToFunctions;
  55580. module.exports = Vue;
  55581. /* 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))
  55582. /***/ }),
  55583. /***/ "./node_modules/vue/dist/vue.common.js":
  55584. /*!*********************************************!*\
  55585. !*** ./node_modules/vue/dist/vue.common.js ***!
  55586. \*********************************************/
  55587. /*! no static exports found */
  55588. /***/ (function(module, exports, __webpack_require__) {
  55589. if (false) {} else {
  55590. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55591. }
  55592. /***/ }),
  55593. /***/ "./node_modules/webpack/buildin/global.js":
  55594. /*!***********************************!*\
  55595. !*** (webpack)/buildin/global.js ***!
  55596. \***********************************/
  55597. /*! no static exports found */
  55598. /***/ (function(module, exports) {
  55599. var g;
  55600. // This works in non-strict mode
  55601. g = (function() {
  55602. return this;
  55603. })();
  55604. try {
  55605. // This works if eval is allowed (see CSP)
  55606. g = g || new Function("return this")();
  55607. } catch (e) {
  55608. // This works if the window reference is available
  55609. if (typeof window === "object") g = window;
  55610. }
  55611. // g can still be undefined, but nothing to do about it...
  55612. // We return undefined, instead of nothing here, so it's
  55613. // easier to handle this case. if(!global) { ...}
  55614. module.exports = g;
  55615. /***/ }),
  55616. /***/ "./node_modules/webpack/buildin/module.js":
  55617. /*!***********************************!*\
  55618. !*** (webpack)/buildin/module.js ***!
  55619. \***********************************/
  55620. /*! no static exports found */
  55621. /***/ (function(module, exports) {
  55622. module.exports = function(module) {
  55623. if (!module.webpackPolyfill) {
  55624. module.deprecate = function() {};
  55625. module.paths = [];
  55626. // module.parent = undefined by default
  55627. if (!module.children) module.children = [];
  55628. Object.defineProperty(module, "loaded", {
  55629. enumerable: true,
  55630. get: function() {
  55631. return module.l;
  55632. }
  55633. });
  55634. Object.defineProperty(module, "id", {
  55635. enumerable: true,
  55636. get: function() {
  55637. return module.i;
  55638. }
  55639. });
  55640. module.webpackPolyfill = 1;
  55641. }
  55642. return module;
  55643. };
  55644. /***/ }),
  55645. /***/ "./resources/js/app.js":
  55646. /*!*****************************!*\
  55647. !*** ./resources/js/app.js ***!
  55648. \*****************************/
  55649. /*! no static exports found */
  55650. /***/ (function(module, exports, __webpack_require__) {
  55651. /**
  55652. * First we will load all of this project's JavaScript dependencies which
  55653. * includes Vue and other libraries. It is a great starting point when
  55654. * building robust, powerful web applications using Vue and Laravel.
  55655. */
  55656. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55657. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55658. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55659. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55660. /**
  55661. * The following block of code may be used to automatically register your
  55662. * Vue components. It will recursively scan this directory for the Vue
  55663. * components and automatically register them with their "basename".
  55664. *
  55665. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55666. */
  55667. // const files = require.context('./', true, /\.vue$/i)
  55668. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55669. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55670. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55671. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55672. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55673. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55674. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55675. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55676. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55677. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55678. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55679. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55680. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55681. /**
  55682. * Next, we will create a fresh Vue application instance and attach it to
  55683. * the page. Then, you may begin adding components to this application
  55684. * or customize the JavaScript scaffolding to fit your unique needs.
  55685. */
  55686. var app = new Vue({
  55687. el: '#app'
  55688. });
  55689. $(function () {
  55690. $('[data-toggle="tooltip"]').tooltip();
  55691. });
  55692. var clipboard = new Clipboard('.btn-clip');
  55693. clipboard.on('success', function (e) {
  55694. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55695. position: "right",
  55696. className: 'success'
  55697. });
  55698. e.clearSelection();
  55699. });
  55700. /***/ }),
  55701. /***/ "./resources/js/bootstrap.js":
  55702. /*!***********************************!*\
  55703. !*** ./resources/js/bootstrap.js ***!
  55704. \***********************************/
  55705. /*! no exports provided */
  55706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55707. "use strict";
  55708. __webpack_require__.r(__webpack_exports__);
  55709. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55710. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55711. /**
  55712. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55713. * for JavaScript based Bootstrap features such as modals and tabs. This
  55714. * code may be modified to fit the specific needs of your application.
  55715. */
  55716. try {
  55717. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55718. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55719. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55720. } catch (e) {}
  55721. /**
  55722. * We'll load the axios HTTP library which allows us to easily issue requests
  55723. * to our Laravel back-end. This library automatically handles sending the
  55724. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55725. */
  55726. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55727. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55728. /**
  55729. * Echo exposes an expressive API for subscribing to channels and listening
  55730. * for events that are broadcast by Laravel. Echo and event broadcasting
  55731. * allows your team to easily build robust real-time web applications.
  55732. */
  55733. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55734. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55735. broadcaster: 'pusher',
  55736. key: "upccrt",
  55737. authEndpoint: '/broadcasting/auth',
  55738. wsHost: window.location.hostname,
  55739. wsPort: 6001,
  55740. disableStats: true
  55741. });
  55742. /***/ }),
  55743. /***/ "./resources/js/components/ExampleComponent.vue":
  55744. /*!******************************************************!*\
  55745. !*** ./resources/js/components/ExampleComponent.vue ***!
  55746. \******************************************************/
  55747. /*! exports provided: default */
  55748. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55749. "use strict";
  55750. __webpack_require__.r(__webpack_exports__);
  55751. /* harmony import */ var _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&");
  55752. /* 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&");
  55753. /* 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");
  55754. /* normalize component */
  55755. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55756. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55757. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55758. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55759. false,
  55760. null,
  55761. null,
  55762. null
  55763. )
  55764. /* hot reload */
  55765. if (false) { var api; }
  55766. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55767. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55768. /***/ }),
  55769. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55770. /*!*******************************************************************************!*\
  55771. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55772. \*******************************************************************************/
  55773. /*! exports provided: default */
  55774. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55775. "use strict";
  55776. __webpack_require__.r(__webpack_exports__);
  55777. /* 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&");
  55778. /* 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"]);
  55779. /***/ }),
  55780. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55781. /*!*************************************************************************************!*\
  55782. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55783. \*************************************************************************************/
  55784. /*! exports provided: render, staticRenderFns */
  55785. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55786. "use strict";
  55787. __webpack_require__.r(__webpack_exports__);
  55788. /* 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&");
  55789. /* 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"]; });
  55790. /* 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"]; });
  55791. /***/ }),
  55792. /***/ "./resources/js/components/assetinfo.vue":
  55793. /*!***********************************************!*\
  55794. !*** ./resources/js/components/assetinfo.vue ***!
  55795. \***********************************************/
  55796. /*! exports provided: default */
  55797. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55798. "use strict";
  55799. __webpack_require__.r(__webpack_exports__);
  55800. /* harmony import */ var _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&");
  55801. /* 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&");
  55802. /* 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");
  55803. /* normalize component */
  55804. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55805. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55806. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55807. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55808. false,
  55809. null,
  55810. null,
  55811. null
  55812. )
  55813. /* hot reload */
  55814. if (false) { var api; }
  55815. component.options.__file = "resources/js/components/assetinfo.vue"
  55816. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55817. /***/ }),
  55818. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55819. /*!************************************************************************!*\
  55820. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55821. \************************************************************************/
  55822. /*! exports provided: default */
  55823. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55824. "use strict";
  55825. __webpack_require__.r(__webpack_exports__);
  55826. /* 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&");
  55827. /* 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"]);
  55828. /***/ }),
  55829. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55830. /*!******************************************************************************!*\
  55831. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55832. \******************************************************************************/
  55833. /*! exports provided: render, staticRenderFns */
  55834. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55835. "use strict";
  55836. __webpack_require__.r(__webpack_exports__);
  55837. /* 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&");
  55838. /* 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"]; });
  55839. /* 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"]; });
  55840. /***/ }),
  55841. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55842. /*!******************************************************************!*\
  55843. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55844. \******************************************************************/
  55845. /*! exports provided: default */
  55846. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55847. "use strict";
  55848. __webpack_require__.r(__webpack_exports__);
  55849. /* harmony import */ var _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&");
  55850. /* 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&");
  55851. /* 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");
  55852. /* normalize component */
  55853. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55854. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55855. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55856. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55857. false,
  55858. null,
  55859. null,
  55860. null
  55861. )
  55862. /* hot reload */
  55863. if (false) { var api; }
  55864. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55865. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55866. /***/ }),
  55867. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55868. /*!*******************************************************************************************!*\
  55869. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55870. \*******************************************************************************************/
  55871. /*! exports provided: default */
  55872. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55873. "use strict";
  55874. __webpack_require__.r(__webpack_exports__);
  55875. /* 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&");
  55876. /* 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"]);
  55877. /***/ }),
  55878. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55879. /*!*************************************************************************************************!*\
  55880. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55881. \*************************************************************************************************/
  55882. /*! exports provided: render, staticRenderFns */
  55883. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55884. "use strict";
  55885. __webpack_require__.r(__webpack_exports__);
  55886. /* 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&");
  55887. /* 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"]; });
  55888. /* 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"]; });
  55889. /***/ }),
  55890. /***/ "./resources/js/components/credential-form-modal.vue":
  55891. /*!***********************************************************!*\
  55892. !*** ./resources/js/components/credential-form-modal.vue ***!
  55893. \***********************************************************/
  55894. /*! exports provided: default */
  55895. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55896. "use strict";
  55897. __webpack_require__.r(__webpack_exports__);
  55898. /* harmony import */ var _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&");
  55899. /* 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&");
  55900. /* 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");
  55901. /* normalize component */
  55902. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55903. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55904. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55905. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55906. false,
  55907. null,
  55908. null,
  55909. null
  55910. )
  55911. /* hot reload */
  55912. if (false) { var api; }
  55913. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55914. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55915. /***/ }),
  55916. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55917. /*!************************************************************************************!*\
  55918. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55919. \************************************************************************************/
  55920. /*! exports provided: default */
  55921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55922. "use strict";
  55923. __webpack_require__.r(__webpack_exports__);
  55924. /* 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&");
  55925. /* 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"]);
  55926. /***/ }),
  55927. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55928. /*!******************************************************************************************!*\
  55929. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55930. \******************************************************************************************/
  55931. /*! exports provided: render, staticRenderFns */
  55932. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55933. "use strict";
  55934. __webpack_require__.r(__webpack_exports__);
  55935. /* 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&");
  55936. /* 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"]; });
  55937. /* 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"]; });
  55938. /***/ }),
  55939. /***/ "./resources/js/components/credential-list.vue":
  55940. /*!*****************************************************!*\
  55941. !*** ./resources/js/components/credential-list.vue ***!
  55942. \*****************************************************/
  55943. /*! exports provided: default */
  55944. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55945. "use strict";
  55946. __webpack_require__.r(__webpack_exports__);
  55947. /* harmony import */ var _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&");
  55948. /* 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&");
  55949. /* 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");
  55950. /* normalize component */
  55951. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55952. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55953. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55954. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55955. false,
  55956. null,
  55957. null,
  55958. null
  55959. )
  55960. /* hot reload */
  55961. if (false) { var api; }
  55962. component.options.__file = "resources/js/components/credential-list.vue"
  55963. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55964. /***/ }),
  55965. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55966. /*!******************************************************************************!*\
  55967. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55968. \******************************************************************************/
  55969. /*! exports provided: default */
  55970. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55971. "use strict";
  55972. __webpack_require__.r(__webpack_exports__);
  55973. /* 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&");
  55974. /* 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"]);
  55975. /***/ }),
  55976. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55977. /*!************************************************************************************!*\
  55978. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55979. \************************************************************************************/
  55980. /*! exports provided: render, staticRenderFns */
  55981. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55982. "use strict";
  55983. __webpack_require__.r(__webpack_exports__);
  55984. /* 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&");
  55985. /* 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"]; });
  55986. /* 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"]; });
  55987. /***/ }),
  55988. /***/ "./resources/js/components/credential.vue":
  55989. /*!************************************************!*\
  55990. !*** ./resources/js/components/credential.vue ***!
  55991. \************************************************/
  55992. /*! exports provided: default */
  55993. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55994. "use strict";
  55995. __webpack_require__.r(__webpack_exports__);
  55996. /* harmony import */ var _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&");
  55997. /* 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&");
  55998. /* 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");
  55999. /* normalize component */
  56000. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56001. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56002. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  56003. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56004. false,
  56005. null,
  56006. null,
  56007. null
  56008. )
  56009. /* hot reload */
  56010. if (false) { var api; }
  56011. component.options.__file = "resources/js/components/credential.vue"
  56012. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56013. /***/ }),
  56014. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  56015. /*!*************************************************************************!*\
  56016. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  56017. \*************************************************************************/
  56018. /*! exports provided: default */
  56019. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56020. "use strict";
  56021. __webpack_require__.r(__webpack_exports__);
  56022. /* 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&");
  56023. /* 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"]);
  56024. /***/ }),
  56025. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  56026. /*!*******************************************************************************!*\
  56027. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  56028. \*******************************************************************************/
  56029. /*! exports provided: render, staticRenderFns */
  56030. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56031. "use strict";
  56032. __webpack_require__.r(__webpack_exports__);
  56033. /* 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&");
  56034. /* 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"]; });
  56035. /* 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"]; });
  56036. /***/ }),
  56037. /***/ "./resources/js/components/errorlist.vue":
  56038. /*!***********************************************!*\
  56039. !*** ./resources/js/components/errorlist.vue ***!
  56040. \***********************************************/
  56041. /*! exports provided: default */
  56042. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56043. "use strict";
  56044. __webpack_require__.r(__webpack_exports__);
  56045. /* harmony import */ var _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&");
  56046. /* 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&");
  56047. /* 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");
  56048. /* normalize component */
  56049. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56050. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56051. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  56052. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56053. false,
  56054. null,
  56055. null,
  56056. null
  56057. )
  56058. /* hot reload */
  56059. if (false) { var api; }
  56060. component.options.__file = "resources/js/components/errorlist.vue"
  56061. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56062. /***/ }),
  56063. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  56064. /*!************************************************************************!*\
  56065. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  56066. \************************************************************************/
  56067. /*! exports provided: default */
  56068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56069. "use strict";
  56070. __webpack_require__.r(__webpack_exports__);
  56071. /* 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&");
  56072. /* 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"]);
  56073. /***/ }),
  56074. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  56075. /*!******************************************************************************!*\
  56076. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  56077. \******************************************************************************/
  56078. /*! exports provided: render, staticRenderFns */
  56079. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56080. "use strict";
  56081. __webpack_require__.r(__webpack_exports__);
  56082. /* 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&");
  56083. /* 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"]; });
  56084. /* 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"]; });
  56085. /***/ }),
  56086. /***/ "./resources/js/components/modal.vue":
  56087. /*!*******************************************!*\
  56088. !*** ./resources/js/components/modal.vue ***!
  56089. \*******************************************/
  56090. /*! exports provided: default */
  56091. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56092. "use strict";
  56093. __webpack_require__.r(__webpack_exports__);
  56094. /* 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&");
  56095. /* 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");
  56096. var script = {}
  56097. /* normalize component */
  56098. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  56099. script,
  56100. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  56101. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56102. false,
  56103. null,
  56104. null,
  56105. null
  56106. )
  56107. /* hot reload */
  56108. if (false) { var api; }
  56109. component.options.__file = "resources/js/components/modal.vue"
  56110. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56111. /***/ }),
  56112. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56113. /*!**************************************************************************!*\
  56114. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56115. \**************************************************************************/
  56116. /*! exports provided: render, staticRenderFns */
  56117. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56118. "use strict";
  56119. __webpack_require__.r(__webpack_exports__);
  56120. /* 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&");
  56121. /* 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"]; });
  56122. /* 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"]; });
  56123. /***/ }),
  56124. /***/ "./resources/js/components/note-form-modal.vue":
  56125. /*!*****************************************************!*\
  56126. !*** ./resources/js/components/note-form-modal.vue ***!
  56127. \*****************************************************/
  56128. /*! exports provided: default */
  56129. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56130. "use strict";
  56131. __webpack_require__.r(__webpack_exports__);
  56132. /* harmony import */ var _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&");
  56133. /* 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&");
  56134. /* 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");
  56135. /* normalize component */
  56136. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56137. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56138. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56139. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56140. false,
  56141. null,
  56142. null,
  56143. null
  56144. )
  56145. /* hot reload */
  56146. if (false) { var api; }
  56147. component.options.__file = "resources/js/components/note-form-modal.vue"
  56148. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56149. /***/ }),
  56150. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56151. /*!******************************************************************************!*\
  56152. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56153. \******************************************************************************/
  56154. /*! exports provided: default */
  56155. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56156. "use strict";
  56157. __webpack_require__.r(__webpack_exports__);
  56158. /* 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&");
  56159. /* 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"]);
  56160. /***/ }),
  56161. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56162. /*!************************************************************************************!*\
  56163. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56164. \************************************************************************************/
  56165. /*! exports provided: render, staticRenderFns */
  56166. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56167. "use strict";
  56168. __webpack_require__.r(__webpack_exports__);
  56169. /* 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&");
  56170. /* 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"]; });
  56171. /* 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"]; });
  56172. /***/ }),
  56173. /***/ "./resources/js/components/notes.vue":
  56174. /*!*******************************************!*\
  56175. !*** ./resources/js/components/notes.vue ***!
  56176. \*******************************************/
  56177. /*! exports provided: default */
  56178. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56179. "use strict";
  56180. __webpack_require__.r(__webpack_exports__);
  56181. /* harmony import */ var _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&");
  56182. /* 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&");
  56183. /* 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");
  56184. /* normalize component */
  56185. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56186. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56187. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56188. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56189. false,
  56190. null,
  56191. null,
  56192. null
  56193. )
  56194. /* hot reload */
  56195. if (false) { var api; }
  56196. component.options.__file = "resources/js/components/notes.vue"
  56197. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56198. /***/ }),
  56199. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56200. /*!********************************************************************!*\
  56201. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56202. \********************************************************************/
  56203. /*! exports provided: default */
  56204. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56205. "use strict";
  56206. __webpack_require__.r(__webpack_exports__);
  56207. /* 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&");
  56208. /* 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"]);
  56209. /***/ }),
  56210. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56211. /*!**************************************************************************!*\
  56212. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56213. \**************************************************************************/
  56214. /*! exports provided: render, staticRenderFns */
  56215. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56216. "use strict";
  56217. __webpack_require__.r(__webpack_exports__);
  56218. /* 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&");
  56219. /* 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"]; });
  56220. /* 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"]; });
  56221. /***/ }),
  56222. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56223. /*!*******************************************************!*\
  56224. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56225. \*******************************************************/
  56226. /*! exports provided: default */
  56227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56228. "use strict";
  56229. __webpack_require__.r(__webpack_exports__);
  56230. /* harmony import */ var _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&");
  56231. /* 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&");
  56232. /* 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");
  56233. /* normalize component */
  56234. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56235. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56236. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56237. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56238. false,
  56239. null,
  56240. null,
  56241. null
  56242. )
  56243. /* hot reload */
  56244. if (false) { var api; }
  56245. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56246. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56247. /***/ }),
  56248. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56249. /*!********************************************************************************!*\
  56250. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56251. \********************************************************************************/
  56252. /*! exports provided: default */
  56253. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56254. "use strict";
  56255. __webpack_require__.r(__webpack_exports__);
  56256. /* 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&");
  56257. /* 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"]);
  56258. /***/ }),
  56259. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56260. /*!**************************************************************************************!*\
  56261. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56262. \**************************************************************************************/
  56263. /*! exports provided: render, staticRenderFns */
  56264. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56265. "use strict";
  56266. __webpack_require__.r(__webpack_exports__);
  56267. /* 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&");
  56268. /* 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"]; });
  56269. /* 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"]; });
  56270. /***/ }),
  56271. /***/ "./resources/js/components/woinfo.vue":
  56272. /*!********************************************!*\
  56273. !*** ./resources/js/components/woinfo.vue ***!
  56274. \********************************************/
  56275. /*! exports provided: default */
  56276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56277. "use strict";
  56278. __webpack_require__.r(__webpack_exports__);
  56279. /* harmony import */ var _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&");
  56280. /* 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&");
  56281. /* 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");
  56282. /* normalize component */
  56283. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56284. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56285. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56286. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56287. false,
  56288. null,
  56289. null,
  56290. null
  56291. )
  56292. /* hot reload */
  56293. if (false) { var api; }
  56294. component.options.__file = "resources/js/components/woinfo.vue"
  56295. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56296. /***/ }),
  56297. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56298. /*!*********************************************************************!*\
  56299. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56300. \*********************************************************************/
  56301. /*! exports provided: default */
  56302. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56303. "use strict";
  56304. __webpack_require__.r(__webpack_exports__);
  56305. /* 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&");
  56306. /* 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"]);
  56307. /***/ }),
  56308. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56309. /*!***************************************************************************!*\
  56310. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56311. \***************************************************************************/
  56312. /*! exports provided: render, staticRenderFns */
  56313. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56314. "use strict";
  56315. __webpack_require__.r(__webpack_exports__);
  56316. /* 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&");
  56317. /* 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"]; });
  56318. /* 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"]; });
  56319. /***/ }),
  56320. /***/ "./resources/js/mixins/dateMixin.js":
  56321. /*!******************************************!*\
  56322. !*** ./resources/js/mixins/dateMixin.js ***!
  56323. \******************************************/
  56324. /*! exports provided: default */
  56325. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56326. "use strict";
  56327. __webpack_require__.r(__webpack_exports__);
  56328. /* harmony default export */ __webpack_exports__["default"] = ({
  56329. methods: {
  56330. treatAsUTC: function treatAsUTC(date) {
  56331. var result = new Date(date);
  56332. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56333. return result;
  56334. },
  56335. daysSinceToday: function daysSinceToday(date) {
  56336. var currentDate = new Date();
  56337. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56338. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56339. },
  56340. getHRDate: function getHRDate(dateString) {
  56341. var date = new Date(dateString);
  56342. return date.toLocaleString('default', {
  56343. month: 'short',
  56344. day: 'numeric',
  56345. year: 'numeric',
  56346. hour: 'numeric',
  56347. minute: 'numeric'
  56348. });
  56349. },
  56350. isZero: function isZero(dateString) {
  56351. return dateString === '0000-00-00 00:00:00';
  56352. }
  56353. }
  56354. });
  56355. /***/ }),
  56356. /***/ "./resources/js/notify.min.js":
  56357. /*!************************************!*\
  56358. !*** ./resources/js/notify.min.js ***!
  56359. \************************************/
  56360. /*! no static exports found */
  56361. /***/ (function(module, exports, __webpack_require__) {
  56362. 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); }
  56363. (function (e) {
  56364. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56365. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56366. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56367. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56368. })(function (e) {
  56369. function A(t, n, i) {
  56370. typeof i == "string" && (i = {
  56371. className: i
  56372. }), 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);
  56373. }
  56374. var t = [].indexOf || function (e) {
  56375. for (var t = 0, n = this.length; t < n; t++) {
  56376. if (t in this && this[t] === e) return t;
  56377. }
  56378. return -1;
  56379. },
  56380. n = "notify",
  56381. r = n + "js",
  56382. i = n + "!blank",
  56383. s = {
  56384. t: "top",
  56385. m: "middle",
  56386. b: "bottom",
  56387. l: "left",
  56388. c: "center",
  56389. r: "right"
  56390. },
  56391. o = ["l", "c", "r"],
  56392. u = ["t", "m", "b"],
  56393. a = ["t", "b", "l", "r"],
  56394. f = {
  56395. t: "b",
  56396. m: null,
  56397. b: "t",
  56398. l: "r",
  56399. c: null,
  56400. r: "l"
  56401. },
  56402. l = function l(t) {
  56403. var n;
  56404. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56405. var r;
  56406. r = t.toLowerCase().charAt(0);
  56407. if (s[r]) return n.push(r);
  56408. }), n;
  56409. },
  56410. c = {},
  56411. h = {
  56412. name: "core",
  56413. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56414. 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}"
  56415. },
  56416. p = {
  56417. "border-radius": ["-webkit-", "-moz-"]
  56418. },
  56419. d = function d(e) {
  56420. return c[e];
  56421. },
  56422. v = function v(e) {
  56423. if (!e) throw "Missing Style name";
  56424. c[e] && delete c[e];
  56425. },
  56426. m = function m(t, i) {
  56427. if (!t) throw "Missing Style name";
  56428. if (!i) throw "Missing Style definition";
  56429. if (!i.html) throw "Missing Style HTML";
  56430. var s = c[t];
  56431. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56432. var o = "";
  56433. i.classes && e.each(i.classes, function (t, n) {
  56434. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56435. return p[t] && e.each(p[t], function (e, r) {
  56436. return o += " " + r + t + ": " + n + ";\n";
  56437. }), o += " " + t + ": " + n + ";\n";
  56438. }), o += "}\n";
  56439. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56440. var u = {},
  56441. a = e(i.html);
  56442. y("html", a, u), y("text", a, u), i.fields = u;
  56443. },
  56444. g = function g(t) {
  56445. var n, r, i;
  56446. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56447. try {
  56448. r.html(t);
  56449. } catch (s) {
  56450. r[0].styleSheet.cssText = t;
  56451. }
  56452. return r;
  56453. },
  56454. y = function y(t, n, r) {
  56455. var s;
  56456. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56457. var n;
  56458. n = e(this).attr(s), n || (n = i), r[n] = t;
  56459. });
  56460. },
  56461. b = function b(e, t) {
  56462. return e.is(t) ? e : e.find(t);
  56463. },
  56464. w = {
  56465. clickToHide: !0,
  56466. autoHide: !0,
  56467. autoHideDelay: 5e3,
  56468. arrowShow: !0,
  56469. arrowSize: 5,
  56470. breakNewLines: !0,
  56471. elementPosition: "bottom",
  56472. globalPosition: "top right",
  56473. style: "bootstrap",
  56474. className: "error",
  56475. showAnimation: "slideDown",
  56476. showDuration: 400,
  56477. hideAnimation: "slideUp",
  56478. hideDuration: 200,
  56479. gap: 5
  56480. },
  56481. E = function E(t, n) {
  56482. var r;
  56483. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56484. },
  56485. S = function S(t) {
  56486. return e.extend(w, t);
  56487. },
  56488. x = function x(t) {
  56489. return e("<" + t + "></" + t + ">");
  56490. },
  56491. T = {},
  56492. N = function N(t) {
  56493. var n;
  56494. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56495. return e(r).attr("name") === t.attr("name");
  56496. }), t = n.first()), t;
  56497. },
  56498. C = function C(e, t, n) {
  56499. var r, i;
  56500. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56501. if (isNaN(n)) return;
  56502. 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;
  56503. },
  56504. k = function k(e, t, n) {
  56505. if (e === "l" || e === "t") return 0;
  56506. if (e === "c" || e === "m") return n / 2 - t / 2;
  56507. if (e === "r" || e === "b") return n - t;
  56508. throw "Invalid alignment";
  56509. },
  56510. L = function L(e) {
  56511. return L.e = L.e || x("div"), L.e.text(e).html();
  56512. };
  56513. A.prototype.loadHTML = function () {
  56514. var t;
  56515. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56516. }, A.prototype.show = function (e, t) {
  56517. var n, r, i, s, o;
  56518. r = function (n) {
  56519. return function () {
  56520. !e && !n.elem && n.destroy();
  56521. if (t) return t();
  56522. };
  56523. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56524. 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 {
  56525. if (!!o || !!e) return r();
  56526. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56527. }
  56528. return n.push(r), i[s].apply(i, n);
  56529. }, A.prototype.setGlobalPosition = function () {
  56530. var t = this.getPosition(),
  56531. n = t[0],
  56532. i = t[1],
  56533. o = s[n],
  56534. u = s[i],
  56535. a = n + "|" + i,
  56536. f = T[a];
  56537. if (!f || !document.body.contains(f[0])) {
  56538. f = T[a] = x("div");
  56539. var l = {};
  56540. 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);
  56541. }
  56542. return f.prepend(this.wrapper);
  56543. }, A.prototype.setElementPosition = function () {
  56544. 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;
  56545. 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"];
  56546. for (w = 0, S = B.length; w < S; w++) {
  56547. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56548. }
  56549. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56550. if (!this.options.arrowShow) this.arrow.hide();else {
  56551. 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";
  56552. for (E = 0, x = a.length; E < x; E++) {
  56553. D = a[E], P = s[D];
  56554. if (D === L) continue;
  56555. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56556. }
  56557. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56558. }
  56559. 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);
  56560. if (r) return this.arrow.removeAttr("style").css(r);
  56561. }, A.prototype.getPosition = function () {
  56562. var e, n, r, i, s, f, c, h;
  56563. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56564. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56565. 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";
  56566. return e.length === 2 && (e[2] = e[1]), e;
  56567. }, A.prototype.getStyle = function (e) {
  56568. var t;
  56569. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56570. if (!t) throw "Missing style: " + e;
  56571. return t;
  56572. }, A.prototype.updateClasses = function () {
  56573. var t, n;
  56574. 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) {
  56575. return r + "-" + n.name + "-" + e;
  56576. }).join(" "), this.userContainer.attr("class", t);
  56577. }, A.prototype.run = function (t, n) {
  56578. var r, s, o, u, a;
  56579. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56580. if (this.container && !t) {
  56581. this.show(!1);
  56582. return;
  56583. }
  56584. if (!this.container && !t) return;
  56585. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56586. for (o in s) {
  56587. r = s[o], u = this.userFields[o];
  56588. if (!u) continue;
  56589. 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);
  56590. }
  56591. 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));
  56592. }, A.prototype.destroy = function () {
  56593. this.wrapper.data(r, null), this.wrapper.remove();
  56594. }, e[n] = function (t, r, i) {
  56595. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56596. }, e.fn[n] = function (t, n) {
  56597. return e(this).each(function () {
  56598. var i = N(e(this)).data(r);
  56599. i && i.destroy();
  56600. var s = new A(e(this), t, n);
  56601. }), this;
  56602. }, e.extend(e[n], {
  56603. defaults: S,
  56604. addStyle: m,
  56605. removeStyle: v,
  56606. pluginOptions: w,
  56607. getStyle: d,
  56608. insertCSS: g
  56609. }), m("bootstrap", {
  56610. html: "<div>\n<span data-notify-text></span>\n</div>",
  56611. classes: {
  56612. base: {
  56613. "font-weight": "bold",
  56614. padding: "8px 15px 8px 14px",
  56615. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56616. "background-color": "#fcf8e3",
  56617. border: "1px solid #fbeed5",
  56618. "border-radius": "4px",
  56619. "white-space": "nowrap",
  56620. "padding-left": "25px",
  56621. "background-repeat": "no-repeat",
  56622. "background-position": "3px 7px"
  56623. },
  56624. error: {
  56625. color: "#B94A48",
  56626. "background-color": "#F2DEDE",
  56627. "border-color": "#EED3D7",
  56628. "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=)"
  56629. },
  56630. success: {
  56631. color: "#468847",
  56632. "background-color": "#DFF0D8",
  56633. "border-color": "#D6E9C6",
  56634. "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==)"
  56635. },
  56636. info: {
  56637. color: "#3A87AD",
  56638. "background-color": "#D9EDF7",
  56639. "border-color": "#BCE8F1",
  56640. "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=)"
  56641. },
  56642. warn: {
  56643. color: "#C09853",
  56644. "background-color": "#FCF8E3",
  56645. "border-color": "#FBEED5",
  56646. "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)"
  56647. }
  56648. }
  56649. }), e(function () {
  56650. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56651. e(this).trigger("notify-hide");
  56652. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56653. var n = e(this).data(r);
  56654. n && n.show(!1);
  56655. });
  56656. });
  56657. });
  56658. /***/ }),
  56659. /***/ "./resources/sass/app.scss":
  56660. /*!*********************************!*\
  56661. !*** ./resources/sass/app.scss ***!
  56662. \*********************************/
  56663. /*! no static exports found */
  56664. /***/ (function(module, exports) {
  56665. // removed by extract-text-webpack-plugin
  56666. /***/ }),
  56667. /***/ 0:
  56668. /*!*************************************************************!*\
  56669. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56670. \*************************************************************/
  56671. /*! no static exports found */
  56672. /***/ (function(module, exports, __webpack_require__) {
  56673. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56674. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56675. /***/ })
  56676. /******/ });