app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769
  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.pcid === deletedCred['pcid'];
  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/notes.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/notes.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. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. //
  2178. /* harmony default export */ __webpack_exports__["default"] = ({
  2179. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2180. props: ['initialnotes', 'authusername'],
  2181. data: function data() {
  2182. return {
  2183. notes: this.initialnotes
  2184. };
  2185. }
  2186. });
  2187. /***/ }),
  2188. /***/ "./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&":
  2189. /*!****************************************************************************************************************************************************************************!*\
  2190. !*** ./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& ***!
  2191. \****************************************************************************************************************************************************************************/
  2192. /*! exports provided: default */
  2193. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2194. "use strict";
  2195. __webpack_require__.r(__webpack_exports__);
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2230. props: ['populateWith', 'storeList', 'modalId'],
  2231. data: function data() {
  2232. return {
  2233. // Copies object from prop, so it doesn't mutate the object
  2234. // from the parent component. Parent component will be updated via
  2235. // Websocket if updateWorkOrder is successful.
  2236. data: JSON.parse(JSON.stringify(this.populateWith)),
  2237. id: this.modalId,
  2238. store: {},
  2239. errors: []
  2240. };
  2241. },
  2242. mounted: function mounted() {
  2243. this.store = {
  2244. 'id': this.data.storeid,
  2245. 'name': this.storeList[this.data.storeid]
  2246. };
  2247. },
  2248. methods: {
  2249. updateWorkOrder: function updateWorkOrder() {
  2250. var _this = this;
  2251. this.data.storeid = this.store.id;
  2252. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2253. $('#workordereditModal').modal('hide');
  2254. })["catch"](function (error) {
  2255. _this.errors = JSON.parse(error.response.request.response).errors;
  2256. });
  2257. }
  2258. }
  2259. });
  2260. /***/ }),
  2261. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2262. /*!*****************************************************************************************************************************************************************!*\
  2263. !*** ./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& ***!
  2264. \*****************************************************************************************************************************************************************/
  2265. /*! exports provided: default */
  2266. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2267. "use strict";
  2268. __webpack_require__.r(__webpack_exports__);
  2269. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. //
  2287. //
  2288. //
  2289. //
  2290. /* harmony default export */ __webpack_exports__["default"] = ({
  2291. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2292. props: ['workOrder', 'stores'],
  2293. data: function data() {
  2294. return {
  2295. data: JSON.parse(this.workOrder)
  2296. };
  2297. },
  2298. computed: {
  2299. storeList: function storeList() {
  2300. var list = {};
  2301. JSON.parse(this.stores).map(function (val) {
  2302. list[val.storeid] = val.storesname;
  2303. });
  2304. return list;
  2305. }
  2306. },
  2307. mounted: function mounted() {
  2308. var _this = this;
  2309. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2310. _this.data = e.data;
  2311. });
  2312. }
  2313. });
  2314. /***/ }),
  2315. /***/ "./node_modules/base64-js/index.js":
  2316. /*!*****************************************!*\
  2317. !*** ./node_modules/base64-js/index.js ***!
  2318. \*****************************************/
  2319. /*! no static exports found */
  2320. /***/ (function(module, exports, __webpack_require__) {
  2321. "use strict";
  2322. exports.byteLength = byteLength
  2323. exports.toByteArray = toByteArray
  2324. exports.fromByteArray = fromByteArray
  2325. var lookup = []
  2326. var revLookup = []
  2327. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2328. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2329. for (var i = 0, len = code.length; i < len; ++i) {
  2330. lookup[i] = code[i]
  2331. revLookup[code.charCodeAt(i)] = i
  2332. }
  2333. // Support decoding URL-safe base64 strings, as Node.js does.
  2334. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2335. revLookup['-'.charCodeAt(0)] = 62
  2336. revLookup['_'.charCodeAt(0)] = 63
  2337. function getLens (b64) {
  2338. var len = b64.length
  2339. if (len % 4 > 0) {
  2340. throw new Error('Invalid string. Length must be a multiple of 4')
  2341. }
  2342. // Trim off extra bytes after placeholder bytes are found
  2343. // See: https://github.com/beatgammit/base64-js/issues/42
  2344. var validLen = b64.indexOf('=')
  2345. if (validLen === -1) validLen = len
  2346. var placeHoldersLen = validLen === len
  2347. ? 0
  2348. : 4 - (validLen % 4)
  2349. return [validLen, placeHoldersLen]
  2350. }
  2351. // base64 is 4/3 + up to two characters of the original data
  2352. function byteLength (b64) {
  2353. var lens = getLens(b64)
  2354. var validLen = lens[0]
  2355. var placeHoldersLen = lens[1]
  2356. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2357. }
  2358. function _byteLength (b64, validLen, placeHoldersLen) {
  2359. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2360. }
  2361. function toByteArray (b64) {
  2362. var tmp
  2363. var lens = getLens(b64)
  2364. var validLen = lens[0]
  2365. var placeHoldersLen = lens[1]
  2366. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2367. var curByte = 0
  2368. // if there are placeholders, only get up to the last complete 4 chars
  2369. var len = placeHoldersLen > 0
  2370. ? validLen - 4
  2371. : validLen
  2372. var i
  2373. for (i = 0; i < len; i += 4) {
  2374. tmp =
  2375. (revLookup[b64.charCodeAt(i)] << 18) |
  2376. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2377. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2378. revLookup[b64.charCodeAt(i + 3)]
  2379. arr[curByte++] = (tmp >> 16) & 0xFF
  2380. arr[curByte++] = (tmp >> 8) & 0xFF
  2381. arr[curByte++] = tmp & 0xFF
  2382. }
  2383. if (placeHoldersLen === 2) {
  2384. tmp =
  2385. (revLookup[b64.charCodeAt(i)] << 2) |
  2386. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2387. arr[curByte++] = tmp & 0xFF
  2388. }
  2389. if (placeHoldersLen === 1) {
  2390. tmp =
  2391. (revLookup[b64.charCodeAt(i)] << 10) |
  2392. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2393. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2394. arr[curByte++] = (tmp >> 8) & 0xFF
  2395. arr[curByte++] = tmp & 0xFF
  2396. }
  2397. return arr
  2398. }
  2399. function tripletToBase64 (num) {
  2400. return lookup[num >> 18 & 0x3F] +
  2401. lookup[num >> 12 & 0x3F] +
  2402. lookup[num >> 6 & 0x3F] +
  2403. lookup[num & 0x3F]
  2404. }
  2405. function encodeChunk (uint8, start, end) {
  2406. var tmp
  2407. var output = []
  2408. for (var i = start; i < end; i += 3) {
  2409. tmp =
  2410. ((uint8[i] << 16) & 0xFF0000) +
  2411. ((uint8[i + 1] << 8) & 0xFF00) +
  2412. (uint8[i + 2] & 0xFF)
  2413. output.push(tripletToBase64(tmp))
  2414. }
  2415. return output.join('')
  2416. }
  2417. function fromByteArray (uint8) {
  2418. var tmp
  2419. var len = uint8.length
  2420. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2421. var parts = []
  2422. var maxChunkLength = 16383 // must be multiple of 3
  2423. // go through the array every three bytes, we'll deal with trailing stuff later
  2424. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2425. parts.push(encodeChunk(
  2426. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2427. ))
  2428. }
  2429. // pad the end with zeros, but make sure to not forget the extra bytes
  2430. if (extraBytes === 1) {
  2431. tmp = uint8[len - 1]
  2432. parts.push(
  2433. lookup[tmp >> 2] +
  2434. lookup[(tmp << 4) & 0x3F] +
  2435. '=='
  2436. )
  2437. } else if (extraBytes === 2) {
  2438. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2439. parts.push(
  2440. lookup[tmp >> 10] +
  2441. lookup[(tmp >> 4) & 0x3F] +
  2442. lookup[(tmp << 2) & 0x3F] +
  2443. '='
  2444. )
  2445. }
  2446. return parts.join('')
  2447. }
  2448. /***/ }),
  2449. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2450. /*!*****************************************************!*\
  2451. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2452. \*****************************************************/
  2453. /*! no static exports found */
  2454. /***/ (function(module, exports, __webpack_require__) {
  2455. /*!
  2456. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2457. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2458. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2459. */
  2460. (function (global, factory) {
  2461. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2462. undefined;
  2463. }(this, (function (exports, $, Popper) { 'use strict';
  2464. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2465. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2466. function _defineProperties(target, props) {
  2467. for (var i = 0; i < props.length; i++) {
  2468. var descriptor = props[i];
  2469. descriptor.enumerable = descriptor.enumerable || false;
  2470. descriptor.configurable = true;
  2471. if ("value" in descriptor) descriptor.writable = true;
  2472. Object.defineProperty(target, descriptor.key, descriptor);
  2473. }
  2474. }
  2475. function _createClass(Constructor, protoProps, staticProps) {
  2476. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2477. if (staticProps) _defineProperties(Constructor, staticProps);
  2478. return Constructor;
  2479. }
  2480. function _defineProperty(obj, key, value) {
  2481. if (key in obj) {
  2482. Object.defineProperty(obj, key, {
  2483. value: value,
  2484. enumerable: true,
  2485. configurable: true,
  2486. writable: true
  2487. });
  2488. } else {
  2489. obj[key] = value;
  2490. }
  2491. return obj;
  2492. }
  2493. function ownKeys(object, enumerableOnly) {
  2494. var keys = Object.keys(object);
  2495. if (Object.getOwnPropertySymbols) {
  2496. var symbols = Object.getOwnPropertySymbols(object);
  2497. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2498. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2499. });
  2500. keys.push.apply(keys, symbols);
  2501. }
  2502. return keys;
  2503. }
  2504. function _objectSpread2(target) {
  2505. for (var i = 1; i < arguments.length; i++) {
  2506. var source = arguments[i] != null ? arguments[i] : {};
  2507. if (i % 2) {
  2508. ownKeys(Object(source), true).forEach(function (key) {
  2509. _defineProperty(target, key, source[key]);
  2510. });
  2511. } else if (Object.getOwnPropertyDescriptors) {
  2512. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2513. } else {
  2514. ownKeys(Object(source)).forEach(function (key) {
  2515. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2516. });
  2517. }
  2518. }
  2519. return target;
  2520. }
  2521. function _inheritsLoose(subClass, superClass) {
  2522. subClass.prototype = Object.create(superClass.prototype);
  2523. subClass.prototype.constructor = subClass;
  2524. subClass.__proto__ = superClass;
  2525. }
  2526. /**
  2527. * --------------------------------------------------------------------------
  2528. * Bootstrap (v4.4.1): util.js
  2529. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2530. * --------------------------------------------------------------------------
  2531. */
  2532. /**
  2533. * ------------------------------------------------------------------------
  2534. * Private TransitionEnd Helpers
  2535. * ------------------------------------------------------------------------
  2536. */
  2537. var TRANSITION_END = 'transitionend';
  2538. var MAX_UID = 1000000;
  2539. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2540. function toType(obj) {
  2541. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2542. }
  2543. function getSpecialTransitionEndEvent() {
  2544. return {
  2545. bindType: TRANSITION_END,
  2546. delegateType: TRANSITION_END,
  2547. handle: function handle(event) {
  2548. if ($(event.target).is(this)) {
  2549. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2550. }
  2551. return undefined; // eslint-disable-line no-undefined
  2552. }
  2553. };
  2554. }
  2555. function transitionEndEmulator(duration) {
  2556. var _this = this;
  2557. var called = false;
  2558. $(this).one(Util.TRANSITION_END, function () {
  2559. called = true;
  2560. });
  2561. setTimeout(function () {
  2562. if (!called) {
  2563. Util.triggerTransitionEnd(_this);
  2564. }
  2565. }, duration);
  2566. return this;
  2567. }
  2568. function setTransitionEndSupport() {
  2569. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2570. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2571. }
  2572. /**
  2573. * --------------------------------------------------------------------------
  2574. * Public Util Api
  2575. * --------------------------------------------------------------------------
  2576. */
  2577. var Util = {
  2578. TRANSITION_END: 'bsTransitionEnd',
  2579. getUID: function getUID(prefix) {
  2580. do {
  2581. // eslint-disable-next-line no-bitwise
  2582. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2583. } while (document.getElementById(prefix));
  2584. return prefix;
  2585. },
  2586. getSelectorFromElement: function getSelectorFromElement(element) {
  2587. var selector = element.getAttribute('data-target');
  2588. if (!selector || selector === '#') {
  2589. var hrefAttr = element.getAttribute('href');
  2590. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2591. }
  2592. try {
  2593. return document.querySelector(selector) ? selector : null;
  2594. } catch (err) {
  2595. return null;
  2596. }
  2597. },
  2598. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2599. if (!element) {
  2600. return 0;
  2601. } // Get transition-duration of the element
  2602. var transitionDuration = $(element).css('transition-duration');
  2603. var transitionDelay = $(element).css('transition-delay');
  2604. var floatTransitionDuration = parseFloat(transitionDuration);
  2605. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2606. if (!floatTransitionDuration && !floatTransitionDelay) {
  2607. return 0;
  2608. } // If multiple durations are defined, take the first
  2609. transitionDuration = transitionDuration.split(',')[0];
  2610. transitionDelay = transitionDelay.split(',')[0];
  2611. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2612. },
  2613. reflow: function reflow(element) {
  2614. return element.offsetHeight;
  2615. },
  2616. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2617. $(element).trigger(TRANSITION_END);
  2618. },
  2619. // TODO: Remove in v5
  2620. supportsTransitionEnd: function supportsTransitionEnd() {
  2621. return Boolean(TRANSITION_END);
  2622. },
  2623. isElement: function isElement(obj) {
  2624. return (obj[0] || obj).nodeType;
  2625. },
  2626. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2627. for (var property in configTypes) {
  2628. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2629. var expectedTypes = configTypes[property];
  2630. var value = config[property];
  2631. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2632. if (!new RegExp(expectedTypes).test(valueType)) {
  2633. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2634. }
  2635. }
  2636. }
  2637. },
  2638. findShadowRoot: function findShadowRoot(element) {
  2639. if (!document.documentElement.attachShadow) {
  2640. return null;
  2641. } // Can find the shadow root otherwise it'll return the document
  2642. if (typeof element.getRootNode === 'function') {
  2643. var root = element.getRootNode();
  2644. return root instanceof ShadowRoot ? root : null;
  2645. }
  2646. if (element instanceof ShadowRoot) {
  2647. return element;
  2648. } // when we don't find a shadow root
  2649. if (!element.parentNode) {
  2650. return null;
  2651. }
  2652. return Util.findShadowRoot(element.parentNode);
  2653. },
  2654. jQueryDetection: function jQueryDetection() {
  2655. if (typeof $ === 'undefined') {
  2656. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2657. }
  2658. var version = $.fn.jquery.split(' ')[0].split('.');
  2659. var minMajor = 1;
  2660. var ltMajor = 2;
  2661. var minMinor = 9;
  2662. var minPatch = 1;
  2663. var maxMajor = 4;
  2664. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2665. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2666. }
  2667. }
  2668. };
  2669. Util.jQueryDetection();
  2670. setTransitionEndSupport();
  2671. /**
  2672. * ------------------------------------------------------------------------
  2673. * Constants
  2674. * ------------------------------------------------------------------------
  2675. */
  2676. var NAME = 'alert';
  2677. var VERSION = '4.4.1';
  2678. var DATA_KEY = 'bs.alert';
  2679. var EVENT_KEY = "." + DATA_KEY;
  2680. var DATA_API_KEY = '.data-api';
  2681. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2682. var Selector = {
  2683. DISMISS: '[data-dismiss="alert"]'
  2684. };
  2685. var Event = {
  2686. CLOSE: "close" + EVENT_KEY,
  2687. CLOSED: "closed" + EVENT_KEY,
  2688. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2689. };
  2690. var ClassName = {
  2691. ALERT: 'alert',
  2692. FADE: 'fade',
  2693. SHOW: 'show'
  2694. };
  2695. /**
  2696. * ------------------------------------------------------------------------
  2697. * Class Definition
  2698. * ------------------------------------------------------------------------
  2699. */
  2700. var Alert =
  2701. /*#__PURE__*/
  2702. function () {
  2703. function Alert(element) {
  2704. this._element = element;
  2705. } // Getters
  2706. var _proto = Alert.prototype;
  2707. // Public
  2708. _proto.close = function close(element) {
  2709. var rootElement = this._element;
  2710. if (element) {
  2711. rootElement = this._getRootElement(element);
  2712. }
  2713. var customEvent = this._triggerCloseEvent(rootElement);
  2714. if (customEvent.isDefaultPrevented()) {
  2715. return;
  2716. }
  2717. this._removeElement(rootElement);
  2718. };
  2719. _proto.dispose = function dispose() {
  2720. $.removeData(this._element, DATA_KEY);
  2721. this._element = null;
  2722. } // Private
  2723. ;
  2724. _proto._getRootElement = function _getRootElement(element) {
  2725. var selector = Util.getSelectorFromElement(element);
  2726. var parent = false;
  2727. if (selector) {
  2728. parent = document.querySelector(selector);
  2729. }
  2730. if (!parent) {
  2731. parent = $(element).closest("." + ClassName.ALERT)[0];
  2732. }
  2733. return parent;
  2734. };
  2735. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2736. var closeEvent = $.Event(Event.CLOSE);
  2737. $(element).trigger(closeEvent);
  2738. return closeEvent;
  2739. };
  2740. _proto._removeElement = function _removeElement(element) {
  2741. var _this = this;
  2742. $(element).removeClass(ClassName.SHOW);
  2743. if (!$(element).hasClass(ClassName.FADE)) {
  2744. this._destroyElement(element);
  2745. return;
  2746. }
  2747. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2748. $(element).one(Util.TRANSITION_END, function (event) {
  2749. return _this._destroyElement(element, event);
  2750. }).emulateTransitionEnd(transitionDuration);
  2751. };
  2752. _proto._destroyElement = function _destroyElement(element) {
  2753. $(element).detach().trigger(Event.CLOSED).remove();
  2754. } // Static
  2755. ;
  2756. Alert._jQueryInterface = function _jQueryInterface(config) {
  2757. return this.each(function () {
  2758. var $element = $(this);
  2759. var data = $element.data(DATA_KEY);
  2760. if (!data) {
  2761. data = new Alert(this);
  2762. $element.data(DATA_KEY, data);
  2763. }
  2764. if (config === 'close') {
  2765. data[config](this);
  2766. }
  2767. });
  2768. };
  2769. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2770. return function (event) {
  2771. if (event) {
  2772. event.preventDefault();
  2773. }
  2774. alertInstance.close(this);
  2775. };
  2776. };
  2777. _createClass(Alert, null, [{
  2778. key: "VERSION",
  2779. get: function get() {
  2780. return VERSION;
  2781. }
  2782. }]);
  2783. return Alert;
  2784. }();
  2785. /**
  2786. * ------------------------------------------------------------------------
  2787. * Data Api implementation
  2788. * ------------------------------------------------------------------------
  2789. */
  2790. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2791. /**
  2792. * ------------------------------------------------------------------------
  2793. * jQuery
  2794. * ------------------------------------------------------------------------
  2795. */
  2796. $.fn[NAME] = Alert._jQueryInterface;
  2797. $.fn[NAME].Constructor = Alert;
  2798. $.fn[NAME].noConflict = function () {
  2799. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2800. return Alert._jQueryInterface;
  2801. };
  2802. /**
  2803. * ------------------------------------------------------------------------
  2804. * Constants
  2805. * ------------------------------------------------------------------------
  2806. */
  2807. var NAME$1 = 'button';
  2808. var VERSION$1 = '4.4.1';
  2809. var DATA_KEY$1 = 'bs.button';
  2810. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2811. var DATA_API_KEY$1 = '.data-api';
  2812. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2813. var ClassName$1 = {
  2814. ACTIVE: 'active',
  2815. BUTTON: 'btn',
  2816. FOCUS: 'focus'
  2817. };
  2818. var Selector$1 = {
  2819. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2820. DATA_TOGGLES: '[data-toggle="buttons"]',
  2821. DATA_TOGGLE: '[data-toggle="button"]',
  2822. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2823. INPUT: 'input:not([type="hidden"])',
  2824. ACTIVE: '.active',
  2825. BUTTON: '.btn'
  2826. };
  2827. var Event$1 = {
  2828. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2829. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2830. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2831. };
  2832. /**
  2833. * ------------------------------------------------------------------------
  2834. * Class Definition
  2835. * ------------------------------------------------------------------------
  2836. */
  2837. var Button =
  2838. /*#__PURE__*/
  2839. function () {
  2840. function Button(element) {
  2841. this._element = element;
  2842. } // Getters
  2843. var _proto = Button.prototype;
  2844. // Public
  2845. _proto.toggle = function toggle() {
  2846. var triggerChangeEvent = true;
  2847. var addAriaPressed = true;
  2848. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2849. if (rootElement) {
  2850. var input = this._element.querySelector(Selector$1.INPUT);
  2851. if (input) {
  2852. if (input.type === 'radio') {
  2853. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2854. triggerChangeEvent = false;
  2855. } else {
  2856. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2857. if (activeElement) {
  2858. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2859. }
  2860. }
  2861. } else if (input.type === 'checkbox') {
  2862. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2863. triggerChangeEvent = false;
  2864. }
  2865. } else {
  2866. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2867. triggerChangeEvent = false;
  2868. }
  2869. if (triggerChangeEvent) {
  2870. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2871. $(input).trigger('change');
  2872. }
  2873. input.focus();
  2874. addAriaPressed = false;
  2875. }
  2876. }
  2877. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2878. if (addAriaPressed) {
  2879. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2880. }
  2881. if (triggerChangeEvent) {
  2882. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2883. }
  2884. }
  2885. };
  2886. _proto.dispose = function dispose() {
  2887. $.removeData(this._element, DATA_KEY$1);
  2888. this._element = null;
  2889. } // Static
  2890. ;
  2891. Button._jQueryInterface = function _jQueryInterface(config) {
  2892. return this.each(function () {
  2893. var data = $(this).data(DATA_KEY$1);
  2894. if (!data) {
  2895. data = new Button(this);
  2896. $(this).data(DATA_KEY$1, data);
  2897. }
  2898. if (config === 'toggle') {
  2899. data[config]();
  2900. }
  2901. });
  2902. };
  2903. _createClass(Button, null, [{
  2904. key: "VERSION",
  2905. get: function get() {
  2906. return VERSION$1;
  2907. }
  2908. }]);
  2909. return Button;
  2910. }();
  2911. /**
  2912. * ------------------------------------------------------------------------
  2913. * Data Api implementation
  2914. * ------------------------------------------------------------------------
  2915. */
  2916. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2917. var button = event.target;
  2918. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2919. button = $(button).closest(Selector$1.BUTTON)[0];
  2920. }
  2921. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2922. event.preventDefault(); // work around Firefox bug #1540995
  2923. } else {
  2924. var inputBtn = button.querySelector(Selector$1.INPUT);
  2925. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2926. event.preventDefault(); // work around Firefox bug #1540995
  2927. return;
  2928. }
  2929. Button._jQueryInterface.call($(button), 'toggle');
  2930. }
  2931. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2932. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2933. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2934. });
  2935. $(window).on(Event$1.LOAD_DATA_API, function () {
  2936. // ensure correct active class is set to match the controls' actual values/states
  2937. // find all checkboxes/readio buttons inside data-toggle groups
  2938. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2939. for (var i = 0, len = buttons.length; i < len; i++) {
  2940. var button = buttons[i];
  2941. var input = button.querySelector(Selector$1.INPUT);
  2942. if (input.checked || input.hasAttribute('checked')) {
  2943. button.classList.add(ClassName$1.ACTIVE);
  2944. } else {
  2945. button.classList.remove(ClassName$1.ACTIVE);
  2946. }
  2947. } // find all button toggles
  2948. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2949. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2950. var _button = buttons[_i];
  2951. if (_button.getAttribute('aria-pressed') === 'true') {
  2952. _button.classList.add(ClassName$1.ACTIVE);
  2953. } else {
  2954. _button.classList.remove(ClassName$1.ACTIVE);
  2955. }
  2956. }
  2957. });
  2958. /**
  2959. * ------------------------------------------------------------------------
  2960. * jQuery
  2961. * ------------------------------------------------------------------------
  2962. */
  2963. $.fn[NAME$1] = Button._jQueryInterface;
  2964. $.fn[NAME$1].Constructor = Button;
  2965. $.fn[NAME$1].noConflict = function () {
  2966. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2967. return Button._jQueryInterface;
  2968. };
  2969. /**
  2970. * ------------------------------------------------------------------------
  2971. * Constants
  2972. * ------------------------------------------------------------------------
  2973. */
  2974. var NAME$2 = 'carousel';
  2975. var VERSION$2 = '4.4.1';
  2976. var DATA_KEY$2 = 'bs.carousel';
  2977. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2978. var DATA_API_KEY$2 = '.data-api';
  2979. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2980. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2981. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2982. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2983. var SWIPE_THRESHOLD = 40;
  2984. var Default = {
  2985. interval: 5000,
  2986. keyboard: true,
  2987. slide: false,
  2988. pause: 'hover',
  2989. wrap: true,
  2990. touch: true
  2991. };
  2992. var DefaultType = {
  2993. interval: '(number|boolean)',
  2994. keyboard: 'boolean',
  2995. slide: '(boolean|string)',
  2996. pause: '(string|boolean)',
  2997. wrap: 'boolean',
  2998. touch: 'boolean'
  2999. };
  3000. var Direction = {
  3001. NEXT: 'next',
  3002. PREV: 'prev',
  3003. LEFT: 'left',
  3004. RIGHT: 'right'
  3005. };
  3006. var Event$2 = {
  3007. SLIDE: "slide" + EVENT_KEY$2,
  3008. SLID: "slid" + EVENT_KEY$2,
  3009. KEYDOWN: "keydown" + EVENT_KEY$2,
  3010. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3011. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3012. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3013. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3014. TOUCHEND: "touchend" + EVENT_KEY$2,
  3015. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3016. POINTERUP: "pointerup" + EVENT_KEY$2,
  3017. DRAG_START: "dragstart" + EVENT_KEY$2,
  3018. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3019. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3020. };
  3021. var ClassName$2 = {
  3022. CAROUSEL: 'carousel',
  3023. ACTIVE: 'active',
  3024. SLIDE: 'slide',
  3025. RIGHT: 'carousel-item-right',
  3026. LEFT: 'carousel-item-left',
  3027. NEXT: 'carousel-item-next',
  3028. PREV: 'carousel-item-prev',
  3029. ITEM: 'carousel-item',
  3030. POINTER_EVENT: 'pointer-event'
  3031. };
  3032. var Selector$2 = {
  3033. ACTIVE: '.active',
  3034. ACTIVE_ITEM: '.active.carousel-item',
  3035. ITEM: '.carousel-item',
  3036. ITEM_IMG: '.carousel-item img',
  3037. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3038. INDICATORS: '.carousel-indicators',
  3039. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3040. DATA_RIDE: '[data-ride="carousel"]'
  3041. };
  3042. var PointerType = {
  3043. TOUCH: 'touch',
  3044. PEN: 'pen'
  3045. };
  3046. /**
  3047. * ------------------------------------------------------------------------
  3048. * Class Definition
  3049. * ------------------------------------------------------------------------
  3050. */
  3051. var Carousel =
  3052. /*#__PURE__*/
  3053. function () {
  3054. function Carousel(element, config) {
  3055. this._items = null;
  3056. this._interval = null;
  3057. this._activeElement = null;
  3058. this._isPaused = false;
  3059. this._isSliding = false;
  3060. this.touchTimeout = null;
  3061. this.touchStartX = 0;
  3062. this.touchDeltaX = 0;
  3063. this._config = this._getConfig(config);
  3064. this._element = element;
  3065. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3066. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3067. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3068. this._addEventListeners();
  3069. } // Getters
  3070. var _proto = Carousel.prototype;
  3071. // Public
  3072. _proto.next = function next() {
  3073. if (!this._isSliding) {
  3074. this._slide(Direction.NEXT);
  3075. }
  3076. };
  3077. _proto.nextWhenVisible = function nextWhenVisible() {
  3078. // Don't call next when the page isn't visible
  3079. // or the carousel or its parent isn't visible
  3080. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3081. this.next();
  3082. }
  3083. };
  3084. _proto.prev = function prev() {
  3085. if (!this._isSliding) {
  3086. this._slide(Direction.PREV);
  3087. }
  3088. };
  3089. _proto.pause = function pause(event) {
  3090. if (!event) {
  3091. this._isPaused = true;
  3092. }
  3093. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3094. Util.triggerTransitionEnd(this._element);
  3095. this.cycle(true);
  3096. }
  3097. clearInterval(this._interval);
  3098. this._interval = null;
  3099. };
  3100. _proto.cycle = function cycle(event) {
  3101. if (!event) {
  3102. this._isPaused = false;
  3103. }
  3104. if (this._interval) {
  3105. clearInterval(this._interval);
  3106. this._interval = null;
  3107. }
  3108. if (this._config.interval && !this._isPaused) {
  3109. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3110. }
  3111. };
  3112. _proto.to = function to(index) {
  3113. var _this = this;
  3114. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3115. var activeIndex = this._getItemIndex(this._activeElement);
  3116. if (index > this._items.length - 1 || index < 0) {
  3117. return;
  3118. }
  3119. if (this._isSliding) {
  3120. $(this._element).one(Event$2.SLID, function () {
  3121. return _this.to(index);
  3122. });
  3123. return;
  3124. }
  3125. if (activeIndex === index) {
  3126. this.pause();
  3127. this.cycle();
  3128. return;
  3129. }
  3130. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3131. this._slide(direction, this._items[index]);
  3132. };
  3133. _proto.dispose = function dispose() {
  3134. $(this._element).off(EVENT_KEY$2);
  3135. $.removeData(this._element, DATA_KEY$2);
  3136. this._items = null;
  3137. this._config = null;
  3138. this._element = null;
  3139. this._interval = null;
  3140. this._isPaused = null;
  3141. this._isSliding = null;
  3142. this._activeElement = null;
  3143. this._indicatorsElement = null;
  3144. } // Private
  3145. ;
  3146. _proto._getConfig = function _getConfig(config) {
  3147. config = _objectSpread2({}, Default, {}, config);
  3148. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3149. return config;
  3150. };
  3151. _proto._handleSwipe = function _handleSwipe() {
  3152. var absDeltax = Math.abs(this.touchDeltaX);
  3153. if (absDeltax <= SWIPE_THRESHOLD) {
  3154. return;
  3155. }
  3156. var direction = absDeltax / this.touchDeltaX;
  3157. this.touchDeltaX = 0; // swipe left
  3158. if (direction > 0) {
  3159. this.prev();
  3160. } // swipe right
  3161. if (direction < 0) {
  3162. this.next();
  3163. }
  3164. };
  3165. _proto._addEventListeners = function _addEventListeners() {
  3166. var _this2 = this;
  3167. if (this._config.keyboard) {
  3168. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3169. return _this2._keydown(event);
  3170. });
  3171. }
  3172. if (this._config.pause === 'hover') {
  3173. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3174. return _this2.pause(event);
  3175. }).on(Event$2.MOUSELEAVE, function (event) {
  3176. return _this2.cycle(event);
  3177. });
  3178. }
  3179. if (this._config.touch) {
  3180. this._addTouchEventListeners();
  3181. }
  3182. };
  3183. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3184. var _this3 = this;
  3185. if (!this._touchSupported) {
  3186. return;
  3187. }
  3188. var start = function start(event) {
  3189. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3190. _this3.touchStartX = event.originalEvent.clientX;
  3191. } else if (!_this3._pointerEvent) {
  3192. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3193. }
  3194. };
  3195. var move = function move(event) {
  3196. // ensure swiping with one touch and not pinching
  3197. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3198. _this3.touchDeltaX = 0;
  3199. } else {
  3200. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3201. }
  3202. };
  3203. var end = function end(event) {
  3204. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3205. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3206. }
  3207. _this3._handleSwipe();
  3208. if (_this3._config.pause === 'hover') {
  3209. // If it's a touch-enabled device, mouseenter/leave are fired as
  3210. // part of the mouse compatibility events on first tap - the carousel
  3211. // would stop cycling until user tapped out of it;
  3212. // here, we listen for touchend, explicitly pause the carousel
  3213. // (as if it's the second time we tap on it, mouseenter compat event
  3214. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3215. // events to fire) we explicitly restart cycling
  3216. _this3.pause();
  3217. if (_this3.touchTimeout) {
  3218. clearTimeout(_this3.touchTimeout);
  3219. }
  3220. _this3.touchTimeout = setTimeout(function (event) {
  3221. return _this3.cycle(event);
  3222. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3223. }
  3224. };
  3225. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3226. return e.preventDefault();
  3227. });
  3228. if (this._pointerEvent) {
  3229. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3230. return start(event);
  3231. });
  3232. $(this._element).on(Event$2.POINTERUP, function (event) {
  3233. return end(event);
  3234. });
  3235. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3236. } else {
  3237. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3238. return start(event);
  3239. });
  3240. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3241. return move(event);
  3242. });
  3243. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3244. return end(event);
  3245. });
  3246. }
  3247. };
  3248. _proto._keydown = function _keydown(event) {
  3249. if (/input|textarea/i.test(event.target.tagName)) {
  3250. return;
  3251. }
  3252. switch (event.which) {
  3253. case ARROW_LEFT_KEYCODE:
  3254. event.preventDefault();
  3255. this.prev();
  3256. break;
  3257. case ARROW_RIGHT_KEYCODE:
  3258. event.preventDefault();
  3259. this.next();
  3260. break;
  3261. }
  3262. };
  3263. _proto._getItemIndex = function _getItemIndex(element) {
  3264. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3265. return this._items.indexOf(element);
  3266. };
  3267. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3268. var isNextDirection = direction === Direction.NEXT;
  3269. var isPrevDirection = direction === Direction.PREV;
  3270. var activeIndex = this._getItemIndex(activeElement);
  3271. var lastItemIndex = this._items.length - 1;
  3272. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3273. if (isGoingToWrap && !this._config.wrap) {
  3274. return activeElement;
  3275. }
  3276. var delta = direction === Direction.PREV ? -1 : 1;
  3277. var itemIndex = (activeIndex + delta) % this._items.length;
  3278. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3279. };
  3280. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3281. var targetIndex = this._getItemIndex(relatedTarget);
  3282. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3283. var slideEvent = $.Event(Event$2.SLIDE, {
  3284. relatedTarget: relatedTarget,
  3285. direction: eventDirectionName,
  3286. from: fromIndex,
  3287. to: targetIndex
  3288. });
  3289. $(this._element).trigger(slideEvent);
  3290. return slideEvent;
  3291. };
  3292. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3293. if (this._indicatorsElement) {
  3294. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3295. $(indicators).removeClass(ClassName$2.ACTIVE);
  3296. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3297. if (nextIndicator) {
  3298. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3299. }
  3300. }
  3301. };
  3302. _proto._slide = function _slide(direction, element) {
  3303. var _this4 = this;
  3304. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3305. var activeElementIndex = this._getItemIndex(activeElement);
  3306. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3307. var nextElementIndex = this._getItemIndex(nextElement);
  3308. var isCycling = Boolean(this._interval);
  3309. var directionalClassName;
  3310. var orderClassName;
  3311. var eventDirectionName;
  3312. if (direction === Direction.NEXT) {
  3313. directionalClassName = ClassName$2.LEFT;
  3314. orderClassName = ClassName$2.NEXT;
  3315. eventDirectionName = Direction.LEFT;
  3316. } else {
  3317. directionalClassName = ClassName$2.RIGHT;
  3318. orderClassName = ClassName$2.PREV;
  3319. eventDirectionName = Direction.RIGHT;
  3320. }
  3321. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3322. this._isSliding = false;
  3323. return;
  3324. }
  3325. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3326. if (slideEvent.isDefaultPrevented()) {
  3327. return;
  3328. }
  3329. if (!activeElement || !nextElement) {
  3330. // Some weirdness is happening, so we bail
  3331. return;
  3332. }
  3333. this._isSliding = true;
  3334. if (isCycling) {
  3335. this.pause();
  3336. }
  3337. this._setActiveIndicatorElement(nextElement);
  3338. var slidEvent = $.Event(Event$2.SLID, {
  3339. relatedTarget: nextElement,
  3340. direction: eventDirectionName,
  3341. from: activeElementIndex,
  3342. to: nextElementIndex
  3343. });
  3344. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3345. $(nextElement).addClass(orderClassName);
  3346. Util.reflow(nextElement);
  3347. $(activeElement).addClass(directionalClassName);
  3348. $(nextElement).addClass(directionalClassName);
  3349. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3350. if (nextElementInterval) {
  3351. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3352. this._config.interval = nextElementInterval;
  3353. } else {
  3354. this._config.interval = this._config.defaultInterval || this._config.interval;
  3355. }
  3356. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3357. $(activeElement).one(Util.TRANSITION_END, function () {
  3358. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3359. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3360. _this4._isSliding = false;
  3361. setTimeout(function () {
  3362. return $(_this4._element).trigger(slidEvent);
  3363. }, 0);
  3364. }).emulateTransitionEnd(transitionDuration);
  3365. } else {
  3366. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3367. $(nextElement).addClass(ClassName$2.ACTIVE);
  3368. this._isSliding = false;
  3369. $(this._element).trigger(slidEvent);
  3370. }
  3371. if (isCycling) {
  3372. this.cycle();
  3373. }
  3374. } // Static
  3375. ;
  3376. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3377. return this.each(function () {
  3378. var data = $(this).data(DATA_KEY$2);
  3379. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3380. if (typeof config === 'object') {
  3381. _config = _objectSpread2({}, _config, {}, config);
  3382. }
  3383. var action = typeof config === 'string' ? config : _config.slide;
  3384. if (!data) {
  3385. data = new Carousel(this, _config);
  3386. $(this).data(DATA_KEY$2, data);
  3387. }
  3388. if (typeof config === 'number') {
  3389. data.to(config);
  3390. } else if (typeof action === 'string') {
  3391. if (typeof data[action] === 'undefined') {
  3392. throw new TypeError("No method named \"" + action + "\"");
  3393. }
  3394. data[action]();
  3395. } else if (_config.interval && _config.ride) {
  3396. data.pause();
  3397. data.cycle();
  3398. }
  3399. });
  3400. };
  3401. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3402. var selector = Util.getSelectorFromElement(this);
  3403. if (!selector) {
  3404. return;
  3405. }
  3406. var target = $(selector)[0];
  3407. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3408. return;
  3409. }
  3410. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3411. var slideIndex = this.getAttribute('data-slide-to');
  3412. if (slideIndex) {
  3413. config.interval = false;
  3414. }
  3415. Carousel._jQueryInterface.call($(target), config);
  3416. if (slideIndex) {
  3417. $(target).data(DATA_KEY$2).to(slideIndex);
  3418. }
  3419. event.preventDefault();
  3420. };
  3421. _createClass(Carousel, null, [{
  3422. key: "VERSION",
  3423. get: function get() {
  3424. return VERSION$2;
  3425. }
  3426. }, {
  3427. key: "Default",
  3428. get: function get() {
  3429. return Default;
  3430. }
  3431. }]);
  3432. return Carousel;
  3433. }();
  3434. /**
  3435. * ------------------------------------------------------------------------
  3436. * Data Api implementation
  3437. * ------------------------------------------------------------------------
  3438. */
  3439. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3440. $(window).on(Event$2.LOAD_DATA_API, function () {
  3441. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3442. for (var i = 0, len = carousels.length; i < len; i++) {
  3443. var $carousel = $(carousels[i]);
  3444. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3445. }
  3446. });
  3447. /**
  3448. * ------------------------------------------------------------------------
  3449. * jQuery
  3450. * ------------------------------------------------------------------------
  3451. */
  3452. $.fn[NAME$2] = Carousel._jQueryInterface;
  3453. $.fn[NAME$2].Constructor = Carousel;
  3454. $.fn[NAME$2].noConflict = function () {
  3455. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3456. return Carousel._jQueryInterface;
  3457. };
  3458. /**
  3459. * ------------------------------------------------------------------------
  3460. * Constants
  3461. * ------------------------------------------------------------------------
  3462. */
  3463. var NAME$3 = 'collapse';
  3464. var VERSION$3 = '4.4.1';
  3465. var DATA_KEY$3 = 'bs.collapse';
  3466. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3467. var DATA_API_KEY$3 = '.data-api';
  3468. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3469. var Default$1 = {
  3470. toggle: true,
  3471. parent: ''
  3472. };
  3473. var DefaultType$1 = {
  3474. toggle: 'boolean',
  3475. parent: '(string|element)'
  3476. };
  3477. var Event$3 = {
  3478. SHOW: "show" + EVENT_KEY$3,
  3479. SHOWN: "shown" + EVENT_KEY$3,
  3480. HIDE: "hide" + EVENT_KEY$3,
  3481. HIDDEN: "hidden" + EVENT_KEY$3,
  3482. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3483. };
  3484. var ClassName$3 = {
  3485. SHOW: 'show',
  3486. COLLAPSE: 'collapse',
  3487. COLLAPSING: 'collapsing',
  3488. COLLAPSED: 'collapsed'
  3489. };
  3490. var Dimension = {
  3491. WIDTH: 'width',
  3492. HEIGHT: 'height'
  3493. };
  3494. var Selector$3 = {
  3495. ACTIVES: '.show, .collapsing',
  3496. DATA_TOGGLE: '[data-toggle="collapse"]'
  3497. };
  3498. /**
  3499. * ------------------------------------------------------------------------
  3500. * Class Definition
  3501. * ------------------------------------------------------------------------
  3502. */
  3503. var Collapse =
  3504. /*#__PURE__*/
  3505. function () {
  3506. function Collapse(element, config) {
  3507. this._isTransitioning = false;
  3508. this._element = element;
  3509. this._config = this._getConfig(config);
  3510. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3511. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3512. for (var i = 0, len = toggleList.length; i < len; i++) {
  3513. var elem = toggleList[i];
  3514. var selector = Util.getSelectorFromElement(elem);
  3515. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3516. return foundElem === element;
  3517. });
  3518. if (selector !== null && filterElement.length > 0) {
  3519. this._selector = selector;
  3520. this._triggerArray.push(elem);
  3521. }
  3522. }
  3523. this._parent = this._config.parent ? this._getParent() : null;
  3524. if (!this._config.parent) {
  3525. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3526. }
  3527. if (this._config.toggle) {
  3528. this.toggle();
  3529. }
  3530. } // Getters
  3531. var _proto = Collapse.prototype;
  3532. // Public
  3533. _proto.toggle = function toggle() {
  3534. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3535. this.hide();
  3536. } else {
  3537. this.show();
  3538. }
  3539. };
  3540. _proto.show = function show() {
  3541. var _this = this;
  3542. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3543. return;
  3544. }
  3545. var actives;
  3546. var activesData;
  3547. if (this._parent) {
  3548. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3549. if (typeof _this._config.parent === 'string') {
  3550. return elem.getAttribute('data-parent') === _this._config.parent;
  3551. }
  3552. return elem.classList.contains(ClassName$3.COLLAPSE);
  3553. });
  3554. if (actives.length === 0) {
  3555. actives = null;
  3556. }
  3557. }
  3558. if (actives) {
  3559. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3560. if (activesData && activesData._isTransitioning) {
  3561. return;
  3562. }
  3563. }
  3564. var startEvent = $.Event(Event$3.SHOW);
  3565. $(this._element).trigger(startEvent);
  3566. if (startEvent.isDefaultPrevented()) {
  3567. return;
  3568. }
  3569. if (actives) {
  3570. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3571. if (!activesData) {
  3572. $(actives).data(DATA_KEY$3, null);
  3573. }
  3574. }
  3575. var dimension = this._getDimension();
  3576. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3577. this._element.style[dimension] = 0;
  3578. if (this._triggerArray.length) {
  3579. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3580. }
  3581. this.setTransitioning(true);
  3582. var complete = function complete() {
  3583. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3584. _this._element.style[dimension] = '';
  3585. _this.setTransitioning(false);
  3586. $(_this._element).trigger(Event$3.SHOWN);
  3587. };
  3588. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3589. var scrollSize = "scroll" + capitalizedDimension;
  3590. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3591. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3592. this._element.style[dimension] = this._element[scrollSize] + "px";
  3593. };
  3594. _proto.hide = function hide() {
  3595. var _this2 = this;
  3596. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3597. return;
  3598. }
  3599. var startEvent = $.Event(Event$3.HIDE);
  3600. $(this._element).trigger(startEvent);
  3601. if (startEvent.isDefaultPrevented()) {
  3602. return;
  3603. }
  3604. var dimension = this._getDimension();
  3605. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3606. Util.reflow(this._element);
  3607. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3608. var triggerArrayLength = this._triggerArray.length;
  3609. if (triggerArrayLength > 0) {
  3610. for (var i = 0; i < triggerArrayLength; i++) {
  3611. var trigger = this._triggerArray[i];
  3612. var selector = Util.getSelectorFromElement(trigger);
  3613. if (selector !== null) {
  3614. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3615. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3616. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3617. }
  3618. }
  3619. }
  3620. }
  3621. this.setTransitioning(true);
  3622. var complete = function complete() {
  3623. _this2.setTransitioning(false);
  3624. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3625. };
  3626. this._element.style[dimension] = '';
  3627. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3628. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3629. };
  3630. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3631. this._isTransitioning = isTransitioning;
  3632. };
  3633. _proto.dispose = function dispose() {
  3634. $.removeData(this._element, DATA_KEY$3);
  3635. this._config = null;
  3636. this._parent = null;
  3637. this._element = null;
  3638. this._triggerArray = null;
  3639. this._isTransitioning = null;
  3640. } // Private
  3641. ;
  3642. _proto._getConfig = function _getConfig(config) {
  3643. config = _objectSpread2({}, Default$1, {}, config);
  3644. config.toggle = Boolean(config.toggle); // Coerce string values
  3645. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3646. return config;
  3647. };
  3648. _proto._getDimension = function _getDimension() {
  3649. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3650. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3651. };
  3652. _proto._getParent = function _getParent() {
  3653. var _this3 = this;
  3654. var parent;
  3655. if (Util.isElement(this._config.parent)) {
  3656. parent = this._config.parent; // It's a jQuery object
  3657. if (typeof this._config.parent.jquery !== 'undefined') {
  3658. parent = this._config.parent[0];
  3659. }
  3660. } else {
  3661. parent = document.querySelector(this._config.parent);
  3662. }
  3663. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3664. var children = [].slice.call(parent.querySelectorAll(selector));
  3665. $(children).each(function (i, element) {
  3666. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3667. });
  3668. return parent;
  3669. };
  3670. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3671. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3672. if (triggerArray.length) {
  3673. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3674. }
  3675. } // Static
  3676. ;
  3677. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3678. var selector = Util.getSelectorFromElement(element);
  3679. return selector ? document.querySelector(selector) : null;
  3680. };
  3681. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3682. return this.each(function () {
  3683. var $this = $(this);
  3684. var data = $this.data(DATA_KEY$3);
  3685. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3686. if (!data && _config.toggle && /show|hide/.test(config)) {
  3687. _config.toggle = false;
  3688. }
  3689. if (!data) {
  3690. data = new Collapse(this, _config);
  3691. $this.data(DATA_KEY$3, data);
  3692. }
  3693. if (typeof config === 'string') {
  3694. if (typeof data[config] === 'undefined') {
  3695. throw new TypeError("No method named \"" + config + "\"");
  3696. }
  3697. data[config]();
  3698. }
  3699. });
  3700. };
  3701. _createClass(Collapse, null, [{
  3702. key: "VERSION",
  3703. get: function get() {
  3704. return VERSION$3;
  3705. }
  3706. }, {
  3707. key: "Default",
  3708. get: function get() {
  3709. return Default$1;
  3710. }
  3711. }]);
  3712. return Collapse;
  3713. }();
  3714. /**
  3715. * ------------------------------------------------------------------------
  3716. * Data Api implementation
  3717. * ------------------------------------------------------------------------
  3718. */
  3719. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3720. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3721. if (event.currentTarget.tagName === 'A') {
  3722. event.preventDefault();
  3723. }
  3724. var $trigger = $(this);
  3725. var selector = Util.getSelectorFromElement(this);
  3726. var selectors = [].slice.call(document.querySelectorAll(selector));
  3727. $(selectors).each(function () {
  3728. var $target = $(this);
  3729. var data = $target.data(DATA_KEY$3);
  3730. var config = data ? 'toggle' : $trigger.data();
  3731. Collapse._jQueryInterface.call($target, config);
  3732. });
  3733. });
  3734. /**
  3735. * ------------------------------------------------------------------------
  3736. * jQuery
  3737. * ------------------------------------------------------------------------
  3738. */
  3739. $.fn[NAME$3] = Collapse._jQueryInterface;
  3740. $.fn[NAME$3].Constructor = Collapse;
  3741. $.fn[NAME$3].noConflict = function () {
  3742. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3743. return Collapse._jQueryInterface;
  3744. };
  3745. /**
  3746. * ------------------------------------------------------------------------
  3747. * Constants
  3748. * ------------------------------------------------------------------------
  3749. */
  3750. var NAME$4 = 'dropdown';
  3751. var VERSION$4 = '4.4.1';
  3752. var DATA_KEY$4 = 'bs.dropdown';
  3753. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3754. var DATA_API_KEY$4 = '.data-api';
  3755. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3756. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3757. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3758. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3759. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3760. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3761. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3762. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3763. var Event$4 = {
  3764. HIDE: "hide" + EVENT_KEY$4,
  3765. HIDDEN: "hidden" + EVENT_KEY$4,
  3766. SHOW: "show" + EVENT_KEY$4,
  3767. SHOWN: "shown" + EVENT_KEY$4,
  3768. CLICK: "click" + EVENT_KEY$4,
  3769. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3770. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3771. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3772. };
  3773. var ClassName$4 = {
  3774. DISABLED: 'disabled',
  3775. SHOW: 'show',
  3776. DROPUP: 'dropup',
  3777. DROPRIGHT: 'dropright',
  3778. DROPLEFT: 'dropleft',
  3779. MENURIGHT: 'dropdown-menu-right',
  3780. MENULEFT: 'dropdown-menu-left',
  3781. POSITION_STATIC: 'position-static'
  3782. };
  3783. var Selector$4 = {
  3784. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3785. FORM_CHILD: '.dropdown form',
  3786. MENU: '.dropdown-menu',
  3787. NAVBAR_NAV: '.navbar-nav',
  3788. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3789. };
  3790. var AttachmentMap = {
  3791. TOP: 'top-start',
  3792. TOPEND: 'top-end',
  3793. BOTTOM: 'bottom-start',
  3794. BOTTOMEND: 'bottom-end',
  3795. RIGHT: 'right-start',
  3796. RIGHTEND: 'right-end',
  3797. LEFT: 'left-start',
  3798. LEFTEND: 'left-end'
  3799. };
  3800. var Default$2 = {
  3801. offset: 0,
  3802. flip: true,
  3803. boundary: 'scrollParent',
  3804. reference: 'toggle',
  3805. display: 'dynamic',
  3806. popperConfig: null
  3807. };
  3808. var DefaultType$2 = {
  3809. offset: '(number|string|function)',
  3810. flip: 'boolean',
  3811. boundary: '(string|element)',
  3812. reference: '(string|element)',
  3813. display: 'string',
  3814. popperConfig: '(null|object)'
  3815. };
  3816. /**
  3817. * ------------------------------------------------------------------------
  3818. * Class Definition
  3819. * ------------------------------------------------------------------------
  3820. */
  3821. var Dropdown =
  3822. /*#__PURE__*/
  3823. function () {
  3824. function Dropdown(element, config) {
  3825. this._element = element;
  3826. this._popper = null;
  3827. this._config = this._getConfig(config);
  3828. this._menu = this._getMenuElement();
  3829. this._inNavbar = this._detectNavbar();
  3830. this._addEventListeners();
  3831. } // Getters
  3832. var _proto = Dropdown.prototype;
  3833. // Public
  3834. _proto.toggle = function toggle() {
  3835. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3836. return;
  3837. }
  3838. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3839. Dropdown._clearMenus();
  3840. if (isActive) {
  3841. return;
  3842. }
  3843. this.show(true);
  3844. };
  3845. _proto.show = function show(usePopper) {
  3846. if (usePopper === void 0) {
  3847. usePopper = false;
  3848. }
  3849. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3850. return;
  3851. }
  3852. var relatedTarget = {
  3853. relatedTarget: this._element
  3854. };
  3855. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3856. var parent = Dropdown._getParentFromElement(this._element);
  3857. $(parent).trigger(showEvent);
  3858. if (showEvent.isDefaultPrevented()) {
  3859. return;
  3860. } // Disable totally Popper.js for Dropdown in Navbar
  3861. if (!this._inNavbar && usePopper) {
  3862. /**
  3863. * Check for Popper dependency
  3864. * Popper - https://popper.js.org
  3865. */
  3866. if (typeof Popper === 'undefined') {
  3867. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3868. }
  3869. var referenceElement = this._element;
  3870. if (this._config.reference === 'parent') {
  3871. referenceElement = parent;
  3872. } else if (Util.isElement(this._config.reference)) {
  3873. referenceElement = this._config.reference; // Check if it's jQuery element
  3874. if (typeof this._config.reference.jquery !== 'undefined') {
  3875. referenceElement = this._config.reference[0];
  3876. }
  3877. } // If boundary is not `scrollParent`, then set position to `static`
  3878. // to allow the menu to "escape" the scroll parent's boundaries
  3879. // https://github.com/twbs/bootstrap/issues/24251
  3880. if (this._config.boundary !== 'scrollParent') {
  3881. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3882. }
  3883. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3884. } // If this is a touch-enabled device we add extra
  3885. // empty mouseover listeners to the body's immediate children;
  3886. // only needed because of broken event delegation on iOS
  3887. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3888. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3889. $(document.body).children().on('mouseover', null, $.noop);
  3890. }
  3891. this._element.focus();
  3892. this._element.setAttribute('aria-expanded', true);
  3893. $(this._menu).toggleClass(ClassName$4.SHOW);
  3894. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3895. };
  3896. _proto.hide = function hide() {
  3897. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3898. return;
  3899. }
  3900. var relatedTarget = {
  3901. relatedTarget: this._element
  3902. };
  3903. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3904. var parent = Dropdown._getParentFromElement(this._element);
  3905. $(parent).trigger(hideEvent);
  3906. if (hideEvent.isDefaultPrevented()) {
  3907. return;
  3908. }
  3909. if (this._popper) {
  3910. this._popper.destroy();
  3911. }
  3912. $(this._menu).toggleClass(ClassName$4.SHOW);
  3913. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3914. };
  3915. _proto.dispose = function dispose() {
  3916. $.removeData(this._element, DATA_KEY$4);
  3917. $(this._element).off(EVENT_KEY$4);
  3918. this._element = null;
  3919. this._menu = null;
  3920. if (this._popper !== null) {
  3921. this._popper.destroy();
  3922. this._popper = null;
  3923. }
  3924. };
  3925. _proto.update = function update() {
  3926. this._inNavbar = this._detectNavbar();
  3927. if (this._popper !== null) {
  3928. this._popper.scheduleUpdate();
  3929. }
  3930. } // Private
  3931. ;
  3932. _proto._addEventListeners = function _addEventListeners() {
  3933. var _this = this;
  3934. $(this._element).on(Event$4.CLICK, function (event) {
  3935. event.preventDefault();
  3936. event.stopPropagation();
  3937. _this.toggle();
  3938. });
  3939. };
  3940. _proto._getConfig = function _getConfig(config) {
  3941. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3942. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3943. return config;
  3944. };
  3945. _proto._getMenuElement = function _getMenuElement() {
  3946. if (!this._menu) {
  3947. var parent = Dropdown._getParentFromElement(this._element);
  3948. if (parent) {
  3949. this._menu = parent.querySelector(Selector$4.MENU);
  3950. }
  3951. }
  3952. return this._menu;
  3953. };
  3954. _proto._getPlacement = function _getPlacement() {
  3955. var $parentDropdown = $(this._element.parentNode);
  3956. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3957. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3958. placement = AttachmentMap.TOP;
  3959. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3960. placement = AttachmentMap.TOPEND;
  3961. }
  3962. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3963. placement = AttachmentMap.RIGHT;
  3964. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3965. placement = AttachmentMap.LEFT;
  3966. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3967. placement = AttachmentMap.BOTTOMEND;
  3968. }
  3969. return placement;
  3970. };
  3971. _proto._detectNavbar = function _detectNavbar() {
  3972. return $(this._element).closest('.navbar').length > 0;
  3973. };
  3974. _proto._getOffset = function _getOffset() {
  3975. var _this2 = this;
  3976. var offset = {};
  3977. if (typeof this._config.offset === 'function') {
  3978. offset.fn = function (data) {
  3979. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3980. return data;
  3981. };
  3982. } else {
  3983. offset.offset = this._config.offset;
  3984. }
  3985. return offset;
  3986. };
  3987. _proto._getPopperConfig = function _getPopperConfig() {
  3988. var popperConfig = {
  3989. placement: this._getPlacement(),
  3990. modifiers: {
  3991. offset: this._getOffset(),
  3992. flip: {
  3993. enabled: this._config.flip
  3994. },
  3995. preventOverflow: {
  3996. boundariesElement: this._config.boundary
  3997. }
  3998. }
  3999. }; // Disable Popper.js if we have a static display
  4000. if (this._config.display === 'static') {
  4001. popperConfig.modifiers.applyStyle = {
  4002. enabled: false
  4003. };
  4004. }
  4005. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4006. } // Static
  4007. ;
  4008. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4009. return this.each(function () {
  4010. var data = $(this).data(DATA_KEY$4);
  4011. var _config = typeof config === 'object' ? config : null;
  4012. if (!data) {
  4013. data = new Dropdown(this, _config);
  4014. $(this).data(DATA_KEY$4, data);
  4015. }
  4016. if (typeof config === 'string') {
  4017. if (typeof data[config] === 'undefined') {
  4018. throw new TypeError("No method named \"" + config + "\"");
  4019. }
  4020. data[config]();
  4021. }
  4022. });
  4023. };
  4024. Dropdown._clearMenus = function _clearMenus(event) {
  4025. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4026. return;
  4027. }
  4028. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4029. for (var i = 0, len = toggles.length; i < len; i++) {
  4030. var parent = Dropdown._getParentFromElement(toggles[i]);
  4031. var context = $(toggles[i]).data(DATA_KEY$4);
  4032. var relatedTarget = {
  4033. relatedTarget: toggles[i]
  4034. };
  4035. if (event && event.type === 'click') {
  4036. relatedTarget.clickEvent = event;
  4037. }
  4038. if (!context) {
  4039. continue;
  4040. }
  4041. var dropdownMenu = context._menu;
  4042. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4043. continue;
  4044. }
  4045. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4046. continue;
  4047. }
  4048. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4049. $(parent).trigger(hideEvent);
  4050. if (hideEvent.isDefaultPrevented()) {
  4051. continue;
  4052. } // If this is a touch-enabled device we remove the extra
  4053. // empty mouseover listeners we added for iOS support
  4054. if ('ontouchstart' in document.documentElement) {
  4055. $(document.body).children().off('mouseover', null, $.noop);
  4056. }
  4057. toggles[i].setAttribute('aria-expanded', 'false');
  4058. if (context._popper) {
  4059. context._popper.destroy();
  4060. }
  4061. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4062. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4063. }
  4064. };
  4065. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4066. var parent;
  4067. var selector = Util.getSelectorFromElement(element);
  4068. if (selector) {
  4069. parent = document.querySelector(selector);
  4070. }
  4071. return parent || element.parentNode;
  4072. } // eslint-disable-next-line complexity
  4073. ;
  4074. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4075. // If not input/textarea:
  4076. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4077. // If input/textarea:
  4078. // - If space key => not a dropdown command
  4079. // - If key is other than escape
  4080. // - If key is not up or down => not a dropdown command
  4081. // - If trigger inside the menu => not a dropdown command
  4082. 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)) {
  4083. return;
  4084. }
  4085. event.preventDefault();
  4086. event.stopPropagation();
  4087. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4088. return;
  4089. }
  4090. var parent = Dropdown._getParentFromElement(this);
  4091. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4092. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4093. return;
  4094. }
  4095. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4096. if (event.which === ESCAPE_KEYCODE) {
  4097. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4098. $(toggle).trigger('focus');
  4099. }
  4100. $(this).trigger('click');
  4101. return;
  4102. }
  4103. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4104. return $(item).is(':visible');
  4105. });
  4106. if (items.length === 0) {
  4107. return;
  4108. }
  4109. var index = items.indexOf(event.target);
  4110. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4111. // Up
  4112. index--;
  4113. }
  4114. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4115. // Down
  4116. index++;
  4117. }
  4118. if (index < 0) {
  4119. index = 0;
  4120. }
  4121. items[index].focus();
  4122. };
  4123. _createClass(Dropdown, null, [{
  4124. key: "VERSION",
  4125. get: function get() {
  4126. return VERSION$4;
  4127. }
  4128. }, {
  4129. key: "Default",
  4130. get: function get() {
  4131. return Default$2;
  4132. }
  4133. }, {
  4134. key: "DefaultType",
  4135. get: function get() {
  4136. return DefaultType$2;
  4137. }
  4138. }]);
  4139. return Dropdown;
  4140. }();
  4141. /**
  4142. * ------------------------------------------------------------------------
  4143. * Data Api implementation
  4144. * ------------------------------------------------------------------------
  4145. */
  4146. $(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) {
  4147. event.preventDefault();
  4148. event.stopPropagation();
  4149. Dropdown._jQueryInterface.call($(this), 'toggle');
  4150. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4151. e.stopPropagation();
  4152. });
  4153. /**
  4154. * ------------------------------------------------------------------------
  4155. * jQuery
  4156. * ------------------------------------------------------------------------
  4157. */
  4158. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4159. $.fn[NAME$4].Constructor = Dropdown;
  4160. $.fn[NAME$4].noConflict = function () {
  4161. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4162. return Dropdown._jQueryInterface;
  4163. };
  4164. /**
  4165. * ------------------------------------------------------------------------
  4166. * Constants
  4167. * ------------------------------------------------------------------------
  4168. */
  4169. var NAME$5 = 'modal';
  4170. var VERSION$5 = '4.4.1';
  4171. var DATA_KEY$5 = 'bs.modal';
  4172. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4173. var DATA_API_KEY$5 = '.data-api';
  4174. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4175. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4176. var Default$3 = {
  4177. backdrop: true,
  4178. keyboard: true,
  4179. focus: true,
  4180. show: true
  4181. };
  4182. var DefaultType$3 = {
  4183. backdrop: '(boolean|string)',
  4184. keyboard: 'boolean',
  4185. focus: 'boolean',
  4186. show: 'boolean'
  4187. };
  4188. var Event$5 = {
  4189. HIDE: "hide" + EVENT_KEY$5,
  4190. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4191. HIDDEN: "hidden" + EVENT_KEY$5,
  4192. SHOW: "show" + EVENT_KEY$5,
  4193. SHOWN: "shown" + EVENT_KEY$5,
  4194. FOCUSIN: "focusin" + EVENT_KEY$5,
  4195. RESIZE: "resize" + EVENT_KEY$5,
  4196. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4197. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4198. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4199. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4200. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4201. };
  4202. var ClassName$5 = {
  4203. SCROLLABLE: 'modal-dialog-scrollable',
  4204. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4205. BACKDROP: 'modal-backdrop',
  4206. OPEN: 'modal-open',
  4207. FADE: 'fade',
  4208. SHOW: 'show',
  4209. STATIC: 'modal-static'
  4210. };
  4211. var Selector$5 = {
  4212. DIALOG: '.modal-dialog',
  4213. MODAL_BODY: '.modal-body',
  4214. DATA_TOGGLE: '[data-toggle="modal"]',
  4215. DATA_DISMISS: '[data-dismiss="modal"]',
  4216. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4217. STICKY_CONTENT: '.sticky-top'
  4218. };
  4219. /**
  4220. * ------------------------------------------------------------------------
  4221. * Class Definition
  4222. * ------------------------------------------------------------------------
  4223. */
  4224. var Modal =
  4225. /*#__PURE__*/
  4226. function () {
  4227. function Modal(element, config) {
  4228. this._config = this._getConfig(config);
  4229. this._element = element;
  4230. this._dialog = element.querySelector(Selector$5.DIALOG);
  4231. this._backdrop = null;
  4232. this._isShown = false;
  4233. this._isBodyOverflowing = false;
  4234. this._ignoreBackdropClick = false;
  4235. this._isTransitioning = false;
  4236. this._scrollbarWidth = 0;
  4237. } // Getters
  4238. var _proto = Modal.prototype;
  4239. // Public
  4240. _proto.toggle = function toggle(relatedTarget) {
  4241. return this._isShown ? this.hide() : this.show(relatedTarget);
  4242. };
  4243. _proto.show = function show(relatedTarget) {
  4244. var _this = this;
  4245. if (this._isShown || this._isTransitioning) {
  4246. return;
  4247. }
  4248. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4249. this._isTransitioning = true;
  4250. }
  4251. var showEvent = $.Event(Event$5.SHOW, {
  4252. relatedTarget: relatedTarget
  4253. });
  4254. $(this._element).trigger(showEvent);
  4255. if (this._isShown || showEvent.isDefaultPrevented()) {
  4256. return;
  4257. }
  4258. this._isShown = true;
  4259. this._checkScrollbar();
  4260. this._setScrollbar();
  4261. this._adjustDialog();
  4262. this._setEscapeEvent();
  4263. this._setResizeEvent();
  4264. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4265. return _this.hide(event);
  4266. });
  4267. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4268. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4269. if ($(event.target).is(_this._element)) {
  4270. _this._ignoreBackdropClick = true;
  4271. }
  4272. });
  4273. });
  4274. this._showBackdrop(function () {
  4275. return _this._showElement(relatedTarget);
  4276. });
  4277. };
  4278. _proto.hide = function hide(event) {
  4279. var _this2 = this;
  4280. if (event) {
  4281. event.preventDefault();
  4282. }
  4283. if (!this._isShown || this._isTransitioning) {
  4284. return;
  4285. }
  4286. var hideEvent = $.Event(Event$5.HIDE);
  4287. $(this._element).trigger(hideEvent);
  4288. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4289. return;
  4290. }
  4291. this._isShown = false;
  4292. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4293. if (transition) {
  4294. this._isTransitioning = true;
  4295. }
  4296. this._setEscapeEvent();
  4297. this._setResizeEvent();
  4298. $(document).off(Event$5.FOCUSIN);
  4299. $(this._element).removeClass(ClassName$5.SHOW);
  4300. $(this._element).off(Event$5.CLICK_DISMISS);
  4301. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4302. if (transition) {
  4303. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4304. $(this._element).one(Util.TRANSITION_END, function (event) {
  4305. return _this2._hideModal(event);
  4306. }).emulateTransitionEnd(transitionDuration);
  4307. } else {
  4308. this._hideModal();
  4309. }
  4310. };
  4311. _proto.dispose = function dispose() {
  4312. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4313. return $(htmlElement).off(EVENT_KEY$5);
  4314. });
  4315. /**
  4316. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4317. * Do not move `document` in `htmlElements` array
  4318. * It will remove `Event.CLICK_DATA_API` event that should remain
  4319. */
  4320. $(document).off(Event$5.FOCUSIN);
  4321. $.removeData(this._element, DATA_KEY$5);
  4322. this._config = null;
  4323. this._element = null;
  4324. this._dialog = null;
  4325. this._backdrop = null;
  4326. this._isShown = null;
  4327. this._isBodyOverflowing = null;
  4328. this._ignoreBackdropClick = null;
  4329. this._isTransitioning = null;
  4330. this._scrollbarWidth = null;
  4331. };
  4332. _proto.handleUpdate = function handleUpdate() {
  4333. this._adjustDialog();
  4334. } // Private
  4335. ;
  4336. _proto._getConfig = function _getConfig(config) {
  4337. config = _objectSpread2({}, Default$3, {}, config);
  4338. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4339. return config;
  4340. };
  4341. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4342. var _this3 = this;
  4343. if (this._config.backdrop === 'static') {
  4344. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4345. $(this._element).trigger(hideEventPrevented);
  4346. if (hideEventPrevented.defaultPrevented) {
  4347. return;
  4348. }
  4349. this._element.classList.add(ClassName$5.STATIC);
  4350. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4351. $(this._element).one(Util.TRANSITION_END, function () {
  4352. _this3._element.classList.remove(ClassName$5.STATIC);
  4353. }).emulateTransitionEnd(modalTransitionDuration);
  4354. this._element.focus();
  4355. } else {
  4356. this.hide();
  4357. }
  4358. };
  4359. _proto._showElement = function _showElement(relatedTarget) {
  4360. var _this4 = this;
  4361. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4362. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4363. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4364. // Don't move modal's DOM position
  4365. document.body.appendChild(this._element);
  4366. }
  4367. this._element.style.display = 'block';
  4368. this._element.removeAttribute('aria-hidden');
  4369. this._element.setAttribute('aria-modal', true);
  4370. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4371. modalBody.scrollTop = 0;
  4372. } else {
  4373. this._element.scrollTop = 0;
  4374. }
  4375. if (transition) {
  4376. Util.reflow(this._element);
  4377. }
  4378. $(this._element).addClass(ClassName$5.SHOW);
  4379. if (this._config.focus) {
  4380. this._enforceFocus();
  4381. }
  4382. var shownEvent = $.Event(Event$5.SHOWN, {
  4383. relatedTarget: relatedTarget
  4384. });
  4385. var transitionComplete = function transitionComplete() {
  4386. if (_this4._config.focus) {
  4387. _this4._element.focus();
  4388. }
  4389. _this4._isTransitioning = false;
  4390. $(_this4._element).trigger(shownEvent);
  4391. };
  4392. if (transition) {
  4393. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4394. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4395. } else {
  4396. transitionComplete();
  4397. }
  4398. };
  4399. _proto._enforceFocus = function _enforceFocus() {
  4400. var _this5 = this;
  4401. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4402. .on(Event$5.FOCUSIN, function (event) {
  4403. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4404. _this5._element.focus();
  4405. }
  4406. });
  4407. };
  4408. _proto._setEscapeEvent = function _setEscapeEvent() {
  4409. var _this6 = this;
  4410. if (this._isShown && this._config.keyboard) {
  4411. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4412. if (event.which === ESCAPE_KEYCODE$1) {
  4413. _this6._triggerBackdropTransition();
  4414. }
  4415. });
  4416. } else if (!this._isShown) {
  4417. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4418. }
  4419. };
  4420. _proto._setResizeEvent = function _setResizeEvent() {
  4421. var _this7 = this;
  4422. if (this._isShown) {
  4423. $(window).on(Event$5.RESIZE, function (event) {
  4424. return _this7.handleUpdate(event);
  4425. });
  4426. } else {
  4427. $(window).off(Event$5.RESIZE);
  4428. }
  4429. };
  4430. _proto._hideModal = function _hideModal() {
  4431. var _this8 = this;
  4432. this._element.style.display = 'none';
  4433. this._element.setAttribute('aria-hidden', true);
  4434. this._element.removeAttribute('aria-modal');
  4435. this._isTransitioning = false;
  4436. this._showBackdrop(function () {
  4437. $(document.body).removeClass(ClassName$5.OPEN);
  4438. _this8._resetAdjustments();
  4439. _this8._resetScrollbar();
  4440. $(_this8._element).trigger(Event$5.HIDDEN);
  4441. });
  4442. };
  4443. _proto._removeBackdrop = function _removeBackdrop() {
  4444. if (this._backdrop) {
  4445. $(this._backdrop).remove();
  4446. this._backdrop = null;
  4447. }
  4448. };
  4449. _proto._showBackdrop = function _showBackdrop(callback) {
  4450. var _this9 = this;
  4451. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4452. if (this._isShown && this._config.backdrop) {
  4453. this._backdrop = document.createElement('div');
  4454. this._backdrop.className = ClassName$5.BACKDROP;
  4455. if (animate) {
  4456. this._backdrop.classList.add(animate);
  4457. }
  4458. $(this._backdrop).appendTo(document.body);
  4459. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4460. if (_this9._ignoreBackdropClick) {
  4461. _this9._ignoreBackdropClick = false;
  4462. return;
  4463. }
  4464. if (event.target !== event.currentTarget) {
  4465. return;
  4466. }
  4467. _this9._triggerBackdropTransition();
  4468. });
  4469. if (animate) {
  4470. Util.reflow(this._backdrop);
  4471. }
  4472. $(this._backdrop).addClass(ClassName$5.SHOW);
  4473. if (!callback) {
  4474. return;
  4475. }
  4476. if (!animate) {
  4477. callback();
  4478. return;
  4479. }
  4480. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4481. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4482. } else if (!this._isShown && this._backdrop) {
  4483. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4484. var callbackRemove = function callbackRemove() {
  4485. _this9._removeBackdrop();
  4486. if (callback) {
  4487. callback();
  4488. }
  4489. };
  4490. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4491. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4492. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4493. } else {
  4494. callbackRemove();
  4495. }
  4496. } else if (callback) {
  4497. callback();
  4498. }
  4499. } // ----------------------------------------------------------------------
  4500. // the following methods are used to handle overflowing modals
  4501. // todo (fat): these should probably be refactored out of modal.js
  4502. // ----------------------------------------------------------------------
  4503. ;
  4504. _proto._adjustDialog = function _adjustDialog() {
  4505. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4506. if (!this._isBodyOverflowing && isModalOverflowing) {
  4507. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4508. }
  4509. if (this._isBodyOverflowing && !isModalOverflowing) {
  4510. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4511. }
  4512. };
  4513. _proto._resetAdjustments = function _resetAdjustments() {
  4514. this._element.style.paddingLeft = '';
  4515. this._element.style.paddingRight = '';
  4516. };
  4517. _proto._checkScrollbar = function _checkScrollbar() {
  4518. var rect = document.body.getBoundingClientRect();
  4519. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4520. this._scrollbarWidth = this._getScrollbarWidth();
  4521. };
  4522. _proto._setScrollbar = function _setScrollbar() {
  4523. var _this10 = this;
  4524. if (this._isBodyOverflowing) {
  4525. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4526. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4527. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4528. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4529. $(fixedContent).each(function (index, element) {
  4530. var actualPadding = element.style.paddingRight;
  4531. var calculatedPadding = $(element).css('padding-right');
  4532. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4533. }); // Adjust sticky content margin
  4534. $(stickyContent).each(function (index, element) {
  4535. var actualMargin = element.style.marginRight;
  4536. var calculatedMargin = $(element).css('margin-right');
  4537. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4538. }); // Adjust body padding
  4539. var actualPadding = document.body.style.paddingRight;
  4540. var calculatedPadding = $(document.body).css('padding-right');
  4541. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4542. }
  4543. $(document.body).addClass(ClassName$5.OPEN);
  4544. };
  4545. _proto._resetScrollbar = function _resetScrollbar() {
  4546. // Restore fixed content padding
  4547. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4548. $(fixedContent).each(function (index, element) {
  4549. var padding = $(element).data('padding-right');
  4550. $(element).removeData('padding-right');
  4551. element.style.paddingRight = padding ? padding : '';
  4552. }); // Restore sticky content
  4553. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4554. $(elements).each(function (index, element) {
  4555. var margin = $(element).data('margin-right');
  4556. if (typeof margin !== 'undefined') {
  4557. $(element).css('margin-right', margin).removeData('margin-right');
  4558. }
  4559. }); // Restore body padding
  4560. var padding = $(document.body).data('padding-right');
  4561. $(document.body).removeData('padding-right');
  4562. document.body.style.paddingRight = padding ? padding : '';
  4563. };
  4564. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4565. // thx d.walsh
  4566. var scrollDiv = document.createElement('div');
  4567. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4568. document.body.appendChild(scrollDiv);
  4569. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4570. document.body.removeChild(scrollDiv);
  4571. return scrollbarWidth;
  4572. } // Static
  4573. ;
  4574. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4575. return this.each(function () {
  4576. var data = $(this).data(DATA_KEY$5);
  4577. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4578. if (!data) {
  4579. data = new Modal(this, _config);
  4580. $(this).data(DATA_KEY$5, data);
  4581. }
  4582. if (typeof config === 'string') {
  4583. if (typeof data[config] === 'undefined') {
  4584. throw new TypeError("No method named \"" + config + "\"");
  4585. }
  4586. data[config](relatedTarget);
  4587. } else if (_config.show) {
  4588. data.show(relatedTarget);
  4589. }
  4590. });
  4591. };
  4592. _createClass(Modal, null, [{
  4593. key: "VERSION",
  4594. get: function get() {
  4595. return VERSION$5;
  4596. }
  4597. }, {
  4598. key: "Default",
  4599. get: function get() {
  4600. return Default$3;
  4601. }
  4602. }]);
  4603. return Modal;
  4604. }();
  4605. /**
  4606. * ------------------------------------------------------------------------
  4607. * Data Api implementation
  4608. * ------------------------------------------------------------------------
  4609. */
  4610. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4611. var _this11 = this;
  4612. var target;
  4613. var selector = Util.getSelectorFromElement(this);
  4614. if (selector) {
  4615. target = document.querySelector(selector);
  4616. }
  4617. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4618. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4619. event.preventDefault();
  4620. }
  4621. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4622. if (showEvent.isDefaultPrevented()) {
  4623. // Only register focus restorer if modal will actually get shown
  4624. return;
  4625. }
  4626. $target.one(Event$5.HIDDEN, function () {
  4627. if ($(_this11).is(':visible')) {
  4628. _this11.focus();
  4629. }
  4630. });
  4631. });
  4632. Modal._jQueryInterface.call($(target), config, this);
  4633. });
  4634. /**
  4635. * ------------------------------------------------------------------------
  4636. * jQuery
  4637. * ------------------------------------------------------------------------
  4638. */
  4639. $.fn[NAME$5] = Modal._jQueryInterface;
  4640. $.fn[NAME$5].Constructor = Modal;
  4641. $.fn[NAME$5].noConflict = function () {
  4642. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4643. return Modal._jQueryInterface;
  4644. };
  4645. /**
  4646. * --------------------------------------------------------------------------
  4647. * Bootstrap (v4.4.1): tools/sanitizer.js
  4648. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4649. * --------------------------------------------------------------------------
  4650. */
  4651. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4652. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4653. var DefaultWhitelist = {
  4654. // Global attributes allowed on any supplied element below.
  4655. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4656. a: ['target', 'href', 'title', 'rel'],
  4657. area: [],
  4658. b: [],
  4659. br: [],
  4660. col: [],
  4661. code: [],
  4662. div: [],
  4663. em: [],
  4664. hr: [],
  4665. h1: [],
  4666. h2: [],
  4667. h3: [],
  4668. h4: [],
  4669. h5: [],
  4670. h6: [],
  4671. i: [],
  4672. img: ['src', 'alt', 'title', 'width', 'height'],
  4673. li: [],
  4674. ol: [],
  4675. p: [],
  4676. pre: [],
  4677. s: [],
  4678. small: [],
  4679. span: [],
  4680. sub: [],
  4681. sup: [],
  4682. strong: [],
  4683. u: [],
  4684. ul: []
  4685. };
  4686. /**
  4687. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4688. *
  4689. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4690. */
  4691. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4692. /**
  4693. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4694. *
  4695. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4696. */
  4697. 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;
  4698. function allowedAttribute(attr, allowedAttributeList) {
  4699. var attrName = attr.nodeName.toLowerCase();
  4700. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4701. if (uriAttrs.indexOf(attrName) !== -1) {
  4702. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4703. }
  4704. return true;
  4705. }
  4706. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4707. return attrRegex instanceof RegExp;
  4708. }); // Check if a regular expression validates the attribute.
  4709. for (var i = 0, l = regExp.length; i < l; i++) {
  4710. if (attrName.match(regExp[i])) {
  4711. return true;
  4712. }
  4713. }
  4714. return false;
  4715. }
  4716. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4717. if (unsafeHtml.length === 0) {
  4718. return unsafeHtml;
  4719. }
  4720. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4721. return sanitizeFn(unsafeHtml);
  4722. }
  4723. var domParser = new window.DOMParser();
  4724. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4725. var whitelistKeys = Object.keys(whiteList);
  4726. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4727. var _loop = function _loop(i, len) {
  4728. var el = elements[i];
  4729. var elName = el.nodeName.toLowerCase();
  4730. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4731. el.parentNode.removeChild(el);
  4732. return "continue";
  4733. }
  4734. var attributeList = [].slice.call(el.attributes);
  4735. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4736. attributeList.forEach(function (attr) {
  4737. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4738. el.removeAttribute(attr.nodeName);
  4739. }
  4740. });
  4741. };
  4742. for (var i = 0, len = elements.length; i < len; i++) {
  4743. var _ret = _loop(i);
  4744. if (_ret === "continue") continue;
  4745. }
  4746. return createdDocument.body.innerHTML;
  4747. }
  4748. /**
  4749. * ------------------------------------------------------------------------
  4750. * Constants
  4751. * ------------------------------------------------------------------------
  4752. */
  4753. var NAME$6 = 'tooltip';
  4754. var VERSION$6 = '4.4.1';
  4755. var DATA_KEY$6 = 'bs.tooltip';
  4756. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4757. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4758. var CLASS_PREFIX = 'bs-tooltip';
  4759. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4760. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4761. var DefaultType$4 = {
  4762. animation: 'boolean',
  4763. template: 'string',
  4764. title: '(string|element|function)',
  4765. trigger: 'string',
  4766. delay: '(number|object)',
  4767. html: 'boolean',
  4768. selector: '(string|boolean)',
  4769. placement: '(string|function)',
  4770. offset: '(number|string|function)',
  4771. container: '(string|element|boolean)',
  4772. fallbackPlacement: '(string|array)',
  4773. boundary: '(string|element)',
  4774. sanitize: 'boolean',
  4775. sanitizeFn: '(null|function)',
  4776. whiteList: 'object',
  4777. popperConfig: '(null|object)'
  4778. };
  4779. var AttachmentMap$1 = {
  4780. AUTO: 'auto',
  4781. TOP: 'top',
  4782. RIGHT: 'right',
  4783. BOTTOM: 'bottom',
  4784. LEFT: 'left'
  4785. };
  4786. var Default$4 = {
  4787. animation: true,
  4788. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4789. trigger: 'hover focus',
  4790. title: '',
  4791. delay: 0,
  4792. html: false,
  4793. selector: false,
  4794. placement: 'top',
  4795. offset: 0,
  4796. container: false,
  4797. fallbackPlacement: 'flip',
  4798. boundary: 'scrollParent',
  4799. sanitize: true,
  4800. sanitizeFn: null,
  4801. whiteList: DefaultWhitelist,
  4802. popperConfig: null
  4803. };
  4804. var HoverState = {
  4805. SHOW: 'show',
  4806. OUT: 'out'
  4807. };
  4808. var Event$6 = {
  4809. HIDE: "hide" + EVENT_KEY$6,
  4810. HIDDEN: "hidden" + EVENT_KEY$6,
  4811. SHOW: "show" + EVENT_KEY$6,
  4812. SHOWN: "shown" + EVENT_KEY$6,
  4813. INSERTED: "inserted" + EVENT_KEY$6,
  4814. CLICK: "click" + EVENT_KEY$6,
  4815. FOCUSIN: "focusin" + EVENT_KEY$6,
  4816. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4817. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4818. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4819. };
  4820. var ClassName$6 = {
  4821. FADE: 'fade',
  4822. SHOW: 'show'
  4823. };
  4824. var Selector$6 = {
  4825. TOOLTIP: '.tooltip',
  4826. TOOLTIP_INNER: '.tooltip-inner',
  4827. ARROW: '.arrow'
  4828. };
  4829. var Trigger = {
  4830. HOVER: 'hover',
  4831. FOCUS: 'focus',
  4832. CLICK: 'click',
  4833. MANUAL: 'manual'
  4834. };
  4835. /**
  4836. * ------------------------------------------------------------------------
  4837. * Class Definition
  4838. * ------------------------------------------------------------------------
  4839. */
  4840. var Tooltip =
  4841. /*#__PURE__*/
  4842. function () {
  4843. function Tooltip(element, config) {
  4844. if (typeof Popper === 'undefined') {
  4845. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4846. } // private
  4847. this._isEnabled = true;
  4848. this._timeout = 0;
  4849. this._hoverState = '';
  4850. this._activeTrigger = {};
  4851. this._popper = null; // Protected
  4852. this.element = element;
  4853. this.config = this._getConfig(config);
  4854. this.tip = null;
  4855. this._setListeners();
  4856. } // Getters
  4857. var _proto = Tooltip.prototype;
  4858. // Public
  4859. _proto.enable = function enable() {
  4860. this._isEnabled = true;
  4861. };
  4862. _proto.disable = function disable() {
  4863. this._isEnabled = false;
  4864. };
  4865. _proto.toggleEnabled = function toggleEnabled() {
  4866. this._isEnabled = !this._isEnabled;
  4867. };
  4868. _proto.toggle = function toggle(event) {
  4869. if (!this._isEnabled) {
  4870. return;
  4871. }
  4872. if (event) {
  4873. var dataKey = this.constructor.DATA_KEY;
  4874. var context = $(event.currentTarget).data(dataKey);
  4875. if (!context) {
  4876. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4877. $(event.currentTarget).data(dataKey, context);
  4878. }
  4879. context._activeTrigger.click = !context._activeTrigger.click;
  4880. if (context._isWithActiveTrigger()) {
  4881. context._enter(null, context);
  4882. } else {
  4883. context._leave(null, context);
  4884. }
  4885. } else {
  4886. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4887. this._leave(null, this);
  4888. return;
  4889. }
  4890. this._enter(null, this);
  4891. }
  4892. };
  4893. _proto.dispose = function dispose() {
  4894. clearTimeout(this._timeout);
  4895. $.removeData(this.element, this.constructor.DATA_KEY);
  4896. $(this.element).off(this.constructor.EVENT_KEY);
  4897. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4898. if (this.tip) {
  4899. $(this.tip).remove();
  4900. }
  4901. this._isEnabled = null;
  4902. this._timeout = null;
  4903. this._hoverState = null;
  4904. this._activeTrigger = null;
  4905. if (this._popper) {
  4906. this._popper.destroy();
  4907. }
  4908. this._popper = null;
  4909. this.element = null;
  4910. this.config = null;
  4911. this.tip = null;
  4912. };
  4913. _proto.show = function show() {
  4914. var _this = this;
  4915. if ($(this.element).css('display') === 'none') {
  4916. throw new Error('Please use show on visible elements');
  4917. }
  4918. var showEvent = $.Event(this.constructor.Event.SHOW);
  4919. if (this.isWithContent() && this._isEnabled) {
  4920. $(this.element).trigger(showEvent);
  4921. var shadowRoot = Util.findShadowRoot(this.element);
  4922. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4923. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4924. return;
  4925. }
  4926. var tip = this.getTipElement();
  4927. var tipId = Util.getUID(this.constructor.NAME);
  4928. tip.setAttribute('id', tipId);
  4929. this.element.setAttribute('aria-describedby', tipId);
  4930. this.setContent();
  4931. if (this.config.animation) {
  4932. $(tip).addClass(ClassName$6.FADE);
  4933. }
  4934. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4935. var attachment = this._getAttachment(placement);
  4936. this.addAttachmentClass(attachment);
  4937. var container = this._getContainer();
  4938. $(tip).data(this.constructor.DATA_KEY, this);
  4939. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4940. $(tip).appendTo(container);
  4941. }
  4942. $(this.element).trigger(this.constructor.Event.INSERTED);
  4943. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4944. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4945. // empty mouseover listeners to the body's immediate children;
  4946. // only needed because of broken event delegation on iOS
  4947. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4948. if ('ontouchstart' in document.documentElement) {
  4949. $(document.body).children().on('mouseover', null, $.noop);
  4950. }
  4951. var complete = function complete() {
  4952. if (_this.config.animation) {
  4953. _this._fixTransition();
  4954. }
  4955. var prevHoverState = _this._hoverState;
  4956. _this._hoverState = null;
  4957. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4958. if (prevHoverState === HoverState.OUT) {
  4959. _this._leave(null, _this);
  4960. }
  4961. };
  4962. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4963. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4964. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4965. } else {
  4966. complete();
  4967. }
  4968. }
  4969. };
  4970. _proto.hide = function hide(callback) {
  4971. var _this2 = this;
  4972. var tip = this.getTipElement();
  4973. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4974. var complete = function complete() {
  4975. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4976. tip.parentNode.removeChild(tip);
  4977. }
  4978. _this2._cleanTipClass();
  4979. _this2.element.removeAttribute('aria-describedby');
  4980. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4981. if (_this2._popper !== null) {
  4982. _this2._popper.destroy();
  4983. }
  4984. if (callback) {
  4985. callback();
  4986. }
  4987. };
  4988. $(this.element).trigger(hideEvent);
  4989. if (hideEvent.isDefaultPrevented()) {
  4990. return;
  4991. }
  4992. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4993. // empty mouseover listeners we added for iOS support
  4994. if ('ontouchstart' in document.documentElement) {
  4995. $(document.body).children().off('mouseover', null, $.noop);
  4996. }
  4997. this._activeTrigger[Trigger.CLICK] = false;
  4998. this._activeTrigger[Trigger.FOCUS] = false;
  4999. this._activeTrigger[Trigger.HOVER] = false;
  5000. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5001. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5002. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5003. } else {
  5004. complete();
  5005. }
  5006. this._hoverState = '';
  5007. };
  5008. _proto.update = function update() {
  5009. if (this._popper !== null) {
  5010. this._popper.scheduleUpdate();
  5011. }
  5012. } // Protected
  5013. ;
  5014. _proto.isWithContent = function isWithContent() {
  5015. return Boolean(this.getTitle());
  5016. };
  5017. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5018. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5019. };
  5020. _proto.getTipElement = function getTipElement() {
  5021. this.tip = this.tip || $(this.config.template)[0];
  5022. return this.tip;
  5023. };
  5024. _proto.setContent = function setContent() {
  5025. var tip = this.getTipElement();
  5026. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5027. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5028. };
  5029. _proto.setElementContent = function setElementContent($element, content) {
  5030. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5031. // Content is a DOM node or a jQuery
  5032. if (this.config.html) {
  5033. if (!$(content).parent().is($element)) {
  5034. $element.empty().append(content);
  5035. }
  5036. } else {
  5037. $element.text($(content).text());
  5038. }
  5039. return;
  5040. }
  5041. if (this.config.html) {
  5042. if (this.config.sanitize) {
  5043. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5044. }
  5045. $element.html(content);
  5046. } else {
  5047. $element.text(content);
  5048. }
  5049. };
  5050. _proto.getTitle = function getTitle() {
  5051. var title = this.element.getAttribute('data-original-title');
  5052. if (!title) {
  5053. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5054. }
  5055. return title;
  5056. } // Private
  5057. ;
  5058. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5059. var _this3 = this;
  5060. var defaultBsConfig = {
  5061. placement: attachment,
  5062. modifiers: {
  5063. offset: this._getOffset(),
  5064. flip: {
  5065. behavior: this.config.fallbackPlacement
  5066. },
  5067. arrow: {
  5068. element: Selector$6.ARROW
  5069. },
  5070. preventOverflow: {
  5071. boundariesElement: this.config.boundary
  5072. }
  5073. },
  5074. onCreate: function onCreate(data) {
  5075. if (data.originalPlacement !== data.placement) {
  5076. _this3._handlePopperPlacementChange(data);
  5077. }
  5078. },
  5079. onUpdate: function onUpdate(data) {
  5080. return _this3._handlePopperPlacementChange(data);
  5081. }
  5082. };
  5083. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5084. };
  5085. _proto._getOffset = function _getOffset() {
  5086. var _this4 = this;
  5087. var offset = {};
  5088. if (typeof this.config.offset === 'function') {
  5089. offset.fn = function (data) {
  5090. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5091. return data;
  5092. };
  5093. } else {
  5094. offset.offset = this.config.offset;
  5095. }
  5096. return offset;
  5097. };
  5098. _proto._getContainer = function _getContainer() {
  5099. if (this.config.container === false) {
  5100. return document.body;
  5101. }
  5102. if (Util.isElement(this.config.container)) {
  5103. return $(this.config.container);
  5104. }
  5105. return $(document).find(this.config.container);
  5106. };
  5107. _proto._getAttachment = function _getAttachment(placement) {
  5108. return AttachmentMap$1[placement.toUpperCase()];
  5109. };
  5110. _proto._setListeners = function _setListeners() {
  5111. var _this5 = this;
  5112. var triggers = this.config.trigger.split(' ');
  5113. triggers.forEach(function (trigger) {
  5114. if (trigger === 'click') {
  5115. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5116. return _this5.toggle(event);
  5117. });
  5118. } else if (trigger !== Trigger.MANUAL) {
  5119. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5120. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5121. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5122. return _this5._enter(event);
  5123. }).on(eventOut, _this5.config.selector, function (event) {
  5124. return _this5._leave(event);
  5125. });
  5126. }
  5127. });
  5128. this._hideModalHandler = function () {
  5129. if (_this5.element) {
  5130. _this5.hide();
  5131. }
  5132. };
  5133. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5134. if (this.config.selector) {
  5135. this.config = _objectSpread2({}, this.config, {
  5136. trigger: 'manual',
  5137. selector: ''
  5138. });
  5139. } else {
  5140. this._fixTitle();
  5141. }
  5142. };
  5143. _proto._fixTitle = function _fixTitle() {
  5144. var titleType = typeof this.element.getAttribute('data-original-title');
  5145. if (this.element.getAttribute('title') || titleType !== 'string') {
  5146. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5147. this.element.setAttribute('title', '');
  5148. }
  5149. };
  5150. _proto._enter = function _enter(event, context) {
  5151. var dataKey = this.constructor.DATA_KEY;
  5152. context = context || $(event.currentTarget).data(dataKey);
  5153. if (!context) {
  5154. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5155. $(event.currentTarget).data(dataKey, context);
  5156. }
  5157. if (event) {
  5158. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5159. }
  5160. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5161. context._hoverState = HoverState.SHOW;
  5162. return;
  5163. }
  5164. clearTimeout(context._timeout);
  5165. context._hoverState = HoverState.SHOW;
  5166. if (!context.config.delay || !context.config.delay.show) {
  5167. context.show();
  5168. return;
  5169. }
  5170. context._timeout = setTimeout(function () {
  5171. if (context._hoverState === HoverState.SHOW) {
  5172. context.show();
  5173. }
  5174. }, context.config.delay.show);
  5175. };
  5176. _proto._leave = function _leave(event, context) {
  5177. var dataKey = this.constructor.DATA_KEY;
  5178. context = context || $(event.currentTarget).data(dataKey);
  5179. if (!context) {
  5180. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5181. $(event.currentTarget).data(dataKey, context);
  5182. }
  5183. if (event) {
  5184. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5185. }
  5186. if (context._isWithActiveTrigger()) {
  5187. return;
  5188. }
  5189. clearTimeout(context._timeout);
  5190. context._hoverState = HoverState.OUT;
  5191. if (!context.config.delay || !context.config.delay.hide) {
  5192. context.hide();
  5193. return;
  5194. }
  5195. context._timeout = setTimeout(function () {
  5196. if (context._hoverState === HoverState.OUT) {
  5197. context.hide();
  5198. }
  5199. }, context.config.delay.hide);
  5200. };
  5201. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5202. for (var trigger in this._activeTrigger) {
  5203. if (this._activeTrigger[trigger]) {
  5204. return true;
  5205. }
  5206. }
  5207. return false;
  5208. };
  5209. _proto._getConfig = function _getConfig(config) {
  5210. var dataAttributes = $(this.element).data();
  5211. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5212. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5213. delete dataAttributes[dataAttr];
  5214. }
  5215. });
  5216. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5217. if (typeof config.delay === 'number') {
  5218. config.delay = {
  5219. show: config.delay,
  5220. hide: config.delay
  5221. };
  5222. }
  5223. if (typeof config.title === 'number') {
  5224. config.title = config.title.toString();
  5225. }
  5226. if (typeof config.content === 'number') {
  5227. config.content = config.content.toString();
  5228. }
  5229. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5230. if (config.sanitize) {
  5231. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5232. }
  5233. return config;
  5234. };
  5235. _proto._getDelegateConfig = function _getDelegateConfig() {
  5236. var config = {};
  5237. if (this.config) {
  5238. for (var key in this.config) {
  5239. if (this.constructor.Default[key] !== this.config[key]) {
  5240. config[key] = this.config[key];
  5241. }
  5242. }
  5243. }
  5244. return config;
  5245. };
  5246. _proto._cleanTipClass = function _cleanTipClass() {
  5247. var $tip = $(this.getTipElement());
  5248. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5249. if (tabClass !== null && tabClass.length) {
  5250. $tip.removeClass(tabClass.join(''));
  5251. }
  5252. };
  5253. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5254. var popperInstance = popperData.instance;
  5255. this.tip = popperInstance.popper;
  5256. this._cleanTipClass();
  5257. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5258. };
  5259. _proto._fixTransition = function _fixTransition() {
  5260. var tip = this.getTipElement();
  5261. var initConfigAnimation = this.config.animation;
  5262. if (tip.getAttribute('x-placement') !== null) {
  5263. return;
  5264. }
  5265. $(tip).removeClass(ClassName$6.FADE);
  5266. this.config.animation = false;
  5267. this.hide();
  5268. this.show();
  5269. this.config.animation = initConfigAnimation;
  5270. } // Static
  5271. ;
  5272. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5273. return this.each(function () {
  5274. var data = $(this).data(DATA_KEY$6);
  5275. var _config = typeof config === 'object' && config;
  5276. if (!data && /dispose|hide/.test(config)) {
  5277. return;
  5278. }
  5279. if (!data) {
  5280. data = new Tooltip(this, _config);
  5281. $(this).data(DATA_KEY$6, data);
  5282. }
  5283. if (typeof config === 'string') {
  5284. if (typeof data[config] === 'undefined') {
  5285. throw new TypeError("No method named \"" + config + "\"");
  5286. }
  5287. data[config]();
  5288. }
  5289. });
  5290. };
  5291. _createClass(Tooltip, null, [{
  5292. key: "VERSION",
  5293. get: function get() {
  5294. return VERSION$6;
  5295. }
  5296. }, {
  5297. key: "Default",
  5298. get: function get() {
  5299. return Default$4;
  5300. }
  5301. }, {
  5302. key: "NAME",
  5303. get: function get() {
  5304. return NAME$6;
  5305. }
  5306. }, {
  5307. key: "DATA_KEY",
  5308. get: function get() {
  5309. return DATA_KEY$6;
  5310. }
  5311. }, {
  5312. key: "Event",
  5313. get: function get() {
  5314. return Event$6;
  5315. }
  5316. }, {
  5317. key: "EVENT_KEY",
  5318. get: function get() {
  5319. return EVENT_KEY$6;
  5320. }
  5321. }, {
  5322. key: "DefaultType",
  5323. get: function get() {
  5324. return DefaultType$4;
  5325. }
  5326. }]);
  5327. return Tooltip;
  5328. }();
  5329. /**
  5330. * ------------------------------------------------------------------------
  5331. * jQuery
  5332. * ------------------------------------------------------------------------
  5333. */
  5334. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5335. $.fn[NAME$6].Constructor = Tooltip;
  5336. $.fn[NAME$6].noConflict = function () {
  5337. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5338. return Tooltip._jQueryInterface;
  5339. };
  5340. /**
  5341. * ------------------------------------------------------------------------
  5342. * Constants
  5343. * ------------------------------------------------------------------------
  5344. */
  5345. var NAME$7 = 'popover';
  5346. var VERSION$7 = '4.4.1';
  5347. var DATA_KEY$7 = 'bs.popover';
  5348. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5349. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5350. var CLASS_PREFIX$1 = 'bs-popover';
  5351. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5352. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5353. placement: 'right',
  5354. trigger: 'click',
  5355. content: '',
  5356. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5357. });
  5358. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5359. content: '(string|element|function)'
  5360. });
  5361. var ClassName$7 = {
  5362. FADE: 'fade',
  5363. SHOW: 'show'
  5364. };
  5365. var Selector$7 = {
  5366. TITLE: '.popover-header',
  5367. CONTENT: '.popover-body'
  5368. };
  5369. var Event$7 = {
  5370. HIDE: "hide" + EVENT_KEY$7,
  5371. HIDDEN: "hidden" + EVENT_KEY$7,
  5372. SHOW: "show" + EVENT_KEY$7,
  5373. SHOWN: "shown" + EVENT_KEY$7,
  5374. INSERTED: "inserted" + EVENT_KEY$7,
  5375. CLICK: "click" + EVENT_KEY$7,
  5376. FOCUSIN: "focusin" + EVENT_KEY$7,
  5377. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5378. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5379. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5380. };
  5381. /**
  5382. * ------------------------------------------------------------------------
  5383. * Class Definition
  5384. * ------------------------------------------------------------------------
  5385. */
  5386. var Popover =
  5387. /*#__PURE__*/
  5388. function (_Tooltip) {
  5389. _inheritsLoose(Popover, _Tooltip);
  5390. function Popover() {
  5391. return _Tooltip.apply(this, arguments) || this;
  5392. }
  5393. var _proto = Popover.prototype;
  5394. // Overrides
  5395. _proto.isWithContent = function isWithContent() {
  5396. return this.getTitle() || this._getContent();
  5397. };
  5398. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5399. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5400. };
  5401. _proto.getTipElement = function getTipElement() {
  5402. this.tip = this.tip || $(this.config.template)[0];
  5403. return this.tip;
  5404. };
  5405. _proto.setContent = function setContent() {
  5406. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5407. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5408. var content = this._getContent();
  5409. if (typeof content === 'function') {
  5410. content = content.call(this.element);
  5411. }
  5412. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5413. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5414. } // Private
  5415. ;
  5416. _proto._getContent = function _getContent() {
  5417. return this.element.getAttribute('data-content') || this.config.content;
  5418. };
  5419. _proto._cleanTipClass = function _cleanTipClass() {
  5420. var $tip = $(this.getTipElement());
  5421. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5422. if (tabClass !== null && tabClass.length > 0) {
  5423. $tip.removeClass(tabClass.join(''));
  5424. }
  5425. } // Static
  5426. ;
  5427. Popover._jQueryInterface = function _jQueryInterface(config) {
  5428. return this.each(function () {
  5429. var data = $(this).data(DATA_KEY$7);
  5430. var _config = typeof config === 'object' ? config : null;
  5431. if (!data && /dispose|hide/.test(config)) {
  5432. return;
  5433. }
  5434. if (!data) {
  5435. data = new Popover(this, _config);
  5436. $(this).data(DATA_KEY$7, data);
  5437. }
  5438. if (typeof config === 'string') {
  5439. if (typeof data[config] === 'undefined') {
  5440. throw new TypeError("No method named \"" + config + "\"");
  5441. }
  5442. data[config]();
  5443. }
  5444. });
  5445. };
  5446. _createClass(Popover, null, [{
  5447. key: "VERSION",
  5448. // Getters
  5449. get: function get() {
  5450. return VERSION$7;
  5451. }
  5452. }, {
  5453. key: "Default",
  5454. get: function get() {
  5455. return Default$5;
  5456. }
  5457. }, {
  5458. key: "NAME",
  5459. get: function get() {
  5460. return NAME$7;
  5461. }
  5462. }, {
  5463. key: "DATA_KEY",
  5464. get: function get() {
  5465. return DATA_KEY$7;
  5466. }
  5467. }, {
  5468. key: "Event",
  5469. get: function get() {
  5470. return Event$7;
  5471. }
  5472. }, {
  5473. key: "EVENT_KEY",
  5474. get: function get() {
  5475. return EVENT_KEY$7;
  5476. }
  5477. }, {
  5478. key: "DefaultType",
  5479. get: function get() {
  5480. return DefaultType$5;
  5481. }
  5482. }]);
  5483. return Popover;
  5484. }(Tooltip);
  5485. /**
  5486. * ------------------------------------------------------------------------
  5487. * jQuery
  5488. * ------------------------------------------------------------------------
  5489. */
  5490. $.fn[NAME$7] = Popover._jQueryInterface;
  5491. $.fn[NAME$7].Constructor = Popover;
  5492. $.fn[NAME$7].noConflict = function () {
  5493. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5494. return Popover._jQueryInterface;
  5495. };
  5496. /**
  5497. * ------------------------------------------------------------------------
  5498. * Constants
  5499. * ------------------------------------------------------------------------
  5500. */
  5501. var NAME$8 = 'scrollspy';
  5502. var VERSION$8 = '4.4.1';
  5503. var DATA_KEY$8 = 'bs.scrollspy';
  5504. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5505. var DATA_API_KEY$6 = '.data-api';
  5506. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5507. var Default$6 = {
  5508. offset: 10,
  5509. method: 'auto',
  5510. target: ''
  5511. };
  5512. var DefaultType$6 = {
  5513. offset: 'number',
  5514. method: 'string',
  5515. target: '(string|element)'
  5516. };
  5517. var Event$8 = {
  5518. ACTIVATE: "activate" + EVENT_KEY$8,
  5519. SCROLL: "scroll" + EVENT_KEY$8,
  5520. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5521. };
  5522. var ClassName$8 = {
  5523. DROPDOWN_ITEM: 'dropdown-item',
  5524. DROPDOWN_MENU: 'dropdown-menu',
  5525. ACTIVE: 'active'
  5526. };
  5527. var Selector$8 = {
  5528. DATA_SPY: '[data-spy="scroll"]',
  5529. ACTIVE: '.active',
  5530. NAV_LIST_GROUP: '.nav, .list-group',
  5531. NAV_LINKS: '.nav-link',
  5532. NAV_ITEMS: '.nav-item',
  5533. LIST_ITEMS: '.list-group-item',
  5534. DROPDOWN: '.dropdown',
  5535. DROPDOWN_ITEMS: '.dropdown-item',
  5536. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5537. };
  5538. var OffsetMethod = {
  5539. OFFSET: 'offset',
  5540. POSITION: 'position'
  5541. };
  5542. /**
  5543. * ------------------------------------------------------------------------
  5544. * Class Definition
  5545. * ------------------------------------------------------------------------
  5546. */
  5547. var ScrollSpy =
  5548. /*#__PURE__*/
  5549. function () {
  5550. function ScrollSpy(element, config) {
  5551. var _this = this;
  5552. this._element = element;
  5553. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5554. this._config = this._getConfig(config);
  5555. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5556. this._offsets = [];
  5557. this._targets = [];
  5558. this._activeTarget = null;
  5559. this._scrollHeight = 0;
  5560. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5561. return _this._process(event);
  5562. });
  5563. this.refresh();
  5564. this._process();
  5565. } // Getters
  5566. var _proto = ScrollSpy.prototype;
  5567. // Public
  5568. _proto.refresh = function refresh() {
  5569. var _this2 = this;
  5570. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5571. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5572. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5573. this._offsets = [];
  5574. this._targets = [];
  5575. this._scrollHeight = this._getScrollHeight();
  5576. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5577. targets.map(function (element) {
  5578. var target;
  5579. var targetSelector = Util.getSelectorFromElement(element);
  5580. if (targetSelector) {
  5581. target = document.querySelector(targetSelector);
  5582. }
  5583. if (target) {
  5584. var targetBCR = target.getBoundingClientRect();
  5585. if (targetBCR.width || targetBCR.height) {
  5586. // TODO (fat): remove sketch reliance on jQuery position/offset
  5587. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5588. }
  5589. }
  5590. return null;
  5591. }).filter(function (item) {
  5592. return item;
  5593. }).sort(function (a, b) {
  5594. return a[0] - b[0];
  5595. }).forEach(function (item) {
  5596. _this2._offsets.push(item[0]);
  5597. _this2._targets.push(item[1]);
  5598. });
  5599. };
  5600. _proto.dispose = function dispose() {
  5601. $.removeData(this._element, DATA_KEY$8);
  5602. $(this._scrollElement).off(EVENT_KEY$8);
  5603. this._element = null;
  5604. this._scrollElement = null;
  5605. this._config = null;
  5606. this._selector = null;
  5607. this._offsets = null;
  5608. this._targets = null;
  5609. this._activeTarget = null;
  5610. this._scrollHeight = null;
  5611. } // Private
  5612. ;
  5613. _proto._getConfig = function _getConfig(config) {
  5614. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5615. if (typeof config.target !== 'string') {
  5616. var id = $(config.target).attr('id');
  5617. if (!id) {
  5618. id = Util.getUID(NAME$8);
  5619. $(config.target).attr('id', id);
  5620. }
  5621. config.target = "#" + id;
  5622. }
  5623. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5624. return config;
  5625. };
  5626. _proto._getScrollTop = function _getScrollTop() {
  5627. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5628. };
  5629. _proto._getScrollHeight = function _getScrollHeight() {
  5630. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5631. };
  5632. _proto._getOffsetHeight = function _getOffsetHeight() {
  5633. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5634. };
  5635. _proto._process = function _process() {
  5636. var scrollTop = this._getScrollTop() + this._config.offset;
  5637. var scrollHeight = this._getScrollHeight();
  5638. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5639. if (this._scrollHeight !== scrollHeight) {
  5640. this.refresh();
  5641. }
  5642. if (scrollTop >= maxScroll) {
  5643. var target = this._targets[this._targets.length - 1];
  5644. if (this._activeTarget !== target) {
  5645. this._activate(target);
  5646. }
  5647. return;
  5648. }
  5649. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5650. this._activeTarget = null;
  5651. this._clear();
  5652. return;
  5653. }
  5654. var offsetLength = this._offsets.length;
  5655. for (var i = offsetLength; i--;) {
  5656. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5657. if (isActiveTarget) {
  5658. this._activate(this._targets[i]);
  5659. }
  5660. }
  5661. };
  5662. _proto._activate = function _activate(target) {
  5663. this._activeTarget = target;
  5664. this._clear();
  5665. var queries = this._selector.split(',').map(function (selector) {
  5666. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5667. });
  5668. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5669. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5670. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5671. $link.addClass(ClassName$8.ACTIVE);
  5672. } else {
  5673. // Set triggered link as active
  5674. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5675. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5676. $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
  5677. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5678. }
  5679. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5680. relatedTarget: target
  5681. });
  5682. };
  5683. _proto._clear = function _clear() {
  5684. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5685. return node.classList.contains(ClassName$8.ACTIVE);
  5686. }).forEach(function (node) {
  5687. return node.classList.remove(ClassName$8.ACTIVE);
  5688. });
  5689. } // Static
  5690. ;
  5691. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5692. return this.each(function () {
  5693. var data = $(this).data(DATA_KEY$8);
  5694. var _config = typeof config === 'object' && config;
  5695. if (!data) {
  5696. data = new ScrollSpy(this, _config);
  5697. $(this).data(DATA_KEY$8, data);
  5698. }
  5699. if (typeof config === 'string') {
  5700. if (typeof data[config] === 'undefined') {
  5701. throw new TypeError("No method named \"" + config + "\"");
  5702. }
  5703. data[config]();
  5704. }
  5705. });
  5706. };
  5707. _createClass(ScrollSpy, null, [{
  5708. key: "VERSION",
  5709. get: function get() {
  5710. return VERSION$8;
  5711. }
  5712. }, {
  5713. key: "Default",
  5714. get: function get() {
  5715. return Default$6;
  5716. }
  5717. }]);
  5718. return ScrollSpy;
  5719. }();
  5720. /**
  5721. * ------------------------------------------------------------------------
  5722. * Data Api implementation
  5723. * ------------------------------------------------------------------------
  5724. */
  5725. $(window).on(Event$8.LOAD_DATA_API, function () {
  5726. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5727. var scrollSpysLength = scrollSpys.length;
  5728. for (var i = scrollSpysLength; i--;) {
  5729. var $spy = $(scrollSpys[i]);
  5730. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5731. }
  5732. });
  5733. /**
  5734. * ------------------------------------------------------------------------
  5735. * jQuery
  5736. * ------------------------------------------------------------------------
  5737. */
  5738. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5739. $.fn[NAME$8].Constructor = ScrollSpy;
  5740. $.fn[NAME$8].noConflict = function () {
  5741. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5742. return ScrollSpy._jQueryInterface;
  5743. };
  5744. /**
  5745. * ------------------------------------------------------------------------
  5746. * Constants
  5747. * ------------------------------------------------------------------------
  5748. */
  5749. var NAME$9 = 'tab';
  5750. var VERSION$9 = '4.4.1';
  5751. var DATA_KEY$9 = 'bs.tab';
  5752. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5753. var DATA_API_KEY$7 = '.data-api';
  5754. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5755. var Event$9 = {
  5756. HIDE: "hide" + EVENT_KEY$9,
  5757. HIDDEN: "hidden" + EVENT_KEY$9,
  5758. SHOW: "show" + EVENT_KEY$9,
  5759. SHOWN: "shown" + EVENT_KEY$9,
  5760. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5761. };
  5762. var ClassName$9 = {
  5763. DROPDOWN_MENU: 'dropdown-menu',
  5764. ACTIVE: 'active',
  5765. DISABLED: 'disabled',
  5766. FADE: 'fade',
  5767. SHOW: 'show'
  5768. };
  5769. var Selector$9 = {
  5770. DROPDOWN: '.dropdown',
  5771. NAV_LIST_GROUP: '.nav, .list-group',
  5772. ACTIVE: '.active',
  5773. ACTIVE_UL: '> li > .active',
  5774. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5775. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5776. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5777. };
  5778. /**
  5779. * ------------------------------------------------------------------------
  5780. * Class Definition
  5781. * ------------------------------------------------------------------------
  5782. */
  5783. var Tab =
  5784. /*#__PURE__*/
  5785. function () {
  5786. function Tab(element) {
  5787. this._element = element;
  5788. } // Getters
  5789. var _proto = Tab.prototype;
  5790. // Public
  5791. _proto.show = function show() {
  5792. var _this = this;
  5793. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5794. return;
  5795. }
  5796. var target;
  5797. var previous;
  5798. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5799. var selector = Util.getSelectorFromElement(this._element);
  5800. if (listElement) {
  5801. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5802. previous = $.makeArray($(listElement).find(itemSelector));
  5803. previous = previous[previous.length - 1];
  5804. }
  5805. var hideEvent = $.Event(Event$9.HIDE, {
  5806. relatedTarget: this._element
  5807. });
  5808. var showEvent = $.Event(Event$9.SHOW, {
  5809. relatedTarget: previous
  5810. });
  5811. if (previous) {
  5812. $(previous).trigger(hideEvent);
  5813. }
  5814. $(this._element).trigger(showEvent);
  5815. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5816. return;
  5817. }
  5818. if (selector) {
  5819. target = document.querySelector(selector);
  5820. }
  5821. this._activate(this._element, listElement);
  5822. var complete = function complete() {
  5823. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5824. relatedTarget: _this._element
  5825. });
  5826. var shownEvent = $.Event(Event$9.SHOWN, {
  5827. relatedTarget: previous
  5828. });
  5829. $(previous).trigger(hiddenEvent);
  5830. $(_this._element).trigger(shownEvent);
  5831. };
  5832. if (target) {
  5833. this._activate(target, target.parentNode, complete);
  5834. } else {
  5835. complete();
  5836. }
  5837. };
  5838. _proto.dispose = function dispose() {
  5839. $.removeData(this._element, DATA_KEY$9);
  5840. this._element = null;
  5841. } // Private
  5842. ;
  5843. _proto._activate = function _activate(element, container, callback) {
  5844. var _this2 = this;
  5845. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5846. var active = activeElements[0];
  5847. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5848. var complete = function complete() {
  5849. return _this2._transitionComplete(element, active, callback);
  5850. };
  5851. if (active && isTransitioning) {
  5852. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5853. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5854. } else {
  5855. complete();
  5856. }
  5857. };
  5858. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5859. if (active) {
  5860. $(active).removeClass(ClassName$9.ACTIVE);
  5861. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5862. if (dropdownChild) {
  5863. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5864. }
  5865. if (active.getAttribute('role') === 'tab') {
  5866. active.setAttribute('aria-selected', false);
  5867. }
  5868. }
  5869. $(element).addClass(ClassName$9.ACTIVE);
  5870. if (element.getAttribute('role') === 'tab') {
  5871. element.setAttribute('aria-selected', true);
  5872. }
  5873. Util.reflow(element);
  5874. if (element.classList.contains(ClassName$9.FADE)) {
  5875. element.classList.add(ClassName$9.SHOW);
  5876. }
  5877. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5878. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5879. if (dropdownElement) {
  5880. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5881. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5882. }
  5883. element.setAttribute('aria-expanded', true);
  5884. }
  5885. if (callback) {
  5886. callback();
  5887. }
  5888. } // Static
  5889. ;
  5890. Tab._jQueryInterface = function _jQueryInterface(config) {
  5891. return this.each(function () {
  5892. var $this = $(this);
  5893. var data = $this.data(DATA_KEY$9);
  5894. if (!data) {
  5895. data = new Tab(this);
  5896. $this.data(DATA_KEY$9, data);
  5897. }
  5898. if (typeof config === 'string') {
  5899. if (typeof data[config] === 'undefined') {
  5900. throw new TypeError("No method named \"" + config + "\"");
  5901. }
  5902. data[config]();
  5903. }
  5904. });
  5905. };
  5906. _createClass(Tab, null, [{
  5907. key: "VERSION",
  5908. get: function get() {
  5909. return VERSION$9;
  5910. }
  5911. }]);
  5912. return Tab;
  5913. }();
  5914. /**
  5915. * ------------------------------------------------------------------------
  5916. * Data Api implementation
  5917. * ------------------------------------------------------------------------
  5918. */
  5919. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5920. event.preventDefault();
  5921. Tab._jQueryInterface.call($(this), 'show');
  5922. });
  5923. /**
  5924. * ------------------------------------------------------------------------
  5925. * jQuery
  5926. * ------------------------------------------------------------------------
  5927. */
  5928. $.fn[NAME$9] = Tab._jQueryInterface;
  5929. $.fn[NAME$9].Constructor = Tab;
  5930. $.fn[NAME$9].noConflict = function () {
  5931. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5932. return Tab._jQueryInterface;
  5933. };
  5934. /**
  5935. * ------------------------------------------------------------------------
  5936. * Constants
  5937. * ------------------------------------------------------------------------
  5938. */
  5939. var NAME$a = 'toast';
  5940. var VERSION$a = '4.4.1';
  5941. var DATA_KEY$a = 'bs.toast';
  5942. var EVENT_KEY$a = "." + DATA_KEY$a;
  5943. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5944. var Event$a = {
  5945. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5946. HIDE: "hide" + EVENT_KEY$a,
  5947. HIDDEN: "hidden" + EVENT_KEY$a,
  5948. SHOW: "show" + EVENT_KEY$a,
  5949. SHOWN: "shown" + EVENT_KEY$a
  5950. };
  5951. var ClassName$a = {
  5952. FADE: 'fade',
  5953. HIDE: 'hide',
  5954. SHOW: 'show',
  5955. SHOWING: 'showing'
  5956. };
  5957. var DefaultType$7 = {
  5958. animation: 'boolean',
  5959. autohide: 'boolean',
  5960. delay: 'number'
  5961. };
  5962. var Default$7 = {
  5963. animation: true,
  5964. autohide: true,
  5965. delay: 500
  5966. };
  5967. var Selector$a = {
  5968. DATA_DISMISS: '[data-dismiss="toast"]'
  5969. };
  5970. /**
  5971. * ------------------------------------------------------------------------
  5972. * Class Definition
  5973. * ------------------------------------------------------------------------
  5974. */
  5975. var Toast =
  5976. /*#__PURE__*/
  5977. function () {
  5978. function Toast(element, config) {
  5979. this._element = element;
  5980. this._config = this._getConfig(config);
  5981. this._timeout = null;
  5982. this._setListeners();
  5983. } // Getters
  5984. var _proto = Toast.prototype;
  5985. // Public
  5986. _proto.show = function show() {
  5987. var _this = this;
  5988. var showEvent = $.Event(Event$a.SHOW);
  5989. $(this._element).trigger(showEvent);
  5990. if (showEvent.isDefaultPrevented()) {
  5991. return;
  5992. }
  5993. if (this._config.animation) {
  5994. this._element.classList.add(ClassName$a.FADE);
  5995. }
  5996. var complete = function complete() {
  5997. _this._element.classList.remove(ClassName$a.SHOWING);
  5998. _this._element.classList.add(ClassName$a.SHOW);
  5999. $(_this._element).trigger(Event$a.SHOWN);
  6000. if (_this._config.autohide) {
  6001. _this._timeout = setTimeout(function () {
  6002. _this.hide();
  6003. }, _this._config.delay);
  6004. }
  6005. };
  6006. this._element.classList.remove(ClassName$a.HIDE);
  6007. Util.reflow(this._element);
  6008. this._element.classList.add(ClassName$a.SHOWING);
  6009. if (this._config.animation) {
  6010. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6011. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6012. } else {
  6013. complete();
  6014. }
  6015. };
  6016. _proto.hide = function hide() {
  6017. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6018. return;
  6019. }
  6020. var hideEvent = $.Event(Event$a.HIDE);
  6021. $(this._element).trigger(hideEvent);
  6022. if (hideEvent.isDefaultPrevented()) {
  6023. return;
  6024. }
  6025. this._close();
  6026. };
  6027. _proto.dispose = function dispose() {
  6028. clearTimeout(this._timeout);
  6029. this._timeout = null;
  6030. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6031. this._element.classList.remove(ClassName$a.SHOW);
  6032. }
  6033. $(this._element).off(Event$a.CLICK_DISMISS);
  6034. $.removeData(this._element, DATA_KEY$a);
  6035. this._element = null;
  6036. this._config = null;
  6037. } // Private
  6038. ;
  6039. _proto._getConfig = function _getConfig(config) {
  6040. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6041. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6042. return config;
  6043. };
  6044. _proto._setListeners = function _setListeners() {
  6045. var _this2 = this;
  6046. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6047. return _this2.hide();
  6048. });
  6049. };
  6050. _proto._close = function _close() {
  6051. var _this3 = this;
  6052. var complete = function complete() {
  6053. _this3._element.classList.add(ClassName$a.HIDE);
  6054. $(_this3._element).trigger(Event$a.HIDDEN);
  6055. };
  6056. this._element.classList.remove(ClassName$a.SHOW);
  6057. if (this._config.animation) {
  6058. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6059. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6060. } else {
  6061. complete();
  6062. }
  6063. } // Static
  6064. ;
  6065. Toast._jQueryInterface = function _jQueryInterface(config) {
  6066. return this.each(function () {
  6067. var $element = $(this);
  6068. var data = $element.data(DATA_KEY$a);
  6069. var _config = typeof config === 'object' && config;
  6070. if (!data) {
  6071. data = new Toast(this, _config);
  6072. $element.data(DATA_KEY$a, data);
  6073. }
  6074. if (typeof config === 'string') {
  6075. if (typeof data[config] === 'undefined') {
  6076. throw new TypeError("No method named \"" + config + "\"");
  6077. }
  6078. data[config](this);
  6079. }
  6080. });
  6081. };
  6082. _createClass(Toast, null, [{
  6083. key: "VERSION",
  6084. get: function get() {
  6085. return VERSION$a;
  6086. }
  6087. }, {
  6088. key: "DefaultType",
  6089. get: function get() {
  6090. return DefaultType$7;
  6091. }
  6092. }, {
  6093. key: "Default",
  6094. get: function get() {
  6095. return Default$7;
  6096. }
  6097. }]);
  6098. return Toast;
  6099. }();
  6100. /**
  6101. * ------------------------------------------------------------------------
  6102. * jQuery
  6103. * ------------------------------------------------------------------------
  6104. */
  6105. $.fn[NAME$a] = Toast._jQueryInterface;
  6106. $.fn[NAME$a].Constructor = Toast;
  6107. $.fn[NAME$a].noConflict = function () {
  6108. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6109. return Toast._jQueryInterface;
  6110. };
  6111. exports.Alert = Alert;
  6112. exports.Button = Button;
  6113. exports.Carousel = Carousel;
  6114. exports.Collapse = Collapse;
  6115. exports.Dropdown = Dropdown;
  6116. exports.Modal = Modal;
  6117. exports.Popover = Popover;
  6118. exports.Scrollspy = ScrollSpy;
  6119. exports.Tab = Tab;
  6120. exports.Toast = Toast;
  6121. exports.Tooltip = Tooltip;
  6122. exports.Util = Util;
  6123. Object.defineProperty(exports, '__esModule', { value: true });
  6124. })));
  6125. //# sourceMappingURL=bootstrap.js.map
  6126. /***/ }),
  6127. /***/ "./node_modules/buffer/index.js":
  6128. /*!**************************************!*\
  6129. !*** ./node_modules/buffer/index.js ***!
  6130. \**************************************/
  6131. /*! no static exports found */
  6132. /***/ (function(module, exports, __webpack_require__) {
  6133. "use strict";
  6134. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6135. * The buffer module from node.js, for the browser.
  6136. *
  6137. * @author Feross Aboukhadijeh <http://feross.org>
  6138. * @license MIT
  6139. */
  6140. /* eslint-disable no-proto */
  6141. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6142. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6143. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6144. exports.Buffer = Buffer
  6145. exports.SlowBuffer = SlowBuffer
  6146. exports.INSPECT_MAX_BYTES = 50
  6147. /**
  6148. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6149. * === true Use Uint8Array implementation (fastest)
  6150. * === false Use Object implementation (most compatible, even IE6)
  6151. *
  6152. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6153. * Opera 11.6+, iOS 4.2+.
  6154. *
  6155. * Due to various browser bugs, sometimes the Object implementation will be used even
  6156. * when the browser supports typed arrays.
  6157. *
  6158. * Note:
  6159. *
  6160. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6161. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6162. *
  6163. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6164. *
  6165. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6166. * incorrect length in some situations.
  6167. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6168. * get the Object implementation, which is slower but behaves correctly.
  6169. */
  6170. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6171. ? global.TYPED_ARRAY_SUPPORT
  6172. : typedArraySupport()
  6173. /*
  6174. * Export kMaxLength after typed array support is determined.
  6175. */
  6176. exports.kMaxLength = kMaxLength()
  6177. function typedArraySupport () {
  6178. try {
  6179. var arr = new Uint8Array(1)
  6180. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6181. return arr.foo() === 42 && // typed array instances can be augmented
  6182. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6183. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6184. } catch (e) {
  6185. return false
  6186. }
  6187. }
  6188. function kMaxLength () {
  6189. return Buffer.TYPED_ARRAY_SUPPORT
  6190. ? 0x7fffffff
  6191. : 0x3fffffff
  6192. }
  6193. function createBuffer (that, length) {
  6194. if (kMaxLength() < length) {
  6195. throw new RangeError('Invalid typed array length')
  6196. }
  6197. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6198. // Return an augmented `Uint8Array` instance, for best performance
  6199. that = new Uint8Array(length)
  6200. that.__proto__ = Buffer.prototype
  6201. } else {
  6202. // Fallback: Return an object instance of the Buffer class
  6203. if (that === null) {
  6204. that = new Buffer(length)
  6205. }
  6206. that.length = length
  6207. }
  6208. return that
  6209. }
  6210. /**
  6211. * The Buffer constructor returns instances of `Uint8Array` that have their
  6212. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6213. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6214. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6215. * returns a single octet.
  6216. *
  6217. * The `Uint8Array` prototype remains unmodified.
  6218. */
  6219. function Buffer (arg, encodingOrOffset, length) {
  6220. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6221. return new Buffer(arg, encodingOrOffset, length)
  6222. }
  6223. // Common case.
  6224. if (typeof arg === 'number') {
  6225. if (typeof encodingOrOffset === 'string') {
  6226. throw new Error(
  6227. 'If encoding is specified then the first argument must be a string'
  6228. )
  6229. }
  6230. return allocUnsafe(this, arg)
  6231. }
  6232. return from(this, arg, encodingOrOffset, length)
  6233. }
  6234. Buffer.poolSize = 8192 // not used by this implementation
  6235. // TODO: Legacy, not needed anymore. Remove in next major version.
  6236. Buffer._augment = function (arr) {
  6237. arr.__proto__ = Buffer.prototype
  6238. return arr
  6239. }
  6240. function from (that, value, encodingOrOffset, length) {
  6241. if (typeof value === 'number') {
  6242. throw new TypeError('"value" argument must not be a number')
  6243. }
  6244. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6245. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6246. }
  6247. if (typeof value === 'string') {
  6248. return fromString(that, value, encodingOrOffset)
  6249. }
  6250. return fromObject(that, value)
  6251. }
  6252. /**
  6253. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6254. * if value is a number.
  6255. * Buffer.from(str[, encoding])
  6256. * Buffer.from(array)
  6257. * Buffer.from(buffer)
  6258. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6259. **/
  6260. Buffer.from = function (value, encodingOrOffset, length) {
  6261. return from(null, value, encodingOrOffset, length)
  6262. }
  6263. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6264. Buffer.prototype.__proto__ = Uint8Array.prototype
  6265. Buffer.__proto__ = Uint8Array
  6266. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6267. Buffer[Symbol.species] === Buffer) {
  6268. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6269. Object.defineProperty(Buffer, Symbol.species, {
  6270. value: null,
  6271. configurable: true
  6272. })
  6273. }
  6274. }
  6275. function assertSize (size) {
  6276. if (typeof size !== 'number') {
  6277. throw new TypeError('"size" argument must be a number')
  6278. } else if (size < 0) {
  6279. throw new RangeError('"size" argument must not be negative')
  6280. }
  6281. }
  6282. function alloc (that, size, fill, encoding) {
  6283. assertSize(size)
  6284. if (size <= 0) {
  6285. return createBuffer(that, size)
  6286. }
  6287. if (fill !== undefined) {
  6288. // Only pay attention to encoding if it's a string. This
  6289. // prevents accidentally sending in a number that would
  6290. // be interpretted as a start offset.
  6291. return typeof encoding === 'string'
  6292. ? createBuffer(that, size).fill(fill, encoding)
  6293. : createBuffer(that, size).fill(fill)
  6294. }
  6295. return createBuffer(that, size)
  6296. }
  6297. /**
  6298. * Creates a new filled Buffer instance.
  6299. * alloc(size[, fill[, encoding]])
  6300. **/
  6301. Buffer.alloc = function (size, fill, encoding) {
  6302. return alloc(null, size, fill, encoding)
  6303. }
  6304. function allocUnsafe (that, size) {
  6305. assertSize(size)
  6306. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6307. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6308. for (var i = 0; i < size; ++i) {
  6309. that[i] = 0
  6310. }
  6311. }
  6312. return that
  6313. }
  6314. /**
  6315. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6316. * */
  6317. Buffer.allocUnsafe = function (size) {
  6318. return allocUnsafe(null, size)
  6319. }
  6320. /**
  6321. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6322. */
  6323. Buffer.allocUnsafeSlow = function (size) {
  6324. return allocUnsafe(null, size)
  6325. }
  6326. function fromString (that, string, encoding) {
  6327. if (typeof encoding !== 'string' || encoding === '') {
  6328. encoding = 'utf8'
  6329. }
  6330. if (!Buffer.isEncoding(encoding)) {
  6331. throw new TypeError('"encoding" must be a valid string encoding')
  6332. }
  6333. var length = byteLength(string, encoding) | 0
  6334. that = createBuffer(that, length)
  6335. var actual = that.write(string, encoding)
  6336. if (actual !== length) {
  6337. // Writing a hex string, for example, that contains invalid characters will
  6338. // cause everything after the first invalid character to be ignored. (e.g.
  6339. // 'abxxcd' will be treated as 'ab')
  6340. that = that.slice(0, actual)
  6341. }
  6342. return that
  6343. }
  6344. function fromArrayLike (that, array) {
  6345. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6346. that = createBuffer(that, length)
  6347. for (var i = 0; i < length; i += 1) {
  6348. that[i] = array[i] & 255
  6349. }
  6350. return that
  6351. }
  6352. function fromArrayBuffer (that, array, byteOffset, length) {
  6353. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6354. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6355. throw new RangeError('\'offset\' is out of bounds')
  6356. }
  6357. if (array.byteLength < byteOffset + (length || 0)) {
  6358. throw new RangeError('\'length\' is out of bounds')
  6359. }
  6360. if (byteOffset === undefined && length === undefined) {
  6361. array = new Uint8Array(array)
  6362. } else if (length === undefined) {
  6363. array = new Uint8Array(array, byteOffset)
  6364. } else {
  6365. array = new Uint8Array(array, byteOffset, length)
  6366. }
  6367. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6368. // Return an augmented `Uint8Array` instance, for best performance
  6369. that = array
  6370. that.__proto__ = Buffer.prototype
  6371. } else {
  6372. // Fallback: Return an object instance of the Buffer class
  6373. that = fromArrayLike(that, array)
  6374. }
  6375. return that
  6376. }
  6377. function fromObject (that, obj) {
  6378. if (Buffer.isBuffer(obj)) {
  6379. var len = checked(obj.length) | 0
  6380. that = createBuffer(that, len)
  6381. if (that.length === 0) {
  6382. return that
  6383. }
  6384. obj.copy(that, 0, 0, len)
  6385. return that
  6386. }
  6387. if (obj) {
  6388. if ((typeof ArrayBuffer !== 'undefined' &&
  6389. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6390. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6391. return createBuffer(that, 0)
  6392. }
  6393. return fromArrayLike(that, obj)
  6394. }
  6395. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6396. return fromArrayLike(that, obj.data)
  6397. }
  6398. }
  6399. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6400. }
  6401. function checked (length) {
  6402. // Note: cannot use `length < kMaxLength()` here because that fails when
  6403. // length is NaN (which is otherwise coerced to zero.)
  6404. if (length >= kMaxLength()) {
  6405. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6406. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6407. }
  6408. return length | 0
  6409. }
  6410. function SlowBuffer (length) {
  6411. if (+length != length) { // eslint-disable-line eqeqeq
  6412. length = 0
  6413. }
  6414. return Buffer.alloc(+length)
  6415. }
  6416. Buffer.isBuffer = function isBuffer (b) {
  6417. return !!(b != null && b._isBuffer)
  6418. }
  6419. Buffer.compare = function compare (a, b) {
  6420. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6421. throw new TypeError('Arguments must be Buffers')
  6422. }
  6423. if (a === b) return 0
  6424. var x = a.length
  6425. var y = b.length
  6426. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6427. if (a[i] !== b[i]) {
  6428. x = a[i]
  6429. y = b[i]
  6430. break
  6431. }
  6432. }
  6433. if (x < y) return -1
  6434. if (y < x) return 1
  6435. return 0
  6436. }
  6437. Buffer.isEncoding = function isEncoding (encoding) {
  6438. switch (String(encoding).toLowerCase()) {
  6439. case 'hex':
  6440. case 'utf8':
  6441. case 'utf-8':
  6442. case 'ascii':
  6443. case 'latin1':
  6444. case 'binary':
  6445. case 'base64':
  6446. case 'ucs2':
  6447. case 'ucs-2':
  6448. case 'utf16le':
  6449. case 'utf-16le':
  6450. return true
  6451. default:
  6452. return false
  6453. }
  6454. }
  6455. Buffer.concat = function concat (list, length) {
  6456. if (!isArray(list)) {
  6457. throw new TypeError('"list" argument must be an Array of Buffers')
  6458. }
  6459. if (list.length === 0) {
  6460. return Buffer.alloc(0)
  6461. }
  6462. var i
  6463. if (length === undefined) {
  6464. length = 0
  6465. for (i = 0; i < list.length; ++i) {
  6466. length += list[i].length
  6467. }
  6468. }
  6469. var buffer = Buffer.allocUnsafe(length)
  6470. var pos = 0
  6471. for (i = 0; i < list.length; ++i) {
  6472. var buf = list[i]
  6473. if (!Buffer.isBuffer(buf)) {
  6474. throw new TypeError('"list" argument must be an Array of Buffers')
  6475. }
  6476. buf.copy(buffer, pos)
  6477. pos += buf.length
  6478. }
  6479. return buffer
  6480. }
  6481. function byteLength (string, encoding) {
  6482. if (Buffer.isBuffer(string)) {
  6483. return string.length
  6484. }
  6485. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6486. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6487. return string.byteLength
  6488. }
  6489. if (typeof string !== 'string') {
  6490. string = '' + string
  6491. }
  6492. var len = string.length
  6493. if (len === 0) return 0
  6494. // Use a for loop to avoid recursion
  6495. var loweredCase = false
  6496. for (;;) {
  6497. switch (encoding) {
  6498. case 'ascii':
  6499. case 'latin1':
  6500. case 'binary':
  6501. return len
  6502. case 'utf8':
  6503. case 'utf-8':
  6504. case undefined:
  6505. return utf8ToBytes(string).length
  6506. case 'ucs2':
  6507. case 'ucs-2':
  6508. case 'utf16le':
  6509. case 'utf-16le':
  6510. return len * 2
  6511. case 'hex':
  6512. return len >>> 1
  6513. case 'base64':
  6514. return base64ToBytes(string).length
  6515. default:
  6516. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6517. encoding = ('' + encoding).toLowerCase()
  6518. loweredCase = true
  6519. }
  6520. }
  6521. }
  6522. Buffer.byteLength = byteLength
  6523. function slowToString (encoding, start, end) {
  6524. var loweredCase = false
  6525. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6526. // property of a typed array.
  6527. // This behaves neither like String nor Uint8Array in that we set start/end
  6528. // to their upper/lower bounds if the value passed is out of range.
  6529. // undefined is handled specially as per ECMA-262 6th Edition,
  6530. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6531. if (start === undefined || start < 0) {
  6532. start = 0
  6533. }
  6534. // Return early if start > this.length. Done here to prevent potential uint32
  6535. // coercion fail below.
  6536. if (start > this.length) {
  6537. return ''
  6538. }
  6539. if (end === undefined || end > this.length) {
  6540. end = this.length
  6541. }
  6542. if (end <= 0) {
  6543. return ''
  6544. }
  6545. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6546. end >>>= 0
  6547. start >>>= 0
  6548. if (end <= start) {
  6549. return ''
  6550. }
  6551. if (!encoding) encoding = 'utf8'
  6552. while (true) {
  6553. switch (encoding) {
  6554. case 'hex':
  6555. return hexSlice(this, start, end)
  6556. case 'utf8':
  6557. case 'utf-8':
  6558. return utf8Slice(this, start, end)
  6559. case 'ascii':
  6560. return asciiSlice(this, start, end)
  6561. case 'latin1':
  6562. case 'binary':
  6563. return latin1Slice(this, start, end)
  6564. case 'base64':
  6565. return base64Slice(this, start, end)
  6566. case 'ucs2':
  6567. case 'ucs-2':
  6568. case 'utf16le':
  6569. case 'utf-16le':
  6570. return utf16leSlice(this, start, end)
  6571. default:
  6572. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6573. encoding = (encoding + '').toLowerCase()
  6574. loweredCase = true
  6575. }
  6576. }
  6577. }
  6578. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6579. // Buffer instances.
  6580. Buffer.prototype._isBuffer = true
  6581. function swap (b, n, m) {
  6582. var i = b[n]
  6583. b[n] = b[m]
  6584. b[m] = i
  6585. }
  6586. Buffer.prototype.swap16 = function swap16 () {
  6587. var len = this.length
  6588. if (len % 2 !== 0) {
  6589. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6590. }
  6591. for (var i = 0; i < len; i += 2) {
  6592. swap(this, i, i + 1)
  6593. }
  6594. return this
  6595. }
  6596. Buffer.prototype.swap32 = function swap32 () {
  6597. var len = this.length
  6598. if (len % 4 !== 0) {
  6599. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6600. }
  6601. for (var i = 0; i < len; i += 4) {
  6602. swap(this, i, i + 3)
  6603. swap(this, i + 1, i + 2)
  6604. }
  6605. return this
  6606. }
  6607. Buffer.prototype.swap64 = function swap64 () {
  6608. var len = this.length
  6609. if (len % 8 !== 0) {
  6610. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6611. }
  6612. for (var i = 0; i < len; i += 8) {
  6613. swap(this, i, i + 7)
  6614. swap(this, i + 1, i + 6)
  6615. swap(this, i + 2, i + 5)
  6616. swap(this, i + 3, i + 4)
  6617. }
  6618. return this
  6619. }
  6620. Buffer.prototype.toString = function toString () {
  6621. var length = this.length | 0
  6622. if (length === 0) return ''
  6623. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6624. return slowToString.apply(this, arguments)
  6625. }
  6626. Buffer.prototype.equals = function equals (b) {
  6627. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6628. if (this === b) return true
  6629. return Buffer.compare(this, b) === 0
  6630. }
  6631. Buffer.prototype.inspect = function inspect () {
  6632. var str = ''
  6633. var max = exports.INSPECT_MAX_BYTES
  6634. if (this.length > 0) {
  6635. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6636. if (this.length > max) str += ' ... '
  6637. }
  6638. return '<Buffer ' + str + '>'
  6639. }
  6640. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6641. if (!Buffer.isBuffer(target)) {
  6642. throw new TypeError('Argument must be a Buffer')
  6643. }
  6644. if (start === undefined) {
  6645. start = 0
  6646. }
  6647. if (end === undefined) {
  6648. end = target ? target.length : 0
  6649. }
  6650. if (thisStart === undefined) {
  6651. thisStart = 0
  6652. }
  6653. if (thisEnd === undefined) {
  6654. thisEnd = this.length
  6655. }
  6656. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6657. throw new RangeError('out of range index')
  6658. }
  6659. if (thisStart >= thisEnd && start >= end) {
  6660. return 0
  6661. }
  6662. if (thisStart >= thisEnd) {
  6663. return -1
  6664. }
  6665. if (start >= end) {
  6666. return 1
  6667. }
  6668. start >>>= 0
  6669. end >>>= 0
  6670. thisStart >>>= 0
  6671. thisEnd >>>= 0
  6672. if (this === target) return 0
  6673. var x = thisEnd - thisStart
  6674. var y = end - start
  6675. var len = Math.min(x, y)
  6676. var thisCopy = this.slice(thisStart, thisEnd)
  6677. var targetCopy = target.slice(start, end)
  6678. for (var i = 0; i < len; ++i) {
  6679. if (thisCopy[i] !== targetCopy[i]) {
  6680. x = thisCopy[i]
  6681. y = targetCopy[i]
  6682. break
  6683. }
  6684. }
  6685. if (x < y) return -1
  6686. if (y < x) return 1
  6687. return 0
  6688. }
  6689. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6690. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6691. //
  6692. // Arguments:
  6693. // - buffer - a Buffer to search
  6694. // - val - a string, Buffer, or number
  6695. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6696. // - encoding - an optional encoding, relevant is val is a string
  6697. // - dir - true for indexOf, false for lastIndexOf
  6698. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6699. // Empty buffer means no match
  6700. if (buffer.length === 0) return -1
  6701. // Normalize byteOffset
  6702. if (typeof byteOffset === 'string') {
  6703. encoding = byteOffset
  6704. byteOffset = 0
  6705. } else if (byteOffset > 0x7fffffff) {
  6706. byteOffset = 0x7fffffff
  6707. } else if (byteOffset < -0x80000000) {
  6708. byteOffset = -0x80000000
  6709. }
  6710. byteOffset = +byteOffset // Coerce to Number.
  6711. if (isNaN(byteOffset)) {
  6712. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6713. byteOffset = dir ? 0 : (buffer.length - 1)
  6714. }
  6715. // Normalize byteOffset: negative offsets start from the end of the buffer
  6716. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6717. if (byteOffset >= buffer.length) {
  6718. if (dir) return -1
  6719. else byteOffset = buffer.length - 1
  6720. } else if (byteOffset < 0) {
  6721. if (dir) byteOffset = 0
  6722. else return -1
  6723. }
  6724. // Normalize val
  6725. if (typeof val === 'string') {
  6726. val = Buffer.from(val, encoding)
  6727. }
  6728. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6729. if (Buffer.isBuffer(val)) {
  6730. // Special case: looking for empty string/buffer always fails
  6731. if (val.length === 0) {
  6732. return -1
  6733. }
  6734. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6735. } else if (typeof val === 'number') {
  6736. val = val & 0xFF // Search for a byte value [0-255]
  6737. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6738. typeof Uint8Array.prototype.indexOf === 'function') {
  6739. if (dir) {
  6740. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6741. } else {
  6742. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6743. }
  6744. }
  6745. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6746. }
  6747. throw new TypeError('val must be string, number or Buffer')
  6748. }
  6749. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6750. var indexSize = 1
  6751. var arrLength = arr.length
  6752. var valLength = val.length
  6753. if (encoding !== undefined) {
  6754. encoding = String(encoding).toLowerCase()
  6755. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6756. encoding === 'utf16le' || encoding === 'utf-16le') {
  6757. if (arr.length < 2 || val.length < 2) {
  6758. return -1
  6759. }
  6760. indexSize = 2
  6761. arrLength /= 2
  6762. valLength /= 2
  6763. byteOffset /= 2
  6764. }
  6765. }
  6766. function read (buf, i) {
  6767. if (indexSize === 1) {
  6768. return buf[i]
  6769. } else {
  6770. return buf.readUInt16BE(i * indexSize)
  6771. }
  6772. }
  6773. var i
  6774. if (dir) {
  6775. var foundIndex = -1
  6776. for (i = byteOffset; i < arrLength; i++) {
  6777. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6778. if (foundIndex === -1) foundIndex = i
  6779. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6780. } else {
  6781. if (foundIndex !== -1) i -= i - foundIndex
  6782. foundIndex = -1
  6783. }
  6784. }
  6785. } else {
  6786. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6787. for (i = byteOffset; i >= 0; i--) {
  6788. var found = true
  6789. for (var j = 0; j < valLength; j++) {
  6790. if (read(arr, i + j) !== read(val, j)) {
  6791. found = false
  6792. break
  6793. }
  6794. }
  6795. if (found) return i
  6796. }
  6797. }
  6798. return -1
  6799. }
  6800. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6801. return this.indexOf(val, byteOffset, encoding) !== -1
  6802. }
  6803. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6804. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6805. }
  6806. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6807. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6808. }
  6809. function hexWrite (buf, string, offset, length) {
  6810. offset = Number(offset) || 0
  6811. var remaining = buf.length - offset
  6812. if (!length) {
  6813. length = remaining
  6814. } else {
  6815. length = Number(length)
  6816. if (length > remaining) {
  6817. length = remaining
  6818. }
  6819. }
  6820. // must be an even number of digits
  6821. var strLen = string.length
  6822. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6823. if (length > strLen / 2) {
  6824. length = strLen / 2
  6825. }
  6826. for (var i = 0; i < length; ++i) {
  6827. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6828. if (isNaN(parsed)) return i
  6829. buf[offset + i] = parsed
  6830. }
  6831. return i
  6832. }
  6833. function utf8Write (buf, string, offset, length) {
  6834. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6835. }
  6836. function asciiWrite (buf, string, offset, length) {
  6837. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6838. }
  6839. function latin1Write (buf, string, offset, length) {
  6840. return asciiWrite(buf, string, offset, length)
  6841. }
  6842. function base64Write (buf, string, offset, length) {
  6843. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6844. }
  6845. function ucs2Write (buf, string, offset, length) {
  6846. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6847. }
  6848. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6849. // Buffer#write(string)
  6850. if (offset === undefined) {
  6851. encoding = 'utf8'
  6852. length = this.length
  6853. offset = 0
  6854. // Buffer#write(string, encoding)
  6855. } else if (length === undefined && typeof offset === 'string') {
  6856. encoding = offset
  6857. length = this.length
  6858. offset = 0
  6859. // Buffer#write(string, offset[, length][, encoding])
  6860. } else if (isFinite(offset)) {
  6861. offset = offset | 0
  6862. if (isFinite(length)) {
  6863. length = length | 0
  6864. if (encoding === undefined) encoding = 'utf8'
  6865. } else {
  6866. encoding = length
  6867. length = undefined
  6868. }
  6869. // legacy write(string, encoding, offset, length) - remove in v0.13
  6870. } else {
  6871. throw new Error(
  6872. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6873. )
  6874. }
  6875. var remaining = this.length - offset
  6876. if (length === undefined || length > remaining) length = remaining
  6877. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6878. throw new RangeError('Attempt to write outside buffer bounds')
  6879. }
  6880. if (!encoding) encoding = 'utf8'
  6881. var loweredCase = false
  6882. for (;;) {
  6883. switch (encoding) {
  6884. case 'hex':
  6885. return hexWrite(this, string, offset, length)
  6886. case 'utf8':
  6887. case 'utf-8':
  6888. return utf8Write(this, string, offset, length)
  6889. case 'ascii':
  6890. return asciiWrite(this, string, offset, length)
  6891. case 'latin1':
  6892. case 'binary':
  6893. return latin1Write(this, string, offset, length)
  6894. case 'base64':
  6895. // Warning: maxLength not taken into account in base64Write
  6896. return base64Write(this, string, offset, length)
  6897. case 'ucs2':
  6898. case 'ucs-2':
  6899. case 'utf16le':
  6900. case 'utf-16le':
  6901. return ucs2Write(this, string, offset, length)
  6902. default:
  6903. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6904. encoding = ('' + encoding).toLowerCase()
  6905. loweredCase = true
  6906. }
  6907. }
  6908. }
  6909. Buffer.prototype.toJSON = function toJSON () {
  6910. return {
  6911. type: 'Buffer',
  6912. data: Array.prototype.slice.call(this._arr || this, 0)
  6913. }
  6914. }
  6915. function base64Slice (buf, start, end) {
  6916. if (start === 0 && end === buf.length) {
  6917. return base64.fromByteArray(buf)
  6918. } else {
  6919. return base64.fromByteArray(buf.slice(start, end))
  6920. }
  6921. }
  6922. function utf8Slice (buf, start, end) {
  6923. end = Math.min(buf.length, end)
  6924. var res = []
  6925. var i = start
  6926. while (i < end) {
  6927. var firstByte = buf[i]
  6928. var codePoint = null
  6929. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6930. : (firstByte > 0xDF) ? 3
  6931. : (firstByte > 0xBF) ? 2
  6932. : 1
  6933. if (i + bytesPerSequence <= end) {
  6934. var secondByte, thirdByte, fourthByte, tempCodePoint
  6935. switch (bytesPerSequence) {
  6936. case 1:
  6937. if (firstByte < 0x80) {
  6938. codePoint = firstByte
  6939. }
  6940. break
  6941. case 2:
  6942. secondByte = buf[i + 1]
  6943. if ((secondByte & 0xC0) === 0x80) {
  6944. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6945. if (tempCodePoint > 0x7F) {
  6946. codePoint = tempCodePoint
  6947. }
  6948. }
  6949. break
  6950. case 3:
  6951. secondByte = buf[i + 1]
  6952. thirdByte = buf[i + 2]
  6953. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6954. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6955. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6956. codePoint = tempCodePoint
  6957. }
  6958. }
  6959. break
  6960. case 4:
  6961. secondByte = buf[i + 1]
  6962. thirdByte = buf[i + 2]
  6963. fourthByte = buf[i + 3]
  6964. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6965. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6966. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6967. codePoint = tempCodePoint
  6968. }
  6969. }
  6970. }
  6971. }
  6972. if (codePoint === null) {
  6973. // we did not generate a valid codePoint so insert a
  6974. // replacement char (U+FFFD) and advance only 1 byte
  6975. codePoint = 0xFFFD
  6976. bytesPerSequence = 1
  6977. } else if (codePoint > 0xFFFF) {
  6978. // encode to utf16 (surrogate pair dance)
  6979. codePoint -= 0x10000
  6980. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6981. codePoint = 0xDC00 | codePoint & 0x3FF
  6982. }
  6983. res.push(codePoint)
  6984. i += bytesPerSequence
  6985. }
  6986. return decodeCodePointsArray(res)
  6987. }
  6988. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6989. // the lowest limit is Chrome, with 0x10000 args.
  6990. // We go 1 magnitude less, for safety
  6991. var MAX_ARGUMENTS_LENGTH = 0x1000
  6992. function decodeCodePointsArray (codePoints) {
  6993. var len = codePoints.length
  6994. if (len <= MAX_ARGUMENTS_LENGTH) {
  6995. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6996. }
  6997. // Decode in chunks to avoid "call stack size exceeded".
  6998. var res = ''
  6999. var i = 0
  7000. while (i < len) {
  7001. res += String.fromCharCode.apply(
  7002. String,
  7003. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7004. )
  7005. }
  7006. return res
  7007. }
  7008. function asciiSlice (buf, start, end) {
  7009. var ret = ''
  7010. end = Math.min(buf.length, end)
  7011. for (var i = start; i < end; ++i) {
  7012. ret += String.fromCharCode(buf[i] & 0x7F)
  7013. }
  7014. return ret
  7015. }
  7016. function latin1Slice (buf, start, end) {
  7017. var ret = ''
  7018. end = Math.min(buf.length, end)
  7019. for (var i = start; i < end; ++i) {
  7020. ret += String.fromCharCode(buf[i])
  7021. }
  7022. return ret
  7023. }
  7024. function hexSlice (buf, start, end) {
  7025. var len = buf.length
  7026. if (!start || start < 0) start = 0
  7027. if (!end || end < 0 || end > len) end = len
  7028. var out = ''
  7029. for (var i = start; i < end; ++i) {
  7030. out += toHex(buf[i])
  7031. }
  7032. return out
  7033. }
  7034. function utf16leSlice (buf, start, end) {
  7035. var bytes = buf.slice(start, end)
  7036. var res = ''
  7037. for (var i = 0; i < bytes.length; i += 2) {
  7038. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7039. }
  7040. return res
  7041. }
  7042. Buffer.prototype.slice = function slice (start, end) {
  7043. var len = this.length
  7044. start = ~~start
  7045. end = end === undefined ? len : ~~end
  7046. if (start < 0) {
  7047. start += len
  7048. if (start < 0) start = 0
  7049. } else if (start > len) {
  7050. start = len
  7051. }
  7052. if (end < 0) {
  7053. end += len
  7054. if (end < 0) end = 0
  7055. } else if (end > len) {
  7056. end = len
  7057. }
  7058. if (end < start) end = start
  7059. var newBuf
  7060. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7061. newBuf = this.subarray(start, end)
  7062. newBuf.__proto__ = Buffer.prototype
  7063. } else {
  7064. var sliceLen = end - start
  7065. newBuf = new Buffer(sliceLen, undefined)
  7066. for (var i = 0; i < sliceLen; ++i) {
  7067. newBuf[i] = this[i + start]
  7068. }
  7069. }
  7070. return newBuf
  7071. }
  7072. /*
  7073. * Need to make sure that buffer isn't trying to write out of bounds.
  7074. */
  7075. function checkOffset (offset, ext, length) {
  7076. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7077. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7078. }
  7079. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7080. offset = offset | 0
  7081. byteLength = byteLength | 0
  7082. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7083. var val = this[offset]
  7084. var mul = 1
  7085. var i = 0
  7086. while (++i < byteLength && (mul *= 0x100)) {
  7087. val += this[offset + i] * mul
  7088. }
  7089. return val
  7090. }
  7091. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7092. offset = offset | 0
  7093. byteLength = byteLength | 0
  7094. if (!noAssert) {
  7095. checkOffset(offset, byteLength, this.length)
  7096. }
  7097. var val = this[offset + --byteLength]
  7098. var mul = 1
  7099. while (byteLength > 0 && (mul *= 0x100)) {
  7100. val += this[offset + --byteLength] * mul
  7101. }
  7102. return val
  7103. }
  7104. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7105. if (!noAssert) checkOffset(offset, 1, this.length)
  7106. return this[offset]
  7107. }
  7108. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7109. if (!noAssert) checkOffset(offset, 2, this.length)
  7110. return this[offset] | (this[offset + 1] << 8)
  7111. }
  7112. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7113. if (!noAssert) checkOffset(offset, 2, this.length)
  7114. return (this[offset] << 8) | this[offset + 1]
  7115. }
  7116. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7117. if (!noAssert) checkOffset(offset, 4, this.length)
  7118. return ((this[offset]) |
  7119. (this[offset + 1] << 8) |
  7120. (this[offset + 2] << 16)) +
  7121. (this[offset + 3] * 0x1000000)
  7122. }
  7123. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7124. if (!noAssert) checkOffset(offset, 4, this.length)
  7125. return (this[offset] * 0x1000000) +
  7126. ((this[offset + 1] << 16) |
  7127. (this[offset + 2] << 8) |
  7128. this[offset + 3])
  7129. }
  7130. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7131. offset = offset | 0
  7132. byteLength = byteLength | 0
  7133. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7134. var val = this[offset]
  7135. var mul = 1
  7136. var i = 0
  7137. while (++i < byteLength && (mul *= 0x100)) {
  7138. val += this[offset + i] * mul
  7139. }
  7140. mul *= 0x80
  7141. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7142. return val
  7143. }
  7144. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7145. offset = offset | 0
  7146. byteLength = byteLength | 0
  7147. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7148. var i = byteLength
  7149. var mul = 1
  7150. var val = this[offset + --i]
  7151. while (i > 0 && (mul *= 0x100)) {
  7152. val += this[offset + --i] * mul
  7153. }
  7154. mul *= 0x80
  7155. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7156. return val
  7157. }
  7158. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7159. if (!noAssert) checkOffset(offset, 1, this.length)
  7160. if (!(this[offset] & 0x80)) return (this[offset])
  7161. return ((0xff - this[offset] + 1) * -1)
  7162. }
  7163. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7164. if (!noAssert) checkOffset(offset, 2, this.length)
  7165. var val = this[offset] | (this[offset + 1] << 8)
  7166. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7167. }
  7168. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7169. if (!noAssert) checkOffset(offset, 2, this.length)
  7170. var val = this[offset + 1] | (this[offset] << 8)
  7171. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7172. }
  7173. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7174. if (!noAssert) checkOffset(offset, 4, this.length)
  7175. return (this[offset]) |
  7176. (this[offset + 1] << 8) |
  7177. (this[offset + 2] << 16) |
  7178. (this[offset + 3] << 24)
  7179. }
  7180. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7181. if (!noAssert) checkOffset(offset, 4, this.length)
  7182. return (this[offset] << 24) |
  7183. (this[offset + 1] << 16) |
  7184. (this[offset + 2] << 8) |
  7185. (this[offset + 3])
  7186. }
  7187. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7188. if (!noAssert) checkOffset(offset, 4, this.length)
  7189. return ieee754.read(this, offset, true, 23, 4)
  7190. }
  7191. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7192. if (!noAssert) checkOffset(offset, 4, this.length)
  7193. return ieee754.read(this, offset, false, 23, 4)
  7194. }
  7195. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7196. if (!noAssert) checkOffset(offset, 8, this.length)
  7197. return ieee754.read(this, offset, true, 52, 8)
  7198. }
  7199. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7200. if (!noAssert) checkOffset(offset, 8, this.length)
  7201. return ieee754.read(this, offset, false, 52, 8)
  7202. }
  7203. function checkInt (buf, value, offset, ext, max, min) {
  7204. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7205. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7206. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7207. }
  7208. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7209. value = +value
  7210. offset = offset | 0
  7211. byteLength = byteLength | 0
  7212. if (!noAssert) {
  7213. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7214. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7215. }
  7216. var mul = 1
  7217. var i = 0
  7218. this[offset] = value & 0xFF
  7219. while (++i < byteLength && (mul *= 0x100)) {
  7220. this[offset + i] = (value / mul) & 0xFF
  7221. }
  7222. return offset + byteLength
  7223. }
  7224. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7225. value = +value
  7226. offset = offset | 0
  7227. byteLength = byteLength | 0
  7228. if (!noAssert) {
  7229. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7230. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7231. }
  7232. var i = byteLength - 1
  7233. var mul = 1
  7234. this[offset + i] = value & 0xFF
  7235. while (--i >= 0 && (mul *= 0x100)) {
  7236. this[offset + i] = (value / mul) & 0xFF
  7237. }
  7238. return offset + byteLength
  7239. }
  7240. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7241. value = +value
  7242. offset = offset | 0
  7243. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7244. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7245. this[offset] = (value & 0xff)
  7246. return offset + 1
  7247. }
  7248. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7249. if (value < 0) value = 0xffff + value + 1
  7250. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7251. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7252. (littleEndian ? i : 1 - i) * 8
  7253. }
  7254. }
  7255. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7256. value = +value
  7257. offset = offset | 0
  7258. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7259. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7260. this[offset] = (value & 0xff)
  7261. this[offset + 1] = (value >>> 8)
  7262. } else {
  7263. objectWriteUInt16(this, value, offset, true)
  7264. }
  7265. return offset + 2
  7266. }
  7267. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7268. value = +value
  7269. offset = offset | 0
  7270. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7271. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7272. this[offset] = (value >>> 8)
  7273. this[offset + 1] = (value & 0xff)
  7274. } else {
  7275. objectWriteUInt16(this, value, offset, false)
  7276. }
  7277. return offset + 2
  7278. }
  7279. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7280. if (value < 0) value = 0xffffffff + value + 1
  7281. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7282. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7283. }
  7284. }
  7285. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7286. value = +value
  7287. offset = offset | 0
  7288. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7289. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7290. this[offset + 3] = (value >>> 24)
  7291. this[offset + 2] = (value >>> 16)
  7292. this[offset + 1] = (value >>> 8)
  7293. this[offset] = (value & 0xff)
  7294. } else {
  7295. objectWriteUInt32(this, value, offset, true)
  7296. }
  7297. return offset + 4
  7298. }
  7299. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7300. value = +value
  7301. offset = offset | 0
  7302. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7303. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7304. this[offset] = (value >>> 24)
  7305. this[offset + 1] = (value >>> 16)
  7306. this[offset + 2] = (value >>> 8)
  7307. this[offset + 3] = (value & 0xff)
  7308. } else {
  7309. objectWriteUInt32(this, value, offset, false)
  7310. }
  7311. return offset + 4
  7312. }
  7313. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7314. value = +value
  7315. offset = offset | 0
  7316. if (!noAssert) {
  7317. var limit = Math.pow(2, 8 * byteLength - 1)
  7318. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7319. }
  7320. var i = 0
  7321. var mul = 1
  7322. var sub = 0
  7323. this[offset] = value & 0xFF
  7324. while (++i < byteLength && (mul *= 0x100)) {
  7325. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7326. sub = 1
  7327. }
  7328. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7329. }
  7330. return offset + byteLength
  7331. }
  7332. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7333. value = +value
  7334. offset = offset | 0
  7335. if (!noAssert) {
  7336. var limit = Math.pow(2, 8 * byteLength - 1)
  7337. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7338. }
  7339. var i = byteLength - 1
  7340. var mul = 1
  7341. var sub = 0
  7342. this[offset + i] = value & 0xFF
  7343. while (--i >= 0 && (mul *= 0x100)) {
  7344. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7345. sub = 1
  7346. }
  7347. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7348. }
  7349. return offset + byteLength
  7350. }
  7351. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7352. value = +value
  7353. offset = offset | 0
  7354. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7355. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7356. if (value < 0) value = 0xff + value + 1
  7357. this[offset] = (value & 0xff)
  7358. return offset + 1
  7359. }
  7360. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7361. value = +value
  7362. offset = offset | 0
  7363. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7364. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7365. this[offset] = (value & 0xff)
  7366. this[offset + 1] = (value >>> 8)
  7367. } else {
  7368. objectWriteUInt16(this, value, offset, true)
  7369. }
  7370. return offset + 2
  7371. }
  7372. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7373. value = +value
  7374. offset = offset | 0
  7375. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7376. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7377. this[offset] = (value >>> 8)
  7378. this[offset + 1] = (value & 0xff)
  7379. } else {
  7380. objectWriteUInt16(this, value, offset, false)
  7381. }
  7382. return offset + 2
  7383. }
  7384. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7385. value = +value
  7386. offset = offset | 0
  7387. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7388. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7389. this[offset] = (value & 0xff)
  7390. this[offset + 1] = (value >>> 8)
  7391. this[offset + 2] = (value >>> 16)
  7392. this[offset + 3] = (value >>> 24)
  7393. } else {
  7394. objectWriteUInt32(this, value, offset, true)
  7395. }
  7396. return offset + 4
  7397. }
  7398. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7399. value = +value
  7400. offset = offset | 0
  7401. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7402. if (value < 0) value = 0xffffffff + value + 1
  7403. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7404. this[offset] = (value >>> 24)
  7405. this[offset + 1] = (value >>> 16)
  7406. this[offset + 2] = (value >>> 8)
  7407. this[offset + 3] = (value & 0xff)
  7408. } else {
  7409. objectWriteUInt32(this, value, offset, false)
  7410. }
  7411. return offset + 4
  7412. }
  7413. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7414. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7415. if (offset < 0) throw new RangeError('Index out of range')
  7416. }
  7417. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7418. if (!noAssert) {
  7419. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7420. }
  7421. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7422. return offset + 4
  7423. }
  7424. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7425. return writeFloat(this, value, offset, true, noAssert)
  7426. }
  7427. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7428. return writeFloat(this, value, offset, false, noAssert)
  7429. }
  7430. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7431. if (!noAssert) {
  7432. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7433. }
  7434. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7435. return offset + 8
  7436. }
  7437. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7438. return writeDouble(this, value, offset, true, noAssert)
  7439. }
  7440. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7441. return writeDouble(this, value, offset, false, noAssert)
  7442. }
  7443. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7444. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7445. if (!start) start = 0
  7446. if (!end && end !== 0) end = this.length
  7447. if (targetStart >= target.length) targetStart = target.length
  7448. if (!targetStart) targetStart = 0
  7449. if (end > 0 && end < start) end = start
  7450. // Copy 0 bytes; we're done
  7451. if (end === start) return 0
  7452. if (target.length === 0 || this.length === 0) return 0
  7453. // Fatal error conditions
  7454. if (targetStart < 0) {
  7455. throw new RangeError('targetStart out of bounds')
  7456. }
  7457. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7458. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7459. // Are we oob?
  7460. if (end > this.length) end = this.length
  7461. if (target.length - targetStart < end - start) {
  7462. end = target.length - targetStart + start
  7463. }
  7464. var len = end - start
  7465. var i
  7466. if (this === target && start < targetStart && targetStart < end) {
  7467. // descending copy from end
  7468. for (i = len - 1; i >= 0; --i) {
  7469. target[i + targetStart] = this[i + start]
  7470. }
  7471. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7472. // ascending copy from start
  7473. for (i = 0; i < len; ++i) {
  7474. target[i + targetStart] = this[i + start]
  7475. }
  7476. } else {
  7477. Uint8Array.prototype.set.call(
  7478. target,
  7479. this.subarray(start, start + len),
  7480. targetStart
  7481. )
  7482. }
  7483. return len
  7484. }
  7485. // Usage:
  7486. // buffer.fill(number[, offset[, end]])
  7487. // buffer.fill(buffer[, offset[, end]])
  7488. // buffer.fill(string[, offset[, end]][, encoding])
  7489. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7490. // Handle string cases:
  7491. if (typeof val === 'string') {
  7492. if (typeof start === 'string') {
  7493. encoding = start
  7494. start = 0
  7495. end = this.length
  7496. } else if (typeof end === 'string') {
  7497. encoding = end
  7498. end = this.length
  7499. }
  7500. if (val.length === 1) {
  7501. var code = val.charCodeAt(0)
  7502. if (code < 256) {
  7503. val = code
  7504. }
  7505. }
  7506. if (encoding !== undefined && typeof encoding !== 'string') {
  7507. throw new TypeError('encoding must be a string')
  7508. }
  7509. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7510. throw new TypeError('Unknown encoding: ' + encoding)
  7511. }
  7512. } else if (typeof val === 'number') {
  7513. val = val & 255
  7514. }
  7515. // Invalid ranges are not set to a default, so can range check early.
  7516. if (start < 0 || this.length < start || this.length < end) {
  7517. throw new RangeError('Out of range index')
  7518. }
  7519. if (end <= start) {
  7520. return this
  7521. }
  7522. start = start >>> 0
  7523. end = end === undefined ? this.length : end >>> 0
  7524. if (!val) val = 0
  7525. var i
  7526. if (typeof val === 'number') {
  7527. for (i = start; i < end; ++i) {
  7528. this[i] = val
  7529. }
  7530. } else {
  7531. var bytes = Buffer.isBuffer(val)
  7532. ? val
  7533. : utf8ToBytes(new Buffer(val, encoding).toString())
  7534. var len = bytes.length
  7535. for (i = 0; i < end - start; ++i) {
  7536. this[i + start] = bytes[i % len]
  7537. }
  7538. }
  7539. return this
  7540. }
  7541. // HELPER FUNCTIONS
  7542. // ================
  7543. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7544. function base64clean (str) {
  7545. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7546. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7547. // Node converts strings with length < 2 to ''
  7548. if (str.length < 2) return ''
  7549. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7550. while (str.length % 4 !== 0) {
  7551. str = str + '='
  7552. }
  7553. return str
  7554. }
  7555. function stringtrim (str) {
  7556. if (str.trim) return str.trim()
  7557. return str.replace(/^\s+|\s+$/g, '')
  7558. }
  7559. function toHex (n) {
  7560. if (n < 16) return '0' + n.toString(16)
  7561. return n.toString(16)
  7562. }
  7563. function utf8ToBytes (string, units) {
  7564. units = units || Infinity
  7565. var codePoint
  7566. var length = string.length
  7567. var leadSurrogate = null
  7568. var bytes = []
  7569. for (var i = 0; i < length; ++i) {
  7570. codePoint = string.charCodeAt(i)
  7571. // is surrogate component
  7572. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7573. // last char was a lead
  7574. if (!leadSurrogate) {
  7575. // no lead yet
  7576. if (codePoint > 0xDBFF) {
  7577. // unexpected trail
  7578. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7579. continue
  7580. } else if (i + 1 === length) {
  7581. // unpaired lead
  7582. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7583. continue
  7584. }
  7585. // valid lead
  7586. leadSurrogate = codePoint
  7587. continue
  7588. }
  7589. // 2 leads in a row
  7590. if (codePoint < 0xDC00) {
  7591. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7592. leadSurrogate = codePoint
  7593. continue
  7594. }
  7595. // valid surrogate pair
  7596. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7597. } else if (leadSurrogate) {
  7598. // valid bmp char, but last char was a lead
  7599. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7600. }
  7601. leadSurrogate = null
  7602. // encode utf8
  7603. if (codePoint < 0x80) {
  7604. if ((units -= 1) < 0) break
  7605. bytes.push(codePoint)
  7606. } else if (codePoint < 0x800) {
  7607. if ((units -= 2) < 0) break
  7608. bytes.push(
  7609. codePoint >> 0x6 | 0xC0,
  7610. codePoint & 0x3F | 0x80
  7611. )
  7612. } else if (codePoint < 0x10000) {
  7613. if ((units -= 3) < 0) break
  7614. bytes.push(
  7615. codePoint >> 0xC | 0xE0,
  7616. codePoint >> 0x6 & 0x3F | 0x80,
  7617. codePoint & 0x3F | 0x80
  7618. )
  7619. } else if (codePoint < 0x110000) {
  7620. if ((units -= 4) < 0) break
  7621. bytes.push(
  7622. codePoint >> 0x12 | 0xF0,
  7623. codePoint >> 0xC & 0x3F | 0x80,
  7624. codePoint >> 0x6 & 0x3F | 0x80,
  7625. codePoint & 0x3F | 0x80
  7626. )
  7627. } else {
  7628. throw new Error('Invalid code point')
  7629. }
  7630. }
  7631. return bytes
  7632. }
  7633. function asciiToBytes (str) {
  7634. var byteArray = []
  7635. for (var i = 0; i < str.length; ++i) {
  7636. // Node's code seems to be doing this and not & 0x7F..
  7637. byteArray.push(str.charCodeAt(i) & 0xFF)
  7638. }
  7639. return byteArray
  7640. }
  7641. function utf16leToBytes (str, units) {
  7642. var c, hi, lo
  7643. var byteArray = []
  7644. for (var i = 0; i < str.length; ++i) {
  7645. if ((units -= 2) < 0) break
  7646. c = str.charCodeAt(i)
  7647. hi = c >> 8
  7648. lo = c % 256
  7649. byteArray.push(lo)
  7650. byteArray.push(hi)
  7651. }
  7652. return byteArray
  7653. }
  7654. function base64ToBytes (str) {
  7655. return base64.toByteArray(base64clean(str))
  7656. }
  7657. function blitBuffer (src, dst, offset, length) {
  7658. for (var i = 0; i < length; ++i) {
  7659. if ((i + offset >= dst.length) || (i >= src.length)) break
  7660. dst[i + offset] = src[i]
  7661. }
  7662. return i
  7663. }
  7664. function isnan (val) {
  7665. return val !== val // eslint-disable-line no-self-compare
  7666. }
  7667. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7668. /***/ }),
  7669. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7670. /*!**************************************************!*\
  7671. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7672. \**************************************************/
  7673. /*! no static exports found */
  7674. /***/ (function(module, exports, __webpack_require__) {
  7675. /*!
  7676. * clipboard.js v2.0.4
  7677. * https://zenorocha.github.io/clipboard.js
  7678. *
  7679. * Licensed MIT © Zeno Rocha
  7680. */
  7681. (function webpackUniversalModuleDefinition(root, factory) {
  7682. if(true)
  7683. module.exports = factory();
  7684. else {}
  7685. })(this, function() {
  7686. return /******/ (function(modules) { // webpackBootstrap
  7687. /******/ // The module cache
  7688. /******/ var installedModules = {};
  7689. /******/
  7690. /******/ // The require function
  7691. /******/ function __webpack_require__(moduleId) {
  7692. /******/
  7693. /******/ // Check if module is in cache
  7694. /******/ if(installedModules[moduleId]) {
  7695. /******/ return installedModules[moduleId].exports;
  7696. /******/ }
  7697. /******/ // Create a new module (and put it into the cache)
  7698. /******/ var module = installedModules[moduleId] = {
  7699. /******/ i: moduleId,
  7700. /******/ l: false,
  7701. /******/ exports: {}
  7702. /******/ };
  7703. /******/
  7704. /******/ // Execute the module function
  7705. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7706. /******/
  7707. /******/ // Flag the module as loaded
  7708. /******/ module.l = true;
  7709. /******/
  7710. /******/ // Return the exports of the module
  7711. /******/ return module.exports;
  7712. /******/ }
  7713. /******/
  7714. /******/
  7715. /******/ // expose the modules object (__webpack_modules__)
  7716. /******/ __webpack_require__.m = modules;
  7717. /******/
  7718. /******/ // expose the module cache
  7719. /******/ __webpack_require__.c = installedModules;
  7720. /******/
  7721. /******/ // define getter function for harmony exports
  7722. /******/ __webpack_require__.d = function(exports, name, getter) {
  7723. /******/ if(!__webpack_require__.o(exports, name)) {
  7724. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7725. /******/ }
  7726. /******/ };
  7727. /******/
  7728. /******/ // define __esModule on exports
  7729. /******/ __webpack_require__.r = function(exports) {
  7730. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7731. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7732. /******/ }
  7733. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7734. /******/ };
  7735. /******/
  7736. /******/ // create a fake namespace object
  7737. /******/ // mode & 1: value is a module id, require it
  7738. /******/ // mode & 2: merge all properties of value into the ns
  7739. /******/ // mode & 4: return value when already ns object
  7740. /******/ // mode & 8|1: behave like require
  7741. /******/ __webpack_require__.t = function(value, mode) {
  7742. /******/ if(mode & 1) value = __webpack_require__(value);
  7743. /******/ if(mode & 8) return value;
  7744. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7745. /******/ var ns = Object.create(null);
  7746. /******/ __webpack_require__.r(ns);
  7747. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7748. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7749. /******/ return ns;
  7750. /******/ };
  7751. /******/
  7752. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7753. /******/ __webpack_require__.n = function(module) {
  7754. /******/ var getter = module && module.__esModule ?
  7755. /******/ function getDefault() { return module['default']; } :
  7756. /******/ function getModuleExports() { return module; };
  7757. /******/ __webpack_require__.d(getter, 'a', getter);
  7758. /******/ return getter;
  7759. /******/ };
  7760. /******/
  7761. /******/ // Object.prototype.hasOwnProperty.call
  7762. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7763. /******/
  7764. /******/ // __webpack_public_path__
  7765. /******/ __webpack_require__.p = "";
  7766. /******/
  7767. /******/
  7768. /******/ // Load entry module and return exports
  7769. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7770. /******/ })
  7771. /************************************************************************/
  7772. /******/ ([
  7773. /* 0 */
  7774. /***/ (function(module, exports, __webpack_require__) {
  7775. "use strict";
  7776. 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; };
  7777. 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; }; }();
  7778. var _clipboardAction = __webpack_require__(1);
  7779. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7780. var _tinyEmitter = __webpack_require__(3);
  7781. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7782. var _goodListener = __webpack_require__(4);
  7783. var _goodListener2 = _interopRequireDefault(_goodListener);
  7784. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7785. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7786. 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; }
  7787. 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; }
  7788. /**
  7789. * Base class which takes one or more elements, adds event listeners to them,
  7790. * and instantiates a new `ClipboardAction` on each click.
  7791. */
  7792. var Clipboard = function (_Emitter) {
  7793. _inherits(Clipboard, _Emitter);
  7794. /**
  7795. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7796. * @param {Object} options
  7797. */
  7798. function Clipboard(trigger, options) {
  7799. _classCallCheck(this, Clipboard);
  7800. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7801. _this.resolveOptions(options);
  7802. _this.listenClick(trigger);
  7803. return _this;
  7804. }
  7805. /**
  7806. * Defines if attributes would be resolved using internal setter functions
  7807. * or custom functions that were passed in the constructor.
  7808. * @param {Object} options
  7809. */
  7810. _createClass(Clipboard, [{
  7811. key: 'resolveOptions',
  7812. value: function resolveOptions() {
  7813. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7814. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7815. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7816. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7817. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7818. }
  7819. /**
  7820. * Adds a click event listener to the passed trigger.
  7821. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7822. */
  7823. }, {
  7824. key: 'listenClick',
  7825. value: function listenClick(trigger) {
  7826. var _this2 = this;
  7827. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7828. return _this2.onClick(e);
  7829. });
  7830. }
  7831. /**
  7832. * Defines a new `ClipboardAction` on each click event.
  7833. * @param {Event} e
  7834. */
  7835. }, {
  7836. key: 'onClick',
  7837. value: function onClick(e) {
  7838. var trigger = e.delegateTarget || e.currentTarget;
  7839. if (this.clipboardAction) {
  7840. this.clipboardAction = null;
  7841. }
  7842. this.clipboardAction = new _clipboardAction2.default({
  7843. action: this.action(trigger),
  7844. target: this.target(trigger),
  7845. text: this.text(trigger),
  7846. container: this.container,
  7847. trigger: trigger,
  7848. emitter: this
  7849. });
  7850. }
  7851. /**
  7852. * Default `action` lookup function.
  7853. * @param {Element} trigger
  7854. */
  7855. }, {
  7856. key: 'defaultAction',
  7857. value: function defaultAction(trigger) {
  7858. return getAttributeValue('action', trigger);
  7859. }
  7860. /**
  7861. * Default `target` lookup function.
  7862. * @param {Element} trigger
  7863. */
  7864. }, {
  7865. key: 'defaultTarget',
  7866. value: function defaultTarget(trigger) {
  7867. var selector = getAttributeValue('target', trigger);
  7868. if (selector) {
  7869. return document.querySelector(selector);
  7870. }
  7871. }
  7872. /**
  7873. * Returns the support of the given action, or all actions if no action is
  7874. * given.
  7875. * @param {String} [action]
  7876. */
  7877. }, {
  7878. key: 'defaultText',
  7879. /**
  7880. * Default `text` lookup function.
  7881. * @param {Element} trigger
  7882. */
  7883. value: function defaultText(trigger) {
  7884. return getAttributeValue('text', trigger);
  7885. }
  7886. /**
  7887. * Destroy lifecycle.
  7888. */
  7889. }, {
  7890. key: 'destroy',
  7891. value: function destroy() {
  7892. this.listener.destroy();
  7893. if (this.clipboardAction) {
  7894. this.clipboardAction.destroy();
  7895. this.clipboardAction = null;
  7896. }
  7897. }
  7898. }], [{
  7899. key: 'isSupported',
  7900. value: function isSupported() {
  7901. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7902. var actions = typeof action === 'string' ? [action] : action;
  7903. var support = !!document.queryCommandSupported;
  7904. actions.forEach(function (action) {
  7905. support = support && !!document.queryCommandSupported(action);
  7906. });
  7907. return support;
  7908. }
  7909. }]);
  7910. return Clipboard;
  7911. }(_tinyEmitter2.default);
  7912. /**
  7913. * Helper function to retrieve attribute value.
  7914. * @param {String} suffix
  7915. * @param {Element} element
  7916. */
  7917. function getAttributeValue(suffix, element) {
  7918. var attribute = 'data-clipboard-' + suffix;
  7919. if (!element.hasAttribute(attribute)) {
  7920. return;
  7921. }
  7922. return element.getAttribute(attribute);
  7923. }
  7924. module.exports = Clipboard;
  7925. /***/ }),
  7926. /* 1 */
  7927. /***/ (function(module, exports, __webpack_require__) {
  7928. "use strict";
  7929. 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; };
  7930. 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; }; }();
  7931. var _select = __webpack_require__(2);
  7932. var _select2 = _interopRequireDefault(_select);
  7933. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7934. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7935. /**
  7936. * Inner class which performs selection from either `text` or `target`
  7937. * properties and then executes copy or cut operations.
  7938. */
  7939. var ClipboardAction = function () {
  7940. /**
  7941. * @param {Object} options
  7942. */
  7943. function ClipboardAction(options) {
  7944. _classCallCheck(this, ClipboardAction);
  7945. this.resolveOptions(options);
  7946. this.initSelection();
  7947. }
  7948. /**
  7949. * Defines base properties passed from constructor.
  7950. * @param {Object} options
  7951. */
  7952. _createClass(ClipboardAction, [{
  7953. key: 'resolveOptions',
  7954. value: function resolveOptions() {
  7955. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7956. this.action = options.action;
  7957. this.container = options.container;
  7958. this.emitter = options.emitter;
  7959. this.target = options.target;
  7960. this.text = options.text;
  7961. this.trigger = options.trigger;
  7962. this.selectedText = '';
  7963. }
  7964. /**
  7965. * Decides which selection strategy is going to be applied based
  7966. * on the existence of `text` and `target` properties.
  7967. */
  7968. }, {
  7969. key: 'initSelection',
  7970. value: function initSelection() {
  7971. if (this.text) {
  7972. this.selectFake();
  7973. } else if (this.target) {
  7974. this.selectTarget();
  7975. }
  7976. }
  7977. /**
  7978. * Creates a fake textarea element, sets its value from `text` property,
  7979. * and makes a selection on it.
  7980. */
  7981. }, {
  7982. key: 'selectFake',
  7983. value: function selectFake() {
  7984. var _this = this;
  7985. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7986. this.removeFake();
  7987. this.fakeHandlerCallback = function () {
  7988. return _this.removeFake();
  7989. };
  7990. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7991. this.fakeElem = document.createElement('textarea');
  7992. // Prevent zooming on iOS
  7993. this.fakeElem.style.fontSize = '12pt';
  7994. // Reset box model
  7995. this.fakeElem.style.border = '0';
  7996. this.fakeElem.style.padding = '0';
  7997. this.fakeElem.style.margin = '0';
  7998. // Move element out of screen horizontally
  7999. this.fakeElem.style.position = 'absolute';
  8000. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8001. // Move element to the same position vertically
  8002. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8003. this.fakeElem.style.top = yPosition + 'px';
  8004. this.fakeElem.setAttribute('readonly', '');
  8005. this.fakeElem.value = this.text;
  8006. this.container.appendChild(this.fakeElem);
  8007. this.selectedText = (0, _select2.default)(this.fakeElem);
  8008. this.copyText();
  8009. }
  8010. /**
  8011. * Only removes the fake element after another click event, that way
  8012. * a user can hit `Ctrl+C` to copy because selection still exists.
  8013. */
  8014. }, {
  8015. key: 'removeFake',
  8016. value: function removeFake() {
  8017. if (this.fakeHandler) {
  8018. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8019. this.fakeHandler = null;
  8020. this.fakeHandlerCallback = null;
  8021. }
  8022. if (this.fakeElem) {
  8023. this.container.removeChild(this.fakeElem);
  8024. this.fakeElem = null;
  8025. }
  8026. }
  8027. /**
  8028. * Selects the content from element passed on `target` property.
  8029. */
  8030. }, {
  8031. key: 'selectTarget',
  8032. value: function selectTarget() {
  8033. this.selectedText = (0, _select2.default)(this.target);
  8034. this.copyText();
  8035. }
  8036. /**
  8037. * Executes the copy operation based on the current selection.
  8038. */
  8039. }, {
  8040. key: 'copyText',
  8041. value: function copyText() {
  8042. var succeeded = void 0;
  8043. try {
  8044. succeeded = document.execCommand(this.action);
  8045. } catch (err) {
  8046. succeeded = false;
  8047. }
  8048. this.handleResult(succeeded);
  8049. }
  8050. /**
  8051. * Fires an event based on the copy operation result.
  8052. * @param {Boolean} succeeded
  8053. */
  8054. }, {
  8055. key: 'handleResult',
  8056. value: function handleResult(succeeded) {
  8057. this.emitter.emit(succeeded ? 'success' : 'error', {
  8058. action: this.action,
  8059. text: this.selectedText,
  8060. trigger: this.trigger,
  8061. clearSelection: this.clearSelection.bind(this)
  8062. });
  8063. }
  8064. /**
  8065. * Moves focus away from `target` and back to the trigger, removes current selection.
  8066. */
  8067. }, {
  8068. key: 'clearSelection',
  8069. value: function clearSelection() {
  8070. if (this.trigger) {
  8071. this.trigger.focus();
  8072. }
  8073. window.getSelection().removeAllRanges();
  8074. }
  8075. /**
  8076. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8077. * @param {String} action
  8078. */
  8079. }, {
  8080. key: 'destroy',
  8081. /**
  8082. * Destroy lifecycle.
  8083. */
  8084. value: function destroy() {
  8085. this.removeFake();
  8086. }
  8087. }, {
  8088. key: 'action',
  8089. set: function set() {
  8090. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8091. this._action = action;
  8092. if (this._action !== 'copy' && this._action !== 'cut') {
  8093. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8094. }
  8095. }
  8096. /**
  8097. * Gets the `action` property.
  8098. * @return {String}
  8099. */
  8100. ,
  8101. get: function get() {
  8102. return this._action;
  8103. }
  8104. /**
  8105. * Sets the `target` property using an element
  8106. * that will be have its content copied.
  8107. * @param {Element} target
  8108. */
  8109. }, {
  8110. key: 'target',
  8111. set: function set(target) {
  8112. if (target !== undefined) {
  8113. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8114. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8115. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8116. }
  8117. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8118. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8119. }
  8120. this._target = target;
  8121. } else {
  8122. throw new Error('Invalid "target" value, use a valid Element');
  8123. }
  8124. }
  8125. }
  8126. /**
  8127. * Gets the `target` property.
  8128. * @return {String|HTMLElement}
  8129. */
  8130. ,
  8131. get: function get() {
  8132. return this._target;
  8133. }
  8134. }]);
  8135. return ClipboardAction;
  8136. }();
  8137. module.exports = ClipboardAction;
  8138. /***/ }),
  8139. /* 2 */
  8140. /***/ (function(module, exports) {
  8141. function select(element) {
  8142. var selectedText;
  8143. if (element.nodeName === 'SELECT') {
  8144. element.focus();
  8145. selectedText = element.value;
  8146. }
  8147. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8148. var isReadOnly = element.hasAttribute('readonly');
  8149. if (!isReadOnly) {
  8150. element.setAttribute('readonly', '');
  8151. }
  8152. element.select();
  8153. element.setSelectionRange(0, element.value.length);
  8154. if (!isReadOnly) {
  8155. element.removeAttribute('readonly');
  8156. }
  8157. selectedText = element.value;
  8158. }
  8159. else {
  8160. if (element.hasAttribute('contenteditable')) {
  8161. element.focus();
  8162. }
  8163. var selection = window.getSelection();
  8164. var range = document.createRange();
  8165. range.selectNodeContents(element);
  8166. selection.removeAllRanges();
  8167. selection.addRange(range);
  8168. selectedText = selection.toString();
  8169. }
  8170. return selectedText;
  8171. }
  8172. module.exports = select;
  8173. /***/ }),
  8174. /* 3 */
  8175. /***/ (function(module, exports) {
  8176. function E () {
  8177. // Keep this empty so it's easier to inherit from
  8178. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8179. }
  8180. E.prototype = {
  8181. on: function (name, callback, ctx) {
  8182. var e = this.e || (this.e = {});
  8183. (e[name] || (e[name] = [])).push({
  8184. fn: callback,
  8185. ctx: ctx
  8186. });
  8187. return this;
  8188. },
  8189. once: function (name, callback, ctx) {
  8190. var self = this;
  8191. function listener () {
  8192. self.off(name, listener);
  8193. callback.apply(ctx, arguments);
  8194. };
  8195. listener._ = callback
  8196. return this.on(name, listener, ctx);
  8197. },
  8198. emit: function (name) {
  8199. var data = [].slice.call(arguments, 1);
  8200. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8201. var i = 0;
  8202. var len = evtArr.length;
  8203. for (i; i < len; i++) {
  8204. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8205. }
  8206. return this;
  8207. },
  8208. off: function (name, callback) {
  8209. var e = this.e || (this.e = {});
  8210. var evts = e[name];
  8211. var liveEvents = [];
  8212. if (evts && callback) {
  8213. for (var i = 0, len = evts.length; i < len; i++) {
  8214. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8215. liveEvents.push(evts[i]);
  8216. }
  8217. }
  8218. // Remove event from queue to prevent memory leak
  8219. // Suggested by https://github.com/lazd
  8220. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8221. (liveEvents.length)
  8222. ? e[name] = liveEvents
  8223. : delete e[name];
  8224. return this;
  8225. }
  8226. };
  8227. module.exports = E;
  8228. /***/ }),
  8229. /* 4 */
  8230. /***/ (function(module, exports, __webpack_require__) {
  8231. var is = __webpack_require__(5);
  8232. var delegate = __webpack_require__(6);
  8233. /**
  8234. * Validates all params and calls the right
  8235. * listener function based on its target type.
  8236. *
  8237. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8238. * @param {String} type
  8239. * @param {Function} callback
  8240. * @return {Object}
  8241. */
  8242. function listen(target, type, callback) {
  8243. if (!target && !type && !callback) {
  8244. throw new Error('Missing required arguments');
  8245. }
  8246. if (!is.string(type)) {
  8247. throw new TypeError('Second argument must be a String');
  8248. }
  8249. if (!is.fn(callback)) {
  8250. throw new TypeError('Third argument must be a Function');
  8251. }
  8252. if (is.node(target)) {
  8253. return listenNode(target, type, callback);
  8254. }
  8255. else if (is.nodeList(target)) {
  8256. return listenNodeList(target, type, callback);
  8257. }
  8258. else if (is.string(target)) {
  8259. return listenSelector(target, type, callback);
  8260. }
  8261. else {
  8262. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8263. }
  8264. }
  8265. /**
  8266. * Adds an event listener to a HTML element
  8267. * and returns a remove listener function.
  8268. *
  8269. * @param {HTMLElement} node
  8270. * @param {String} type
  8271. * @param {Function} callback
  8272. * @return {Object}
  8273. */
  8274. function listenNode(node, type, callback) {
  8275. node.addEventListener(type, callback);
  8276. return {
  8277. destroy: function() {
  8278. node.removeEventListener(type, callback);
  8279. }
  8280. }
  8281. }
  8282. /**
  8283. * Add an event listener to a list of HTML elements
  8284. * and returns a remove listener function.
  8285. *
  8286. * @param {NodeList|HTMLCollection} nodeList
  8287. * @param {String} type
  8288. * @param {Function} callback
  8289. * @return {Object}
  8290. */
  8291. function listenNodeList(nodeList, type, callback) {
  8292. Array.prototype.forEach.call(nodeList, function(node) {
  8293. node.addEventListener(type, callback);
  8294. });
  8295. return {
  8296. destroy: function() {
  8297. Array.prototype.forEach.call(nodeList, function(node) {
  8298. node.removeEventListener(type, callback);
  8299. });
  8300. }
  8301. }
  8302. }
  8303. /**
  8304. * Add an event listener to a selector
  8305. * and returns a remove listener function.
  8306. *
  8307. * @param {String} selector
  8308. * @param {String} type
  8309. * @param {Function} callback
  8310. * @return {Object}
  8311. */
  8312. function listenSelector(selector, type, callback) {
  8313. return delegate(document.body, selector, type, callback);
  8314. }
  8315. module.exports = listen;
  8316. /***/ }),
  8317. /* 5 */
  8318. /***/ (function(module, exports) {
  8319. /**
  8320. * Check if argument is a HTML element.
  8321. *
  8322. * @param {Object} value
  8323. * @return {Boolean}
  8324. */
  8325. exports.node = function(value) {
  8326. return value !== undefined
  8327. && value instanceof HTMLElement
  8328. && value.nodeType === 1;
  8329. };
  8330. /**
  8331. * Check if argument is a list of HTML elements.
  8332. *
  8333. * @param {Object} value
  8334. * @return {Boolean}
  8335. */
  8336. exports.nodeList = function(value) {
  8337. var type = Object.prototype.toString.call(value);
  8338. return value !== undefined
  8339. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8340. && ('length' in value)
  8341. && (value.length === 0 || exports.node(value[0]));
  8342. };
  8343. /**
  8344. * Check if argument is a string.
  8345. *
  8346. * @param {Object} value
  8347. * @return {Boolean}
  8348. */
  8349. exports.string = function(value) {
  8350. return typeof value === 'string'
  8351. || value instanceof String;
  8352. };
  8353. /**
  8354. * Check if argument is a function.
  8355. *
  8356. * @param {Object} value
  8357. * @return {Boolean}
  8358. */
  8359. exports.fn = function(value) {
  8360. var type = Object.prototype.toString.call(value);
  8361. return type === '[object Function]';
  8362. };
  8363. /***/ }),
  8364. /* 6 */
  8365. /***/ (function(module, exports, __webpack_require__) {
  8366. var closest = __webpack_require__(7);
  8367. /**
  8368. * Delegates event to a selector.
  8369. *
  8370. * @param {Element} element
  8371. * @param {String} selector
  8372. * @param {String} type
  8373. * @param {Function} callback
  8374. * @param {Boolean} useCapture
  8375. * @return {Object}
  8376. */
  8377. function _delegate(element, selector, type, callback, useCapture) {
  8378. var listenerFn = listener.apply(this, arguments);
  8379. element.addEventListener(type, listenerFn, useCapture);
  8380. return {
  8381. destroy: function() {
  8382. element.removeEventListener(type, listenerFn, useCapture);
  8383. }
  8384. }
  8385. }
  8386. /**
  8387. * Delegates event to a selector.
  8388. *
  8389. * @param {Element|String|Array} [elements]
  8390. * @param {String} selector
  8391. * @param {String} type
  8392. * @param {Function} callback
  8393. * @param {Boolean} useCapture
  8394. * @return {Object}
  8395. */
  8396. function delegate(elements, selector, type, callback, useCapture) {
  8397. // Handle the regular Element usage
  8398. if (typeof elements.addEventListener === 'function') {
  8399. return _delegate.apply(null, arguments);
  8400. }
  8401. // Handle Element-less usage, it defaults to global delegation
  8402. if (typeof type === 'function') {
  8403. // Use `document` as the first parameter, then apply arguments
  8404. // This is a short way to .unshift `arguments` without running into deoptimizations
  8405. return _delegate.bind(null, document).apply(null, arguments);
  8406. }
  8407. // Handle Selector-based usage
  8408. if (typeof elements === 'string') {
  8409. elements = document.querySelectorAll(elements);
  8410. }
  8411. // Handle Array-like based usage
  8412. return Array.prototype.map.call(elements, function (element) {
  8413. return _delegate(element, selector, type, callback, useCapture);
  8414. });
  8415. }
  8416. /**
  8417. * Finds closest match and invokes callback.
  8418. *
  8419. * @param {Element} element
  8420. * @param {String} selector
  8421. * @param {String} type
  8422. * @param {Function} callback
  8423. * @return {Function}
  8424. */
  8425. function listener(element, selector, type, callback) {
  8426. return function(e) {
  8427. e.delegateTarget = closest(e.target, selector);
  8428. if (e.delegateTarget) {
  8429. callback.call(element, e);
  8430. }
  8431. }
  8432. }
  8433. module.exports = delegate;
  8434. /***/ }),
  8435. /* 7 */
  8436. /***/ (function(module, exports) {
  8437. var DOCUMENT_NODE_TYPE = 9;
  8438. /**
  8439. * A polyfill for Element.matches()
  8440. */
  8441. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8442. var proto = Element.prototype;
  8443. proto.matches = proto.matchesSelector ||
  8444. proto.mozMatchesSelector ||
  8445. proto.msMatchesSelector ||
  8446. proto.oMatchesSelector ||
  8447. proto.webkitMatchesSelector;
  8448. }
  8449. /**
  8450. * Finds the closest parent that matches a selector.
  8451. *
  8452. * @param {Element} element
  8453. * @param {String} selector
  8454. * @return {Function}
  8455. */
  8456. function closest (element, selector) {
  8457. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8458. if (typeof element.matches === 'function' &&
  8459. element.matches(selector)) {
  8460. return element;
  8461. }
  8462. element = element.parentNode;
  8463. }
  8464. }
  8465. module.exports = closest;
  8466. /***/ })
  8467. /******/ ]);
  8468. });
  8469. /***/ }),
  8470. /***/ "./node_modules/ieee754/index.js":
  8471. /*!***************************************!*\
  8472. !*** ./node_modules/ieee754/index.js ***!
  8473. \***************************************/
  8474. /*! no static exports found */
  8475. /***/ (function(module, exports) {
  8476. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8477. var e, m
  8478. var eLen = (nBytes * 8) - mLen - 1
  8479. var eMax = (1 << eLen) - 1
  8480. var eBias = eMax >> 1
  8481. var nBits = -7
  8482. var i = isLE ? (nBytes - 1) : 0
  8483. var d = isLE ? -1 : 1
  8484. var s = buffer[offset + i]
  8485. i += d
  8486. e = s & ((1 << (-nBits)) - 1)
  8487. s >>= (-nBits)
  8488. nBits += eLen
  8489. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8490. m = e & ((1 << (-nBits)) - 1)
  8491. e >>= (-nBits)
  8492. nBits += mLen
  8493. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8494. if (e === 0) {
  8495. e = 1 - eBias
  8496. } else if (e === eMax) {
  8497. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8498. } else {
  8499. m = m + Math.pow(2, mLen)
  8500. e = e - eBias
  8501. }
  8502. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8503. }
  8504. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8505. var e, m, c
  8506. var eLen = (nBytes * 8) - mLen - 1
  8507. var eMax = (1 << eLen) - 1
  8508. var eBias = eMax >> 1
  8509. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8510. var i = isLE ? 0 : (nBytes - 1)
  8511. var d = isLE ? 1 : -1
  8512. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8513. value = Math.abs(value)
  8514. if (isNaN(value) || value === Infinity) {
  8515. m = isNaN(value) ? 1 : 0
  8516. e = eMax
  8517. } else {
  8518. e = Math.floor(Math.log(value) / Math.LN2)
  8519. if (value * (c = Math.pow(2, -e)) < 1) {
  8520. e--
  8521. c *= 2
  8522. }
  8523. if (e + eBias >= 1) {
  8524. value += rt / c
  8525. } else {
  8526. value += rt * Math.pow(2, 1 - eBias)
  8527. }
  8528. if (value * c >= 2) {
  8529. e++
  8530. c /= 2
  8531. }
  8532. if (e + eBias >= eMax) {
  8533. m = 0
  8534. e = eMax
  8535. } else if (e + eBias >= 1) {
  8536. m = ((value * c) - 1) * Math.pow(2, mLen)
  8537. e = e + eBias
  8538. } else {
  8539. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8540. e = 0
  8541. }
  8542. }
  8543. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8544. e = (e << mLen) | m
  8545. eLen += mLen
  8546. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8547. buffer[offset + i - d] |= s * 128
  8548. }
  8549. /***/ }),
  8550. /***/ "./node_modules/isarray/index.js":
  8551. /*!***************************************!*\
  8552. !*** ./node_modules/isarray/index.js ***!
  8553. \***************************************/
  8554. /*! no static exports found */
  8555. /***/ (function(module, exports) {
  8556. var toString = {}.toString;
  8557. module.exports = Array.isArray || function (arr) {
  8558. return toString.call(arr) == '[object Array]';
  8559. };
  8560. /***/ }),
  8561. /***/ "./node_modules/jquery/dist/jquery.js":
  8562. /*!********************************************!*\
  8563. !*** ./node_modules/jquery/dist/jquery.js ***!
  8564. \********************************************/
  8565. /*! no static exports found */
  8566. /***/ (function(module, exports, __webpack_require__) {
  8567. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8568. * jQuery JavaScript Library v3.4.1
  8569. * https://jquery.com/
  8570. *
  8571. * Includes Sizzle.js
  8572. * https://sizzlejs.com/
  8573. *
  8574. * Copyright JS Foundation and other contributors
  8575. * Released under the MIT license
  8576. * https://jquery.org/license
  8577. *
  8578. * Date: 2019-05-01T21:04Z
  8579. */
  8580. ( function( global, factory ) {
  8581. "use strict";
  8582. if ( true && typeof module.exports === "object" ) {
  8583. // For CommonJS and CommonJS-like environments where a proper `window`
  8584. // is present, execute the factory and get jQuery.
  8585. // For environments that do not have a `window` with a `document`
  8586. // (such as Node.js), expose a factory as module.exports.
  8587. // This accentuates the need for the creation of a real `window`.
  8588. // e.g. var jQuery = require("jquery")(window);
  8589. // See ticket #14549 for more info.
  8590. module.exports = global.document ?
  8591. factory( global, true ) :
  8592. function( w ) {
  8593. if ( !w.document ) {
  8594. throw new Error( "jQuery requires a window with a document" );
  8595. }
  8596. return factory( w );
  8597. };
  8598. } else {
  8599. factory( global );
  8600. }
  8601. // Pass this if window is not defined yet
  8602. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8603. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8604. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8605. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8606. // enough that all such attempts are guarded in a try block.
  8607. "use strict";
  8608. var arr = [];
  8609. var document = window.document;
  8610. var getProto = Object.getPrototypeOf;
  8611. var slice = arr.slice;
  8612. var concat = arr.concat;
  8613. var push = arr.push;
  8614. var indexOf = arr.indexOf;
  8615. var class2type = {};
  8616. var toString = class2type.toString;
  8617. var hasOwn = class2type.hasOwnProperty;
  8618. var fnToString = hasOwn.toString;
  8619. var ObjectFunctionString = fnToString.call( Object );
  8620. var support = {};
  8621. var isFunction = function isFunction( obj ) {
  8622. // Support: Chrome <=57, Firefox <=52
  8623. // In some browsers, typeof returns "function" for HTML <object> elements
  8624. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8625. // We don't want to classify *any* DOM node as a function.
  8626. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8627. };
  8628. var isWindow = function isWindow( obj ) {
  8629. return obj != null && obj === obj.window;
  8630. };
  8631. var preservedScriptAttributes = {
  8632. type: true,
  8633. src: true,
  8634. nonce: true,
  8635. noModule: true
  8636. };
  8637. function DOMEval( code, node, doc ) {
  8638. doc = doc || document;
  8639. var i, val,
  8640. script = doc.createElement( "script" );
  8641. script.text = code;
  8642. if ( node ) {
  8643. for ( i in preservedScriptAttributes ) {
  8644. // Support: Firefox 64+, Edge 18+
  8645. // Some browsers don't support the "nonce" property on scripts.
  8646. // On the other hand, just using `getAttribute` is not enough as
  8647. // the `nonce` attribute is reset to an empty string whenever it
  8648. // becomes browsing-context connected.
  8649. // See https://github.com/whatwg/html/issues/2369
  8650. // See https://html.spec.whatwg.org/#nonce-attributes
  8651. // The `node.getAttribute` check was added for the sake of
  8652. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8653. // via an object.
  8654. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8655. if ( val ) {
  8656. script.setAttribute( i, val );
  8657. }
  8658. }
  8659. }
  8660. doc.head.appendChild( script ).parentNode.removeChild( script );
  8661. }
  8662. function toType( obj ) {
  8663. if ( obj == null ) {
  8664. return obj + "";
  8665. }
  8666. // Support: Android <=2.3 only (functionish RegExp)
  8667. return typeof obj === "object" || typeof obj === "function" ?
  8668. class2type[ toString.call( obj ) ] || "object" :
  8669. typeof obj;
  8670. }
  8671. /* global Symbol */
  8672. // Defining this global in .eslintrc.json would create a danger of using the global
  8673. // unguarded in another place, it seems safer to define global only for this module
  8674. var
  8675. version = "3.4.1",
  8676. // Define a local copy of jQuery
  8677. jQuery = function( selector, context ) {
  8678. // The jQuery object is actually just the init constructor 'enhanced'
  8679. // Need init if jQuery is called (just allow error to be thrown if not included)
  8680. return new jQuery.fn.init( selector, context );
  8681. },
  8682. // Support: Android <=4.0 only
  8683. // Make sure we trim BOM and NBSP
  8684. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8685. jQuery.fn = jQuery.prototype = {
  8686. // The current version of jQuery being used
  8687. jquery: version,
  8688. constructor: jQuery,
  8689. // The default length of a jQuery object is 0
  8690. length: 0,
  8691. toArray: function() {
  8692. return slice.call( this );
  8693. },
  8694. // Get the Nth element in the matched element set OR
  8695. // Get the whole matched element set as a clean array
  8696. get: function( num ) {
  8697. // Return all the elements in a clean array
  8698. if ( num == null ) {
  8699. return slice.call( this );
  8700. }
  8701. // Return just the one element from the set
  8702. return num < 0 ? this[ num + this.length ] : this[ num ];
  8703. },
  8704. // Take an array of elements and push it onto the stack
  8705. // (returning the new matched element set)
  8706. pushStack: function( elems ) {
  8707. // Build a new jQuery matched element set
  8708. var ret = jQuery.merge( this.constructor(), elems );
  8709. // Add the old object onto the stack (as a reference)
  8710. ret.prevObject = this;
  8711. // Return the newly-formed element set
  8712. return ret;
  8713. },
  8714. // Execute a callback for every element in the matched set.
  8715. each: function( callback ) {
  8716. return jQuery.each( this, callback );
  8717. },
  8718. map: function( callback ) {
  8719. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8720. return callback.call( elem, i, elem );
  8721. } ) );
  8722. },
  8723. slice: function() {
  8724. return this.pushStack( slice.apply( this, arguments ) );
  8725. },
  8726. first: function() {
  8727. return this.eq( 0 );
  8728. },
  8729. last: function() {
  8730. return this.eq( -1 );
  8731. },
  8732. eq: function( i ) {
  8733. var len = this.length,
  8734. j = +i + ( i < 0 ? len : 0 );
  8735. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8736. },
  8737. end: function() {
  8738. return this.prevObject || this.constructor();
  8739. },
  8740. // For internal use only.
  8741. // Behaves like an Array's method, not like a jQuery method.
  8742. push: push,
  8743. sort: arr.sort,
  8744. splice: arr.splice
  8745. };
  8746. jQuery.extend = jQuery.fn.extend = function() {
  8747. var options, name, src, copy, copyIsArray, clone,
  8748. target = arguments[ 0 ] || {},
  8749. i = 1,
  8750. length = arguments.length,
  8751. deep = false;
  8752. // Handle a deep copy situation
  8753. if ( typeof target === "boolean" ) {
  8754. deep = target;
  8755. // Skip the boolean and the target
  8756. target = arguments[ i ] || {};
  8757. i++;
  8758. }
  8759. // Handle case when target is a string or something (possible in deep copy)
  8760. if ( typeof target !== "object" && !isFunction( target ) ) {
  8761. target = {};
  8762. }
  8763. // Extend jQuery itself if only one argument is passed
  8764. if ( i === length ) {
  8765. target = this;
  8766. i--;
  8767. }
  8768. for ( ; i < length; i++ ) {
  8769. // Only deal with non-null/undefined values
  8770. if ( ( options = arguments[ i ] ) != null ) {
  8771. // Extend the base object
  8772. for ( name in options ) {
  8773. copy = options[ name ];
  8774. // Prevent Object.prototype pollution
  8775. // Prevent never-ending loop
  8776. if ( name === "__proto__" || target === copy ) {
  8777. continue;
  8778. }
  8779. // Recurse if we're merging plain objects or arrays
  8780. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8781. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8782. src = target[ name ];
  8783. // Ensure proper type for the source value
  8784. if ( copyIsArray && !Array.isArray( src ) ) {
  8785. clone = [];
  8786. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8787. clone = {};
  8788. } else {
  8789. clone = src;
  8790. }
  8791. copyIsArray = false;
  8792. // Never move original objects, clone them
  8793. target[ name ] = jQuery.extend( deep, clone, copy );
  8794. // Don't bring in undefined values
  8795. } else if ( copy !== undefined ) {
  8796. target[ name ] = copy;
  8797. }
  8798. }
  8799. }
  8800. }
  8801. // Return the modified object
  8802. return target;
  8803. };
  8804. jQuery.extend( {
  8805. // Unique for each copy of jQuery on the page
  8806. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8807. // Assume jQuery is ready without the ready module
  8808. isReady: true,
  8809. error: function( msg ) {
  8810. throw new Error( msg );
  8811. },
  8812. noop: function() {},
  8813. isPlainObject: function( obj ) {
  8814. var proto, Ctor;
  8815. // Detect obvious negatives
  8816. // Use toString instead of jQuery.type to catch host objects
  8817. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8818. return false;
  8819. }
  8820. proto = getProto( obj );
  8821. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8822. if ( !proto ) {
  8823. return true;
  8824. }
  8825. // Objects with prototype are plain iff they were constructed by a global Object function
  8826. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8827. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8828. },
  8829. isEmptyObject: function( obj ) {
  8830. var name;
  8831. for ( name in obj ) {
  8832. return false;
  8833. }
  8834. return true;
  8835. },
  8836. // Evaluates a script in a global context
  8837. globalEval: function( code, options ) {
  8838. DOMEval( code, { nonce: options && options.nonce } );
  8839. },
  8840. each: function( obj, callback ) {
  8841. var length, i = 0;
  8842. if ( isArrayLike( obj ) ) {
  8843. length = obj.length;
  8844. for ( ; i < length; i++ ) {
  8845. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8846. break;
  8847. }
  8848. }
  8849. } else {
  8850. for ( i in obj ) {
  8851. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8852. break;
  8853. }
  8854. }
  8855. }
  8856. return obj;
  8857. },
  8858. // Support: Android <=4.0 only
  8859. trim: function( text ) {
  8860. return text == null ?
  8861. "" :
  8862. ( text + "" ).replace( rtrim, "" );
  8863. },
  8864. // results is for internal usage only
  8865. makeArray: function( arr, results ) {
  8866. var ret = results || [];
  8867. if ( arr != null ) {
  8868. if ( isArrayLike( Object( arr ) ) ) {
  8869. jQuery.merge( ret,
  8870. typeof arr === "string" ?
  8871. [ arr ] : arr
  8872. );
  8873. } else {
  8874. push.call( ret, arr );
  8875. }
  8876. }
  8877. return ret;
  8878. },
  8879. inArray: function( elem, arr, i ) {
  8880. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8881. },
  8882. // Support: Android <=4.0 only, PhantomJS 1 only
  8883. // push.apply(_, arraylike) throws on ancient WebKit
  8884. merge: function( first, second ) {
  8885. var len = +second.length,
  8886. j = 0,
  8887. i = first.length;
  8888. for ( ; j < len; j++ ) {
  8889. first[ i++ ] = second[ j ];
  8890. }
  8891. first.length = i;
  8892. return first;
  8893. },
  8894. grep: function( elems, callback, invert ) {
  8895. var callbackInverse,
  8896. matches = [],
  8897. i = 0,
  8898. length = elems.length,
  8899. callbackExpect = !invert;
  8900. // Go through the array, only saving the items
  8901. // that pass the validator function
  8902. for ( ; i < length; i++ ) {
  8903. callbackInverse = !callback( elems[ i ], i );
  8904. if ( callbackInverse !== callbackExpect ) {
  8905. matches.push( elems[ i ] );
  8906. }
  8907. }
  8908. return matches;
  8909. },
  8910. // arg is for internal usage only
  8911. map: function( elems, callback, arg ) {
  8912. var length, value,
  8913. i = 0,
  8914. ret = [];
  8915. // Go through the array, translating each of the items to their new values
  8916. if ( isArrayLike( elems ) ) {
  8917. length = elems.length;
  8918. for ( ; i < length; i++ ) {
  8919. value = callback( elems[ i ], i, arg );
  8920. if ( value != null ) {
  8921. ret.push( value );
  8922. }
  8923. }
  8924. // Go through every key on the object,
  8925. } else {
  8926. for ( i in elems ) {
  8927. value = callback( elems[ i ], i, arg );
  8928. if ( value != null ) {
  8929. ret.push( value );
  8930. }
  8931. }
  8932. }
  8933. // Flatten any nested arrays
  8934. return concat.apply( [], ret );
  8935. },
  8936. // A global GUID counter for objects
  8937. guid: 1,
  8938. // jQuery.support is not used in Core but other projects attach their
  8939. // properties to it so it needs to exist.
  8940. support: support
  8941. } );
  8942. if ( typeof Symbol === "function" ) {
  8943. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8944. }
  8945. // Populate the class2type map
  8946. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8947. function( i, name ) {
  8948. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8949. } );
  8950. function isArrayLike( obj ) {
  8951. // Support: real iOS 8.2 only (not reproducible in simulator)
  8952. // `in` check used to prevent JIT error (gh-2145)
  8953. // hasOwn isn't used here due to false negatives
  8954. // regarding Nodelist length in IE
  8955. var length = !!obj && "length" in obj && obj.length,
  8956. type = toType( obj );
  8957. if ( isFunction( obj ) || isWindow( obj ) ) {
  8958. return false;
  8959. }
  8960. return type === "array" || length === 0 ||
  8961. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8962. }
  8963. var Sizzle =
  8964. /*!
  8965. * Sizzle CSS Selector Engine v2.3.4
  8966. * https://sizzlejs.com/
  8967. *
  8968. * Copyright JS Foundation and other contributors
  8969. * Released under the MIT license
  8970. * https://js.foundation/
  8971. *
  8972. * Date: 2019-04-08
  8973. */
  8974. (function( window ) {
  8975. var i,
  8976. support,
  8977. Expr,
  8978. getText,
  8979. isXML,
  8980. tokenize,
  8981. compile,
  8982. select,
  8983. outermostContext,
  8984. sortInput,
  8985. hasDuplicate,
  8986. // Local document vars
  8987. setDocument,
  8988. document,
  8989. docElem,
  8990. documentIsHTML,
  8991. rbuggyQSA,
  8992. rbuggyMatches,
  8993. matches,
  8994. contains,
  8995. // Instance-specific data
  8996. expando = "sizzle" + 1 * new Date(),
  8997. preferredDoc = window.document,
  8998. dirruns = 0,
  8999. done = 0,
  9000. classCache = createCache(),
  9001. tokenCache = createCache(),
  9002. compilerCache = createCache(),
  9003. nonnativeSelectorCache = createCache(),
  9004. sortOrder = function( a, b ) {
  9005. if ( a === b ) {
  9006. hasDuplicate = true;
  9007. }
  9008. return 0;
  9009. },
  9010. // Instance methods
  9011. hasOwn = ({}).hasOwnProperty,
  9012. arr = [],
  9013. pop = arr.pop,
  9014. push_native = arr.push,
  9015. push = arr.push,
  9016. slice = arr.slice,
  9017. // Use a stripped-down indexOf as it's faster than native
  9018. // https://jsperf.com/thor-indexof-vs-for/5
  9019. indexOf = function( list, elem ) {
  9020. var i = 0,
  9021. len = list.length;
  9022. for ( ; i < len; i++ ) {
  9023. if ( list[i] === elem ) {
  9024. return i;
  9025. }
  9026. }
  9027. return -1;
  9028. },
  9029. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9030. // Regular expressions
  9031. // http://www.w3.org/TR/css3-selectors/#whitespace
  9032. whitespace = "[\\x20\\t\\r\\n\\f]",
  9033. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9034. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9035. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9036. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9037. // Operator (capture 2)
  9038. "*([*^$|!~]?=)" + whitespace +
  9039. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9040. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9041. "*\\]",
  9042. pseudos = ":(" + identifier + ")(?:\\((" +
  9043. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9044. // 1. quoted (capture 3; capture 4 or capture 5)
  9045. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9046. // 2. simple (capture 6)
  9047. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9048. // 3. anything else (capture 2)
  9049. ".*" +
  9050. ")\\)|)",
  9051. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9052. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9053. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9054. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9055. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9056. rdescend = new RegExp( whitespace + "|>" ),
  9057. rpseudo = new RegExp( pseudos ),
  9058. ridentifier = new RegExp( "^" + identifier + "$" ),
  9059. matchExpr = {
  9060. "ID": new RegExp( "^#(" + identifier + ")" ),
  9061. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9062. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9063. "ATTR": new RegExp( "^" + attributes ),
  9064. "PSEUDO": new RegExp( "^" + pseudos ),
  9065. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9066. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9067. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9068. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9069. // For use in libraries implementing .is()
  9070. // We use this for POS matching in `select`
  9071. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9072. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9073. },
  9074. rhtml = /HTML$/i,
  9075. rinputs = /^(?:input|select|textarea|button)$/i,
  9076. rheader = /^h\d$/i,
  9077. rnative = /^[^{]+\{\s*\[native \w/,
  9078. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9079. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9080. rsibling = /[+~]/,
  9081. // CSS escapes
  9082. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9083. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9084. funescape = function( _, escaped, escapedWhitespace ) {
  9085. var high = "0x" + escaped - 0x10000;
  9086. // NaN means non-codepoint
  9087. // Support: Firefox<24
  9088. // Workaround erroneous numeric interpretation of +"0x"
  9089. return high !== high || escapedWhitespace ?
  9090. escaped :
  9091. high < 0 ?
  9092. // BMP codepoint
  9093. String.fromCharCode( high + 0x10000 ) :
  9094. // Supplemental Plane codepoint (surrogate pair)
  9095. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9096. },
  9097. // CSS string/identifier serialization
  9098. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9099. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9100. fcssescape = function( ch, asCodePoint ) {
  9101. if ( asCodePoint ) {
  9102. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9103. if ( ch === "\0" ) {
  9104. return "\uFFFD";
  9105. }
  9106. // Control characters and (dependent upon position) numbers get escaped as code points
  9107. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9108. }
  9109. // Other potentially-special ASCII characters get backslash-escaped
  9110. return "\\" + ch;
  9111. },
  9112. // Used for iframes
  9113. // See setDocument()
  9114. // Removing the function wrapper causes a "Permission Denied"
  9115. // error in IE
  9116. unloadHandler = function() {
  9117. setDocument();
  9118. },
  9119. inDisabledFieldset = addCombinator(
  9120. function( elem ) {
  9121. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9122. },
  9123. { dir: "parentNode", next: "legend" }
  9124. );
  9125. // Optimize for push.apply( _, NodeList )
  9126. try {
  9127. push.apply(
  9128. (arr = slice.call( preferredDoc.childNodes )),
  9129. preferredDoc.childNodes
  9130. );
  9131. // Support: Android<4.0
  9132. // Detect silently failing push.apply
  9133. arr[ preferredDoc.childNodes.length ].nodeType;
  9134. } catch ( e ) {
  9135. push = { apply: arr.length ?
  9136. // Leverage slice if possible
  9137. function( target, els ) {
  9138. push_native.apply( target, slice.call(els) );
  9139. } :
  9140. // Support: IE<9
  9141. // Otherwise append directly
  9142. function( target, els ) {
  9143. var j = target.length,
  9144. i = 0;
  9145. // Can't trust NodeList.length
  9146. while ( (target[j++] = els[i++]) ) {}
  9147. target.length = j - 1;
  9148. }
  9149. };
  9150. }
  9151. function Sizzle( selector, context, results, seed ) {
  9152. var m, i, elem, nid, match, groups, newSelector,
  9153. newContext = context && context.ownerDocument,
  9154. // nodeType defaults to 9, since context defaults to document
  9155. nodeType = context ? context.nodeType : 9;
  9156. results = results || [];
  9157. // Return early from calls with invalid selector or context
  9158. if ( typeof selector !== "string" || !selector ||
  9159. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9160. return results;
  9161. }
  9162. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9163. if ( !seed ) {
  9164. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9165. setDocument( context );
  9166. }
  9167. context = context || document;
  9168. if ( documentIsHTML ) {
  9169. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9170. // (excepting DocumentFragment context, where the methods don't exist)
  9171. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9172. // ID selector
  9173. if ( (m = match[1]) ) {
  9174. // Document context
  9175. if ( nodeType === 9 ) {
  9176. if ( (elem = context.getElementById( m )) ) {
  9177. // Support: IE, Opera, Webkit
  9178. // TODO: identify versions
  9179. // getElementById can match elements by name instead of ID
  9180. if ( elem.id === m ) {
  9181. results.push( elem );
  9182. return results;
  9183. }
  9184. } else {
  9185. return results;
  9186. }
  9187. // Element context
  9188. } else {
  9189. // Support: IE, Opera, Webkit
  9190. // TODO: identify versions
  9191. // getElementById can match elements by name instead of ID
  9192. if ( newContext && (elem = newContext.getElementById( m )) &&
  9193. contains( context, elem ) &&
  9194. elem.id === m ) {
  9195. results.push( elem );
  9196. return results;
  9197. }
  9198. }
  9199. // Type selector
  9200. } else if ( match[2] ) {
  9201. push.apply( results, context.getElementsByTagName( selector ) );
  9202. return results;
  9203. // Class selector
  9204. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9205. context.getElementsByClassName ) {
  9206. push.apply( results, context.getElementsByClassName( m ) );
  9207. return results;
  9208. }
  9209. }
  9210. // Take advantage of querySelectorAll
  9211. if ( support.qsa &&
  9212. !nonnativeSelectorCache[ selector + " " ] &&
  9213. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9214. // Support: IE 8 only
  9215. // Exclude object elements
  9216. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9217. newSelector = selector;
  9218. newContext = context;
  9219. // qSA considers elements outside a scoping root when evaluating child or
  9220. // descendant combinators, which is not what we want.
  9221. // In such cases, we work around the behavior by prefixing every selector in the
  9222. // list with an ID selector referencing the scope context.
  9223. // Thanks to Andrew Dupont for this technique.
  9224. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9225. // Capture the context ID, setting it first if necessary
  9226. if ( (nid = context.getAttribute( "id" )) ) {
  9227. nid = nid.replace( rcssescape, fcssescape );
  9228. } else {
  9229. context.setAttribute( "id", (nid = expando) );
  9230. }
  9231. // Prefix every selector in the list
  9232. groups = tokenize( selector );
  9233. i = groups.length;
  9234. while ( i-- ) {
  9235. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9236. }
  9237. newSelector = groups.join( "," );
  9238. // Expand context for sibling selectors
  9239. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9240. context;
  9241. }
  9242. try {
  9243. push.apply( results,
  9244. newContext.querySelectorAll( newSelector )
  9245. );
  9246. return results;
  9247. } catch ( qsaError ) {
  9248. nonnativeSelectorCache( selector, true );
  9249. } finally {
  9250. if ( nid === expando ) {
  9251. context.removeAttribute( "id" );
  9252. }
  9253. }
  9254. }
  9255. }
  9256. }
  9257. // All others
  9258. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9259. }
  9260. /**
  9261. * Create key-value caches of limited size
  9262. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9263. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9264. * deleting the oldest entry
  9265. */
  9266. function createCache() {
  9267. var keys = [];
  9268. function cache( key, value ) {
  9269. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9270. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9271. // Only keep the most recent entries
  9272. delete cache[ keys.shift() ];
  9273. }
  9274. return (cache[ key + " " ] = value);
  9275. }
  9276. return cache;
  9277. }
  9278. /**
  9279. * Mark a function for special use by Sizzle
  9280. * @param {Function} fn The function to mark
  9281. */
  9282. function markFunction( fn ) {
  9283. fn[ expando ] = true;
  9284. return fn;
  9285. }
  9286. /**
  9287. * Support testing using an element
  9288. * @param {Function} fn Passed the created element and returns a boolean result
  9289. */
  9290. function assert( fn ) {
  9291. var el = document.createElement("fieldset");
  9292. try {
  9293. return !!fn( el );
  9294. } catch (e) {
  9295. return false;
  9296. } finally {
  9297. // Remove from its parent by default
  9298. if ( el.parentNode ) {
  9299. el.parentNode.removeChild( el );
  9300. }
  9301. // release memory in IE
  9302. el = null;
  9303. }
  9304. }
  9305. /**
  9306. * Adds the same handler for all of the specified attrs
  9307. * @param {String} attrs Pipe-separated list of attributes
  9308. * @param {Function} handler The method that will be applied
  9309. */
  9310. function addHandle( attrs, handler ) {
  9311. var arr = attrs.split("|"),
  9312. i = arr.length;
  9313. while ( i-- ) {
  9314. Expr.attrHandle[ arr[i] ] = handler;
  9315. }
  9316. }
  9317. /**
  9318. * Checks document order of two siblings
  9319. * @param {Element} a
  9320. * @param {Element} b
  9321. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9322. */
  9323. function siblingCheck( a, b ) {
  9324. var cur = b && a,
  9325. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9326. a.sourceIndex - b.sourceIndex;
  9327. // Use IE sourceIndex if available on both nodes
  9328. if ( diff ) {
  9329. return diff;
  9330. }
  9331. // Check if b follows a
  9332. if ( cur ) {
  9333. while ( (cur = cur.nextSibling) ) {
  9334. if ( cur === b ) {
  9335. return -1;
  9336. }
  9337. }
  9338. }
  9339. return a ? 1 : -1;
  9340. }
  9341. /**
  9342. * Returns a function to use in pseudos for input types
  9343. * @param {String} type
  9344. */
  9345. function createInputPseudo( type ) {
  9346. return function( elem ) {
  9347. var name = elem.nodeName.toLowerCase();
  9348. return name === "input" && elem.type === type;
  9349. };
  9350. }
  9351. /**
  9352. * Returns a function to use in pseudos for buttons
  9353. * @param {String} type
  9354. */
  9355. function createButtonPseudo( type ) {
  9356. return function( elem ) {
  9357. var name = elem.nodeName.toLowerCase();
  9358. return (name === "input" || name === "button") && elem.type === type;
  9359. };
  9360. }
  9361. /**
  9362. * Returns a function to use in pseudos for :enabled/:disabled
  9363. * @param {Boolean} disabled true for :disabled; false for :enabled
  9364. */
  9365. function createDisabledPseudo( disabled ) {
  9366. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9367. return function( elem ) {
  9368. // Only certain elements can match :enabled or :disabled
  9369. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9370. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9371. if ( "form" in elem ) {
  9372. // Check for inherited disabledness on relevant non-disabled elements:
  9373. // * listed form-associated elements in a disabled fieldset
  9374. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9375. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9376. // * option elements in a disabled optgroup
  9377. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9378. // All such elements have a "form" property.
  9379. if ( elem.parentNode && elem.disabled === false ) {
  9380. // Option elements defer to a parent optgroup if present
  9381. if ( "label" in elem ) {
  9382. if ( "label" in elem.parentNode ) {
  9383. return elem.parentNode.disabled === disabled;
  9384. } else {
  9385. return elem.disabled === disabled;
  9386. }
  9387. }
  9388. // Support: IE 6 - 11
  9389. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9390. return elem.isDisabled === disabled ||
  9391. // Where there is no isDisabled, check manually
  9392. /* jshint -W018 */
  9393. elem.isDisabled !== !disabled &&
  9394. inDisabledFieldset( elem ) === disabled;
  9395. }
  9396. return elem.disabled === disabled;
  9397. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9398. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9399. // even exist on them, let alone have a boolean value.
  9400. } else if ( "label" in elem ) {
  9401. return elem.disabled === disabled;
  9402. }
  9403. // Remaining elements are neither :enabled nor :disabled
  9404. return false;
  9405. };
  9406. }
  9407. /**
  9408. * Returns a function to use in pseudos for positionals
  9409. * @param {Function} fn
  9410. */
  9411. function createPositionalPseudo( fn ) {
  9412. return markFunction(function( argument ) {
  9413. argument = +argument;
  9414. return markFunction(function( seed, matches ) {
  9415. var j,
  9416. matchIndexes = fn( [], seed.length, argument ),
  9417. i = matchIndexes.length;
  9418. // Match elements found at the specified indexes
  9419. while ( i-- ) {
  9420. if ( seed[ (j = matchIndexes[i]) ] ) {
  9421. seed[j] = !(matches[j] = seed[j]);
  9422. }
  9423. }
  9424. });
  9425. });
  9426. }
  9427. /**
  9428. * Checks a node for validity as a Sizzle context
  9429. * @param {Element|Object=} context
  9430. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9431. */
  9432. function testContext( context ) {
  9433. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9434. }
  9435. // Expose support vars for convenience
  9436. support = Sizzle.support = {};
  9437. /**
  9438. * Detects XML nodes
  9439. * @param {Element|Object} elem An element or a document
  9440. * @returns {Boolean} True iff elem is a non-HTML XML node
  9441. */
  9442. isXML = Sizzle.isXML = function( elem ) {
  9443. var namespace = elem.namespaceURI,
  9444. docElem = (elem.ownerDocument || elem).documentElement;
  9445. // Support: IE <=8
  9446. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9447. // https://bugs.jquery.com/ticket/4833
  9448. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9449. };
  9450. /**
  9451. * Sets document-related variables once based on the current document
  9452. * @param {Element|Object} [doc] An element or document object to use to set the document
  9453. * @returns {Object} Returns the current document
  9454. */
  9455. setDocument = Sizzle.setDocument = function( node ) {
  9456. var hasCompare, subWindow,
  9457. doc = node ? node.ownerDocument || node : preferredDoc;
  9458. // Return early if doc is invalid or already selected
  9459. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9460. return document;
  9461. }
  9462. // Update global variables
  9463. document = doc;
  9464. docElem = document.documentElement;
  9465. documentIsHTML = !isXML( document );
  9466. // Support: IE 9-11, Edge
  9467. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9468. if ( preferredDoc !== document &&
  9469. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9470. // Support: IE 11, Edge
  9471. if ( subWindow.addEventListener ) {
  9472. subWindow.addEventListener( "unload", unloadHandler, false );
  9473. // Support: IE 9 - 10 only
  9474. } else if ( subWindow.attachEvent ) {
  9475. subWindow.attachEvent( "onunload", unloadHandler );
  9476. }
  9477. }
  9478. /* Attributes
  9479. ---------------------------------------------------------------------- */
  9480. // Support: IE<8
  9481. // Verify that getAttribute really returns attributes and not properties
  9482. // (excepting IE8 booleans)
  9483. support.attributes = assert(function( el ) {
  9484. el.className = "i";
  9485. return !el.getAttribute("className");
  9486. });
  9487. /* getElement(s)By*
  9488. ---------------------------------------------------------------------- */
  9489. // Check if getElementsByTagName("*") returns only elements
  9490. support.getElementsByTagName = assert(function( el ) {
  9491. el.appendChild( document.createComment("") );
  9492. return !el.getElementsByTagName("*").length;
  9493. });
  9494. // Support: IE<9
  9495. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9496. // Support: IE<10
  9497. // Check if getElementById returns elements by name
  9498. // The broken getElementById methods don't pick up programmatically-set names,
  9499. // so use a roundabout getElementsByName test
  9500. support.getById = assert(function( el ) {
  9501. docElem.appendChild( el ).id = expando;
  9502. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9503. });
  9504. // ID filter and find
  9505. if ( support.getById ) {
  9506. Expr.filter["ID"] = function( id ) {
  9507. var attrId = id.replace( runescape, funescape );
  9508. return function( elem ) {
  9509. return elem.getAttribute("id") === attrId;
  9510. };
  9511. };
  9512. Expr.find["ID"] = function( id, context ) {
  9513. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9514. var elem = context.getElementById( id );
  9515. return elem ? [ elem ] : [];
  9516. }
  9517. };
  9518. } else {
  9519. Expr.filter["ID"] = function( id ) {
  9520. var attrId = id.replace( runescape, funescape );
  9521. return function( elem ) {
  9522. var node = typeof elem.getAttributeNode !== "undefined" &&
  9523. elem.getAttributeNode("id");
  9524. return node && node.value === attrId;
  9525. };
  9526. };
  9527. // Support: IE 6 - 7 only
  9528. // getElementById is not reliable as a find shortcut
  9529. Expr.find["ID"] = function( id, context ) {
  9530. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9531. var node, i, elems,
  9532. elem = context.getElementById( id );
  9533. if ( elem ) {
  9534. // Verify the id attribute
  9535. node = elem.getAttributeNode("id");
  9536. if ( node && node.value === id ) {
  9537. return [ elem ];
  9538. }
  9539. // Fall back on getElementsByName
  9540. elems = context.getElementsByName( id );
  9541. i = 0;
  9542. while ( (elem = elems[i++]) ) {
  9543. node = elem.getAttributeNode("id");
  9544. if ( node && node.value === id ) {
  9545. return [ elem ];
  9546. }
  9547. }
  9548. }
  9549. return [];
  9550. }
  9551. };
  9552. }
  9553. // Tag
  9554. Expr.find["TAG"] = support.getElementsByTagName ?
  9555. function( tag, context ) {
  9556. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9557. return context.getElementsByTagName( tag );
  9558. // DocumentFragment nodes don't have gEBTN
  9559. } else if ( support.qsa ) {
  9560. return context.querySelectorAll( tag );
  9561. }
  9562. } :
  9563. function( tag, context ) {
  9564. var elem,
  9565. tmp = [],
  9566. i = 0,
  9567. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9568. results = context.getElementsByTagName( tag );
  9569. // Filter out possible comments
  9570. if ( tag === "*" ) {
  9571. while ( (elem = results[i++]) ) {
  9572. if ( elem.nodeType === 1 ) {
  9573. tmp.push( elem );
  9574. }
  9575. }
  9576. return tmp;
  9577. }
  9578. return results;
  9579. };
  9580. // Class
  9581. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9582. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9583. return context.getElementsByClassName( className );
  9584. }
  9585. };
  9586. /* QSA/matchesSelector
  9587. ---------------------------------------------------------------------- */
  9588. // QSA and matchesSelector support
  9589. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9590. rbuggyMatches = [];
  9591. // qSa(:focus) reports false when true (Chrome 21)
  9592. // We allow this because of a bug in IE8/9 that throws an error
  9593. // whenever `document.activeElement` is accessed on an iframe
  9594. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9595. // See https://bugs.jquery.com/ticket/13378
  9596. rbuggyQSA = [];
  9597. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9598. // Build QSA regex
  9599. // Regex strategy adopted from Diego Perini
  9600. assert(function( el ) {
  9601. // Select is set to empty string on purpose
  9602. // This is to test IE's treatment of not explicitly
  9603. // setting a boolean content attribute,
  9604. // since its presence should be enough
  9605. // https://bugs.jquery.com/ticket/12359
  9606. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9607. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9608. "<option selected=''></option></select>";
  9609. // Support: IE8, Opera 11-12.16
  9610. // Nothing should be selected when empty strings follow ^= or $= or *=
  9611. // The test attribute must be unknown in Opera but "safe" for WinRT
  9612. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9613. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9614. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9615. }
  9616. // Support: IE8
  9617. // Boolean attributes and "value" are not treated correctly
  9618. if ( !el.querySelectorAll("[selected]").length ) {
  9619. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9620. }
  9621. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9622. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9623. rbuggyQSA.push("~=");
  9624. }
  9625. // Webkit/Opera - :checked should return selected option elements
  9626. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9627. // IE8 throws error here and will not see later tests
  9628. if ( !el.querySelectorAll(":checked").length ) {
  9629. rbuggyQSA.push(":checked");
  9630. }
  9631. // Support: Safari 8+, iOS 8+
  9632. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9633. // In-page `selector#id sibling-combinator selector` fails
  9634. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9635. rbuggyQSA.push(".#.+[+~]");
  9636. }
  9637. });
  9638. assert(function( el ) {
  9639. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9640. "<select disabled='disabled'><option/></select>";
  9641. // Support: Windows 8 Native Apps
  9642. // The type and name attributes are restricted during .innerHTML assignment
  9643. var input = document.createElement("input");
  9644. input.setAttribute( "type", "hidden" );
  9645. el.appendChild( input ).setAttribute( "name", "D" );
  9646. // Support: IE8
  9647. // Enforce case-sensitivity of name attribute
  9648. if ( el.querySelectorAll("[name=d]").length ) {
  9649. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9650. }
  9651. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9652. // IE8 throws error here and will not see later tests
  9653. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9654. rbuggyQSA.push( ":enabled", ":disabled" );
  9655. }
  9656. // Support: IE9-11+
  9657. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9658. docElem.appendChild( el ).disabled = true;
  9659. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9660. rbuggyQSA.push( ":enabled", ":disabled" );
  9661. }
  9662. // Opera 10-11 does not throw on post-comma invalid pseudos
  9663. el.querySelectorAll("*,:x");
  9664. rbuggyQSA.push(",.*:");
  9665. });
  9666. }
  9667. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9668. docElem.webkitMatchesSelector ||
  9669. docElem.mozMatchesSelector ||
  9670. docElem.oMatchesSelector ||
  9671. docElem.msMatchesSelector) )) ) {
  9672. assert(function( el ) {
  9673. // Check to see if it's possible to do matchesSelector
  9674. // on a disconnected node (IE 9)
  9675. support.disconnectedMatch = matches.call( el, "*" );
  9676. // This should fail with an exception
  9677. // Gecko does not error, returns false instead
  9678. matches.call( el, "[s!='']:x" );
  9679. rbuggyMatches.push( "!=", pseudos );
  9680. });
  9681. }
  9682. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9683. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9684. /* Contains
  9685. ---------------------------------------------------------------------- */
  9686. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9687. // Element contains another
  9688. // Purposefully self-exclusive
  9689. // As in, an element does not contain itself
  9690. contains = hasCompare || rnative.test( docElem.contains ) ?
  9691. function( a, b ) {
  9692. var adown = a.nodeType === 9 ? a.documentElement : a,
  9693. bup = b && b.parentNode;
  9694. return a === bup || !!( bup && bup.nodeType === 1 && (
  9695. adown.contains ?
  9696. adown.contains( bup ) :
  9697. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9698. ));
  9699. } :
  9700. function( a, b ) {
  9701. if ( b ) {
  9702. while ( (b = b.parentNode) ) {
  9703. if ( b === a ) {
  9704. return true;
  9705. }
  9706. }
  9707. }
  9708. return false;
  9709. };
  9710. /* Sorting
  9711. ---------------------------------------------------------------------- */
  9712. // Document order sorting
  9713. sortOrder = hasCompare ?
  9714. function( a, b ) {
  9715. // Flag for duplicate removal
  9716. if ( a === b ) {
  9717. hasDuplicate = true;
  9718. return 0;
  9719. }
  9720. // Sort on method existence if only one input has compareDocumentPosition
  9721. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9722. if ( compare ) {
  9723. return compare;
  9724. }
  9725. // Calculate position if both inputs belong to the same document
  9726. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9727. a.compareDocumentPosition( b ) :
  9728. // Otherwise we know they are disconnected
  9729. 1;
  9730. // Disconnected nodes
  9731. if ( compare & 1 ||
  9732. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9733. // Choose the first element that is related to our preferred document
  9734. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9735. return -1;
  9736. }
  9737. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9738. return 1;
  9739. }
  9740. // Maintain original order
  9741. return sortInput ?
  9742. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9743. 0;
  9744. }
  9745. return compare & 4 ? -1 : 1;
  9746. } :
  9747. function( a, b ) {
  9748. // Exit early if the nodes are identical
  9749. if ( a === b ) {
  9750. hasDuplicate = true;
  9751. return 0;
  9752. }
  9753. var cur,
  9754. i = 0,
  9755. aup = a.parentNode,
  9756. bup = b.parentNode,
  9757. ap = [ a ],
  9758. bp = [ b ];
  9759. // Parentless nodes are either documents or disconnected
  9760. if ( !aup || !bup ) {
  9761. return a === document ? -1 :
  9762. b === document ? 1 :
  9763. aup ? -1 :
  9764. bup ? 1 :
  9765. sortInput ?
  9766. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9767. 0;
  9768. // If the nodes are siblings, we can do a quick check
  9769. } else if ( aup === bup ) {
  9770. return siblingCheck( a, b );
  9771. }
  9772. // Otherwise we need full lists of their ancestors for comparison
  9773. cur = a;
  9774. while ( (cur = cur.parentNode) ) {
  9775. ap.unshift( cur );
  9776. }
  9777. cur = b;
  9778. while ( (cur = cur.parentNode) ) {
  9779. bp.unshift( cur );
  9780. }
  9781. // Walk down the tree looking for a discrepancy
  9782. while ( ap[i] === bp[i] ) {
  9783. i++;
  9784. }
  9785. return i ?
  9786. // Do a sibling check if the nodes have a common ancestor
  9787. siblingCheck( ap[i], bp[i] ) :
  9788. // Otherwise nodes in our document sort first
  9789. ap[i] === preferredDoc ? -1 :
  9790. bp[i] === preferredDoc ? 1 :
  9791. 0;
  9792. };
  9793. return document;
  9794. };
  9795. Sizzle.matches = function( expr, elements ) {
  9796. return Sizzle( expr, null, null, elements );
  9797. };
  9798. Sizzle.matchesSelector = function( elem, expr ) {
  9799. // Set document vars if needed
  9800. if ( ( elem.ownerDocument || elem ) !== document ) {
  9801. setDocument( elem );
  9802. }
  9803. if ( support.matchesSelector && documentIsHTML &&
  9804. !nonnativeSelectorCache[ expr + " " ] &&
  9805. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9806. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9807. try {
  9808. var ret = matches.call( elem, expr );
  9809. // IE 9's matchesSelector returns false on disconnected nodes
  9810. if ( ret || support.disconnectedMatch ||
  9811. // As well, disconnected nodes are said to be in a document
  9812. // fragment in IE 9
  9813. elem.document && elem.document.nodeType !== 11 ) {
  9814. return ret;
  9815. }
  9816. } catch (e) {
  9817. nonnativeSelectorCache( expr, true );
  9818. }
  9819. }
  9820. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9821. };
  9822. Sizzle.contains = function( context, elem ) {
  9823. // Set document vars if needed
  9824. if ( ( context.ownerDocument || context ) !== document ) {
  9825. setDocument( context );
  9826. }
  9827. return contains( context, elem );
  9828. };
  9829. Sizzle.attr = function( elem, name ) {
  9830. // Set document vars if needed
  9831. if ( ( elem.ownerDocument || elem ) !== document ) {
  9832. setDocument( elem );
  9833. }
  9834. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9835. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9836. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9837. fn( elem, name, !documentIsHTML ) :
  9838. undefined;
  9839. return val !== undefined ?
  9840. val :
  9841. support.attributes || !documentIsHTML ?
  9842. elem.getAttribute( name ) :
  9843. (val = elem.getAttributeNode(name)) && val.specified ?
  9844. val.value :
  9845. null;
  9846. };
  9847. Sizzle.escape = function( sel ) {
  9848. return (sel + "").replace( rcssescape, fcssescape );
  9849. };
  9850. Sizzle.error = function( msg ) {
  9851. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9852. };
  9853. /**
  9854. * Document sorting and removing duplicates
  9855. * @param {ArrayLike} results
  9856. */
  9857. Sizzle.uniqueSort = function( results ) {
  9858. var elem,
  9859. duplicates = [],
  9860. j = 0,
  9861. i = 0;
  9862. // Unless we *know* we can detect duplicates, assume their presence
  9863. hasDuplicate = !support.detectDuplicates;
  9864. sortInput = !support.sortStable && results.slice( 0 );
  9865. results.sort( sortOrder );
  9866. if ( hasDuplicate ) {
  9867. while ( (elem = results[i++]) ) {
  9868. if ( elem === results[ i ] ) {
  9869. j = duplicates.push( i );
  9870. }
  9871. }
  9872. while ( j-- ) {
  9873. results.splice( duplicates[ j ], 1 );
  9874. }
  9875. }
  9876. // Clear input after sorting to release objects
  9877. // See https://github.com/jquery/sizzle/pull/225
  9878. sortInput = null;
  9879. return results;
  9880. };
  9881. /**
  9882. * Utility function for retrieving the text value of an array of DOM nodes
  9883. * @param {Array|Element} elem
  9884. */
  9885. getText = Sizzle.getText = function( elem ) {
  9886. var node,
  9887. ret = "",
  9888. i = 0,
  9889. nodeType = elem.nodeType;
  9890. if ( !nodeType ) {
  9891. // If no nodeType, this is expected to be an array
  9892. while ( (node = elem[i++]) ) {
  9893. // Do not traverse comment nodes
  9894. ret += getText( node );
  9895. }
  9896. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9897. // Use textContent for elements
  9898. // innerText usage removed for consistency of new lines (jQuery #11153)
  9899. if ( typeof elem.textContent === "string" ) {
  9900. return elem.textContent;
  9901. } else {
  9902. // Traverse its children
  9903. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9904. ret += getText( elem );
  9905. }
  9906. }
  9907. } else if ( nodeType === 3 || nodeType === 4 ) {
  9908. return elem.nodeValue;
  9909. }
  9910. // Do not include comment or processing instruction nodes
  9911. return ret;
  9912. };
  9913. Expr = Sizzle.selectors = {
  9914. // Can be adjusted by the user
  9915. cacheLength: 50,
  9916. createPseudo: markFunction,
  9917. match: matchExpr,
  9918. attrHandle: {},
  9919. find: {},
  9920. relative: {
  9921. ">": { dir: "parentNode", first: true },
  9922. " ": { dir: "parentNode" },
  9923. "+": { dir: "previousSibling", first: true },
  9924. "~": { dir: "previousSibling" }
  9925. },
  9926. preFilter: {
  9927. "ATTR": function( match ) {
  9928. match[1] = match[1].replace( runescape, funescape );
  9929. // Move the given value to match[3] whether quoted or unquoted
  9930. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9931. if ( match[2] === "~=" ) {
  9932. match[3] = " " + match[3] + " ";
  9933. }
  9934. return match.slice( 0, 4 );
  9935. },
  9936. "CHILD": function( match ) {
  9937. /* matches from matchExpr["CHILD"]
  9938. 1 type (only|nth|...)
  9939. 2 what (child|of-type)
  9940. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9941. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9942. 5 sign of xn-component
  9943. 6 x of xn-component
  9944. 7 sign of y-component
  9945. 8 y of y-component
  9946. */
  9947. match[1] = match[1].toLowerCase();
  9948. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9949. // nth-* requires argument
  9950. if ( !match[3] ) {
  9951. Sizzle.error( match[0] );
  9952. }
  9953. // numeric x and y parameters for Expr.filter.CHILD
  9954. // remember that false/true cast respectively to 0/1
  9955. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9956. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9957. // other types prohibit arguments
  9958. } else if ( match[3] ) {
  9959. Sizzle.error( match[0] );
  9960. }
  9961. return match;
  9962. },
  9963. "PSEUDO": function( match ) {
  9964. var excess,
  9965. unquoted = !match[6] && match[2];
  9966. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9967. return null;
  9968. }
  9969. // Accept quoted arguments as-is
  9970. if ( match[3] ) {
  9971. match[2] = match[4] || match[5] || "";
  9972. // Strip excess characters from unquoted arguments
  9973. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9974. // Get excess from tokenize (recursively)
  9975. (excess = tokenize( unquoted, true )) &&
  9976. // advance to the next closing parenthesis
  9977. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9978. // excess is a negative index
  9979. match[0] = match[0].slice( 0, excess );
  9980. match[2] = unquoted.slice( 0, excess );
  9981. }
  9982. // Return only captures needed by the pseudo filter method (type and argument)
  9983. return match.slice( 0, 3 );
  9984. }
  9985. },
  9986. filter: {
  9987. "TAG": function( nodeNameSelector ) {
  9988. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9989. return nodeNameSelector === "*" ?
  9990. function() { return true; } :
  9991. function( elem ) {
  9992. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9993. };
  9994. },
  9995. "CLASS": function( className ) {
  9996. var pattern = classCache[ className + " " ];
  9997. return pattern ||
  9998. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9999. classCache( className, function( elem ) {
  10000. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10001. });
  10002. },
  10003. "ATTR": function( name, operator, check ) {
  10004. return function( elem ) {
  10005. var result = Sizzle.attr( elem, name );
  10006. if ( result == null ) {
  10007. return operator === "!=";
  10008. }
  10009. if ( !operator ) {
  10010. return true;
  10011. }
  10012. result += "";
  10013. return operator === "=" ? result === check :
  10014. operator === "!=" ? result !== check :
  10015. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10016. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10017. operator === "$=" ? check && result.slice( -check.length ) === check :
  10018. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10019. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10020. false;
  10021. };
  10022. },
  10023. "CHILD": function( type, what, argument, first, last ) {
  10024. var simple = type.slice( 0, 3 ) !== "nth",
  10025. forward = type.slice( -4 ) !== "last",
  10026. ofType = what === "of-type";
  10027. return first === 1 && last === 0 ?
  10028. // Shortcut for :nth-*(n)
  10029. function( elem ) {
  10030. return !!elem.parentNode;
  10031. } :
  10032. function( elem, context, xml ) {
  10033. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10034. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10035. parent = elem.parentNode,
  10036. name = ofType && elem.nodeName.toLowerCase(),
  10037. useCache = !xml && !ofType,
  10038. diff = false;
  10039. if ( parent ) {
  10040. // :(first|last|only)-(child|of-type)
  10041. if ( simple ) {
  10042. while ( dir ) {
  10043. node = elem;
  10044. while ( (node = node[ dir ]) ) {
  10045. if ( ofType ?
  10046. node.nodeName.toLowerCase() === name :
  10047. node.nodeType === 1 ) {
  10048. return false;
  10049. }
  10050. }
  10051. // Reverse direction for :only-* (if we haven't yet done so)
  10052. start = dir = type === "only" && !start && "nextSibling";
  10053. }
  10054. return true;
  10055. }
  10056. start = [ forward ? parent.firstChild : parent.lastChild ];
  10057. // non-xml :nth-child(...) stores cache data on `parent`
  10058. if ( forward && useCache ) {
  10059. // Seek `elem` from a previously-cached index
  10060. // ...in a gzip-friendly way
  10061. node = parent;
  10062. outerCache = node[ expando ] || (node[ expando ] = {});
  10063. // Support: IE <9 only
  10064. // Defend against cloned attroperties (jQuery gh-1709)
  10065. uniqueCache = outerCache[ node.uniqueID ] ||
  10066. (outerCache[ node.uniqueID ] = {});
  10067. cache = uniqueCache[ type ] || [];
  10068. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10069. diff = nodeIndex && cache[ 2 ];
  10070. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10071. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10072. // Fallback to seeking `elem` from the start
  10073. (diff = nodeIndex = 0) || start.pop()) ) {
  10074. // When found, cache indexes on `parent` and break
  10075. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10076. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10077. break;
  10078. }
  10079. }
  10080. } else {
  10081. // Use previously-cached element index if available
  10082. if ( useCache ) {
  10083. // ...in a gzip-friendly way
  10084. node = elem;
  10085. outerCache = node[ expando ] || (node[ expando ] = {});
  10086. // Support: IE <9 only
  10087. // Defend against cloned attroperties (jQuery gh-1709)
  10088. uniqueCache = outerCache[ node.uniqueID ] ||
  10089. (outerCache[ node.uniqueID ] = {});
  10090. cache = uniqueCache[ type ] || [];
  10091. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10092. diff = nodeIndex;
  10093. }
  10094. // xml :nth-child(...)
  10095. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10096. if ( diff === false ) {
  10097. // Use the same loop as above to seek `elem` from the start
  10098. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10099. (diff = nodeIndex = 0) || start.pop()) ) {
  10100. if ( ( ofType ?
  10101. node.nodeName.toLowerCase() === name :
  10102. node.nodeType === 1 ) &&
  10103. ++diff ) {
  10104. // Cache the index of each encountered element
  10105. if ( useCache ) {
  10106. outerCache = node[ expando ] || (node[ expando ] = {});
  10107. // Support: IE <9 only
  10108. // Defend against cloned attroperties (jQuery gh-1709)
  10109. uniqueCache = outerCache[ node.uniqueID ] ||
  10110. (outerCache[ node.uniqueID ] = {});
  10111. uniqueCache[ type ] = [ dirruns, diff ];
  10112. }
  10113. if ( node === elem ) {
  10114. break;
  10115. }
  10116. }
  10117. }
  10118. }
  10119. }
  10120. // Incorporate the offset, then check against cycle size
  10121. diff -= last;
  10122. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10123. }
  10124. };
  10125. },
  10126. "PSEUDO": function( pseudo, argument ) {
  10127. // pseudo-class names are case-insensitive
  10128. // http://www.w3.org/TR/selectors/#pseudo-classes
  10129. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10130. // Remember that setFilters inherits from pseudos
  10131. var args,
  10132. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10133. Sizzle.error( "unsupported pseudo: " + pseudo );
  10134. // The user may use createPseudo to indicate that
  10135. // arguments are needed to create the filter function
  10136. // just as Sizzle does
  10137. if ( fn[ expando ] ) {
  10138. return fn( argument );
  10139. }
  10140. // But maintain support for old signatures
  10141. if ( fn.length > 1 ) {
  10142. args = [ pseudo, pseudo, "", argument ];
  10143. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10144. markFunction(function( seed, matches ) {
  10145. var idx,
  10146. matched = fn( seed, argument ),
  10147. i = matched.length;
  10148. while ( i-- ) {
  10149. idx = indexOf( seed, matched[i] );
  10150. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10151. }
  10152. }) :
  10153. function( elem ) {
  10154. return fn( elem, 0, args );
  10155. };
  10156. }
  10157. return fn;
  10158. }
  10159. },
  10160. pseudos: {
  10161. // Potentially complex pseudos
  10162. "not": markFunction(function( selector ) {
  10163. // Trim the selector passed to compile
  10164. // to avoid treating leading and trailing
  10165. // spaces as combinators
  10166. var input = [],
  10167. results = [],
  10168. matcher = compile( selector.replace( rtrim, "$1" ) );
  10169. return matcher[ expando ] ?
  10170. markFunction(function( seed, matches, context, xml ) {
  10171. var elem,
  10172. unmatched = matcher( seed, null, xml, [] ),
  10173. i = seed.length;
  10174. // Match elements unmatched by `matcher`
  10175. while ( i-- ) {
  10176. if ( (elem = unmatched[i]) ) {
  10177. seed[i] = !(matches[i] = elem);
  10178. }
  10179. }
  10180. }) :
  10181. function( elem, context, xml ) {
  10182. input[0] = elem;
  10183. matcher( input, null, xml, results );
  10184. // Don't keep the element (issue #299)
  10185. input[0] = null;
  10186. return !results.pop();
  10187. };
  10188. }),
  10189. "has": markFunction(function( selector ) {
  10190. return function( elem ) {
  10191. return Sizzle( selector, elem ).length > 0;
  10192. };
  10193. }),
  10194. "contains": markFunction(function( text ) {
  10195. text = text.replace( runescape, funescape );
  10196. return function( elem ) {
  10197. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10198. };
  10199. }),
  10200. // "Whether an element is represented by a :lang() selector
  10201. // is based solely on the element's language value
  10202. // being equal to the identifier C,
  10203. // or beginning with the identifier C immediately followed by "-".
  10204. // The matching of C against the element's language value is performed case-insensitively.
  10205. // The identifier C does not have to be a valid language name."
  10206. // http://www.w3.org/TR/selectors/#lang-pseudo
  10207. "lang": markFunction( function( lang ) {
  10208. // lang value must be a valid identifier
  10209. if ( !ridentifier.test(lang || "") ) {
  10210. Sizzle.error( "unsupported lang: " + lang );
  10211. }
  10212. lang = lang.replace( runescape, funescape ).toLowerCase();
  10213. return function( elem ) {
  10214. var elemLang;
  10215. do {
  10216. if ( (elemLang = documentIsHTML ?
  10217. elem.lang :
  10218. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10219. elemLang = elemLang.toLowerCase();
  10220. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10221. }
  10222. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10223. return false;
  10224. };
  10225. }),
  10226. // Miscellaneous
  10227. "target": function( elem ) {
  10228. var hash = window.location && window.location.hash;
  10229. return hash && hash.slice( 1 ) === elem.id;
  10230. },
  10231. "root": function( elem ) {
  10232. return elem === docElem;
  10233. },
  10234. "focus": function( elem ) {
  10235. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10236. },
  10237. // Boolean properties
  10238. "enabled": createDisabledPseudo( false ),
  10239. "disabled": createDisabledPseudo( true ),
  10240. "checked": function( elem ) {
  10241. // In CSS3, :checked should return both checked and selected elements
  10242. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10243. var nodeName = elem.nodeName.toLowerCase();
  10244. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10245. },
  10246. "selected": function( elem ) {
  10247. // Accessing this property makes selected-by-default
  10248. // options in Safari work properly
  10249. if ( elem.parentNode ) {
  10250. elem.parentNode.selectedIndex;
  10251. }
  10252. return elem.selected === true;
  10253. },
  10254. // Contents
  10255. "empty": function( elem ) {
  10256. // http://www.w3.org/TR/selectors/#empty-pseudo
  10257. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10258. // but not by others (comment: 8; processing instruction: 7; etc.)
  10259. // nodeType < 6 works because attributes (2) do not appear as children
  10260. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10261. if ( elem.nodeType < 6 ) {
  10262. return false;
  10263. }
  10264. }
  10265. return true;
  10266. },
  10267. "parent": function( elem ) {
  10268. return !Expr.pseudos["empty"]( elem );
  10269. },
  10270. // Element/input types
  10271. "header": function( elem ) {
  10272. return rheader.test( elem.nodeName );
  10273. },
  10274. "input": function( elem ) {
  10275. return rinputs.test( elem.nodeName );
  10276. },
  10277. "button": function( elem ) {
  10278. var name = elem.nodeName.toLowerCase();
  10279. return name === "input" && elem.type === "button" || name === "button";
  10280. },
  10281. "text": function( elem ) {
  10282. var attr;
  10283. return elem.nodeName.toLowerCase() === "input" &&
  10284. elem.type === "text" &&
  10285. // Support: IE<8
  10286. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10287. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10288. },
  10289. // Position-in-collection
  10290. "first": createPositionalPseudo(function() {
  10291. return [ 0 ];
  10292. }),
  10293. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10294. return [ length - 1 ];
  10295. }),
  10296. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10297. return [ argument < 0 ? argument + length : argument ];
  10298. }),
  10299. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10300. var i = 0;
  10301. for ( ; i < length; i += 2 ) {
  10302. matchIndexes.push( i );
  10303. }
  10304. return matchIndexes;
  10305. }),
  10306. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10307. var i = 1;
  10308. for ( ; i < length; i += 2 ) {
  10309. matchIndexes.push( i );
  10310. }
  10311. return matchIndexes;
  10312. }),
  10313. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10314. var i = argument < 0 ?
  10315. argument + length :
  10316. argument > length ?
  10317. length :
  10318. argument;
  10319. for ( ; --i >= 0; ) {
  10320. matchIndexes.push( i );
  10321. }
  10322. return matchIndexes;
  10323. }),
  10324. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10325. var i = argument < 0 ? argument + length : argument;
  10326. for ( ; ++i < length; ) {
  10327. matchIndexes.push( i );
  10328. }
  10329. return matchIndexes;
  10330. })
  10331. }
  10332. };
  10333. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10334. // Add button/input type pseudos
  10335. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10336. Expr.pseudos[ i ] = createInputPseudo( i );
  10337. }
  10338. for ( i in { submit: true, reset: true } ) {
  10339. Expr.pseudos[ i ] = createButtonPseudo( i );
  10340. }
  10341. // Easy API for creating new setFilters
  10342. function setFilters() {}
  10343. setFilters.prototype = Expr.filters = Expr.pseudos;
  10344. Expr.setFilters = new setFilters();
  10345. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10346. var matched, match, tokens, type,
  10347. soFar, groups, preFilters,
  10348. cached = tokenCache[ selector + " " ];
  10349. if ( cached ) {
  10350. return parseOnly ? 0 : cached.slice( 0 );
  10351. }
  10352. soFar = selector;
  10353. groups = [];
  10354. preFilters = Expr.preFilter;
  10355. while ( soFar ) {
  10356. // Comma and first run
  10357. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10358. if ( match ) {
  10359. // Don't consume trailing commas as valid
  10360. soFar = soFar.slice( match[0].length ) || soFar;
  10361. }
  10362. groups.push( (tokens = []) );
  10363. }
  10364. matched = false;
  10365. // Combinators
  10366. if ( (match = rcombinators.exec( soFar )) ) {
  10367. matched = match.shift();
  10368. tokens.push({
  10369. value: matched,
  10370. // Cast descendant combinators to space
  10371. type: match[0].replace( rtrim, " " )
  10372. });
  10373. soFar = soFar.slice( matched.length );
  10374. }
  10375. // Filters
  10376. for ( type in Expr.filter ) {
  10377. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10378. (match = preFilters[ type ]( match ))) ) {
  10379. matched = match.shift();
  10380. tokens.push({
  10381. value: matched,
  10382. type: type,
  10383. matches: match
  10384. });
  10385. soFar = soFar.slice( matched.length );
  10386. }
  10387. }
  10388. if ( !matched ) {
  10389. break;
  10390. }
  10391. }
  10392. // Return the length of the invalid excess
  10393. // if we're just parsing
  10394. // Otherwise, throw an error or return tokens
  10395. return parseOnly ?
  10396. soFar.length :
  10397. soFar ?
  10398. Sizzle.error( selector ) :
  10399. // Cache the tokens
  10400. tokenCache( selector, groups ).slice( 0 );
  10401. };
  10402. function toSelector( tokens ) {
  10403. var i = 0,
  10404. len = tokens.length,
  10405. selector = "";
  10406. for ( ; i < len; i++ ) {
  10407. selector += tokens[i].value;
  10408. }
  10409. return selector;
  10410. }
  10411. function addCombinator( matcher, combinator, base ) {
  10412. var dir = combinator.dir,
  10413. skip = combinator.next,
  10414. key = skip || dir,
  10415. checkNonElements = base && key === "parentNode",
  10416. doneName = done++;
  10417. return combinator.first ?
  10418. // Check against closest ancestor/preceding element
  10419. function( elem, context, xml ) {
  10420. while ( (elem = elem[ dir ]) ) {
  10421. if ( elem.nodeType === 1 || checkNonElements ) {
  10422. return matcher( elem, context, xml );
  10423. }
  10424. }
  10425. return false;
  10426. } :
  10427. // Check against all ancestor/preceding elements
  10428. function( elem, context, xml ) {
  10429. var oldCache, uniqueCache, outerCache,
  10430. newCache = [ dirruns, doneName ];
  10431. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10432. if ( xml ) {
  10433. while ( (elem = elem[ dir ]) ) {
  10434. if ( elem.nodeType === 1 || checkNonElements ) {
  10435. if ( matcher( elem, context, xml ) ) {
  10436. return true;
  10437. }
  10438. }
  10439. }
  10440. } else {
  10441. while ( (elem = elem[ dir ]) ) {
  10442. if ( elem.nodeType === 1 || checkNonElements ) {
  10443. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10444. // Support: IE <9 only
  10445. // Defend against cloned attroperties (jQuery gh-1709)
  10446. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10447. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10448. elem = elem[ dir ] || elem;
  10449. } else if ( (oldCache = uniqueCache[ key ]) &&
  10450. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10451. // Assign to newCache so results back-propagate to previous elements
  10452. return (newCache[ 2 ] = oldCache[ 2 ]);
  10453. } else {
  10454. // Reuse newcache so results back-propagate to previous elements
  10455. uniqueCache[ key ] = newCache;
  10456. // A match means we're done; a fail means we have to keep checking
  10457. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10458. return true;
  10459. }
  10460. }
  10461. }
  10462. }
  10463. }
  10464. return false;
  10465. };
  10466. }
  10467. function elementMatcher( matchers ) {
  10468. return matchers.length > 1 ?
  10469. function( elem, context, xml ) {
  10470. var i = matchers.length;
  10471. while ( i-- ) {
  10472. if ( !matchers[i]( elem, context, xml ) ) {
  10473. return false;
  10474. }
  10475. }
  10476. return true;
  10477. } :
  10478. matchers[0];
  10479. }
  10480. function multipleContexts( selector, contexts, results ) {
  10481. var i = 0,
  10482. len = contexts.length;
  10483. for ( ; i < len; i++ ) {
  10484. Sizzle( selector, contexts[i], results );
  10485. }
  10486. return results;
  10487. }
  10488. function condense( unmatched, map, filter, context, xml ) {
  10489. var elem,
  10490. newUnmatched = [],
  10491. i = 0,
  10492. len = unmatched.length,
  10493. mapped = map != null;
  10494. for ( ; i < len; i++ ) {
  10495. if ( (elem = unmatched[i]) ) {
  10496. if ( !filter || filter( elem, context, xml ) ) {
  10497. newUnmatched.push( elem );
  10498. if ( mapped ) {
  10499. map.push( i );
  10500. }
  10501. }
  10502. }
  10503. }
  10504. return newUnmatched;
  10505. }
  10506. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10507. if ( postFilter && !postFilter[ expando ] ) {
  10508. postFilter = setMatcher( postFilter );
  10509. }
  10510. if ( postFinder && !postFinder[ expando ] ) {
  10511. postFinder = setMatcher( postFinder, postSelector );
  10512. }
  10513. return markFunction(function( seed, results, context, xml ) {
  10514. var temp, i, elem,
  10515. preMap = [],
  10516. postMap = [],
  10517. preexisting = results.length,
  10518. // Get initial elements from seed or context
  10519. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10520. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10521. matcherIn = preFilter && ( seed || !selector ) ?
  10522. condense( elems, preMap, preFilter, context, xml ) :
  10523. elems,
  10524. matcherOut = matcher ?
  10525. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10526. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10527. // ...intermediate processing is necessary
  10528. [] :
  10529. // ...otherwise use results directly
  10530. results :
  10531. matcherIn;
  10532. // Find primary matches
  10533. if ( matcher ) {
  10534. matcher( matcherIn, matcherOut, context, xml );
  10535. }
  10536. // Apply postFilter
  10537. if ( postFilter ) {
  10538. temp = condense( matcherOut, postMap );
  10539. postFilter( temp, [], context, xml );
  10540. // Un-match failing elements by moving them back to matcherIn
  10541. i = temp.length;
  10542. while ( i-- ) {
  10543. if ( (elem = temp[i]) ) {
  10544. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10545. }
  10546. }
  10547. }
  10548. if ( seed ) {
  10549. if ( postFinder || preFilter ) {
  10550. if ( postFinder ) {
  10551. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10552. temp = [];
  10553. i = matcherOut.length;
  10554. while ( i-- ) {
  10555. if ( (elem = matcherOut[i]) ) {
  10556. // Restore matcherIn since elem is not yet a final match
  10557. temp.push( (matcherIn[i] = elem) );
  10558. }
  10559. }
  10560. postFinder( null, (matcherOut = []), temp, xml );
  10561. }
  10562. // Move matched elements from seed to results to keep them synchronized
  10563. i = matcherOut.length;
  10564. while ( i-- ) {
  10565. if ( (elem = matcherOut[i]) &&
  10566. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10567. seed[temp] = !(results[temp] = elem);
  10568. }
  10569. }
  10570. }
  10571. // Add elements to results, through postFinder if defined
  10572. } else {
  10573. matcherOut = condense(
  10574. matcherOut === results ?
  10575. matcherOut.splice( preexisting, matcherOut.length ) :
  10576. matcherOut
  10577. );
  10578. if ( postFinder ) {
  10579. postFinder( null, results, matcherOut, xml );
  10580. } else {
  10581. push.apply( results, matcherOut );
  10582. }
  10583. }
  10584. });
  10585. }
  10586. function matcherFromTokens( tokens ) {
  10587. var checkContext, matcher, j,
  10588. len = tokens.length,
  10589. leadingRelative = Expr.relative[ tokens[0].type ],
  10590. implicitRelative = leadingRelative || Expr.relative[" "],
  10591. i = leadingRelative ? 1 : 0,
  10592. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10593. matchContext = addCombinator( function( elem ) {
  10594. return elem === checkContext;
  10595. }, implicitRelative, true ),
  10596. matchAnyContext = addCombinator( function( elem ) {
  10597. return indexOf( checkContext, elem ) > -1;
  10598. }, implicitRelative, true ),
  10599. matchers = [ function( elem, context, xml ) {
  10600. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10601. (checkContext = context).nodeType ?
  10602. matchContext( elem, context, xml ) :
  10603. matchAnyContext( elem, context, xml ) );
  10604. // Avoid hanging onto element (issue #299)
  10605. checkContext = null;
  10606. return ret;
  10607. } ];
  10608. for ( ; i < len; i++ ) {
  10609. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10610. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10611. } else {
  10612. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10613. // Return special upon seeing a positional matcher
  10614. if ( matcher[ expando ] ) {
  10615. // Find the next relative operator (if any) for proper handling
  10616. j = ++i;
  10617. for ( ; j < len; j++ ) {
  10618. if ( Expr.relative[ tokens[j].type ] ) {
  10619. break;
  10620. }
  10621. }
  10622. return setMatcher(
  10623. i > 1 && elementMatcher( matchers ),
  10624. i > 1 && toSelector(
  10625. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10626. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10627. ).replace( rtrim, "$1" ),
  10628. matcher,
  10629. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10630. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10631. j < len && toSelector( tokens )
  10632. );
  10633. }
  10634. matchers.push( matcher );
  10635. }
  10636. }
  10637. return elementMatcher( matchers );
  10638. }
  10639. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10640. var bySet = setMatchers.length > 0,
  10641. byElement = elementMatchers.length > 0,
  10642. superMatcher = function( seed, context, xml, results, outermost ) {
  10643. var elem, j, matcher,
  10644. matchedCount = 0,
  10645. i = "0",
  10646. unmatched = seed && [],
  10647. setMatched = [],
  10648. contextBackup = outermostContext,
  10649. // We must always have either seed elements or outermost context
  10650. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10651. // Use integer dirruns iff this is the outermost matcher
  10652. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10653. len = elems.length;
  10654. if ( outermost ) {
  10655. outermostContext = context === document || context || outermost;
  10656. }
  10657. // Add elements passing elementMatchers directly to results
  10658. // Support: IE<9, Safari
  10659. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10660. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10661. if ( byElement && elem ) {
  10662. j = 0;
  10663. if ( !context && elem.ownerDocument !== document ) {
  10664. setDocument( elem );
  10665. xml = !documentIsHTML;
  10666. }
  10667. while ( (matcher = elementMatchers[j++]) ) {
  10668. if ( matcher( elem, context || document, xml) ) {
  10669. results.push( elem );
  10670. break;
  10671. }
  10672. }
  10673. if ( outermost ) {
  10674. dirruns = dirrunsUnique;
  10675. }
  10676. }
  10677. // Track unmatched elements for set filters
  10678. if ( bySet ) {
  10679. // They will have gone through all possible matchers
  10680. if ( (elem = !matcher && elem) ) {
  10681. matchedCount--;
  10682. }
  10683. // Lengthen the array for every element, matched or not
  10684. if ( seed ) {
  10685. unmatched.push( elem );
  10686. }
  10687. }
  10688. }
  10689. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10690. // makes the latter nonnegative.
  10691. matchedCount += i;
  10692. // Apply set filters to unmatched elements
  10693. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10694. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10695. // no element matchers and no seed.
  10696. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10697. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10698. // numerically zero.
  10699. if ( bySet && i !== matchedCount ) {
  10700. j = 0;
  10701. while ( (matcher = setMatchers[j++]) ) {
  10702. matcher( unmatched, setMatched, context, xml );
  10703. }
  10704. if ( seed ) {
  10705. // Reintegrate element matches to eliminate the need for sorting
  10706. if ( matchedCount > 0 ) {
  10707. while ( i-- ) {
  10708. if ( !(unmatched[i] || setMatched[i]) ) {
  10709. setMatched[i] = pop.call( results );
  10710. }
  10711. }
  10712. }
  10713. // Discard index placeholder values to get only actual matches
  10714. setMatched = condense( setMatched );
  10715. }
  10716. // Add matches to results
  10717. push.apply( results, setMatched );
  10718. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10719. if ( outermost && !seed && setMatched.length > 0 &&
  10720. ( matchedCount + setMatchers.length ) > 1 ) {
  10721. Sizzle.uniqueSort( results );
  10722. }
  10723. }
  10724. // Override manipulation of globals by nested matchers
  10725. if ( outermost ) {
  10726. dirruns = dirrunsUnique;
  10727. outermostContext = contextBackup;
  10728. }
  10729. return unmatched;
  10730. };
  10731. return bySet ?
  10732. markFunction( superMatcher ) :
  10733. superMatcher;
  10734. }
  10735. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10736. var i,
  10737. setMatchers = [],
  10738. elementMatchers = [],
  10739. cached = compilerCache[ selector + " " ];
  10740. if ( !cached ) {
  10741. // Generate a function of recursive functions that can be used to check each element
  10742. if ( !match ) {
  10743. match = tokenize( selector );
  10744. }
  10745. i = match.length;
  10746. while ( i-- ) {
  10747. cached = matcherFromTokens( match[i] );
  10748. if ( cached[ expando ] ) {
  10749. setMatchers.push( cached );
  10750. } else {
  10751. elementMatchers.push( cached );
  10752. }
  10753. }
  10754. // Cache the compiled function
  10755. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10756. // Save selector and tokenization
  10757. cached.selector = selector;
  10758. }
  10759. return cached;
  10760. };
  10761. /**
  10762. * A low-level selection function that works with Sizzle's compiled
  10763. * selector functions
  10764. * @param {String|Function} selector A selector or a pre-compiled
  10765. * selector function built with Sizzle.compile
  10766. * @param {Element} context
  10767. * @param {Array} [results]
  10768. * @param {Array} [seed] A set of elements to match against
  10769. */
  10770. select = Sizzle.select = function( selector, context, results, seed ) {
  10771. var i, tokens, token, type, find,
  10772. compiled = typeof selector === "function" && selector,
  10773. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10774. results = results || [];
  10775. // Try to minimize operations if there is only one selector in the list and no seed
  10776. // (the latter of which guarantees us context)
  10777. if ( match.length === 1 ) {
  10778. // Reduce context if the leading compound selector is an ID
  10779. tokens = match[0] = match[0].slice( 0 );
  10780. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10781. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10782. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10783. if ( !context ) {
  10784. return results;
  10785. // Precompiled matchers will still verify ancestry, so step up a level
  10786. } else if ( compiled ) {
  10787. context = context.parentNode;
  10788. }
  10789. selector = selector.slice( tokens.shift().value.length );
  10790. }
  10791. // Fetch a seed set for right-to-left matching
  10792. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10793. while ( i-- ) {
  10794. token = tokens[i];
  10795. // Abort if we hit a combinator
  10796. if ( Expr.relative[ (type = token.type) ] ) {
  10797. break;
  10798. }
  10799. if ( (find = Expr.find[ type ]) ) {
  10800. // Search, expanding context for leading sibling combinators
  10801. if ( (seed = find(
  10802. token.matches[0].replace( runescape, funescape ),
  10803. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10804. )) ) {
  10805. // If seed is empty or no tokens remain, we can return early
  10806. tokens.splice( i, 1 );
  10807. selector = seed.length && toSelector( tokens );
  10808. if ( !selector ) {
  10809. push.apply( results, seed );
  10810. return results;
  10811. }
  10812. break;
  10813. }
  10814. }
  10815. }
  10816. }
  10817. // Compile and execute a filtering function if one is not provided
  10818. // Provide `match` to avoid retokenization if we modified the selector above
  10819. ( compiled || compile( selector, match ) )(
  10820. seed,
  10821. context,
  10822. !documentIsHTML,
  10823. results,
  10824. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10825. );
  10826. return results;
  10827. };
  10828. // One-time assignments
  10829. // Sort stability
  10830. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10831. // Support: Chrome 14-35+
  10832. // Always assume duplicates if they aren't passed to the comparison function
  10833. support.detectDuplicates = !!hasDuplicate;
  10834. // Initialize against the default document
  10835. setDocument();
  10836. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10837. // Detached nodes confoundingly follow *each other*
  10838. support.sortDetached = assert(function( el ) {
  10839. // Should return 1, but returns 4 (following)
  10840. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10841. });
  10842. // Support: IE<8
  10843. // Prevent attribute/property "interpolation"
  10844. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10845. if ( !assert(function( el ) {
  10846. el.innerHTML = "<a href='#'></a>";
  10847. return el.firstChild.getAttribute("href") === "#" ;
  10848. }) ) {
  10849. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10850. if ( !isXML ) {
  10851. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10852. }
  10853. });
  10854. }
  10855. // Support: IE<9
  10856. // Use defaultValue in place of getAttribute("value")
  10857. if ( !support.attributes || !assert(function( el ) {
  10858. el.innerHTML = "<input/>";
  10859. el.firstChild.setAttribute( "value", "" );
  10860. return el.firstChild.getAttribute( "value" ) === "";
  10861. }) ) {
  10862. addHandle( "value", function( elem, name, isXML ) {
  10863. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10864. return elem.defaultValue;
  10865. }
  10866. });
  10867. }
  10868. // Support: IE<9
  10869. // Use getAttributeNode to fetch booleans when getAttribute lies
  10870. if ( !assert(function( el ) {
  10871. return el.getAttribute("disabled") == null;
  10872. }) ) {
  10873. addHandle( booleans, function( elem, name, isXML ) {
  10874. var val;
  10875. if ( !isXML ) {
  10876. return elem[ name ] === true ? name.toLowerCase() :
  10877. (val = elem.getAttributeNode( name )) && val.specified ?
  10878. val.value :
  10879. null;
  10880. }
  10881. });
  10882. }
  10883. return Sizzle;
  10884. })( window );
  10885. jQuery.find = Sizzle;
  10886. jQuery.expr = Sizzle.selectors;
  10887. // Deprecated
  10888. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10889. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10890. jQuery.text = Sizzle.getText;
  10891. jQuery.isXMLDoc = Sizzle.isXML;
  10892. jQuery.contains = Sizzle.contains;
  10893. jQuery.escapeSelector = Sizzle.escape;
  10894. var dir = function( elem, dir, until ) {
  10895. var matched = [],
  10896. truncate = until !== undefined;
  10897. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10898. if ( elem.nodeType === 1 ) {
  10899. if ( truncate && jQuery( elem ).is( until ) ) {
  10900. break;
  10901. }
  10902. matched.push( elem );
  10903. }
  10904. }
  10905. return matched;
  10906. };
  10907. var siblings = function( n, elem ) {
  10908. var matched = [];
  10909. for ( ; n; n = n.nextSibling ) {
  10910. if ( n.nodeType === 1 && n !== elem ) {
  10911. matched.push( n );
  10912. }
  10913. }
  10914. return matched;
  10915. };
  10916. var rneedsContext = jQuery.expr.match.needsContext;
  10917. function nodeName( elem, name ) {
  10918. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10919. };
  10920. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10921. // Implement the identical functionality for filter and not
  10922. function winnow( elements, qualifier, not ) {
  10923. if ( isFunction( qualifier ) ) {
  10924. return jQuery.grep( elements, function( elem, i ) {
  10925. return !!qualifier.call( elem, i, elem ) !== not;
  10926. } );
  10927. }
  10928. // Single element
  10929. if ( qualifier.nodeType ) {
  10930. return jQuery.grep( elements, function( elem ) {
  10931. return ( elem === qualifier ) !== not;
  10932. } );
  10933. }
  10934. // Arraylike of elements (jQuery, arguments, Array)
  10935. if ( typeof qualifier !== "string" ) {
  10936. return jQuery.grep( elements, function( elem ) {
  10937. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10938. } );
  10939. }
  10940. // Filtered directly for both simple and complex selectors
  10941. return jQuery.filter( qualifier, elements, not );
  10942. }
  10943. jQuery.filter = function( expr, elems, not ) {
  10944. var elem = elems[ 0 ];
  10945. if ( not ) {
  10946. expr = ":not(" + expr + ")";
  10947. }
  10948. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10949. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10950. }
  10951. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10952. return elem.nodeType === 1;
  10953. } ) );
  10954. };
  10955. jQuery.fn.extend( {
  10956. find: function( selector ) {
  10957. var i, ret,
  10958. len = this.length,
  10959. self = this;
  10960. if ( typeof selector !== "string" ) {
  10961. return this.pushStack( jQuery( selector ).filter( function() {
  10962. for ( i = 0; i < len; i++ ) {
  10963. if ( jQuery.contains( self[ i ], this ) ) {
  10964. return true;
  10965. }
  10966. }
  10967. } ) );
  10968. }
  10969. ret = this.pushStack( [] );
  10970. for ( i = 0; i < len; i++ ) {
  10971. jQuery.find( selector, self[ i ], ret );
  10972. }
  10973. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10974. },
  10975. filter: function( selector ) {
  10976. return this.pushStack( winnow( this, selector || [], false ) );
  10977. },
  10978. not: function( selector ) {
  10979. return this.pushStack( winnow( this, selector || [], true ) );
  10980. },
  10981. is: function( selector ) {
  10982. return !!winnow(
  10983. this,
  10984. // If this is a positional/relative selector, check membership in the returned set
  10985. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10986. typeof selector === "string" && rneedsContext.test( selector ) ?
  10987. jQuery( selector ) :
  10988. selector || [],
  10989. false
  10990. ).length;
  10991. }
  10992. } );
  10993. // Initialize a jQuery object
  10994. // A central reference to the root jQuery(document)
  10995. var rootjQuery,
  10996. // A simple way to check for HTML strings
  10997. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10998. // Strict HTML recognition (#11290: must start with <)
  10999. // Shortcut simple #id case for speed
  11000. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11001. init = jQuery.fn.init = function( selector, context, root ) {
  11002. var match, elem;
  11003. // HANDLE: $(""), $(null), $(undefined), $(false)
  11004. if ( !selector ) {
  11005. return this;
  11006. }
  11007. // Method init() accepts an alternate rootjQuery
  11008. // so migrate can support jQuery.sub (gh-2101)
  11009. root = root || rootjQuery;
  11010. // Handle HTML strings
  11011. if ( typeof selector === "string" ) {
  11012. if ( selector[ 0 ] === "<" &&
  11013. selector[ selector.length - 1 ] === ">" &&
  11014. selector.length >= 3 ) {
  11015. // Assume that strings that start and end with <> are HTML and skip the regex check
  11016. match = [ null, selector, null ];
  11017. } else {
  11018. match = rquickExpr.exec( selector );
  11019. }
  11020. // Match html or make sure no context is specified for #id
  11021. if ( match && ( match[ 1 ] || !context ) ) {
  11022. // HANDLE: $(html) -> $(array)
  11023. if ( match[ 1 ] ) {
  11024. context = context instanceof jQuery ? context[ 0 ] : context;
  11025. // Option to run scripts is true for back-compat
  11026. // Intentionally let the error be thrown if parseHTML is not present
  11027. jQuery.merge( this, jQuery.parseHTML(
  11028. match[ 1 ],
  11029. context && context.nodeType ? context.ownerDocument || context : document,
  11030. true
  11031. ) );
  11032. // HANDLE: $(html, props)
  11033. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11034. for ( match in context ) {
  11035. // Properties of context are called as methods if possible
  11036. if ( isFunction( this[ match ] ) ) {
  11037. this[ match ]( context[ match ] );
  11038. // ...and otherwise set as attributes
  11039. } else {
  11040. this.attr( match, context[ match ] );
  11041. }
  11042. }
  11043. }
  11044. return this;
  11045. // HANDLE: $(#id)
  11046. } else {
  11047. elem = document.getElementById( match[ 2 ] );
  11048. if ( elem ) {
  11049. // Inject the element directly into the jQuery object
  11050. this[ 0 ] = elem;
  11051. this.length = 1;
  11052. }
  11053. return this;
  11054. }
  11055. // HANDLE: $(expr, $(...))
  11056. } else if ( !context || context.jquery ) {
  11057. return ( context || root ).find( selector );
  11058. // HANDLE: $(expr, context)
  11059. // (which is just equivalent to: $(context).find(expr)
  11060. } else {
  11061. return this.constructor( context ).find( selector );
  11062. }
  11063. // HANDLE: $(DOMElement)
  11064. } else if ( selector.nodeType ) {
  11065. this[ 0 ] = selector;
  11066. this.length = 1;
  11067. return this;
  11068. // HANDLE: $(function)
  11069. // Shortcut for document ready
  11070. } else if ( isFunction( selector ) ) {
  11071. return root.ready !== undefined ?
  11072. root.ready( selector ) :
  11073. // Execute immediately if ready is not present
  11074. selector( jQuery );
  11075. }
  11076. return jQuery.makeArray( selector, this );
  11077. };
  11078. // Give the init function the jQuery prototype for later instantiation
  11079. init.prototype = jQuery.fn;
  11080. // Initialize central reference
  11081. rootjQuery = jQuery( document );
  11082. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11083. // Methods guaranteed to produce a unique set when starting from a unique set
  11084. guaranteedUnique = {
  11085. children: true,
  11086. contents: true,
  11087. next: true,
  11088. prev: true
  11089. };
  11090. jQuery.fn.extend( {
  11091. has: function( target ) {
  11092. var targets = jQuery( target, this ),
  11093. l = targets.length;
  11094. return this.filter( function() {
  11095. var i = 0;
  11096. for ( ; i < l; i++ ) {
  11097. if ( jQuery.contains( this, targets[ i ] ) ) {
  11098. return true;
  11099. }
  11100. }
  11101. } );
  11102. },
  11103. closest: function( selectors, context ) {
  11104. var cur,
  11105. i = 0,
  11106. l = this.length,
  11107. matched = [],
  11108. targets = typeof selectors !== "string" && jQuery( selectors );
  11109. // Positional selectors never match, since there's no _selection_ context
  11110. if ( !rneedsContext.test( selectors ) ) {
  11111. for ( ; i < l; i++ ) {
  11112. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11113. // Always skip document fragments
  11114. if ( cur.nodeType < 11 && ( targets ?
  11115. targets.index( cur ) > -1 :
  11116. // Don't pass non-elements to Sizzle
  11117. cur.nodeType === 1 &&
  11118. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11119. matched.push( cur );
  11120. break;
  11121. }
  11122. }
  11123. }
  11124. }
  11125. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11126. },
  11127. // Determine the position of an element within the set
  11128. index: function( elem ) {
  11129. // No argument, return index in parent
  11130. if ( !elem ) {
  11131. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11132. }
  11133. // Index in selector
  11134. if ( typeof elem === "string" ) {
  11135. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11136. }
  11137. // Locate the position of the desired element
  11138. return indexOf.call( this,
  11139. // If it receives a jQuery object, the first element is used
  11140. elem.jquery ? elem[ 0 ] : elem
  11141. );
  11142. },
  11143. add: function( selector, context ) {
  11144. return this.pushStack(
  11145. jQuery.uniqueSort(
  11146. jQuery.merge( this.get(), jQuery( selector, context ) )
  11147. )
  11148. );
  11149. },
  11150. addBack: function( selector ) {
  11151. return this.add( selector == null ?
  11152. this.prevObject : this.prevObject.filter( selector )
  11153. );
  11154. }
  11155. } );
  11156. function sibling( cur, dir ) {
  11157. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11158. return cur;
  11159. }
  11160. jQuery.each( {
  11161. parent: function( elem ) {
  11162. var parent = elem.parentNode;
  11163. return parent && parent.nodeType !== 11 ? parent : null;
  11164. },
  11165. parents: function( elem ) {
  11166. return dir( elem, "parentNode" );
  11167. },
  11168. parentsUntil: function( elem, i, until ) {
  11169. return dir( elem, "parentNode", until );
  11170. },
  11171. next: function( elem ) {
  11172. return sibling( elem, "nextSibling" );
  11173. },
  11174. prev: function( elem ) {
  11175. return sibling( elem, "previousSibling" );
  11176. },
  11177. nextAll: function( elem ) {
  11178. return dir( elem, "nextSibling" );
  11179. },
  11180. prevAll: function( elem ) {
  11181. return dir( elem, "previousSibling" );
  11182. },
  11183. nextUntil: function( elem, i, until ) {
  11184. return dir( elem, "nextSibling", until );
  11185. },
  11186. prevUntil: function( elem, i, until ) {
  11187. return dir( elem, "previousSibling", until );
  11188. },
  11189. siblings: function( elem ) {
  11190. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11191. },
  11192. children: function( elem ) {
  11193. return siblings( elem.firstChild );
  11194. },
  11195. contents: function( elem ) {
  11196. if ( typeof elem.contentDocument !== "undefined" ) {
  11197. return elem.contentDocument;
  11198. }
  11199. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11200. // Treat the template element as a regular one in browsers that
  11201. // don't support it.
  11202. if ( nodeName( elem, "template" ) ) {
  11203. elem = elem.content || elem;
  11204. }
  11205. return jQuery.merge( [], elem.childNodes );
  11206. }
  11207. }, function( name, fn ) {
  11208. jQuery.fn[ name ] = function( until, selector ) {
  11209. var matched = jQuery.map( this, fn, until );
  11210. if ( name.slice( -5 ) !== "Until" ) {
  11211. selector = until;
  11212. }
  11213. if ( selector && typeof selector === "string" ) {
  11214. matched = jQuery.filter( selector, matched );
  11215. }
  11216. if ( this.length > 1 ) {
  11217. // Remove duplicates
  11218. if ( !guaranteedUnique[ name ] ) {
  11219. jQuery.uniqueSort( matched );
  11220. }
  11221. // Reverse order for parents* and prev-derivatives
  11222. if ( rparentsprev.test( name ) ) {
  11223. matched.reverse();
  11224. }
  11225. }
  11226. return this.pushStack( matched );
  11227. };
  11228. } );
  11229. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11230. // Convert String-formatted options into Object-formatted ones
  11231. function createOptions( options ) {
  11232. var object = {};
  11233. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11234. object[ flag ] = true;
  11235. } );
  11236. return object;
  11237. }
  11238. /*
  11239. * Create a callback list using the following parameters:
  11240. *
  11241. * options: an optional list of space-separated options that will change how
  11242. * the callback list behaves or a more traditional option object
  11243. *
  11244. * By default a callback list will act like an event callback list and can be
  11245. * "fired" multiple times.
  11246. *
  11247. * Possible options:
  11248. *
  11249. * once: will ensure the callback list can only be fired once (like a Deferred)
  11250. *
  11251. * memory: will keep track of previous values and will call any callback added
  11252. * after the list has been fired right away with the latest "memorized"
  11253. * values (like a Deferred)
  11254. *
  11255. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11256. *
  11257. * stopOnFalse: interrupt callings when a callback returns false
  11258. *
  11259. */
  11260. jQuery.Callbacks = function( options ) {
  11261. // Convert options from String-formatted to Object-formatted if needed
  11262. // (we check in cache first)
  11263. options = typeof options === "string" ?
  11264. createOptions( options ) :
  11265. jQuery.extend( {}, options );
  11266. var // Flag to know if list is currently firing
  11267. firing,
  11268. // Last fire value for non-forgettable lists
  11269. memory,
  11270. // Flag to know if list was already fired
  11271. fired,
  11272. // Flag to prevent firing
  11273. locked,
  11274. // Actual callback list
  11275. list = [],
  11276. // Queue of execution data for repeatable lists
  11277. queue = [],
  11278. // Index of currently firing callback (modified by add/remove as needed)
  11279. firingIndex = -1,
  11280. // Fire callbacks
  11281. fire = function() {
  11282. // Enforce single-firing
  11283. locked = locked || options.once;
  11284. // Execute callbacks for all pending executions,
  11285. // respecting firingIndex overrides and runtime changes
  11286. fired = firing = true;
  11287. for ( ; queue.length; firingIndex = -1 ) {
  11288. memory = queue.shift();
  11289. while ( ++firingIndex < list.length ) {
  11290. // Run callback and check for early termination
  11291. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11292. options.stopOnFalse ) {
  11293. // Jump to end and forget the data so .add doesn't re-fire
  11294. firingIndex = list.length;
  11295. memory = false;
  11296. }
  11297. }
  11298. }
  11299. // Forget the data if we're done with it
  11300. if ( !options.memory ) {
  11301. memory = false;
  11302. }
  11303. firing = false;
  11304. // Clean up if we're done firing for good
  11305. if ( locked ) {
  11306. // Keep an empty list if we have data for future add calls
  11307. if ( memory ) {
  11308. list = [];
  11309. // Otherwise, this object is spent
  11310. } else {
  11311. list = "";
  11312. }
  11313. }
  11314. },
  11315. // Actual Callbacks object
  11316. self = {
  11317. // Add a callback or a collection of callbacks to the list
  11318. add: function() {
  11319. if ( list ) {
  11320. // If we have memory from a past run, we should fire after adding
  11321. if ( memory && !firing ) {
  11322. firingIndex = list.length - 1;
  11323. queue.push( memory );
  11324. }
  11325. ( function add( args ) {
  11326. jQuery.each( args, function( _, arg ) {
  11327. if ( isFunction( arg ) ) {
  11328. if ( !options.unique || !self.has( arg ) ) {
  11329. list.push( arg );
  11330. }
  11331. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11332. // Inspect recursively
  11333. add( arg );
  11334. }
  11335. } );
  11336. } )( arguments );
  11337. if ( memory && !firing ) {
  11338. fire();
  11339. }
  11340. }
  11341. return this;
  11342. },
  11343. // Remove a callback from the list
  11344. remove: function() {
  11345. jQuery.each( arguments, function( _, arg ) {
  11346. var index;
  11347. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11348. list.splice( index, 1 );
  11349. // Handle firing indexes
  11350. if ( index <= firingIndex ) {
  11351. firingIndex--;
  11352. }
  11353. }
  11354. } );
  11355. return this;
  11356. },
  11357. // Check if a given callback is in the list.
  11358. // If no argument is given, return whether or not list has callbacks attached.
  11359. has: function( fn ) {
  11360. return fn ?
  11361. jQuery.inArray( fn, list ) > -1 :
  11362. list.length > 0;
  11363. },
  11364. // Remove all callbacks from the list
  11365. empty: function() {
  11366. if ( list ) {
  11367. list = [];
  11368. }
  11369. return this;
  11370. },
  11371. // Disable .fire and .add
  11372. // Abort any current/pending executions
  11373. // Clear all callbacks and values
  11374. disable: function() {
  11375. locked = queue = [];
  11376. list = memory = "";
  11377. return this;
  11378. },
  11379. disabled: function() {
  11380. return !list;
  11381. },
  11382. // Disable .fire
  11383. // Also disable .add unless we have memory (since it would have no effect)
  11384. // Abort any pending executions
  11385. lock: function() {
  11386. locked = queue = [];
  11387. if ( !memory && !firing ) {
  11388. list = memory = "";
  11389. }
  11390. return this;
  11391. },
  11392. locked: function() {
  11393. return !!locked;
  11394. },
  11395. // Call all callbacks with the given context and arguments
  11396. fireWith: function( context, args ) {
  11397. if ( !locked ) {
  11398. args = args || [];
  11399. args = [ context, args.slice ? args.slice() : args ];
  11400. queue.push( args );
  11401. if ( !firing ) {
  11402. fire();
  11403. }
  11404. }
  11405. return this;
  11406. },
  11407. // Call all the callbacks with the given arguments
  11408. fire: function() {
  11409. self.fireWith( this, arguments );
  11410. return this;
  11411. },
  11412. // To know if the callbacks have already been called at least once
  11413. fired: function() {
  11414. return !!fired;
  11415. }
  11416. };
  11417. return self;
  11418. };
  11419. function Identity( v ) {
  11420. return v;
  11421. }
  11422. function Thrower( ex ) {
  11423. throw ex;
  11424. }
  11425. function adoptValue( value, resolve, reject, noValue ) {
  11426. var method;
  11427. try {
  11428. // Check for promise aspect first to privilege synchronous behavior
  11429. if ( value && isFunction( ( method = value.promise ) ) ) {
  11430. method.call( value ).done( resolve ).fail( reject );
  11431. // Other thenables
  11432. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11433. method.call( value, resolve, reject );
  11434. // Other non-thenables
  11435. } else {
  11436. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11437. // * false: [ value ].slice( 0 ) => resolve( value )
  11438. // * true: [ value ].slice( 1 ) => resolve()
  11439. resolve.apply( undefined, [ value ].slice( noValue ) );
  11440. }
  11441. // For Promises/A+, convert exceptions into rejections
  11442. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11443. // Deferred#then to conditionally suppress rejection.
  11444. } catch ( value ) {
  11445. // Support: Android 4.0 only
  11446. // Strict mode functions invoked without .call/.apply get global-object context
  11447. reject.apply( undefined, [ value ] );
  11448. }
  11449. }
  11450. jQuery.extend( {
  11451. Deferred: function( func ) {
  11452. var tuples = [
  11453. // action, add listener, callbacks,
  11454. // ... .then handlers, argument index, [final state]
  11455. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11456. jQuery.Callbacks( "memory" ), 2 ],
  11457. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11458. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11459. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11460. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11461. ],
  11462. state = "pending",
  11463. promise = {
  11464. state: function() {
  11465. return state;
  11466. },
  11467. always: function() {
  11468. deferred.done( arguments ).fail( arguments );
  11469. return this;
  11470. },
  11471. "catch": function( fn ) {
  11472. return promise.then( null, fn );
  11473. },
  11474. // Keep pipe for back-compat
  11475. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11476. var fns = arguments;
  11477. return jQuery.Deferred( function( newDefer ) {
  11478. jQuery.each( tuples, function( i, tuple ) {
  11479. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11480. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11481. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11482. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11483. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11484. deferred[ tuple[ 1 ] ]( function() {
  11485. var returned = fn && fn.apply( this, arguments );
  11486. if ( returned && isFunction( returned.promise ) ) {
  11487. returned.promise()
  11488. .progress( newDefer.notify )
  11489. .done( newDefer.resolve )
  11490. .fail( newDefer.reject );
  11491. } else {
  11492. newDefer[ tuple[ 0 ] + "With" ](
  11493. this,
  11494. fn ? [ returned ] : arguments
  11495. );
  11496. }
  11497. } );
  11498. } );
  11499. fns = null;
  11500. } ).promise();
  11501. },
  11502. then: function( onFulfilled, onRejected, onProgress ) {
  11503. var maxDepth = 0;
  11504. function resolve( depth, deferred, handler, special ) {
  11505. return function() {
  11506. var that = this,
  11507. args = arguments,
  11508. mightThrow = function() {
  11509. var returned, then;
  11510. // Support: Promises/A+ section 2.3.3.3.3
  11511. // https://promisesaplus.com/#point-59
  11512. // Ignore double-resolution attempts
  11513. if ( depth < maxDepth ) {
  11514. return;
  11515. }
  11516. returned = handler.apply( that, args );
  11517. // Support: Promises/A+ section 2.3.1
  11518. // https://promisesaplus.com/#point-48
  11519. if ( returned === deferred.promise() ) {
  11520. throw new TypeError( "Thenable self-resolution" );
  11521. }
  11522. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11523. // https://promisesaplus.com/#point-54
  11524. // https://promisesaplus.com/#point-75
  11525. // Retrieve `then` only once
  11526. then = returned &&
  11527. // Support: Promises/A+ section 2.3.4
  11528. // https://promisesaplus.com/#point-64
  11529. // Only check objects and functions for thenability
  11530. ( typeof returned === "object" ||
  11531. typeof returned === "function" ) &&
  11532. returned.then;
  11533. // Handle a returned thenable
  11534. if ( isFunction( then ) ) {
  11535. // Special processors (notify) just wait for resolution
  11536. if ( special ) {
  11537. then.call(
  11538. returned,
  11539. resolve( maxDepth, deferred, Identity, special ),
  11540. resolve( maxDepth, deferred, Thrower, special )
  11541. );
  11542. // Normal processors (resolve) also hook into progress
  11543. } else {
  11544. // ...and disregard older resolution values
  11545. maxDepth++;
  11546. then.call(
  11547. returned,
  11548. resolve( maxDepth, deferred, Identity, special ),
  11549. resolve( maxDepth, deferred, Thrower, special ),
  11550. resolve( maxDepth, deferred, Identity,
  11551. deferred.notifyWith )
  11552. );
  11553. }
  11554. // Handle all other returned values
  11555. } else {
  11556. // Only substitute handlers pass on context
  11557. // and multiple values (non-spec behavior)
  11558. if ( handler !== Identity ) {
  11559. that = undefined;
  11560. args = [ returned ];
  11561. }
  11562. // Process the value(s)
  11563. // Default process is resolve
  11564. ( special || deferred.resolveWith )( that, args );
  11565. }
  11566. },
  11567. // Only normal processors (resolve) catch and reject exceptions
  11568. process = special ?
  11569. mightThrow :
  11570. function() {
  11571. try {
  11572. mightThrow();
  11573. } catch ( e ) {
  11574. if ( jQuery.Deferred.exceptionHook ) {
  11575. jQuery.Deferred.exceptionHook( e,
  11576. process.stackTrace );
  11577. }
  11578. // Support: Promises/A+ section 2.3.3.3.4.1
  11579. // https://promisesaplus.com/#point-61
  11580. // Ignore post-resolution exceptions
  11581. if ( depth + 1 >= maxDepth ) {
  11582. // Only substitute handlers pass on context
  11583. // and multiple values (non-spec behavior)
  11584. if ( handler !== Thrower ) {
  11585. that = undefined;
  11586. args = [ e ];
  11587. }
  11588. deferred.rejectWith( that, args );
  11589. }
  11590. }
  11591. };
  11592. // Support: Promises/A+ section 2.3.3.3.1
  11593. // https://promisesaplus.com/#point-57
  11594. // Re-resolve promises immediately to dodge false rejection from
  11595. // subsequent errors
  11596. if ( depth ) {
  11597. process();
  11598. } else {
  11599. // Call an optional hook to record the stack, in case of exception
  11600. // since it's otherwise lost when execution goes async
  11601. if ( jQuery.Deferred.getStackHook ) {
  11602. process.stackTrace = jQuery.Deferred.getStackHook();
  11603. }
  11604. window.setTimeout( process );
  11605. }
  11606. };
  11607. }
  11608. return jQuery.Deferred( function( newDefer ) {
  11609. // progress_handlers.add( ... )
  11610. tuples[ 0 ][ 3 ].add(
  11611. resolve(
  11612. 0,
  11613. newDefer,
  11614. isFunction( onProgress ) ?
  11615. onProgress :
  11616. Identity,
  11617. newDefer.notifyWith
  11618. )
  11619. );
  11620. // fulfilled_handlers.add( ... )
  11621. tuples[ 1 ][ 3 ].add(
  11622. resolve(
  11623. 0,
  11624. newDefer,
  11625. isFunction( onFulfilled ) ?
  11626. onFulfilled :
  11627. Identity
  11628. )
  11629. );
  11630. // rejected_handlers.add( ... )
  11631. tuples[ 2 ][ 3 ].add(
  11632. resolve(
  11633. 0,
  11634. newDefer,
  11635. isFunction( onRejected ) ?
  11636. onRejected :
  11637. Thrower
  11638. )
  11639. );
  11640. } ).promise();
  11641. },
  11642. // Get a promise for this deferred
  11643. // If obj is provided, the promise aspect is added to the object
  11644. promise: function( obj ) {
  11645. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11646. }
  11647. },
  11648. deferred = {};
  11649. // Add list-specific methods
  11650. jQuery.each( tuples, function( i, tuple ) {
  11651. var list = tuple[ 2 ],
  11652. stateString = tuple[ 5 ];
  11653. // promise.progress = list.add
  11654. // promise.done = list.add
  11655. // promise.fail = list.add
  11656. promise[ tuple[ 1 ] ] = list.add;
  11657. // Handle state
  11658. if ( stateString ) {
  11659. list.add(
  11660. function() {
  11661. // state = "resolved" (i.e., fulfilled)
  11662. // state = "rejected"
  11663. state = stateString;
  11664. },
  11665. // rejected_callbacks.disable
  11666. // fulfilled_callbacks.disable
  11667. tuples[ 3 - i ][ 2 ].disable,
  11668. // rejected_handlers.disable
  11669. // fulfilled_handlers.disable
  11670. tuples[ 3 - i ][ 3 ].disable,
  11671. // progress_callbacks.lock
  11672. tuples[ 0 ][ 2 ].lock,
  11673. // progress_handlers.lock
  11674. tuples[ 0 ][ 3 ].lock
  11675. );
  11676. }
  11677. // progress_handlers.fire
  11678. // fulfilled_handlers.fire
  11679. // rejected_handlers.fire
  11680. list.add( tuple[ 3 ].fire );
  11681. // deferred.notify = function() { deferred.notifyWith(...) }
  11682. // deferred.resolve = function() { deferred.resolveWith(...) }
  11683. // deferred.reject = function() { deferred.rejectWith(...) }
  11684. deferred[ tuple[ 0 ] ] = function() {
  11685. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11686. return this;
  11687. };
  11688. // deferred.notifyWith = list.fireWith
  11689. // deferred.resolveWith = list.fireWith
  11690. // deferred.rejectWith = list.fireWith
  11691. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11692. } );
  11693. // Make the deferred a promise
  11694. promise.promise( deferred );
  11695. // Call given func if any
  11696. if ( func ) {
  11697. func.call( deferred, deferred );
  11698. }
  11699. // All done!
  11700. return deferred;
  11701. },
  11702. // Deferred helper
  11703. when: function( singleValue ) {
  11704. var
  11705. // count of uncompleted subordinates
  11706. remaining = arguments.length,
  11707. // count of unprocessed arguments
  11708. i = remaining,
  11709. // subordinate fulfillment data
  11710. resolveContexts = Array( i ),
  11711. resolveValues = slice.call( arguments ),
  11712. // the master Deferred
  11713. master = jQuery.Deferred(),
  11714. // subordinate callback factory
  11715. updateFunc = function( i ) {
  11716. return function( value ) {
  11717. resolveContexts[ i ] = this;
  11718. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11719. if ( !( --remaining ) ) {
  11720. master.resolveWith( resolveContexts, resolveValues );
  11721. }
  11722. };
  11723. };
  11724. // Single- and empty arguments are adopted like Promise.resolve
  11725. if ( remaining <= 1 ) {
  11726. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11727. !remaining );
  11728. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11729. if ( master.state() === "pending" ||
  11730. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11731. return master.then();
  11732. }
  11733. }
  11734. // Multiple arguments are aggregated like Promise.all array elements
  11735. while ( i-- ) {
  11736. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11737. }
  11738. return master.promise();
  11739. }
  11740. } );
  11741. // These usually indicate a programmer mistake during development,
  11742. // warn about them ASAP rather than swallowing them by default.
  11743. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11744. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11745. // Support: IE 8 - 9 only
  11746. // Console exists when dev tools are open, which can happen at any time
  11747. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11748. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11749. }
  11750. };
  11751. jQuery.readyException = function( error ) {
  11752. window.setTimeout( function() {
  11753. throw error;
  11754. } );
  11755. };
  11756. // The deferred used on DOM ready
  11757. var readyList = jQuery.Deferred();
  11758. jQuery.fn.ready = function( fn ) {
  11759. readyList
  11760. .then( fn )
  11761. // Wrap jQuery.readyException in a function so that the lookup
  11762. // happens at the time of error handling instead of callback
  11763. // registration.
  11764. .catch( function( error ) {
  11765. jQuery.readyException( error );
  11766. } );
  11767. return this;
  11768. };
  11769. jQuery.extend( {
  11770. // Is the DOM ready to be used? Set to true once it occurs.
  11771. isReady: false,
  11772. // A counter to track how many items to wait for before
  11773. // the ready event fires. See #6781
  11774. readyWait: 1,
  11775. // Handle when the DOM is ready
  11776. ready: function( wait ) {
  11777. // Abort if there are pending holds or we're already ready
  11778. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11779. return;
  11780. }
  11781. // Remember that the DOM is ready
  11782. jQuery.isReady = true;
  11783. // If a normal DOM Ready event fired, decrement, and wait if need be
  11784. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11785. return;
  11786. }
  11787. // If there are functions bound, to execute
  11788. readyList.resolveWith( document, [ jQuery ] );
  11789. }
  11790. } );
  11791. jQuery.ready.then = readyList.then;
  11792. // The ready event handler and self cleanup method
  11793. function completed() {
  11794. document.removeEventListener( "DOMContentLoaded", completed );
  11795. window.removeEventListener( "load", completed );
  11796. jQuery.ready();
  11797. }
  11798. // Catch cases where $(document).ready() is called
  11799. // after the browser event has already occurred.
  11800. // Support: IE <=9 - 10 only
  11801. // Older IE sometimes signals "interactive" too soon
  11802. if ( document.readyState === "complete" ||
  11803. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11804. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11805. window.setTimeout( jQuery.ready );
  11806. } else {
  11807. // Use the handy event callback
  11808. document.addEventListener( "DOMContentLoaded", completed );
  11809. // A fallback to window.onload, that will always work
  11810. window.addEventListener( "load", completed );
  11811. }
  11812. // Multifunctional method to get and set values of a collection
  11813. // The value/s can optionally be executed if it's a function
  11814. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11815. var i = 0,
  11816. len = elems.length,
  11817. bulk = key == null;
  11818. // Sets many values
  11819. if ( toType( key ) === "object" ) {
  11820. chainable = true;
  11821. for ( i in key ) {
  11822. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11823. }
  11824. // Sets one value
  11825. } else if ( value !== undefined ) {
  11826. chainable = true;
  11827. if ( !isFunction( value ) ) {
  11828. raw = true;
  11829. }
  11830. if ( bulk ) {
  11831. // Bulk operations run against the entire set
  11832. if ( raw ) {
  11833. fn.call( elems, value );
  11834. fn = null;
  11835. // ...except when executing function values
  11836. } else {
  11837. bulk = fn;
  11838. fn = function( elem, key, value ) {
  11839. return bulk.call( jQuery( elem ), value );
  11840. };
  11841. }
  11842. }
  11843. if ( fn ) {
  11844. for ( ; i < len; i++ ) {
  11845. fn(
  11846. elems[ i ], key, raw ?
  11847. value :
  11848. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11849. );
  11850. }
  11851. }
  11852. }
  11853. if ( chainable ) {
  11854. return elems;
  11855. }
  11856. // Gets
  11857. if ( bulk ) {
  11858. return fn.call( elems );
  11859. }
  11860. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11861. };
  11862. // Matches dashed string for camelizing
  11863. var rmsPrefix = /^-ms-/,
  11864. rdashAlpha = /-([a-z])/g;
  11865. // Used by camelCase as callback to replace()
  11866. function fcamelCase( all, letter ) {
  11867. return letter.toUpperCase();
  11868. }
  11869. // Convert dashed to camelCase; used by the css and data modules
  11870. // Support: IE <=9 - 11, Edge 12 - 15
  11871. // Microsoft forgot to hump their vendor prefix (#9572)
  11872. function camelCase( string ) {
  11873. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11874. }
  11875. var acceptData = function( owner ) {
  11876. // Accepts only:
  11877. // - Node
  11878. // - Node.ELEMENT_NODE
  11879. // - Node.DOCUMENT_NODE
  11880. // - Object
  11881. // - Any
  11882. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11883. };
  11884. function Data() {
  11885. this.expando = jQuery.expando + Data.uid++;
  11886. }
  11887. Data.uid = 1;
  11888. Data.prototype = {
  11889. cache: function( owner ) {
  11890. // Check if the owner object already has a cache
  11891. var value = owner[ this.expando ];
  11892. // If not, create one
  11893. if ( !value ) {
  11894. value = {};
  11895. // We can accept data for non-element nodes in modern browsers,
  11896. // but we should not, see #8335.
  11897. // Always return an empty object.
  11898. if ( acceptData( owner ) ) {
  11899. // If it is a node unlikely to be stringify-ed or looped over
  11900. // use plain assignment
  11901. if ( owner.nodeType ) {
  11902. owner[ this.expando ] = value;
  11903. // Otherwise secure it in a non-enumerable property
  11904. // configurable must be true to allow the property to be
  11905. // deleted when data is removed
  11906. } else {
  11907. Object.defineProperty( owner, this.expando, {
  11908. value: value,
  11909. configurable: true
  11910. } );
  11911. }
  11912. }
  11913. }
  11914. return value;
  11915. },
  11916. set: function( owner, data, value ) {
  11917. var prop,
  11918. cache = this.cache( owner );
  11919. // Handle: [ owner, key, value ] args
  11920. // Always use camelCase key (gh-2257)
  11921. if ( typeof data === "string" ) {
  11922. cache[ camelCase( data ) ] = value;
  11923. // Handle: [ owner, { properties } ] args
  11924. } else {
  11925. // Copy the properties one-by-one to the cache object
  11926. for ( prop in data ) {
  11927. cache[ camelCase( prop ) ] = data[ prop ];
  11928. }
  11929. }
  11930. return cache;
  11931. },
  11932. get: function( owner, key ) {
  11933. return key === undefined ?
  11934. this.cache( owner ) :
  11935. // Always use camelCase key (gh-2257)
  11936. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11937. },
  11938. access: function( owner, key, value ) {
  11939. // In cases where either:
  11940. //
  11941. // 1. No key was specified
  11942. // 2. A string key was specified, but no value provided
  11943. //
  11944. // Take the "read" path and allow the get method to determine
  11945. // which value to return, respectively either:
  11946. //
  11947. // 1. The entire cache object
  11948. // 2. The data stored at the key
  11949. //
  11950. if ( key === undefined ||
  11951. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11952. return this.get( owner, key );
  11953. }
  11954. // When the key is not a string, or both a key and value
  11955. // are specified, set or extend (existing objects) with either:
  11956. //
  11957. // 1. An object of properties
  11958. // 2. A key and value
  11959. //
  11960. this.set( owner, key, value );
  11961. // Since the "set" path can have two possible entry points
  11962. // return the expected data based on which path was taken[*]
  11963. return value !== undefined ? value : key;
  11964. },
  11965. remove: function( owner, key ) {
  11966. var i,
  11967. cache = owner[ this.expando ];
  11968. if ( cache === undefined ) {
  11969. return;
  11970. }
  11971. if ( key !== undefined ) {
  11972. // Support array or space separated string of keys
  11973. if ( Array.isArray( key ) ) {
  11974. // If key is an array of keys...
  11975. // We always set camelCase keys, so remove that.
  11976. key = key.map( camelCase );
  11977. } else {
  11978. key = camelCase( key );
  11979. // If a key with the spaces exists, use it.
  11980. // Otherwise, create an array by matching non-whitespace
  11981. key = key in cache ?
  11982. [ key ] :
  11983. ( key.match( rnothtmlwhite ) || [] );
  11984. }
  11985. i = key.length;
  11986. while ( i-- ) {
  11987. delete cache[ key[ i ] ];
  11988. }
  11989. }
  11990. // Remove the expando if there's no more data
  11991. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11992. // Support: Chrome <=35 - 45
  11993. // Webkit & Blink performance suffers when deleting properties
  11994. // from DOM nodes, so set to undefined instead
  11995. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11996. if ( owner.nodeType ) {
  11997. owner[ this.expando ] = undefined;
  11998. } else {
  11999. delete owner[ this.expando ];
  12000. }
  12001. }
  12002. },
  12003. hasData: function( owner ) {
  12004. var cache = owner[ this.expando ];
  12005. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12006. }
  12007. };
  12008. var dataPriv = new Data();
  12009. var dataUser = new Data();
  12010. // Implementation Summary
  12011. //
  12012. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12013. // 2. Improve the module's maintainability by reducing the storage
  12014. // paths to a single mechanism.
  12015. // 3. Use the same single mechanism to support "private" and "user" data.
  12016. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12017. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12018. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12019. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12020. rmultiDash = /[A-Z]/g;
  12021. function getData( data ) {
  12022. if ( data === "true" ) {
  12023. return true;
  12024. }
  12025. if ( data === "false" ) {
  12026. return false;
  12027. }
  12028. if ( data === "null" ) {
  12029. return null;
  12030. }
  12031. // Only convert to a number if it doesn't change the string
  12032. if ( data === +data + "" ) {
  12033. return +data;
  12034. }
  12035. if ( rbrace.test( data ) ) {
  12036. return JSON.parse( data );
  12037. }
  12038. return data;
  12039. }
  12040. function dataAttr( elem, key, data ) {
  12041. var name;
  12042. // If nothing was found internally, try to fetch any
  12043. // data from the HTML5 data-* attribute
  12044. if ( data === undefined && elem.nodeType === 1 ) {
  12045. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12046. data = elem.getAttribute( name );
  12047. if ( typeof data === "string" ) {
  12048. try {
  12049. data = getData( data );
  12050. } catch ( e ) {}
  12051. // Make sure we set the data so it isn't changed later
  12052. dataUser.set( elem, key, data );
  12053. } else {
  12054. data = undefined;
  12055. }
  12056. }
  12057. return data;
  12058. }
  12059. jQuery.extend( {
  12060. hasData: function( elem ) {
  12061. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12062. },
  12063. data: function( elem, name, data ) {
  12064. return dataUser.access( elem, name, data );
  12065. },
  12066. removeData: function( elem, name ) {
  12067. dataUser.remove( elem, name );
  12068. },
  12069. // TODO: Now that all calls to _data and _removeData have been replaced
  12070. // with direct calls to dataPriv methods, these can be deprecated.
  12071. _data: function( elem, name, data ) {
  12072. return dataPriv.access( elem, name, data );
  12073. },
  12074. _removeData: function( elem, name ) {
  12075. dataPriv.remove( elem, name );
  12076. }
  12077. } );
  12078. jQuery.fn.extend( {
  12079. data: function( key, value ) {
  12080. var i, name, data,
  12081. elem = this[ 0 ],
  12082. attrs = elem && elem.attributes;
  12083. // Gets all values
  12084. if ( key === undefined ) {
  12085. if ( this.length ) {
  12086. data = dataUser.get( elem );
  12087. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12088. i = attrs.length;
  12089. while ( i-- ) {
  12090. // Support: IE 11 only
  12091. // The attrs elements can be null (#14894)
  12092. if ( attrs[ i ] ) {
  12093. name = attrs[ i ].name;
  12094. if ( name.indexOf( "data-" ) === 0 ) {
  12095. name = camelCase( name.slice( 5 ) );
  12096. dataAttr( elem, name, data[ name ] );
  12097. }
  12098. }
  12099. }
  12100. dataPriv.set( elem, "hasDataAttrs", true );
  12101. }
  12102. }
  12103. return data;
  12104. }
  12105. // Sets multiple values
  12106. if ( typeof key === "object" ) {
  12107. return this.each( function() {
  12108. dataUser.set( this, key );
  12109. } );
  12110. }
  12111. return access( this, function( value ) {
  12112. var data;
  12113. // The calling jQuery object (element matches) is not empty
  12114. // (and therefore has an element appears at this[ 0 ]) and the
  12115. // `value` parameter was not undefined. An empty jQuery object
  12116. // will result in `undefined` for elem = this[ 0 ] which will
  12117. // throw an exception if an attempt to read a data cache is made.
  12118. if ( elem && value === undefined ) {
  12119. // Attempt to get data from the cache
  12120. // The key will always be camelCased in Data
  12121. data = dataUser.get( elem, key );
  12122. if ( data !== undefined ) {
  12123. return data;
  12124. }
  12125. // Attempt to "discover" the data in
  12126. // HTML5 custom data-* attrs
  12127. data = dataAttr( elem, key );
  12128. if ( data !== undefined ) {
  12129. return data;
  12130. }
  12131. // We tried really hard, but the data doesn't exist.
  12132. return;
  12133. }
  12134. // Set the data...
  12135. this.each( function() {
  12136. // We always store the camelCased key
  12137. dataUser.set( this, key, value );
  12138. } );
  12139. }, null, value, arguments.length > 1, null, true );
  12140. },
  12141. removeData: function( key ) {
  12142. return this.each( function() {
  12143. dataUser.remove( this, key );
  12144. } );
  12145. }
  12146. } );
  12147. jQuery.extend( {
  12148. queue: function( elem, type, data ) {
  12149. var queue;
  12150. if ( elem ) {
  12151. type = ( type || "fx" ) + "queue";
  12152. queue = dataPriv.get( elem, type );
  12153. // Speed up dequeue by getting out quickly if this is just a lookup
  12154. if ( data ) {
  12155. if ( !queue || Array.isArray( data ) ) {
  12156. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12157. } else {
  12158. queue.push( data );
  12159. }
  12160. }
  12161. return queue || [];
  12162. }
  12163. },
  12164. dequeue: function( elem, type ) {
  12165. type = type || "fx";
  12166. var queue = jQuery.queue( elem, type ),
  12167. startLength = queue.length,
  12168. fn = queue.shift(),
  12169. hooks = jQuery._queueHooks( elem, type ),
  12170. next = function() {
  12171. jQuery.dequeue( elem, type );
  12172. };
  12173. // If the fx queue is dequeued, always remove the progress sentinel
  12174. if ( fn === "inprogress" ) {
  12175. fn = queue.shift();
  12176. startLength--;
  12177. }
  12178. if ( fn ) {
  12179. // Add a progress sentinel to prevent the fx queue from being
  12180. // automatically dequeued
  12181. if ( type === "fx" ) {
  12182. queue.unshift( "inprogress" );
  12183. }
  12184. // Clear up the last queue stop function
  12185. delete hooks.stop;
  12186. fn.call( elem, next, hooks );
  12187. }
  12188. if ( !startLength && hooks ) {
  12189. hooks.empty.fire();
  12190. }
  12191. },
  12192. // Not public - generate a queueHooks object, or return the current one
  12193. _queueHooks: function( elem, type ) {
  12194. var key = type + "queueHooks";
  12195. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12196. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12197. dataPriv.remove( elem, [ type + "queue", key ] );
  12198. } )
  12199. } );
  12200. }
  12201. } );
  12202. jQuery.fn.extend( {
  12203. queue: function( type, data ) {
  12204. var setter = 2;
  12205. if ( typeof type !== "string" ) {
  12206. data = type;
  12207. type = "fx";
  12208. setter--;
  12209. }
  12210. if ( arguments.length < setter ) {
  12211. return jQuery.queue( this[ 0 ], type );
  12212. }
  12213. return data === undefined ?
  12214. this :
  12215. this.each( function() {
  12216. var queue = jQuery.queue( this, type, data );
  12217. // Ensure a hooks for this queue
  12218. jQuery._queueHooks( this, type );
  12219. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12220. jQuery.dequeue( this, type );
  12221. }
  12222. } );
  12223. },
  12224. dequeue: function( type ) {
  12225. return this.each( function() {
  12226. jQuery.dequeue( this, type );
  12227. } );
  12228. },
  12229. clearQueue: function( type ) {
  12230. return this.queue( type || "fx", [] );
  12231. },
  12232. // Get a promise resolved when queues of a certain type
  12233. // are emptied (fx is the type by default)
  12234. promise: function( type, obj ) {
  12235. var tmp,
  12236. count = 1,
  12237. defer = jQuery.Deferred(),
  12238. elements = this,
  12239. i = this.length,
  12240. resolve = function() {
  12241. if ( !( --count ) ) {
  12242. defer.resolveWith( elements, [ elements ] );
  12243. }
  12244. };
  12245. if ( typeof type !== "string" ) {
  12246. obj = type;
  12247. type = undefined;
  12248. }
  12249. type = type || "fx";
  12250. while ( i-- ) {
  12251. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12252. if ( tmp && tmp.empty ) {
  12253. count++;
  12254. tmp.empty.add( resolve );
  12255. }
  12256. }
  12257. resolve();
  12258. return defer.promise( obj );
  12259. }
  12260. } );
  12261. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12262. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12263. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12264. var documentElement = document.documentElement;
  12265. var isAttached = function( elem ) {
  12266. return jQuery.contains( elem.ownerDocument, elem );
  12267. },
  12268. composed = { composed: true };
  12269. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12270. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12271. // Support: iOS 10.0-10.2 only
  12272. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12273. // leading to errors. We need to check for `getRootNode`.
  12274. if ( documentElement.getRootNode ) {
  12275. isAttached = function( elem ) {
  12276. return jQuery.contains( elem.ownerDocument, elem ) ||
  12277. elem.getRootNode( composed ) === elem.ownerDocument;
  12278. };
  12279. }
  12280. var isHiddenWithinTree = function( elem, el ) {
  12281. // isHiddenWithinTree might be called from jQuery#filter function;
  12282. // in that case, element will be second argument
  12283. elem = el || elem;
  12284. // Inline style trumps all
  12285. return elem.style.display === "none" ||
  12286. elem.style.display === "" &&
  12287. // Otherwise, check computed style
  12288. // Support: Firefox <=43 - 45
  12289. // Disconnected elements can have computed display: none, so first confirm that elem is
  12290. // in the document.
  12291. isAttached( elem ) &&
  12292. jQuery.css( elem, "display" ) === "none";
  12293. };
  12294. var swap = function( elem, options, callback, args ) {
  12295. var ret, name,
  12296. old = {};
  12297. // Remember the old values, and insert the new ones
  12298. for ( name in options ) {
  12299. old[ name ] = elem.style[ name ];
  12300. elem.style[ name ] = options[ name ];
  12301. }
  12302. ret = callback.apply( elem, args || [] );
  12303. // Revert the old values
  12304. for ( name in options ) {
  12305. elem.style[ name ] = old[ name ];
  12306. }
  12307. return ret;
  12308. };
  12309. function adjustCSS( elem, prop, valueParts, tween ) {
  12310. var adjusted, scale,
  12311. maxIterations = 20,
  12312. currentValue = tween ?
  12313. function() {
  12314. return tween.cur();
  12315. } :
  12316. function() {
  12317. return jQuery.css( elem, prop, "" );
  12318. },
  12319. initial = currentValue(),
  12320. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12321. // Starting value computation is required for potential unit mismatches
  12322. initialInUnit = elem.nodeType &&
  12323. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12324. rcssNum.exec( jQuery.css( elem, prop ) );
  12325. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12326. // Support: Firefox <=54
  12327. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12328. initial = initial / 2;
  12329. // Trust units reported by jQuery.css
  12330. unit = unit || initialInUnit[ 3 ];
  12331. // Iteratively approximate from a nonzero starting point
  12332. initialInUnit = +initial || 1;
  12333. while ( maxIterations-- ) {
  12334. // Evaluate and update our best guess (doubling guesses that zero out).
  12335. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12336. jQuery.style( elem, prop, initialInUnit + unit );
  12337. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12338. maxIterations = 0;
  12339. }
  12340. initialInUnit = initialInUnit / scale;
  12341. }
  12342. initialInUnit = initialInUnit * 2;
  12343. jQuery.style( elem, prop, initialInUnit + unit );
  12344. // Make sure we update the tween properties later on
  12345. valueParts = valueParts || [];
  12346. }
  12347. if ( valueParts ) {
  12348. initialInUnit = +initialInUnit || +initial || 0;
  12349. // Apply relative offset (+=/-=) if specified
  12350. adjusted = valueParts[ 1 ] ?
  12351. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12352. +valueParts[ 2 ];
  12353. if ( tween ) {
  12354. tween.unit = unit;
  12355. tween.start = initialInUnit;
  12356. tween.end = adjusted;
  12357. }
  12358. }
  12359. return adjusted;
  12360. }
  12361. var defaultDisplayMap = {};
  12362. function getDefaultDisplay( elem ) {
  12363. var temp,
  12364. doc = elem.ownerDocument,
  12365. nodeName = elem.nodeName,
  12366. display = defaultDisplayMap[ nodeName ];
  12367. if ( display ) {
  12368. return display;
  12369. }
  12370. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12371. display = jQuery.css( temp, "display" );
  12372. temp.parentNode.removeChild( temp );
  12373. if ( display === "none" ) {
  12374. display = "block";
  12375. }
  12376. defaultDisplayMap[ nodeName ] = display;
  12377. return display;
  12378. }
  12379. function showHide( elements, show ) {
  12380. var display, elem,
  12381. values = [],
  12382. index = 0,
  12383. length = elements.length;
  12384. // Determine new display value for elements that need to change
  12385. for ( ; index < length; index++ ) {
  12386. elem = elements[ index ];
  12387. if ( !elem.style ) {
  12388. continue;
  12389. }
  12390. display = elem.style.display;
  12391. if ( show ) {
  12392. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12393. // check is required in this first loop unless we have a nonempty display value (either
  12394. // inline or about-to-be-restored)
  12395. if ( display === "none" ) {
  12396. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12397. if ( !values[ index ] ) {
  12398. elem.style.display = "";
  12399. }
  12400. }
  12401. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12402. values[ index ] = getDefaultDisplay( elem );
  12403. }
  12404. } else {
  12405. if ( display !== "none" ) {
  12406. values[ index ] = "none";
  12407. // Remember what we're overwriting
  12408. dataPriv.set( elem, "display", display );
  12409. }
  12410. }
  12411. }
  12412. // Set the display of the elements in a second loop to avoid constant reflow
  12413. for ( index = 0; index < length; index++ ) {
  12414. if ( values[ index ] != null ) {
  12415. elements[ index ].style.display = values[ index ];
  12416. }
  12417. }
  12418. return elements;
  12419. }
  12420. jQuery.fn.extend( {
  12421. show: function() {
  12422. return showHide( this, true );
  12423. },
  12424. hide: function() {
  12425. return showHide( this );
  12426. },
  12427. toggle: function( state ) {
  12428. if ( typeof state === "boolean" ) {
  12429. return state ? this.show() : this.hide();
  12430. }
  12431. return this.each( function() {
  12432. if ( isHiddenWithinTree( this ) ) {
  12433. jQuery( this ).show();
  12434. } else {
  12435. jQuery( this ).hide();
  12436. }
  12437. } );
  12438. }
  12439. } );
  12440. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12441. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12442. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12443. // We have to close these tags to support XHTML (#13200)
  12444. var wrapMap = {
  12445. // Support: IE <=9 only
  12446. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12447. // XHTML parsers do not magically insert elements in the
  12448. // same way that tag soup parsers do. So we cannot shorten
  12449. // this by omitting <tbody> or other required elements.
  12450. thead: [ 1, "<table>", "</table>" ],
  12451. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12452. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12453. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12454. _default: [ 0, "", "" ]
  12455. };
  12456. // Support: IE <=9 only
  12457. wrapMap.optgroup = wrapMap.option;
  12458. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12459. wrapMap.th = wrapMap.td;
  12460. function getAll( context, tag ) {
  12461. // Support: IE <=9 - 11 only
  12462. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12463. var ret;
  12464. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12465. ret = context.getElementsByTagName( tag || "*" );
  12466. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12467. ret = context.querySelectorAll( tag || "*" );
  12468. } else {
  12469. ret = [];
  12470. }
  12471. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12472. return jQuery.merge( [ context ], ret );
  12473. }
  12474. return ret;
  12475. }
  12476. // Mark scripts as having already been evaluated
  12477. function setGlobalEval( elems, refElements ) {
  12478. var i = 0,
  12479. l = elems.length;
  12480. for ( ; i < l; i++ ) {
  12481. dataPriv.set(
  12482. elems[ i ],
  12483. "globalEval",
  12484. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12485. );
  12486. }
  12487. }
  12488. var rhtml = /<|&#?\w+;/;
  12489. function buildFragment( elems, context, scripts, selection, ignored ) {
  12490. var elem, tmp, tag, wrap, attached, j,
  12491. fragment = context.createDocumentFragment(),
  12492. nodes = [],
  12493. i = 0,
  12494. l = elems.length;
  12495. for ( ; i < l; i++ ) {
  12496. elem = elems[ i ];
  12497. if ( elem || elem === 0 ) {
  12498. // Add nodes directly
  12499. if ( toType( elem ) === "object" ) {
  12500. // Support: Android <=4.0 only, PhantomJS 1 only
  12501. // push.apply(_, arraylike) throws on ancient WebKit
  12502. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12503. // Convert non-html into a text node
  12504. } else if ( !rhtml.test( elem ) ) {
  12505. nodes.push( context.createTextNode( elem ) );
  12506. // Convert html into DOM nodes
  12507. } else {
  12508. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12509. // Deserialize a standard representation
  12510. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12511. wrap = wrapMap[ tag ] || wrapMap._default;
  12512. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12513. // Descend through wrappers to the right content
  12514. j = wrap[ 0 ];
  12515. while ( j-- ) {
  12516. tmp = tmp.lastChild;
  12517. }
  12518. // Support: Android <=4.0 only, PhantomJS 1 only
  12519. // push.apply(_, arraylike) throws on ancient WebKit
  12520. jQuery.merge( nodes, tmp.childNodes );
  12521. // Remember the top-level container
  12522. tmp = fragment.firstChild;
  12523. // Ensure the created nodes are orphaned (#12392)
  12524. tmp.textContent = "";
  12525. }
  12526. }
  12527. }
  12528. // Remove wrapper from fragment
  12529. fragment.textContent = "";
  12530. i = 0;
  12531. while ( ( elem = nodes[ i++ ] ) ) {
  12532. // Skip elements already in the context collection (trac-4087)
  12533. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12534. if ( ignored ) {
  12535. ignored.push( elem );
  12536. }
  12537. continue;
  12538. }
  12539. attached = isAttached( elem );
  12540. // Append to fragment
  12541. tmp = getAll( fragment.appendChild( elem ), "script" );
  12542. // Preserve script evaluation history
  12543. if ( attached ) {
  12544. setGlobalEval( tmp );
  12545. }
  12546. // Capture executables
  12547. if ( scripts ) {
  12548. j = 0;
  12549. while ( ( elem = tmp[ j++ ] ) ) {
  12550. if ( rscriptType.test( elem.type || "" ) ) {
  12551. scripts.push( elem );
  12552. }
  12553. }
  12554. }
  12555. }
  12556. return fragment;
  12557. }
  12558. ( function() {
  12559. var fragment = document.createDocumentFragment(),
  12560. div = fragment.appendChild( document.createElement( "div" ) ),
  12561. input = document.createElement( "input" );
  12562. // Support: Android 4.0 - 4.3 only
  12563. // Check state lost if the name is set (#11217)
  12564. // Support: Windows Web Apps (WWA)
  12565. // `name` and `type` must use .setAttribute for WWA (#14901)
  12566. input.setAttribute( "type", "radio" );
  12567. input.setAttribute( "checked", "checked" );
  12568. input.setAttribute( "name", "t" );
  12569. div.appendChild( input );
  12570. // Support: Android <=4.1 only
  12571. // Older WebKit doesn't clone checked state correctly in fragments
  12572. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12573. // Support: IE <=11 only
  12574. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12575. div.innerHTML = "<textarea>x</textarea>";
  12576. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12577. } )();
  12578. var
  12579. rkeyEvent = /^key/,
  12580. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12581. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12582. function returnTrue() {
  12583. return true;
  12584. }
  12585. function returnFalse() {
  12586. return false;
  12587. }
  12588. // Support: IE <=9 - 11+
  12589. // focus() and blur() are asynchronous, except when they are no-op.
  12590. // So expect focus to be synchronous when the element is already active,
  12591. // and blur to be synchronous when the element is not already active.
  12592. // (focus and blur are always synchronous in other supported browsers,
  12593. // this just defines when we can count on it).
  12594. function expectSync( elem, type ) {
  12595. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12596. }
  12597. // Support: IE <=9 only
  12598. // Accessing document.activeElement can throw unexpectedly
  12599. // https://bugs.jquery.com/ticket/13393
  12600. function safeActiveElement() {
  12601. try {
  12602. return document.activeElement;
  12603. } catch ( err ) { }
  12604. }
  12605. function on( elem, types, selector, data, fn, one ) {
  12606. var origFn, type;
  12607. // Types can be a map of types/handlers
  12608. if ( typeof types === "object" ) {
  12609. // ( types-Object, selector, data )
  12610. if ( typeof selector !== "string" ) {
  12611. // ( types-Object, data )
  12612. data = data || selector;
  12613. selector = undefined;
  12614. }
  12615. for ( type in types ) {
  12616. on( elem, type, selector, data, types[ type ], one );
  12617. }
  12618. return elem;
  12619. }
  12620. if ( data == null && fn == null ) {
  12621. // ( types, fn )
  12622. fn = selector;
  12623. data = selector = undefined;
  12624. } else if ( fn == null ) {
  12625. if ( typeof selector === "string" ) {
  12626. // ( types, selector, fn )
  12627. fn = data;
  12628. data = undefined;
  12629. } else {
  12630. // ( types, data, fn )
  12631. fn = data;
  12632. data = selector;
  12633. selector = undefined;
  12634. }
  12635. }
  12636. if ( fn === false ) {
  12637. fn = returnFalse;
  12638. } else if ( !fn ) {
  12639. return elem;
  12640. }
  12641. if ( one === 1 ) {
  12642. origFn = fn;
  12643. fn = function( event ) {
  12644. // Can use an empty set, since event contains the info
  12645. jQuery().off( event );
  12646. return origFn.apply( this, arguments );
  12647. };
  12648. // Use same guid so caller can remove using origFn
  12649. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12650. }
  12651. return elem.each( function() {
  12652. jQuery.event.add( this, types, fn, data, selector );
  12653. } );
  12654. }
  12655. /*
  12656. * Helper functions for managing events -- not part of the public interface.
  12657. * Props to Dean Edwards' addEvent library for many of the ideas.
  12658. */
  12659. jQuery.event = {
  12660. global: {},
  12661. add: function( elem, types, handler, data, selector ) {
  12662. var handleObjIn, eventHandle, tmp,
  12663. events, t, handleObj,
  12664. special, handlers, type, namespaces, origType,
  12665. elemData = dataPriv.get( elem );
  12666. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12667. if ( !elemData ) {
  12668. return;
  12669. }
  12670. // Caller can pass in an object of custom data in lieu of the handler
  12671. if ( handler.handler ) {
  12672. handleObjIn = handler;
  12673. handler = handleObjIn.handler;
  12674. selector = handleObjIn.selector;
  12675. }
  12676. // Ensure that invalid selectors throw exceptions at attach time
  12677. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12678. if ( selector ) {
  12679. jQuery.find.matchesSelector( documentElement, selector );
  12680. }
  12681. // Make sure that the handler has a unique ID, used to find/remove it later
  12682. if ( !handler.guid ) {
  12683. handler.guid = jQuery.guid++;
  12684. }
  12685. // Init the element's event structure and main handler, if this is the first
  12686. if ( !( events = elemData.events ) ) {
  12687. events = elemData.events = {};
  12688. }
  12689. if ( !( eventHandle = elemData.handle ) ) {
  12690. eventHandle = elemData.handle = function( e ) {
  12691. // Discard the second event of a jQuery.event.trigger() and
  12692. // when an event is called after a page has unloaded
  12693. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12694. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12695. };
  12696. }
  12697. // Handle multiple events separated by a space
  12698. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12699. t = types.length;
  12700. while ( t-- ) {
  12701. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12702. type = origType = tmp[ 1 ];
  12703. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12704. // There *must* be a type, no attaching namespace-only handlers
  12705. if ( !type ) {
  12706. continue;
  12707. }
  12708. // If event changes its type, use the special event handlers for the changed type
  12709. special = jQuery.event.special[ type ] || {};
  12710. // If selector defined, determine special event api type, otherwise given type
  12711. type = ( selector ? special.delegateType : special.bindType ) || type;
  12712. // Update special based on newly reset type
  12713. special = jQuery.event.special[ type ] || {};
  12714. // handleObj is passed to all event handlers
  12715. handleObj = jQuery.extend( {
  12716. type: type,
  12717. origType: origType,
  12718. data: data,
  12719. handler: handler,
  12720. guid: handler.guid,
  12721. selector: selector,
  12722. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12723. namespace: namespaces.join( "." )
  12724. }, handleObjIn );
  12725. // Init the event handler queue if we're the first
  12726. if ( !( handlers = events[ type ] ) ) {
  12727. handlers = events[ type ] = [];
  12728. handlers.delegateCount = 0;
  12729. // Only use addEventListener if the special events handler returns false
  12730. if ( !special.setup ||
  12731. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12732. if ( elem.addEventListener ) {
  12733. elem.addEventListener( type, eventHandle );
  12734. }
  12735. }
  12736. }
  12737. if ( special.add ) {
  12738. special.add.call( elem, handleObj );
  12739. if ( !handleObj.handler.guid ) {
  12740. handleObj.handler.guid = handler.guid;
  12741. }
  12742. }
  12743. // Add to the element's handler list, delegates in front
  12744. if ( selector ) {
  12745. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12746. } else {
  12747. handlers.push( handleObj );
  12748. }
  12749. // Keep track of which events have ever been used, for event optimization
  12750. jQuery.event.global[ type ] = true;
  12751. }
  12752. },
  12753. // Detach an event or set of events from an element
  12754. remove: function( elem, types, handler, selector, mappedTypes ) {
  12755. var j, origCount, tmp,
  12756. events, t, handleObj,
  12757. special, handlers, type, namespaces, origType,
  12758. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12759. if ( !elemData || !( events = elemData.events ) ) {
  12760. return;
  12761. }
  12762. // Once for each type.namespace in types; type may be omitted
  12763. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12764. t = types.length;
  12765. while ( t-- ) {
  12766. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12767. type = origType = tmp[ 1 ];
  12768. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12769. // Unbind all events (on this namespace, if provided) for the element
  12770. if ( !type ) {
  12771. for ( type in events ) {
  12772. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12773. }
  12774. continue;
  12775. }
  12776. special = jQuery.event.special[ type ] || {};
  12777. type = ( selector ? special.delegateType : special.bindType ) || type;
  12778. handlers = events[ type ] || [];
  12779. tmp = tmp[ 2 ] &&
  12780. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12781. // Remove matching events
  12782. origCount = j = handlers.length;
  12783. while ( j-- ) {
  12784. handleObj = handlers[ j ];
  12785. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12786. ( !handler || handler.guid === handleObj.guid ) &&
  12787. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12788. ( !selector || selector === handleObj.selector ||
  12789. selector === "**" && handleObj.selector ) ) {
  12790. handlers.splice( j, 1 );
  12791. if ( handleObj.selector ) {
  12792. handlers.delegateCount--;
  12793. }
  12794. if ( special.remove ) {
  12795. special.remove.call( elem, handleObj );
  12796. }
  12797. }
  12798. }
  12799. // Remove generic event handler if we removed something and no more handlers exist
  12800. // (avoids potential for endless recursion during removal of special event handlers)
  12801. if ( origCount && !handlers.length ) {
  12802. if ( !special.teardown ||
  12803. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12804. jQuery.removeEvent( elem, type, elemData.handle );
  12805. }
  12806. delete events[ type ];
  12807. }
  12808. }
  12809. // Remove data and the expando if it's no longer used
  12810. if ( jQuery.isEmptyObject( events ) ) {
  12811. dataPriv.remove( elem, "handle events" );
  12812. }
  12813. },
  12814. dispatch: function( nativeEvent ) {
  12815. // Make a writable jQuery.Event from the native event object
  12816. var event = jQuery.event.fix( nativeEvent );
  12817. var i, j, ret, matched, handleObj, handlerQueue,
  12818. args = new Array( arguments.length ),
  12819. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12820. special = jQuery.event.special[ event.type ] || {};
  12821. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12822. args[ 0 ] = event;
  12823. for ( i = 1; i < arguments.length; i++ ) {
  12824. args[ i ] = arguments[ i ];
  12825. }
  12826. event.delegateTarget = this;
  12827. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12828. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12829. return;
  12830. }
  12831. // Determine handlers
  12832. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12833. // Run delegates first; they may want to stop propagation beneath us
  12834. i = 0;
  12835. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12836. event.currentTarget = matched.elem;
  12837. j = 0;
  12838. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12839. !event.isImmediatePropagationStopped() ) {
  12840. // If the event is namespaced, then each handler is only invoked if it is
  12841. // specially universal or its namespaces are a superset of the event's.
  12842. if ( !event.rnamespace || handleObj.namespace === false ||
  12843. event.rnamespace.test( handleObj.namespace ) ) {
  12844. event.handleObj = handleObj;
  12845. event.data = handleObj.data;
  12846. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12847. handleObj.handler ).apply( matched.elem, args );
  12848. if ( ret !== undefined ) {
  12849. if ( ( event.result = ret ) === false ) {
  12850. event.preventDefault();
  12851. event.stopPropagation();
  12852. }
  12853. }
  12854. }
  12855. }
  12856. }
  12857. // Call the postDispatch hook for the mapped type
  12858. if ( special.postDispatch ) {
  12859. special.postDispatch.call( this, event );
  12860. }
  12861. return event.result;
  12862. },
  12863. handlers: function( event, handlers ) {
  12864. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12865. handlerQueue = [],
  12866. delegateCount = handlers.delegateCount,
  12867. cur = event.target;
  12868. // Find delegate handlers
  12869. if ( delegateCount &&
  12870. // Support: IE <=9
  12871. // Black-hole SVG <use> instance trees (trac-13180)
  12872. cur.nodeType &&
  12873. // Support: Firefox <=42
  12874. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12875. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12876. // Support: IE 11 only
  12877. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12878. !( event.type === "click" && event.button >= 1 ) ) {
  12879. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12880. // Don't check non-elements (#13208)
  12881. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12882. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12883. matchedHandlers = [];
  12884. matchedSelectors = {};
  12885. for ( i = 0; i < delegateCount; i++ ) {
  12886. handleObj = handlers[ i ];
  12887. // Don't conflict with Object.prototype properties (#13203)
  12888. sel = handleObj.selector + " ";
  12889. if ( matchedSelectors[ sel ] === undefined ) {
  12890. matchedSelectors[ sel ] = handleObj.needsContext ?
  12891. jQuery( sel, this ).index( cur ) > -1 :
  12892. jQuery.find( sel, this, null, [ cur ] ).length;
  12893. }
  12894. if ( matchedSelectors[ sel ] ) {
  12895. matchedHandlers.push( handleObj );
  12896. }
  12897. }
  12898. if ( matchedHandlers.length ) {
  12899. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12900. }
  12901. }
  12902. }
  12903. }
  12904. // Add the remaining (directly-bound) handlers
  12905. cur = this;
  12906. if ( delegateCount < handlers.length ) {
  12907. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12908. }
  12909. return handlerQueue;
  12910. },
  12911. addProp: function( name, hook ) {
  12912. Object.defineProperty( jQuery.Event.prototype, name, {
  12913. enumerable: true,
  12914. configurable: true,
  12915. get: isFunction( hook ) ?
  12916. function() {
  12917. if ( this.originalEvent ) {
  12918. return hook( this.originalEvent );
  12919. }
  12920. } :
  12921. function() {
  12922. if ( this.originalEvent ) {
  12923. return this.originalEvent[ name ];
  12924. }
  12925. },
  12926. set: function( value ) {
  12927. Object.defineProperty( this, name, {
  12928. enumerable: true,
  12929. configurable: true,
  12930. writable: true,
  12931. value: value
  12932. } );
  12933. }
  12934. } );
  12935. },
  12936. fix: function( originalEvent ) {
  12937. return originalEvent[ jQuery.expando ] ?
  12938. originalEvent :
  12939. new jQuery.Event( originalEvent );
  12940. },
  12941. special: {
  12942. load: {
  12943. // Prevent triggered image.load events from bubbling to window.load
  12944. noBubble: true
  12945. },
  12946. click: {
  12947. // Utilize native event to ensure correct state for checkable inputs
  12948. setup: function( data ) {
  12949. // For mutual compressibility with _default, replace `this` access with a local var.
  12950. // `|| data` is dead code meant only to preserve the variable through minification.
  12951. var el = this || data;
  12952. // Claim the first handler
  12953. if ( rcheckableType.test( el.type ) &&
  12954. el.click && nodeName( el, "input" ) ) {
  12955. // dataPriv.set( el, "click", ... )
  12956. leverageNative( el, "click", returnTrue );
  12957. }
  12958. // Return false to allow normal processing in the caller
  12959. return false;
  12960. },
  12961. trigger: function( data ) {
  12962. // For mutual compressibility with _default, replace `this` access with a local var.
  12963. // `|| data` is dead code meant only to preserve the variable through minification.
  12964. var el = this || data;
  12965. // Force setup before triggering a click
  12966. if ( rcheckableType.test( el.type ) &&
  12967. el.click && nodeName( el, "input" ) ) {
  12968. leverageNative( el, "click" );
  12969. }
  12970. // Return non-false to allow normal event-path propagation
  12971. return true;
  12972. },
  12973. // For cross-browser consistency, suppress native .click() on links
  12974. // Also prevent it if we're currently inside a leveraged native-event stack
  12975. _default: function( event ) {
  12976. var target = event.target;
  12977. return rcheckableType.test( target.type ) &&
  12978. target.click && nodeName( target, "input" ) &&
  12979. dataPriv.get( target, "click" ) ||
  12980. nodeName( target, "a" );
  12981. }
  12982. },
  12983. beforeunload: {
  12984. postDispatch: function( event ) {
  12985. // Support: Firefox 20+
  12986. // Firefox doesn't alert if the returnValue field is not set.
  12987. if ( event.result !== undefined && event.originalEvent ) {
  12988. event.originalEvent.returnValue = event.result;
  12989. }
  12990. }
  12991. }
  12992. }
  12993. };
  12994. // Ensure the presence of an event listener that handles manually-triggered
  12995. // synthetic events by interrupting progress until reinvoked in response to
  12996. // *native* events that it fires directly, ensuring that state changes have
  12997. // already occurred before other listeners are invoked.
  12998. function leverageNative( el, type, expectSync ) {
  12999. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13000. if ( !expectSync ) {
  13001. if ( dataPriv.get( el, type ) === undefined ) {
  13002. jQuery.event.add( el, type, returnTrue );
  13003. }
  13004. return;
  13005. }
  13006. // Register the controller as a special universal handler for all event namespaces
  13007. dataPriv.set( el, type, false );
  13008. jQuery.event.add( el, type, {
  13009. namespace: false,
  13010. handler: function( event ) {
  13011. var notAsync, result,
  13012. saved = dataPriv.get( this, type );
  13013. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13014. // Interrupt processing of the outer synthetic .trigger()ed event
  13015. // Saved data should be false in such cases, but might be a leftover capture object
  13016. // from an async native handler (gh-4350)
  13017. if ( !saved.length ) {
  13018. // Store arguments for use when handling the inner native event
  13019. // There will always be at least one argument (an event object), so this array
  13020. // will not be confused with a leftover capture object.
  13021. saved = slice.call( arguments );
  13022. dataPriv.set( this, type, saved );
  13023. // Trigger the native event and capture its result
  13024. // Support: IE <=9 - 11+
  13025. // focus() and blur() are asynchronous
  13026. notAsync = expectSync( this, type );
  13027. this[ type ]();
  13028. result = dataPriv.get( this, type );
  13029. if ( saved !== result || notAsync ) {
  13030. dataPriv.set( this, type, false );
  13031. } else {
  13032. result = {};
  13033. }
  13034. if ( saved !== result ) {
  13035. // Cancel the outer synthetic event
  13036. event.stopImmediatePropagation();
  13037. event.preventDefault();
  13038. return result.value;
  13039. }
  13040. // If this is an inner synthetic event for an event with a bubbling surrogate
  13041. // (focus or blur), assume that the surrogate already propagated from triggering the
  13042. // native event and prevent that from happening again here.
  13043. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13044. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13045. // less bad than duplication.
  13046. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13047. event.stopPropagation();
  13048. }
  13049. // If this is a native event triggered above, everything is now in order
  13050. // Fire an inner synthetic event with the original arguments
  13051. } else if ( saved.length ) {
  13052. // ...and capture the result
  13053. dataPriv.set( this, type, {
  13054. value: jQuery.event.trigger(
  13055. // Support: IE <=9 - 11+
  13056. // Extend with the prototype to reset the above stopImmediatePropagation()
  13057. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13058. saved.slice( 1 ),
  13059. this
  13060. )
  13061. } );
  13062. // Abort handling of the native event
  13063. event.stopImmediatePropagation();
  13064. }
  13065. }
  13066. } );
  13067. }
  13068. jQuery.removeEvent = function( elem, type, handle ) {
  13069. // This "if" is needed for plain objects
  13070. if ( elem.removeEventListener ) {
  13071. elem.removeEventListener( type, handle );
  13072. }
  13073. };
  13074. jQuery.Event = function( src, props ) {
  13075. // Allow instantiation without the 'new' keyword
  13076. if ( !( this instanceof jQuery.Event ) ) {
  13077. return new jQuery.Event( src, props );
  13078. }
  13079. // Event object
  13080. if ( src && src.type ) {
  13081. this.originalEvent = src;
  13082. this.type = src.type;
  13083. // Events bubbling up the document may have been marked as prevented
  13084. // by a handler lower down the tree; reflect the correct value.
  13085. this.isDefaultPrevented = src.defaultPrevented ||
  13086. src.defaultPrevented === undefined &&
  13087. // Support: Android <=2.3 only
  13088. src.returnValue === false ?
  13089. returnTrue :
  13090. returnFalse;
  13091. // Create target properties
  13092. // Support: Safari <=6 - 7 only
  13093. // Target should not be a text node (#504, #13143)
  13094. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13095. src.target.parentNode :
  13096. src.target;
  13097. this.currentTarget = src.currentTarget;
  13098. this.relatedTarget = src.relatedTarget;
  13099. // Event type
  13100. } else {
  13101. this.type = src;
  13102. }
  13103. // Put explicitly provided properties onto the event object
  13104. if ( props ) {
  13105. jQuery.extend( this, props );
  13106. }
  13107. // Create a timestamp if incoming event doesn't have one
  13108. this.timeStamp = src && src.timeStamp || Date.now();
  13109. // Mark it as fixed
  13110. this[ jQuery.expando ] = true;
  13111. };
  13112. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13113. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13114. jQuery.Event.prototype = {
  13115. constructor: jQuery.Event,
  13116. isDefaultPrevented: returnFalse,
  13117. isPropagationStopped: returnFalse,
  13118. isImmediatePropagationStopped: returnFalse,
  13119. isSimulated: false,
  13120. preventDefault: function() {
  13121. var e = this.originalEvent;
  13122. this.isDefaultPrevented = returnTrue;
  13123. if ( e && !this.isSimulated ) {
  13124. e.preventDefault();
  13125. }
  13126. },
  13127. stopPropagation: function() {
  13128. var e = this.originalEvent;
  13129. this.isPropagationStopped = returnTrue;
  13130. if ( e && !this.isSimulated ) {
  13131. e.stopPropagation();
  13132. }
  13133. },
  13134. stopImmediatePropagation: function() {
  13135. var e = this.originalEvent;
  13136. this.isImmediatePropagationStopped = returnTrue;
  13137. if ( e && !this.isSimulated ) {
  13138. e.stopImmediatePropagation();
  13139. }
  13140. this.stopPropagation();
  13141. }
  13142. };
  13143. // Includes all common event props including KeyEvent and MouseEvent specific props
  13144. jQuery.each( {
  13145. altKey: true,
  13146. bubbles: true,
  13147. cancelable: true,
  13148. changedTouches: true,
  13149. ctrlKey: true,
  13150. detail: true,
  13151. eventPhase: true,
  13152. metaKey: true,
  13153. pageX: true,
  13154. pageY: true,
  13155. shiftKey: true,
  13156. view: true,
  13157. "char": true,
  13158. code: true,
  13159. charCode: true,
  13160. key: true,
  13161. keyCode: true,
  13162. button: true,
  13163. buttons: true,
  13164. clientX: true,
  13165. clientY: true,
  13166. offsetX: true,
  13167. offsetY: true,
  13168. pointerId: true,
  13169. pointerType: true,
  13170. screenX: true,
  13171. screenY: true,
  13172. targetTouches: true,
  13173. toElement: true,
  13174. touches: true,
  13175. which: function( event ) {
  13176. var button = event.button;
  13177. // Add which for key events
  13178. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13179. return event.charCode != null ? event.charCode : event.keyCode;
  13180. }
  13181. // Add which for click: 1 === left; 2 === middle; 3 === right
  13182. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13183. if ( button & 1 ) {
  13184. return 1;
  13185. }
  13186. if ( button & 2 ) {
  13187. return 3;
  13188. }
  13189. if ( button & 4 ) {
  13190. return 2;
  13191. }
  13192. return 0;
  13193. }
  13194. return event.which;
  13195. }
  13196. }, jQuery.event.addProp );
  13197. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13198. jQuery.event.special[ type ] = {
  13199. // Utilize native event if possible so blur/focus sequence is correct
  13200. setup: function() {
  13201. // Claim the first handler
  13202. // dataPriv.set( this, "focus", ... )
  13203. // dataPriv.set( this, "blur", ... )
  13204. leverageNative( this, type, expectSync );
  13205. // Return false to allow normal processing in the caller
  13206. return false;
  13207. },
  13208. trigger: function() {
  13209. // Force setup before trigger
  13210. leverageNative( this, type );
  13211. // Return non-false to allow normal event-path propagation
  13212. return true;
  13213. },
  13214. delegateType: delegateType
  13215. };
  13216. } );
  13217. // Create mouseenter/leave events using mouseover/out and event-time checks
  13218. // so that event delegation works in jQuery.
  13219. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13220. //
  13221. // Support: Safari 7 only
  13222. // Safari sends mouseenter too often; see:
  13223. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13224. // for the description of the bug (it existed in older Chrome versions as well).
  13225. jQuery.each( {
  13226. mouseenter: "mouseover",
  13227. mouseleave: "mouseout",
  13228. pointerenter: "pointerover",
  13229. pointerleave: "pointerout"
  13230. }, function( orig, fix ) {
  13231. jQuery.event.special[ orig ] = {
  13232. delegateType: fix,
  13233. bindType: fix,
  13234. handle: function( event ) {
  13235. var ret,
  13236. target = this,
  13237. related = event.relatedTarget,
  13238. handleObj = event.handleObj;
  13239. // For mouseenter/leave call the handler if related is outside the target.
  13240. // NB: No relatedTarget if the mouse left/entered the browser window
  13241. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13242. event.type = handleObj.origType;
  13243. ret = handleObj.handler.apply( this, arguments );
  13244. event.type = fix;
  13245. }
  13246. return ret;
  13247. }
  13248. };
  13249. } );
  13250. jQuery.fn.extend( {
  13251. on: function( types, selector, data, fn ) {
  13252. return on( this, types, selector, data, fn );
  13253. },
  13254. one: function( types, selector, data, fn ) {
  13255. return on( this, types, selector, data, fn, 1 );
  13256. },
  13257. off: function( types, selector, fn ) {
  13258. var handleObj, type;
  13259. if ( types && types.preventDefault && types.handleObj ) {
  13260. // ( event ) dispatched jQuery.Event
  13261. handleObj = types.handleObj;
  13262. jQuery( types.delegateTarget ).off(
  13263. handleObj.namespace ?
  13264. handleObj.origType + "." + handleObj.namespace :
  13265. handleObj.origType,
  13266. handleObj.selector,
  13267. handleObj.handler
  13268. );
  13269. return this;
  13270. }
  13271. if ( typeof types === "object" ) {
  13272. // ( types-object [, selector] )
  13273. for ( type in types ) {
  13274. this.off( type, selector, types[ type ] );
  13275. }
  13276. return this;
  13277. }
  13278. if ( selector === false || typeof selector === "function" ) {
  13279. // ( types [, fn] )
  13280. fn = selector;
  13281. selector = undefined;
  13282. }
  13283. if ( fn === false ) {
  13284. fn = returnFalse;
  13285. }
  13286. return this.each( function() {
  13287. jQuery.event.remove( this, types, fn, selector );
  13288. } );
  13289. }
  13290. } );
  13291. var
  13292. /* eslint-disable max-len */
  13293. // See https://github.com/eslint/eslint/issues/3229
  13294. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13295. /* eslint-enable */
  13296. // Support: IE <=10 - 11, Edge 12 - 13 only
  13297. // In IE/Edge using regex groups here causes severe slowdowns.
  13298. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13299. rnoInnerhtml = /<script|<style|<link/i,
  13300. // checked="checked" or checked
  13301. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13302. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13303. // Prefer a tbody over its parent table for containing new rows
  13304. function manipulationTarget( elem, content ) {
  13305. if ( nodeName( elem, "table" ) &&
  13306. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13307. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13308. }
  13309. return elem;
  13310. }
  13311. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13312. function disableScript( elem ) {
  13313. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13314. return elem;
  13315. }
  13316. function restoreScript( elem ) {
  13317. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13318. elem.type = elem.type.slice( 5 );
  13319. } else {
  13320. elem.removeAttribute( "type" );
  13321. }
  13322. return elem;
  13323. }
  13324. function cloneCopyEvent( src, dest ) {
  13325. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13326. if ( dest.nodeType !== 1 ) {
  13327. return;
  13328. }
  13329. // 1. Copy private data: events, handlers, etc.
  13330. if ( dataPriv.hasData( src ) ) {
  13331. pdataOld = dataPriv.access( src );
  13332. pdataCur = dataPriv.set( dest, pdataOld );
  13333. events = pdataOld.events;
  13334. if ( events ) {
  13335. delete pdataCur.handle;
  13336. pdataCur.events = {};
  13337. for ( type in events ) {
  13338. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13339. jQuery.event.add( dest, type, events[ type ][ i ] );
  13340. }
  13341. }
  13342. }
  13343. }
  13344. // 2. Copy user data
  13345. if ( dataUser.hasData( src ) ) {
  13346. udataOld = dataUser.access( src );
  13347. udataCur = jQuery.extend( {}, udataOld );
  13348. dataUser.set( dest, udataCur );
  13349. }
  13350. }
  13351. // Fix IE bugs, see support tests
  13352. function fixInput( src, dest ) {
  13353. var nodeName = dest.nodeName.toLowerCase();
  13354. // Fails to persist the checked state of a cloned checkbox or radio button.
  13355. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13356. dest.checked = src.checked;
  13357. // Fails to return the selected option to the default selected state when cloning options
  13358. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13359. dest.defaultValue = src.defaultValue;
  13360. }
  13361. }
  13362. function domManip( collection, args, callback, ignored ) {
  13363. // Flatten any nested arrays
  13364. args = concat.apply( [], args );
  13365. var fragment, first, scripts, hasScripts, node, doc,
  13366. i = 0,
  13367. l = collection.length,
  13368. iNoClone = l - 1,
  13369. value = args[ 0 ],
  13370. valueIsFunction = isFunction( value );
  13371. // We can't cloneNode fragments that contain checked, in WebKit
  13372. if ( valueIsFunction ||
  13373. ( l > 1 && typeof value === "string" &&
  13374. !support.checkClone && rchecked.test( value ) ) ) {
  13375. return collection.each( function( index ) {
  13376. var self = collection.eq( index );
  13377. if ( valueIsFunction ) {
  13378. args[ 0 ] = value.call( this, index, self.html() );
  13379. }
  13380. domManip( self, args, callback, ignored );
  13381. } );
  13382. }
  13383. if ( l ) {
  13384. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13385. first = fragment.firstChild;
  13386. if ( fragment.childNodes.length === 1 ) {
  13387. fragment = first;
  13388. }
  13389. // Require either new content or an interest in ignored elements to invoke the callback
  13390. if ( first || ignored ) {
  13391. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13392. hasScripts = scripts.length;
  13393. // Use the original fragment for the last item
  13394. // instead of the first because it can end up
  13395. // being emptied incorrectly in certain situations (#8070).
  13396. for ( ; i < l; i++ ) {
  13397. node = fragment;
  13398. if ( i !== iNoClone ) {
  13399. node = jQuery.clone( node, true, true );
  13400. // Keep references to cloned scripts for later restoration
  13401. if ( hasScripts ) {
  13402. // Support: Android <=4.0 only, PhantomJS 1 only
  13403. // push.apply(_, arraylike) throws on ancient WebKit
  13404. jQuery.merge( scripts, getAll( node, "script" ) );
  13405. }
  13406. }
  13407. callback.call( collection[ i ], node, i );
  13408. }
  13409. if ( hasScripts ) {
  13410. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13411. // Reenable scripts
  13412. jQuery.map( scripts, restoreScript );
  13413. // Evaluate executable scripts on first document insertion
  13414. for ( i = 0; i < hasScripts; i++ ) {
  13415. node = scripts[ i ];
  13416. if ( rscriptType.test( node.type || "" ) &&
  13417. !dataPriv.access( node, "globalEval" ) &&
  13418. jQuery.contains( doc, node ) ) {
  13419. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13420. // Optional AJAX dependency, but won't run scripts if not present
  13421. if ( jQuery._evalUrl && !node.noModule ) {
  13422. jQuery._evalUrl( node.src, {
  13423. nonce: node.nonce || node.getAttribute( "nonce" )
  13424. } );
  13425. }
  13426. } else {
  13427. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13428. }
  13429. }
  13430. }
  13431. }
  13432. }
  13433. }
  13434. return collection;
  13435. }
  13436. function remove( elem, selector, keepData ) {
  13437. var node,
  13438. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13439. i = 0;
  13440. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13441. if ( !keepData && node.nodeType === 1 ) {
  13442. jQuery.cleanData( getAll( node ) );
  13443. }
  13444. if ( node.parentNode ) {
  13445. if ( keepData && isAttached( node ) ) {
  13446. setGlobalEval( getAll( node, "script" ) );
  13447. }
  13448. node.parentNode.removeChild( node );
  13449. }
  13450. }
  13451. return elem;
  13452. }
  13453. jQuery.extend( {
  13454. htmlPrefilter: function( html ) {
  13455. return html.replace( rxhtmlTag, "<$1></$2>" );
  13456. },
  13457. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13458. var i, l, srcElements, destElements,
  13459. clone = elem.cloneNode( true ),
  13460. inPage = isAttached( elem );
  13461. // Fix IE cloning issues
  13462. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13463. !jQuery.isXMLDoc( elem ) ) {
  13464. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13465. destElements = getAll( clone );
  13466. srcElements = getAll( elem );
  13467. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13468. fixInput( srcElements[ i ], destElements[ i ] );
  13469. }
  13470. }
  13471. // Copy the events from the original to the clone
  13472. if ( dataAndEvents ) {
  13473. if ( deepDataAndEvents ) {
  13474. srcElements = srcElements || getAll( elem );
  13475. destElements = destElements || getAll( clone );
  13476. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13477. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13478. }
  13479. } else {
  13480. cloneCopyEvent( elem, clone );
  13481. }
  13482. }
  13483. // Preserve script evaluation history
  13484. destElements = getAll( clone, "script" );
  13485. if ( destElements.length > 0 ) {
  13486. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13487. }
  13488. // Return the cloned set
  13489. return clone;
  13490. },
  13491. cleanData: function( elems ) {
  13492. var data, elem, type,
  13493. special = jQuery.event.special,
  13494. i = 0;
  13495. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13496. if ( acceptData( elem ) ) {
  13497. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13498. if ( data.events ) {
  13499. for ( type in data.events ) {
  13500. if ( special[ type ] ) {
  13501. jQuery.event.remove( elem, type );
  13502. // This is a shortcut to avoid jQuery.event.remove's overhead
  13503. } else {
  13504. jQuery.removeEvent( elem, type, data.handle );
  13505. }
  13506. }
  13507. }
  13508. // Support: Chrome <=35 - 45+
  13509. // Assign undefined instead of using delete, see Data#remove
  13510. elem[ dataPriv.expando ] = undefined;
  13511. }
  13512. if ( elem[ dataUser.expando ] ) {
  13513. // Support: Chrome <=35 - 45+
  13514. // Assign undefined instead of using delete, see Data#remove
  13515. elem[ dataUser.expando ] = undefined;
  13516. }
  13517. }
  13518. }
  13519. }
  13520. } );
  13521. jQuery.fn.extend( {
  13522. detach: function( selector ) {
  13523. return remove( this, selector, true );
  13524. },
  13525. remove: function( selector ) {
  13526. return remove( this, selector );
  13527. },
  13528. text: function( value ) {
  13529. return access( this, function( value ) {
  13530. return value === undefined ?
  13531. jQuery.text( this ) :
  13532. this.empty().each( function() {
  13533. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13534. this.textContent = value;
  13535. }
  13536. } );
  13537. }, null, value, arguments.length );
  13538. },
  13539. append: function() {
  13540. return domManip( this, arguments, function( elem ) {
  13541. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13542. var target = manipulationTarget( this, elem );
  13543. target.appendChild( elem );
  13544. }
  13545. } );
  13546. },
  13547. prepend: function() {
  13548. return domManip( this, arguments, function( elem ) {
  13549. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13550. var target = manipulationTarget( this, elem );
  13551. target.insertBefore( elem, target.firstChild );
  13552. }
  13553. } );
  13554. },
  13555. before: function() {
  13556. return domManip( this, arguments, function( elem ) {
  13557. if ( this.parentNode ) {
  13558. this.parentNode.insertBefore( elem, this );
  13559. }
  13560. } );
  13561. },
  13562. after: function() {
  13563. return domManip( this, arguments, function( elem ) {
  13564. if ( this.parentNode ) {
  13565. this.parentNode.insertBefore( elem, this.nextSibling );
  13566. }
  13567. } );
  13568. },
  13569. empty: function() {
  13570. var elem,
  13571. i = 0;
  13572. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13573. if ( elem.nodeType === 1 ) {
  13574. // Prevent memory leaks
  13575. jQuery.cleanData( getAll( elem, false ) );
  13576. // Remove any remaining nodes
  13577. elem.textContent = "";
  13578. }
  13579. }
  13580. return this;
  13581. },
  13582. clone: function( dataAndEvents, deepDataAndEvents ) {
  13583. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13584. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13585. return this.map( function() {
  13586. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13587. } );
  13588. },
  13589. html: function( value ) {
  13590. return access( this, function( value ) {
  13591. var elem = this[ 0 ] || {},
  13592. i = 0,
  13593. l = this.length;
  13594. if ( value === undefined && elem.nodeType === 1 ) {
  13595. return elem.innerHTML;
  13596. }
  13597. // See if we can take a shortcut and just use innerHTML
  13598. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13599. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13600. value = jQuery.htmlPrefilter( value );
  13601. try {
  13602. for ( ; i < l; i++ ) {
  13603. elem = this[ i ] || {};
  13604. // Remove element nodes and prevent memory leaks
  13605. if ( elem.nodeType === 1 ) {
  13606. jQuery.cleanData( getAll( elem, false ) );
  13607. elem.innerHTML = value;
  13608. }
  13609. }
  13610. elem = 0;
  13611. // If using innerHTML throws an exception, use the fallback method
  13612. } catch ( e ) {}
  13613. }
  13614. if ( elem ) {
  13615. this.empty().append( value );
  13616. }
  13617. }, null, value, arguments.length );
  13618. },
  13619. replaceWith: function() {
  13620. var ignored = [];
  13621. // Make the changes, replacing each non-ignored context element with the new content
  13622. return domManip( this, arguments, function( elem ) {
  13623. var parent = this.parentNode;
  13624. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13625. jQuery.cleanData( getAll( this ) );
  13626. if ( parent ) {
  13627. parent.replaceChild( elem, this );
  13628. }
  13629. }
  13630. // Force callback invocation
  13631. }, ignored );
  13632. }
  13633. } );
  13634. jQuery.each( {
  13635. appendTo: "append",
  13636. prependTo: "prepend",
  13637. insertBefore: "before",
  13638. insertAfter: "after",
  13639. replaceAll: "replaceWith"
  13640. }, function( name, original ) {
  13641. jQuery.fn[ name ] = function( selector ) {
  13642. var elems,
  13643. ret = [],
  13644. insert = jQuery( selector ),
  13645. last = insert.length - 1,
  13646. i = 0;
  13647. for ( ; i <= last; i++ ) {
  13648. elems = i === last ? this : this.clone( true );
  13649. jQuery( insert[ i ] )[ original ]( elems );
  13650. // Support: Android <=4.0 only, PhantomJS 1 only
  13651. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13652. push.apply( ret, elems.get() );
  13653. }
  13654. return this.pushStack( ret );
  13655. };
  13656. } );
  13657. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13658. var getStyles = function( elem ) {
  13659. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13660. // IE throws on elements created in popups
  13661. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13662. var view = elem.ownerDocument.defaultView;
  13663. if ( !view || !view.opener ) {
  13664. view = window;
  13665. }
  13666. return view.getComputedStyle( elem );
  13667. };
  13668. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13669. ( function() {
  13670. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13671. // so they're executed at the same time to save the second computation.
  13672. function computeStyleTests() {
  13673. // This is a singleton, we need to execute it only once
  13674. if ( !div ) {
  13675. return;
  13676. }
  13677. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13678. "margin-top:1px;padding:0;border:0";
  13679. div.style.cssText =
  13680. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13681. "margin:auto;border:1px;padding:1px;" +
  13682. "width:60%;top:1%";
  13683. documentElement.appendChild( container ).appendChild( div );
  13684. var divStyle = window.getComputedStyle( div );
  13685. pixelPositionVal = divStyle.top !== "1%";
  13686. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13687. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13688. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13689. // Some styles come back with percentage values, even though they shouldn't
  13690. div.style.right = "60%";
  13691. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13692. // Support: IE 9 - 11 only
  13693. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13694. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13695. // Support: IE 9 only
  13696. // Detect overflow:scroll screwiness (gh-3699)
  13697. // Support: Chrome <=64
  13698. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13699. div.style.position = "absolute";
  13700. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13701. documentElement.removeChild( container );
  13702. // Nullify the div so it wouldn't be stored in the memory and
  13703. // it will also be a sign that checks already performed
  13704. div = null;
  13705. }
  13706. function roundPixelMeasures( measure ) {
  13707. return Math.round( parseFloat( measure ) );
  13708. }
  13709. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13710. reliableMarginLeftVal,
  13711. container = document.createElement( "div" ),
  13712. div = document.createElement( "div" );
  13713. // Finish early in limited (non-browser) environments
  13714. if ( !div.style ) {
  13715. return;
  13716. }
  13717. // Support: IE <=9 - 11 only
  13718. // Style of cloned element affects source element cloned (#8908)
  13719. div.style.backgroundClip = "content-box";
  13720. div.cloneNode( true ).style.backgroundClip = "";
  13721. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13722. jQuery.extend( support, {
  13723. boxSizingReliable: function() {
  13724. computeStyleTests();
  13725. return boxSizingReliableVal;
  13726. },
  13727. pixelBoxStyles: function() {
  13728. computeStyleTests();
  13729. return pixelBoxStylesVal;
  13730. },
  13731. pixelPosition: function() {
  13732. computeStyleTests();
  13733. return pixelPositionVal;
  13734. },
  13735. reliableMarginLeft: function() {
  13736. computeStyleTests();
  13737. return reliableMarginLeftVal;
  13738. },
  13739. scrollboxSize: function() {
  13740. computeStyleTests();
  13741. return scrollboxSizeVal;
  13742. }
  13743. } );
  13744. } )();
  13745. function curCSS( elem, name, computed ) {
  13746. var width, minWidth, maxWidth, ret,
  13747. // Support: Firefox 51+
  13748. // Retrieving style before computed somehow
  13749. // fixes an issue with getting wrong values
  13750. // on detached elements
  13751. style = elem.style;
  13752. computed = computed || getStyles( elem );
  13753. // getPropertyValue is needed for:
  13754. // .css('filter') (IE 9 only, #12537)
  13755. // .css('--customProperty) (#3144)
  13756. if ( computed ) {
  13757. ret = computed.getPropertyValue( name ) || computed[ name ];
  13758. if ( ret === "" && !isAttached( elem ) ) {
  13759. ret = jQuery.style( elem, name );
  13760. }
  13761. // A tribute to the "awesome hack by Dean Edwards"
  13762. // Android Browser returns percentage for some values,
  13763. // but width seems to be reliably pixels.
  13764. // This is against the CSSOM draft spec:
  13765. // https://drafts.csswg.org/cssom/#resolved-values
  13766. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13767. // Remember the original values
  13768. width = style.width;
  13769. minWidth = style.minWidth;
  13770. maxWidth = style.maxWidth;
  13771. // Put in the new values to get a computed value out
  13772. style.minWidth = style.maxWidth = style.width = ret;
  13773. ret = computed.width;
  13774. // Revert the changed values
  13775. style.width = width;
  13776. style.minWidth = minWidth;
  13777. style.maxWidth = maxWidth;
  13778. }
  13779. }
  13780. return ret !== undefined ?
  13781. // Support: IE <=9 - 11 only
  13782. // IE returns zIndex value as an integer.
  13783. ret + "" :
  13784. ret;
  13785. }
  13786. function addGetHookIf( conditionFn, hookFn ) {
  13787. // Define the hook, we'll check on the first run if it's really needed.
  13788. return {
  13789. get: function() {
  13790. if ( conditionFn() ) {
  13791. // Hook not needed (or it's not possible to use it due
  13792. // to missing dependency), remove it.
  13793. delete this.get;
  13794. return;
  13795. }
  13796. // Hook needed; redefine it so that the support test is not executed again.
  13797. return ( this.get = hookFn ).apply( this, arguments );
  13798. }
  13799. };
  13800. }
  13801. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13802. emptyStyle = document.createElement( "div" ).style,
  13803. vendorProps = {};
  13804. // Return a vendor-prefixed property or undefined
  13805. function vendorPropName( name ) {
  13806. // Check for vendor prefixed names
  13807. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13808. i = cssPrefixes.length;
  13809. while ( i-- ) {
  13810. name = cssPrefixes[ i ] + capName;
  13811. if ( name in emptyStyle ) {
  13812. return name;
  13813. }
  13814. }
  13815. }
  13816. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13817. function finalPropName( name ) {
  13818. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13819. if ( final ) {
  13820. return final;
  13821. }
  13822. if ( name in emptyStyle ) {
  13823. return name;
  13824. }
  13825. return vendorProps[ name ] = vendorPropName( name ) || name;
  13826. }
  13827. var
  13828. // Swappable if display is none or starts with table
  13829. // except "table", "table-cell", or "table-caption"
  13830. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13831. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13832. rcustomProp = /^--/,
  13833. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13834. cssNormalTransform = {
  13835. letterSpacing: "0",
  13836. fontWeight: "400"
  13837. };
  13838. function setPositiveNumber( elem, value, subtract ) {
  13839. // Any relative (+/-) values have already been
  13840. // normalized at this point
  13841. var matches = rcssNum.exec( value );
  13842. return matches ?
  13843. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13844. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13845. value;
  13846. }
  13847. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13848. var i = dimension === "width" ? 1 : 0,
  13849. extra = 0,
  13850. delta = 0;
  13851. // Adjustment may not be necessary
  13852. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13853. return 0;
  13854. }
  13855. for ( ; i < 4; i += 2 ) {
  13856. // Both box models exclude margin
  13857. if ( box === "margin" ) {
  13858. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13859. }
  13860. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13861. if ( !isBorderBox ) {
  13862. // Add padding
  13863. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13864. // For "border" or "margin", add border
  13865. if ( box !== "padding" ) {
  13866. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13867. // But still keep track of it otherwise
  13868. } else {
  13869. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13870. }
  13871. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13872. // "padding" or "margin"
  13873. } else {
  13874. // For "content", subtract padding
  13875. if ( box === "content" ) {
  13876. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13877. }
  13878. // For "content" or "padding", subtract border
  13879. if ( box !== "margin" ) {
  13880. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13881. }
  13882. }
  13883. }
  13884. // Account for positive content-box scroll gutter when requested by providing computedVal
  13885. if ( !isBorderBox && computedVal >= 0 ) {
  13886. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13887. // Assuming integer scroll gutter, subtract the rest and round down
  13888. delta += Math.max( 0, Math.ceil(
  13889. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13890. computedVal -
  13891. delta -
  13892. extra -
  13893. 0.5
  13894. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13895. // Use an explicit zero to avoid NaN (gh-3964)
  13896. ) ) || 0;
  13897. }
  13898. return delta;
  13899. }
  13900. function getWidthOrHeight( elem, dimension, extra ) {
  13901. // Start with computed style
  13902. var styles = getStyles( elem ),
  13903. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13904. // Fake content-box until we know it's needed to know the true value.
  13905. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13906. isBorderBox = boxSizingNeeded &&
  13907. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13908. valueIsBorderBox = isBorderBox,
  13909. val = curCSS( elem, dimension, styles ),
  13910. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13911. // Support: Firefox <=54
  13912. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13913. if ( rnumnonpx.test( val ) ) {
  13914. if ( !extra ) {
  13915. return val;
  13916. }
  13917. val = "auto";
  13918. }
  13919. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13920. // This happens for inline elements with no explicit setting (gh-3571)
  13921. // Support: Android <=4.1 - 4.3 only
  13922. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13923. // Support: IE 9-11 only
  13924. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13925. // We use getClientRects() to check for hidden/disconnected.
  13926. // In those cases, the computed value can be trusted to be border-box
  13927. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13928. val === "auto" ||
  13929. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13930. elem.getClientRects().length ) {
  13931. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13932. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13933. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13934. // retrieved value as a content box dimension.
  13935. valueIsBorderBox = offsetProp in elem;
  13936. if ( valueIsBorderBox ) {
  13937. val = elem[ offsetProp ];
  13938. }
  13939. }
  13940. // Normalize "" and auto
  13941. val = parseFloat( val ) || 0;
  13942. // Adjust for the element's box model
  13943. return ( val +
  13944. boxModelAdjustment(
  13945. elem,
  13946. dimension,
  13947. extra || ( isBorderBox ? "border" : "content" ),
  13948. valueIsBorderBox,
  13949. styles,
  13950. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13951. val
  13952. )
  13953. ) + "px";
  13954. }
  13955. jQuery.extend( {
  13956. // Add in style property hooks for overriding the default
  13957. // behavior of getting and setting a style property
  13958. cssHooks: {
  13959. opacity: {
  13960. get: function( elem, computed ) {
  13961. if ( computed ) {
  13962. // We should always get a number back from opacity
  13963. var ret = curCSS( elem, "opacity" );
  13964. return ret === "" ? "1" : ret;
  13965. }
  13966. }
  13967. }
  13968. },
  13969. // Don't automatically add "px" to these possibly-unitless properties
  13970. cssNumber: {
  13971. "animationIterationCount": true,
  13972. "columnCount": true,
  13973. "fillOpacity": true,
  13974. "flexGrow": true,
  13975. "flexShrink": true,
  13976. "fontWeight": true,
  13977. "gridArea": true,
  13978. "gridColumn": true,
  13979. "gridColumnEnd": true,
  13980. "gridColumnStart": true,
  13981. "gridRow": true,
  13982. "gridRowEnd": true,
  13983. "gridRowStart": true,
  13984. "lineHeight": true,
  13985. "opacity": true,
  13986. "order": true,
  13987. "orphans": true,
  13988. "widows": true,
  13989. "zIndex": true,
  13990. "zoom": true
  13991. },
  13992. // Add in properties whose names you wish to fix before
  13993. // setting or getting the value
  13994. cssProps: {},
  13995. // Get and set the style property on a DOM Node
  13996. style: function( elem, name, value, extra ) {
  13997. // Don't set styles on text and comment nodes
  13998. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13999. return;
  14000. }
  14001. // Make sure that we're working with the right name
  14002. var ret, type, hooks,
  14003. origName = camelCase( name ),
  14004. isCustomProp = rcustomProp.test( name ),
  14005. style = elem.style;
  14006. // Make sure that we're working with the right name. We don't
  14007. // want to query the value if it is a CSS custom property
  14008. // since they are user-defined.
  14009. if ( !isCustomProp ) {
  14010. name = finalPropName( origName );
  14011. }
  14012. // Gets hook for the prefixed version, then unprefixed version
  14013. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14014. // Check if we're setting a value
  14015. if ( value !== undefined ) {
  14016. type = typeof value;
  14017. // Convert "+=" or "-=" to relative numbers (#7345)
  14018. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14019. value = adjustCSS( elem, name, ret );
  14020. // Fixes bug #9237
  14021. type = "number";
  14022. }
  14023. // Make sure that null and NaN values aren't set (#7116)
  14024. if ( value == null || value !== value ) {
  14025. return;
  14026. }
  14027. // If a number was passed in, add the unit (except for certain CSS properties)
  14028. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14029. // "px" to a few hardcoded values.
  14030. if ( type === "number" && !isCustomProp ) {
  14031. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14032. }
  14033. // background-* props affect original clone's values
  14034. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14035. style[ name ] = "inherit";
  14036. }
  14037. // If a hook was provided, use that value, otherwise just set the specified value
  14038. if ( !hooks || !( "set" in hooks ) ||
  14039. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14040. if ( isCustomProp ) {
  14041. style.setProperty( name, value );
  14042. } else {
  14043. style[ name ] = value;
  14044. }
  14045. }
  14046. } else {
  14047. // If a hook was provided get the non-computed value from there
  14048. if ( hooks && "get" in hooks &&
  14049. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14050. return ret;
  14051. }
  14052. // Otherwise just get the value from the style object
  14053. return style[ name ];
  14054. }
  14055. },
  14056. css: function( elem, name, extra, styles ) {
  14057. var val, num, hooks,
  14058. origName = camelCase( name ),
  14059. isCustomProp = rcustomProp.test( name );
  14060. // Make sure that we're working with the right name. We don't
  14061. // want to modify the value if it is a CSS custom property
  14062. // since they are user-defined.
  14063. if ( !isCustomProp ) {
  14064. name = finalPropName( origName );
  14065. }
  14066. // Try prefixed name followed by the unprefixed name
  14067. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14068. // If a hook was provided get the computed value from there
  14069. if ( hooks && "get" in hooks ) {
  14070. val = hooks.get( elem, true, extra );
  14071. }
  14072. // Otherwise, if a way to get the computed value exists, use that
  14073. if ( val === undefined ) {
  14074. val = curCSS( elem, name, styles );
  14075. }
  14076. // Convert "normal" to computed value
  14077. if ( val === "normal" && name in cssNormalTransform ) {
  14078. val = cssNormalTransform[ name ];
  14079. }
  14080. // Make numeric if forced or a qualifier was provided and val looks numeric
  14081. if ( extra === "" || extra ) {
  14082. num = parseFloat( val );
  14083. return extra === true || isFinite( num ) ? num || 0 : val;
  14084. }
  14085. return val;
  14086. }
  14087. } );
  14088. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14089. jQuery.cssHooks[ dimension ] = {
  14090. get: function( elem, computed, extra ) {
  14091. if ( computed ) {
  14092. // Certain elements can have dimension info if we invisibly show them
  14093. // but it must have a current display style that would benefit
  14094. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14095. // Support: Safari 8+
  14096. // Table columns in Safari have non-zero offsetWidth & zero
  14097. // getBoundingClientRect().width unless display is changed.
  14098. // Support: IE <=11 only
  14099. // Running getBoundingClientRect on a disconnected node
  14100. // in IE throws an error.
  14101. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14102. swap( elem, cssShow, function() {
  14103. return getWidthOrHeight( elem, dimension, extra );
  14104. } ) :
  14105. getWidthOrHeight( elem, dimension, extra );
  14106. }
  14107. },
  14108. set: function( elem, value, extra ) {
  14109. var matches,
  14110. styles = getStyles( elem ),
  14111. // Only read styles.position if the test has a chance to fail
  14112. // to avoid forcing a reflow.
  14113. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14114. styles.position === "absolute",
  14115. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14116. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14117. isBorderBox = boxSizingNeeded &&
  14118. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14119. subtract = extra ?
  14120. boxModelAdjustment(
  14121. elem,
  14122. dimension,
  14123. extra,
  14124. isBorderBox,
  14125. styles
  14126. ) :
  14127. 0;
  14128. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14129. // faking a content-box to get border and padding (gh-3699)
  14130. if ( isBorderBox && scrollboxSizeBuggy ) {
  14131. subtract -= Math.ceil(
  14132. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14133. parseFloat( styles[ dimension ] ) -
  14134. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14135. 0.5
  14136. );
  14137. }
  14138. // Convert to pixels if value adjustment is needed
  14139. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14140. ( matches[ 3 ] || "px" ) !== "px" ) {
  14141. elem.style[ dimension ] = value;
  14142. value = jQuery.css( elem, dimension );
  14143. }
  14144. return setPositiveNumber( elem, value, subtract );
  14145. }
  14146. };
  14147. } );
  14148. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14149. function( elem, computed ) {
  14150. if ( computed ) {
  14151. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14152. elem.getBoundingClientRect().left -
  14153. swap( elem, { marginLeft: 0 }, function() {
  14154. return elem.getBoundingClientRect().left;
  14155. } )
  14156. ) + "px";
  14157. }
  14158. }
  14159. );
  14160. // These hooks are used by animate to expand properties
  14161. jQuery.each( {
  14162. margin: "",
  14163. padding: "",
  14164. border: "Width"
  14165. }, function( prefix, suffix ) {
  14166. jQuery.cssHooks[ prefix + suffix ] = {
  14167. expand: function( value ) {
  14168. var i = 0,
  14169. expanded = {},
  14170. // Assumes a single number if not a string
  14171. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14172. for ( ; i < 4; i++ ) {
  14173. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14174. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14175. }
  14176. return expanded;
  14177. }
  14178. };
  14179. if ( prefix !== "margin" ) {
  14180. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14181. }
  14182. } );
  14183. jQuery.fn.extend( {
  14184. css: function( name, value ) {
  14185. return access( this, function( elem, name, value ) {
  14186. var styles, len,
  14187. map = {},
  14188. i = 0;
  14189. if ( Array.isArray( name ) ) {
  14190. styles = getStyles( elem );
  14191. len = name.length;
  14192. for ( ; i < len; i++ ) {
  14193. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14194. }
  14195. return map;
  14196. }
  14197. return value !== undefined ?
  14198. jQuery.style( elem, name, value ) :
  14199. jQuery.css( elem, name );
  14200. }, name, value, arguments.length > 1 );
  14201. }
  14202. } );
  14203. function Tween( elem, options, prop, end, easing ) {
  14204. return new Tween.prototype.init( elem, options, prop, end, easing );
  14205. }
  14206. jQuery.Tween = Tween;
  14207. Tween.prototype = {
  14208. constructor: Tween,
  14209. init: function( elem, options, prop, end, easing, unit ) {
  14210. this.elem = elem;
  14211. this.prop = prop;
  14212. this.easing = easing || jQuery.easing._default;
  14213. this.options = options;
  14214. this.start = this.now = this.cur();
  14215. this.end = end;
  14216. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14217. },
  14218. cur: function() {
  14219. var hooks = Tween.propHooks[ this.prop ];
  14220. return hooks && hooks.get ?
  14221. hooks.get( this ) :
  14222. Tween.propHooks._default.get( this );
  14223. },
  14224. run: function( percent ) {
  14225. var eased,
  14226. hooks = Tween.propHooks[ this.prop ];
  14227. if ( this.options.duration ) {
  14228. this.pos = eased = jQuery.easing[ this.easing ](
  14229. percent, this.options.duration * percent, 0, 1, this.options.duration
  14230. );
  14231. } else {
  14232. this.pos = eased = percent;
  14233. }
  14234. this.now = ( this.end - this.start ) * eased + this.start;
  14235. if ( this.options.step ) {
  14236. this.options.step.call( this.elem, this.now, this );
  14237. }
  14238. if ( hooks && hooks.set ) {
  14239. hooks.set( this );
  14240. } else {
  14241. Tween.propHooks._default.set( this );
  14242. }
  14243. return this;
  14244. }
  14245. };
  14246. Tween.prototype.init.prototype = Tween.prototype;
  14247. Tween.propHooks = {
  14248. _default: {
  14249. get: function( tween ) {
  14250. var result;
  14251. // Use a property on the element directly when it is not a DOM element,
  14252. // or when there is no matching style property that exists.
  14253. if ( tween.elem.nodeType !== 1 ||
  14254. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14255. return tween.elem[ tween.prop ];
  14256. }
  14257. // Passing an empty string as a 3rd parameter to .css will automatically
  14258. // attempt a parseFloat and fallback to a string if the parse fails.
  14259. // Simple values such as "10px" are parsed to Float;
  14260. // complex values such as "rotate(1rad)" are returned as-is.
  14261. result = jQuery.css( tween.elem, tween.prop, "" );
  14262. // Empty strings, null, undefined and "auto" are converted to 0.
  14263. return !result || result === "auto" ? 0 : result;
  14264. },
  14265. set: function( tween ) {
  14266. // Use step hook for back compat.
  14267. // Use cssHook if its there.
  14268. // Use .style if available and use plain properties where available.
  14269. if ( jQuery.fx.step[ tween.prop ] ) {
  14270. jQuery.fx.step[ tween.prop ]( tween );
  14271. } else if ( tween.elem.nodeType === 1 && (
  14272. jQuery.cssHooks[ tween.prop ] ||
  14273. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14274. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14275. } else {
  14276. tween.elem[ tween.prop ] = tween.now;
  14277. }
  14278. }
  14279. }
  14280. };
  14281. // Support: IE <=9 only
  14282. // Panic based approach to setting things on disconnected nodes
  14283. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14284. set: function( tween ) {
  14285. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14286. tween.elem[ tween.prop ] = tween.now;
  14287. }
  14288. }
  14289. };
  14290. jQuery.easing = {
  14291. linear: function( p ) {
  14292. return p;
  14293. },
  14294. swing: function( p ) {
  14295. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14296. },
  14297. _default: "swing"
  14298. };
  14299. jQuery.fx = Tween.prototype.init;
  14300. // Back compat <1.8 extension point
  14301. jQuery.fx.step = {};
  14302. var
  14303. fxNow, inProgress,
  14304. rfxtypes = /^(?:toggle|show|hide)$/,
  14305. rrun = /queueHooks$/;
  14306. function schedule() {
  14307. if ( inProgress ) {
  14308. if ( document.hidden === false && window.requestAnimationFrame ) {
  14309. window.requestAnimationFrame( schedule );
  14310. } else {
  14311. window.setTimeout( schedule, jQuery.fx.interval );
  14312. }
  14313. jQuery.fx.tick();
  14314. }
  14315. }
  14316. // Animations created synchronously will run synchronously
  14317. function createFxNow() {
  14318. window.setTimeout( function() {
  14319. fxNow = undefined;
  14320. } );
  14321. return ( fxNow = Date.now() );
  14322. }
  14323. // Generate parameters to create a standard animation
  14324. function genFx( type, includeWidth ) {
  14325. var which,
  14326. i = 0,
  14327. attrs = { height: type };
  14328. // If we include width, step value is 1 to do all cssExpand values,
  14329. // otherwise step value is 2 to skip over Left and Right
  14330. includeWidth = includeWidth ? 1 : 0;
  14331. for ( ; i < 4; i += 2 - includeWidth ) {
  14332. which = cssExpand[ i ];
  14333. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14334. }
  14335. if ( includeWidth ) {
  14336. attrs.opacity = attrs.width = type;
  14337. }
  14338. return attrs;
  14339. }
  14340. function createTween( value, prop, animation ) {
  14341. var tween,
  14342. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14343. index = 0,
  14344. length = collection.length;
  14345. for ( ; index < length; index++ ) {
  14346. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14347. // We're done with this property
  14348. return tween;
  14349. }
  14350. }
  14351. }
  14352. function defaultPrefilter( elem, props, opts ) {
  14353. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14354. isBox = "width" in props || "height" in props,
  14355. anim = this,
  14356. orig = {},
  14357. style = elem.style,
  14358. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14359. dataShow = dataPriv.get( elem, "fxshow" );
  14360. // Queue-skipping animations hijack the fx hooks
  14361. if ( !opts.queue ) {
  14362. hooks = jQuery._queueHooks( elem, "fx" );
  14363. if ( hooks.unqueued == null ) {
  14364. hooks.unqueued = 0;
  14365. oldfire = hooks.empty.fire;
  14366. hooks.empty.fire = function() {
  14367. if ( !hooks.unqueued ) {
  14368. oldfire();
  14369. }
  14370. };
  14371. }
  14372. hooks.unqueued++;
  14373. anim.always( function() {
  14374. // Ensure the complete handler is called before this completes
  14375. anim.always( function() {
  14376. hooks.unqueued--;
  14377. if ( !jQuery.queue( elem, "fx" ).length ) {
  14378. hooks.empty.fire();
  14379. }
  14380. } );
  14381. } );
  14382. }
  14383. // Detect show/hide animations
  14384. for ( prop in props ) {
  14385. value = props[ prop ];
  14386. if ( rfxtypes.test( value ) ) {
  14387. delete props[ prop ];
  14388. toggle = toggle || value === "toggle";
  14389. if ( value === ( hidden ? "hide" : "show" ) ) {
  14390. // Pretend to be hidden if this is a "show" and
  14391. // there is still data from a stopped show/hide
  14392. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14393. hidden = true;
  14394. // Ignore all other no-op show/hide data
  14395. } else {
  14396. continue;
  14397. }
  14398. }
  14399. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14400. }
  14401. }
  14402. // Bail out if this is a no-op like .hide().hide()
  14403. propTween = !jQuery.isEmptyObject( props );
  14404. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14405. return;
  14406. }
  14407. // Restrict "overflow" and "display" styles during box animations
  14408. if ( isBox && elem.nodeType === 1 ) {
  14409. // Support: IE <=9 - 11, Edge 12 - 15
  14410. // Record all 3 overflow attributes because IE does not infer the shorthand
  14411. // from identically-valued overflowX and overflowY and Edge just mirrors
  14412. // the overflowX value there.
  14413. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14414. // Identify a display type, preferring old show/hide data over the CSS cascade
  14415. restoreDisplay = dataShow && dataShow.display;
  14416. if ( restoreDisplay == null ) {
  14417. restoreDisplay = dataPriv.get( elem, "display" );
  14418. }
  14419. display = jQuery.css( elem, "display" );
  14420. if ( display === "none" ) {
  14421. if ( restoreDisplay ) {
  14422. display = restoreDisplay;
  14423. } else {
  14424. // Get nonempty value(s) by temporarily forcing visibility
  14425. showHide( [ elem ], true );
  14426. restoreDisplay = elem.style.display || restoreDisplay;
  14427. display = jQuery.css( elem, "display" );
  14428. showHide( [ elem ] );
  14429. }
  14430. }
  14431. // Animate inline elements as inline-block
  14432. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14433. if ( jQuery.css( elem, "float" ) === "none" ) {
  14434. // Restore the original display value at the end of pure show/hide animations
  14435. if ( !propTween ) {
  14436. anim.done( function() {
  14437. style.display = restoreDisplay;
  14438. } );
  14439. if ( restoreDisplay == null ) {
  14440. display = style.display;
  14441. restoreDisplay = display === "none" ? "" : display;
  14442. }
  14443. }
  14444. style.display = "inline-block";
  14445. }
  14446. }
  14447. }
  14448. if ( opts.overflow ) {
  14449. style.overflow = "hidden";
  14450. anim.always( function() {
  14451. style.overflow = opts.overflow[ 0 ];
  14452. style.overflowX = opts.overflow[ 1 ];
  14453. style.overflowY = opts.overflow[ 2 ];
  14454. } );
  14455. }
  14456. // Implement show/hide animations
  14457. propTween = false;
  14458. for ( prop in orig ) {
  14459. // General show/hide setup for this element animation
  14460. if ( !propTween ) {
  14461. if ( dataShow ) {
  14462. if ( "hidden" in dataShow ) {
  14463. hidden = dataShow.hidden;
  14464. }
  14465. } else {
  14466. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14467. }
  14468. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14469. if ( toggle ) {
  14470. dataShow.hidden = !hidden;
  14471. }
  14472. // Show elements before animating them
  14473. if ( hidden ) {
  14474. showHide( [ elem ], true );
  14475. }
  14476. /* eslint-disable no-loop-func */
  14477. anim.done( function() {
  14478. /* eslint-enable no-loop-func */
  14479. // The final step of a "hide" animation is actually hiding the element
  14480. if ( !hidden ) {
  14481. showHide( [ elem ] );
  14482. }
  14483. dataPriv.remove( elem, "fxshow" );
  14484. for ( prop in orig ) {
  14485. jQuery.style( elem, prop, orig[ prop ] );
  14486. }
  14487. } );
  14488. }
  14489. // Per-property setup
  14490. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14491. if ( !( prop in dataShow ) ) {
  14492. dataShow[ prop ] = propTween.start;
  14493. if ( hidden ) {
  14494. propTween.end = propTween.start;
  14495. propTween.start = 0;
  14496. }
  14497. }
  14498. }
  14499. }
  14500. function propFilter( props, specialEasing ) {
  14501. var index, name, easing, value, hooks;
  14502. // camelCase, specialEasing and expand cssHook pass
  14503. for ( index in props ) {
  14504. name = camelCase( index );
  14505. easing = specialEasing[ name ];
  14506. value = props[ index ];
  14507. if ( Array.isArray( value ) ) {
  14508. easing = value[ 1 ];
  14509. value = props[ index ] = value[ 0 ];
  14510. }
  14511. if ( index !== name ) {
  14512. props[ name ] = value;
  14513. delete props[ index ];
  14514. }
  14515. hooks = jQuery.cssHooks[ name ];
  14516. if ( hooks && "expand" in hooks ) {
  14517. value = hooks.expand( value );
  14518. delete props[ name ];
  14519. // Not quite $.extend, this won't overwrite existing keys.
  14520. // Reusing 'index' because we have the correct "name"
  14521. for ( index in value ) {
  14522. if ( !( index in props ) ) {
  14523. props[ index ] = value[ index ];
  14524. specialEasing[ index ] = easing;
  14525. }
  14526. }
  14527. } else {
  14528. specialEasing[ name ] = easing;
  14529. }
  14530. }
  14531. }
  14532. function Animation( elem, properties, options ) {
  14533. var result,
  14534. stopped,
  14535. index = 0,
  14536. length = Animation.prefilters.length,
  14537. deferred = jQuery.Deferred().always( function() {
  14538. // Don't match elem in the :animated selector
  14539. delete tick.elem;
  14540. } ),
  14541. tick = function() {
  14542. if ( stopped ) {
  14543. return false;
  14544. }
  14545. var currentTime = fxNow || createFxNow(),
  14546. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14547. // Support: Android 2.3 only
  14548. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14549. temp = remaining / animation.duration || 0,
  14550. percent = 1 - temp,
  14551. index = 0,
  14552. length = animation.tweens.length;
  14553. for ( ; index < length; index++ ) {
  14554. animation.tweens[ index ].run( percent );
  14555. }
  14556. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14557. // If there's more to do, yield
  14558. if ( percent < 1 && length ) {
  14559. return remaining;
  14560. }
  14561. // If this was an empty animation, synthesize a final progress notification
  14562. if ( !length ) {
  14563. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14564. }
  14565. // Resolve the animation and report its conclusion
  14566. deferred.resolveWith( elem, [ animation ] );
  14567. return false;
  14568. },
  14569. animation = deferred.promise( {
  14570. elem: elem,
  14571. props: jQuery.extend( {}, properties ),
  14572. opts: jQuery.extend( true, {
  14573. specialEasing: {},
  14574. easing: jQuery.easing._default
  14575. }, options ),
  14576. originalProperties: properties,
  14577. originalOptions: options,
  14578. startTime: fxNow || createFxNow(),
  14579. duration: options.duration,
  14580. tweens: [],
  14581. createTween: function( prop, end ) {
  14582. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14583. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14584. animation.tweens.push( tween );
  14585. return tween;
  14586. },
  14587. stop: function( gotoEnd ) {
  14588. var index = 0,
  14589. // If we are going to the end, we want to run all the tweens
  14590. // otherwise we skip this part
  14591. length = gotoEnd ? animation.tweens.length : 0;
  14592. if ( stopped ) {
  14593. return this;
  14594. }
  14595. stopped = true;
  14596. for ( ; index < length; index++ ) {
  14597. animation.tweens[ index ].run( 1 );
  14598. }
  14599. // Resolve when we played the last frame; otherwise, reject
  14600. if ( gotoEnd ) {
  14601. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14602. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14603. } else {
  14604. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14605. }
  14606. return this;
  14607. }
  14608. } ),
  14609. props = animation.props;
  14610. propFilter( props, animation.opts.specialEasing );
  14611. for ( ; index < length; index++ ) {
  14612. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14613. if ( result ) {
  14614. if ( isFunction( result.stop ) ) {
  14615. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14616. result.stop.bind( result );
  14617. }
  14618. return result;
  14619. }
  14620. }
  14621. jQuery.map( props, createTween, animation );
  14622. if ( isFunction( animation.opts.start ) ) {
  14623. animation.opts.start.call( elem, animation );
  14624. }
  14625. // Attach callbacks from options
  14626. animation
  14627. .progress( animation.opts.progress )
  14628. .done( animation.opts.done, animation.opts.complete )
  14629. .fail( animation.opts.fail )
  14630. .always( animation.opts.always );
  14631. jQuery.fx.timer(
  14632. jQuery.extend( tick, {
  14633. elem: elem,
  14634. anim: animation,
  14635. queue: animation.opts.queue
  14636. } )
  14637. );
  14638. return animation;
  14639. }
  14640. jQuery.Animation = jQuery.extend( Animation, {
  14641. tweeners: {
  14642. "*": [ function( prop, value ) {
  14643. var tween = this.createTween( prop, value );
  14644. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14645. return tween;
  14646. } ]
  14647. },
  14648. tweener: function( props, callback ) {
  14649. if ( isFunction( props ) ) {
  14650. callback = props;
  14651. props = [ "*" ];
  14652. } else {
  14653. props = props.match( rnothtmlwhite );
  14654. }
  14655. var prop,
  14656. index = 0,
  14657. length = props.length;
  14658. for ( ; index < length; index++ ) {
  14659. prop = props[ index ];
  14660. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14661. Animation.tweeners[ prop ].unshift( callback );
  14662. }
  14663. },
  14664. prefilters: [ defaultPrefilter ],
  14665. prefilter: function( callback, prepend ) {
  14666. if ( prepend ) {
  14667. Animation.prefilters.unshift( callback );
  14668. } else {
  14669. Animation.prefilters.push( callback );
  14670. }
  14671. }
  14672. } );
  14673. jQuery.speed = function( speed, easing, fn ) {
  14674. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14675. complete: fn || !fn && easing ||
  14676. isFunction( speed ) && speed,
  14677. duration: speed,
  14678. easing: fn && easing || easing && !isFunction( easing ) && easing
  14679. };
  14680. // Go to the end state if fx are off
  14681. if ( jQuery.fx.off ) {
  14682. opt.duration = 0;
  14683. } else {
  14684. if ( typeof opt.duration !== "number" ) {
  14685. if ( opt.duration in jQuery.fx.speeds ) {
  14686. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14687. } else {
  14688. opt.duration = jQuery.fx.speeds._default;
  14689. }
  14690. }
  14691. }
  14692. // Normalize opt.queue - true/undefined/null -> "fx"
  14693. if ( opt.queue == null || opt.queue === true ) {
  14694. opt.queue = "fx";
  14695. }
  14696. // Queueing
  14697. opt.old = opt.complete;
  14698. opt.complete = function() {
  14699. if ( isFunction( opt.old ) ) {
  14700. opt.old.call( this );
  14701. }
  14702. if ( opt.queue ) {
  14703. jQuery.dequeue( this, opt.queue );
  14704. }
  14705. };
  14706. return opt;
  14707. };
  14708. jQuery.fn.extend( {
  14709. fadeTo: function( speed, to, easing, callback ) {
  14710. // Show any hidden elements after setting opacity to 0
  14711. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14712. // Animate to the value specified
  14713. .end().animate( { opacity: to }, speed, easing, callback );
  14714. },
  14715. animate: function( prop, speed, easing, callback ) {
  14716. var empty = jQuery.isEmptyObject( prop ),
  14717. optall = jQuery.speed( speed, easing, callback ),
  14718. doAnimation = function() {
  14719. // Operate on a copy of prop so per-property easing won't be lost
  14720. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14721. // Empty animations, or finishing resolves immediately
  14722. if ( empty || dataPriv.get( this, "finish" ) ) {
  14723. anim.stop( true );
  14724. }
  14725. };
  14726. doAnimation.finish = doAnimation;
  14727. return empty || optall.queue === false ?
  14728. this.each( doAnimation ) :
  14729. this.queue( optall.queue, doAnimation );
  14730. },
  14731. stop: function( type, clearQueue, gotoEnd ) {
  14732. var stopQueue = function( hooks ) {
  14733. var stop = hooks.stop;
  14734. delete hooks.stop;
  14735. stop( gotoEnd );
  14736. };
  14737. if ( typeof type !== "string" ) {
  14738. gotoEnd = clearQueue;
  14739. clearQueue = type;
  14740. type = undefined;
  14741. }
  14742. if ( clearQueue && type !== false ) {
  14743. this.queue( type || "fx", [] );
  14744. }
  14745. return this.each( function() {
  14746. var dequeue = true,
  14747. index = type != null && type + "queueHooks",
  14748. timers = jQuery.timers,
  14749. data = dataPriv.get( this );
  14750. if ( index ) {
  14751. if ( data[ index ] && data[ index ].stop ) {
  14752. stopQueue( data[ index ] );
  14753. }
  14754. } else {
  14755. for ( index in data ) {
  14756. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14757. stopQueue( data[ index ] );
  14758. }
  14759. }
  14760. }
  14761. for ( index = timers.length; index--; ) {
  14762. if ( timers[ index ].elem === this &&
  14763. ( type == null || timers[ index ].queue === type ) ) {
  14764. timers[ index ].anim.stop( gotoEnd );
  14765. dequeue = false;
  14766. timers.splice( index, 1 );
  14767. }
  14768. }
  14769. // Start the next in the queue if the last step wasn't forced.
  14770. // Timers currently will call their complete callbacks, which
  14771. // will dequeue but only if they were gotoEnd.
  14772. if ( dequeue || !gotoEnd ) {
  14773. jQuery.dequeue( this, type );
  14774. }
  14775. } );
  14776. },
  14777. finish: function( type ) {
  14778. if ( type !== false ) {
  14779. type = type || "fx";
  14780. }
  14781. return this.each( function() {
  14782. var index,
  14783. data = dataPriv.get( this ),
  14784. queue = data[ type + "queue" ],
  14785. hooks = data[ type + "queueHooks" ],
  14786. timers = jQuery.timers,
  14787. length = queue ? queue.length : 0;
  14788. // Enable finishing flag on private data
  14789. data.finish = true;
  14790. // Empty the queue first
  14791. jQuery.queue( this, type, [] );
  14792. if ( hooks && hooks.stop ) {
  14793. hooks.stop.call( this, true );
  14794. }
  14795. // Look for any active animations, and finish them
  14796. for ( index = timers.length; index--; ) {
  14797. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14798. timers[ index ].anim.stop( true );
  14799. timers.splice( index, 1 );
  14800. }
  14801. }
  14802. // Look for any animations in the old queue and finish them
  14803. for ( index = 0; index < length; index++ ) {
  14804. if ( queue[ index ] && queue[ index ].finish ) {
  14805. queue[ index ].finish.call( this );
  14806. }
  14807. }
  14808. // Turn off finishing flag
  14809. delete data.finish;
  14810. } );
  14811. }
  14812. } );
  14813. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14814. var cssFn = jQuery.fn[ name ];
  14815. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14816. return speed == null || typeof speed === "boolean" ?
  14817. cssFn.apply( this, arguments ) :
  14818. this.animate( genFx( name, true ), speed, easing, callback );
  14819. };
  14820. } );
  14821. // Generate shortcuts for custom animations
  14822. jQuery.each( {
  14823. slideDown: genFx( "show" ),
  14824. slideUp: genFx( "hide" ),
  14825. slideToggle: genFx( "toggle" ),
  14826. fadeIn: { opacity: "show" },
  14827. fadeOut: { opacity: "hide" },
  14828. fadeToggle: { opacity: "toggle" }
  14829. }, function( name, props ) {
  14830. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14831. return this.animate( props, speed, easing, callback );
  14832. };
  14833. } );
  14834. jQuery.timers = [];
  14835. jQuery.fx.tick = function() {
  14836. var timer,
  14837. i = 0,
  14838. timers = jQuery.timers;
  14839. fxNow = Date.now();
  14840. for ( ; i < timers.length; i++ ) {
  14841. timer = timers[ i ];
  14842. // Run the timer and safely remove it when done (allowing for external removal)
  14843. if ( !timer() && timers[ i ] === timer ) {
  14844. timers.splice( i--, 1 );
  14845. }
  14846. }
  14847. if ( !timers.length ) {
  14848. jQuery.fx.stop();
  14849. }
  14850. fxNow = undefined;
  14851. };
  14852. jQuery.fx.timer = function( timer ) {
  14853. jQuery.timers.push( timer );
  14854. jQuery.fx.start();
  14855. };
  14856. jQuery.fx.interval = 13;
  14857. jQuery.fx.start = function() {
  14858. if ( inProgress ) {
  14859. return;
  14860. }
  14861. inProgress = true;
  14862. schedule();
  14863. };
  14864. jQuery.fx.stop = function() {
  14865. inProgress = null;
  14866. };
  14867. jQuery.fx.speeds = {
  14868. slow: 600,
  14869. fast: 200,
  14870. // Default speed
  14871. _default: 400
  14872. };
  14873. // Based off of the plugin by Clint Helfers, with permission.
  14874. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14875. jQuery.fn.delay = function( time, type ) {
  14876. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14877. type = type || "fx";
  14878. return this.queue( type, function( next, hooks ) {
  14879. var timeout = window.setTimeout( next, time );
  14880. hooks.stop = function() {
  14881. window.clearTimeout( timeout );
  14882. };
  14883. } );
  14884. };
  14885. ( function() {
  14886. var input = document.createElement( "input" ),
  14887. select = document.createElement( "select" ),
  14888. opt = select.appendChild( document.createElement( "option" ) );
  14889. input.type = "checkbox";
  14890. // Support: Android <=4.3 only
  14891. // Default value for a checkbox should be "on"
  14892. support.checkOn = input.value !== "";
  14893. // Support: IE <=11 only
  14894. // Must access selectedIndex to make default options select
  14895. support.optSelected = opt.selected;
  14896. // Support: IE <=11 only
  14897. // An input loses its value after becoming a radio
  14898. input = document.createElement( "input" );
  14899. input.value = "t";
  14900. input.type = "radio";
  14901. support.radioValue = input.value === "t";
  14902. } )();
  14903. var boolHook,
  14904. attrHandle = jQuery.expr.attrHandle;
  14905. jQuery.fn.extend( {
  14906. attr: function( name, value ) {
  14907. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14908. },
  14909. removeAttr: function( name ) {
  14910. return this.each( function() {
  14911. jQuery.removeAttr( this, name );
  14912. } );
  14913. }
  14914. } );
  14915. jQuery.extend( {
  14916. attr: function( elem, name, value ) {
  14917. var ret, hooks,
  14918. nType = elem.nodeType;
  14919. // Don't get/set attributes on text, comment and attribute nodes
  14920. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14921. return;
  14922. }
  14923. // Fallback to prop when attributes are not supported
  14924. if ( typeof elem.getAttribute === "undefined" ) {
  14925. return jQuery.prop( elem, name, value );
  14926. }
  14927. // Attribute hooks are determined by the lowercase version
  14928. // Grab necessary hook if one is defined
  14929. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14930. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14931. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14932. }
  14933. if ( value !== undefined ) {
  14934. if ( value === null ) {
  14935. jQuery.removeAttr( elem, name );
  14936. return;
  14937. }
  14938. if ( hooks && "set" in hooks &&
  14939. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14940. return ret;
  14941. }
  14942. elem.setAttribute( name, value + "" );
  14943. return value;
  14944. }
  14945. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14946. return ret;
  14947. }
  14948. ret = jQuery.find.attr( elem, name );
  14949. // Non-existent attributes return null, we normalize to undefined
  14950. return ret == null ? undefined : ret;
  14951. },
  14952. attrHooks: {
  14953. type: {
  14954. set: function( elem, value ) {
  14955. if ( !support.radioValue && value === "radio" &&
  14956. nodeName( elem, "input" ) ) {
  14957. var val = elem.value;
  14958. elem.setAttribute( "type", value );
  14959. if ( val ) {
  14960. elem.value = val;
  14961. }
  14962. return value;
  14963. }
  14964. }
  14965. }
  14966. },
  14967. removeAttr: function( elem, value ) {
  14968. var name,
  14969. i = 0,
  14970. // Attribute names can contain non-HTML whitespace characters
  14971. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14972. attrNames = value && value.match( rnothtmlwhite );
  14973. if ( attrNames && elem.nodeType === 1 ) {
  14974. while ( ( name = attrNames[ i++ ] ) ) {
  14975. elem.removeAttribute( name );
  14976. }
  14977. }
  14978. }
  14979. } );
  14980. // Hooks for boolean attributes
  14981. boolHook = {
  14982. set: function( elem, value, name ) {
  14983. if ( value === false ) {
  14984. // Remove boolean attributes when set to false
  14985. jQuery.removeAttr( elem, name );
  14986. } else {
  14987. elem.setAttribute( name, name );
  14988. }
  14989. return name;
  14990. }
  14991. };
  14992. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14993. var getter = attrHandle[ name ] || jQuery.find.attr;
  14994. attrHandle[ name ] = function( elem, name, isXML ) {
  14995. var ret, handle,
  14996. lowercaseName = name.toLowerCase();
  14997. if ( !isXML ) {
  14998. // Avoid an infinite loop by temporarily removing this function from the getter
  14999. handle = attrHandle[ lowercaseName ];
  15000. attrHandle[ lowercaseName ] = ret;
  15001. ret = getter( elem, name, isXML ) != null ?
  15002. lowercaseName :
  15003. null;
  15004. attrHandle[ lowercaseName ] = handle;
  15005. }
  15006. return ret;
  15007. };
  15008. } );
  15009. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15010. rclickable = /^(?:a|area)$/i;
  15011. jQuery.fn.extend( {
  15012. prop: function( name, value ) {
  15013. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15014. },
  15015. removeProp: function( name ) {
  15016. return this.each( function() {
  15017. delete this[ jQuery.propFix[ name ] || name ];
  15018. } );
  15019. }
  15020. } );
  15021. jQuery.extend( {
  15022. prop: function( elem, name, value ) {
  15023. var ret, hooks,
  15024. nType = elem.nodeType;
  15025. // Don't get/set properties on text, comment and attribute nodes
  15026. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15027. return;
  15028. }
  15029. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15030. // Fix name and attach hooks
  15031. name = jQuery.propFix[ name ] || name;
  15032. hooks = jQuery.propHooks[ name ];
  15033. }
  15034. if ( value !== undefined ) {
  15035. if ( hooks && "set" in hooks &&
  15036. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15037. return ret;
  15038. }
  15039. return ( elem[ name ] = value );
  15040. }
  15041. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15042. return ret;
  15043. }
  15044. return elem[ name ];
  15045. },
  15046. propHooks: {
  15047. tabIndex: {
  15048. get: function( elem ) {
  15049. // Support: IE <=9 - 11 only
  15050. // elem.tabIndex doesn't always return the
  15051. // correct value when it hasn't been explicitly set
  15052. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15053. // Use proper attribute retrieval(#12072)
  15054. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15055. if ( tabindex ) {
  15056. return parseInt( tabindex, 10 );
  15057. }
  15058. if (
  15059. rfocusable.test( elem.nodeName ) ||
  15060. rclickable.test( elem.nodeName ) &&
  15061. elem.href
  15062. ) {
  15063. return 0;
  15064. }
  15065. return -1;
  15066. }
  15067. }
  15068. },
  15069. propFix: {
  15070. "for": "htmlFor",
  15071. "class": "className"
  15072. }
  15073. } );
  15074. // Support: IE <=11 only
  15075. // Accessing the selectedIndex property
  15076. // forces the browser to respect setting selected
  15077. // on the option
  15078. // The getter ensures a default option is selected
  15079. // when in an optgroup
  15080. // eslint rule "no-unused-expressions" is disabled for this code
  15081. // since it considers such accessions noop
  15082. if ( !support.optSelected ) {
  15083. jQuery.propHooks.selected = {
  15084. get: function( elem ) {
  15085. /* eslint no-unused-expressions: "off" */
  15086. var parent = elem.parentNode;
  15087. if ( parent && parent.parentNode ) {
  15088. parent.parentNode.selectedIndex;
  15089. }
  15090. return null;
  15091. },
  15092. set: function( elem ) {
  15093. /* eslint no-unused-expressions: "off" */
  15094. var parent = elem.parentNode;
  15095. if ( parent ) {
  15096. parent.selectedIndex;
  15097. if ( parent.parentNode ) {
  15098. parent.parentNode.selectedIndex;
  15099. }
  15100. }
  15101. }
  15102. };
  15103. }
  15104. jQuery.each( [
  15105. "tabIndex",
  15106. "readOnly",
  15107. "maxLength",
  15108. "cellSpacing",
  15109. "cellPadding",
  15110. "rowSpan",
  15111. "colSpan",
  15112. "useMap",
  15113. "frameBorder",
  15114. "contentEditable"
  15115. ], function() {
  15116. jQuery.propFix[ this.toLowerCase() ] = this;
  15117. } );
  15118. // Strip and collapse whitespace according to HTML spec
  15119. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15120. function stripAndCollapse( value ) {
  15121. var tokens = value.match( rnothtmlwhite ) || [];
  15122. return tokens.join( " " );
  15123. }
  15124. function getClass( elem ) {
  15125. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15126. }
  15127. function classesToArray( value ) {
  15128. if ( Array.isArray( value ) ) {
  15129. return value;
  15130. }
  15131. if ( typeof value === "string" ) {
  15132. return value.match( rnothtmlwhite ) || [];
  15133. }
  15134. return [];
  15135. }
  15136. jQuery.fn.extend( {
  15137. addClass: function( value ) {
  15138. var classes, elem, cur, curValue, clazz, j, finalValue,
  15139. i = 0;
  15140. if ( isFunction( value ) ) {
  15141. return this.each( function( j ) {
  15142. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15143. } );
  15144. }
  15145. classes = classesToArray( value );
  15146. if ( classes.length ) {
  15147. while ( ( elem = this[ i++ ] ) ) {
  15148. curValue = getClass( elem );
  15149. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15150. if ( cur ) {
  15151. j = 0;
  15152. while ( ( clazz = classes[ j++ ] ) ) {
  15153. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15154. cur += clazz + " ";
  15155. }
  15156. }
  15157. // Only assign if different to avoid unneeded rendering.
  15158. finalValue = stripAndCollapse( cur );
  15159. if ( curValue !== finalValue ) {
  15160. elem.setAttribute( "class", finalValue );
  15161. }
  15162. }
  15163. }
  15164. }
  15165. return this;
  15166. },
  15167. removeClass: function( value ) {
  15168. var classes, elem, cur, curValue, clazz, j, finalValue,
  15169. i = 0;
  15170. if ( isFunction( value ) ) {
  15171. return this.each( function( j ) {
  15172. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15173. } );
  15174. }
  15175. if ( !arguments.length ) {
  15176. return this.attr( "class", "" );
  15177. }
  15178. classes = classesToArray( value );
  15179. if ( classes.length ) {
  15180. while ( ( elem = this[ i++ ] ) ) {
  15181. curValue = getClass( elem );
  15182. // This expression is here for better compressibility (see addClass)
  15183. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15184. if ( cur ) {
  15185. j = 0;
  15186. while ( ( clazz = classes[ j++ ] ) ) {
  15187. // Remove *all* instances
  15188. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15189. cur = cur.replace( " " + clazz + " ", " " );
  15190. }
  15191. }
  15192. // Only assign if different to avoid unneeded rendering.
  15193. finalValue = stripAndCollapse( cur );
  15194. if ( curValue !== finalValue ) {
  15195. elem.setAttribute( "class", finalValue );
  15196. }
  15197. }
  15198. }
  15199. }
  15200. return this;
  15201. },
  15202. toggleClass: function( value, stateVal ) {
  15203. var type = typeof value,
  15204. isValidValue = type === "string" || Array.isArray( value );
  15205. if ( typeof stateVal === "boolean" && isValidValue ) {
  15206. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15207. }
  15208. if ( isFunction( value ) ) {
  15209. return this.each( function( i ) {
  15210. jQuery( this ).toggleClass(
  15211. value.call( this, i, getClass( this ), stateVal ),
  15212. stateVal
  15213. );
  15214. } );
  15215. }
  15216. return this.each( function() {
  15217. var className, i, self, classNames;
  15218. if ( isValidValue ) {
  15219. // Toggle individual class names
  15220. i = 0;
  15221. self = jQuery( this );
  15222. classNames = classesToArray( value );
  15223. while ( ( className = classNames[ i++ ] ) ) {
  15224. // Check each className given, space separated list
  15225. if ( self.hasClass( className ) ) {
  15226. self.removeClass( className );
  15227. } else {
  15228. self.addClass( className );
  15229. }
  15230. }
  15231. // Toggle whole class name
  15232. } else if ( value === undefined || type === "boolean" ) {
  15233. className = getClass( this );
  15234. if ( className ) {
  15235. // Store className if set
  15236. dataPriv.set( this, "__className__", className );
  15237. }
  15238. // If the element has a class name or if we're passed `false`,
  15239. // then remove the whole classname (if there was one, the above saved it).
  15240. // Otherwise bring back whatever was previously saved (if anything),
  15241. // falling back to the empty string if nothing was stored.
  15242. if ( this.setAttribute ) {
  15243. this.setAttribute( "class",
  15244. className || value === false ?
  15245. "" :
  15246. dataPriv.get( this, "__className__" ) || ""
  15247. );
  15248. }
  15249. }
  15250. } );
  15251. },
  15252. hasClass: function( selector ) {
  15253. var className, elem,
  15254. i = 0;
  15255. className = " " + selector + " ";
  15256. while ( ( elem = this[ i++ ] ) ) {
  15257. if ( elem.nodeType === 1 &&
  15258. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15259. return true;
  15260. }
  15261. }
  15262. return false;
  15263. }
  15264. } );
  15265. var rreturn = /\r/g;
  15266. jQuery.fn.extend( {
  15267. val: function( value ) {
  15268. var hooks, ret, valueIsFunction,
  15269. elem = this[ 0 ];
  15270. if ( !arguments.length ) {
  15271. if ( elem ) {
  15272. hooks = jQuery.valHooks[ elem.type ] ||
  15273. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15274. if ( hooks &&
  15275. "get" in hooks &&
  15276. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15277. ) {
  15278. return ret;
  15279. }
  15280. ret = elem.value;
  15281. // Handle most common string cases
  15282. if ( typeof ret === "string" ) {
  15283. return ret.replace( rreturn, "" );
  15284. }
  15285. // Handle cases where value is null/undef or number
  15286. return ret == null ? "" : ret;
  15287. }
  15288. return;
  15289. }
  15290. valueIsFunction = isFunction( value );
  15291. return this.each( function( i ) {
  15292. var val;
  15293. if ( this.nodeType !== 1 ) {
  15294. return;
  15295. }
  15296. if ( valueIsFunction ) {
  15297. val = value.call( this, i, jQuery( this ).val() );
  15298. } else {
  15299. val = value;
  15300. }
  15301. // Treat null/undefined as ""; convert numbers to string
  15302. if ( val == null ) {
  15303. val = "";
  15304. } else if ( typeof val === "number" ) {
  15305. val += "";
  15306. } else if ( Array.isArray( val ) ) {
  15307. val = jQuery.map( val, function( value ) {
  15308. return value == null ? "" : value + "";
  15309. } );
  15310. }
  15311. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15312. // If set returns undefined, fall back to normal setting
  15313. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15314. this.value = val;
  15315. }
  15316. } );
  15317. }
  15318. } );
  15319. jQuery.extend( {
  15320. valHooks: {
  15321. option: {
  15322. get: function( elem ) {
  15323. var val = jQuery.find.attr( elem, "value" );
  15324. return val != null ?
  15325. val :
  15326. // Support: IE <=10 - 11 only
  15327. // option.text throws exceptions (#14686, #14858)
  15328. // Strip and collapse whitespace
  15329. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15330. stripAndCollapse( jQuery.text( elem ) );
  15331. }
  15332. },
  15333. select: {
  15334. get: function( elem ) {
  15335. var value, option, i,
  15336. options = elem.options,
  15337. index = elem.selectedIndex,
  15338. one = elem.type === "select-one",
  15339. values = one ? null : [],
  15340. max = one ? index + 1 : options.length;
  15341. if ( index < 0 ) {
  15342. i = max;
  15343. } else {
  15344. i = one ? index : 0;
  15345. }
  15346. // Loop through all the selected options
  15347. for ( ; i < max; i++ ) {
  15348. option = options[ i ];
  15349. // Support: IE <=9 only
  15350. // IE8-9 doesn't update selected after form reset (#2551)
  15351. if ( ( option.selected || i === index ) &&
  15352. // Don't return options that are disabled or in a disabled optgroup
  15353. !option.disabled &&
  15354. ( !option.parentNode.disabled ||
  15355. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15356. // Get the specific value for the option
  15357. value = jQuery( option ).val();
  15358. // We don't need an array for one selects
  15359. if ( one ) {
  15360. return value;
  15361. }
  15362. // Multi-Selects return an array
  15363. values.push( value );
  15364. }
  15365. }
  15366. return values;
  15367. },
  15368. set: function( elem, value ) {
  15369. var optionSet, option,
  15370. options = elem.options,
  15371. values = jQuery.makeArray( value ),
  15372. i = options.length;
  15373. while ( i-- ) {
  15374. option = options[ i ];
  15375. /* eslint-disable no-cond-assign */
  15376. if ( option.selected =
  15377. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15378. ) {
  15379. optionSet = true;
  15380. }
  15381. /* eslint-enable no-cond-assign */
  15382. }
  15383. // Force browsers to behave consistently when non-matching value is set
  15384. if ( !optionSet ) {
  15385. elem.selectedIndex = -1;
  15386. }
  15387. return values;
  15388. }
  15389. }
  15390. }
  15391. } );
  15392. // Radios and checkboxes getter/setter
  15393. jQuery.each( [ "radio", "checkbox" ], function() {
  15394. jQuery.valHooks[ this ] = {
  15395. set: function( elem, value ) {
  15396. if ( Array.isArray( value ) ) {
  15397. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15398. }
  15399. }
  15400. };
  15401. if ( !support.checkOn ) {
  15402. jQuery.valHooks[ this ].get = function( elem ) {
  15403. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15404. };
  15405. }
  15406. } );
  15407. // Return jQuery for attributes-only inclusion
  15408. support.focusin = "onfocusin" in window;
  15409. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15410. stopPropagationCallback = function( e ) {
  15411. e.stopPropagation();
  15412. };
  15413. jQuery.extend( jQuery.event, {
  15414. trigger: function( event, data, elem, onlyHandlers ) {
  15415. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15416. eventPath = [ elem || document ],
  15417. type = hasOwn.call( event, "type" ) ? event.type : event,
  15418. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15419. cur = lastElement = tmp = elem = elem || document;
  15420. // Don't do events on text and comment nodes
  15421. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15422. return;
  15423. }
  15424. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15425. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15426. return;
  15427. }
  15428. if ( type.indexOf( "." ) > -1 ) {
  15429. // Namespaced trigger; create a regexp to match event type in handle()
  15430. namespaces = type.split( "." );
  15431. type = namespaces.shift();
  15432. namespaces.sort();
  15433. }
  15434. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15435. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15436. event = event[ jQuery.expando ] ?
  15437. event :
  15438. new jQuery.Event( type, typeof event === "object" && event );
  15439. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15440. event.isTrigger = onlyHandlers ? 2 : 3;
  15441. event.namespace = namespaces.join( "." );
  15442. event.rnamespace = event.namespace ?
  15443. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15444. null;
  15445. // Clean up the event in case it is being reused
  15446. event.result = undefined;
  15447. if ( !event.target ) {
  15448. event.target = elem;
  15449. }
  15450. // Clone any incoming data and prepend the event, creating the handler arg list
  15451. data = data == null ?
  15452. [ event ] :
  15453. jQuery.makeArray( data, [ event ] );
  15454. // Allow special events to draw outside the lines
  15455. special = jQuery.event.special[ type ] || {};
  15456. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15457. return;
  15458. }
  15459. // Determine event propagation path in advance, per W3C events spec (#9951)
  15460. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15461. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15462. bubbleType = special.delegateType || type;
  15463. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15464. cur = cur.parentNode;
  15465. }
  15466. for ( ; cur; cur = cur.parentNode ) {
  15467. eventPath.push( cur );
  15468. tmp = cur;
  15469. }
  15470. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15471. if ( tmp === ( elem.ownerDocument || document ) ) {
  15472. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15473. }
  15474. }
  15475. // Fire handlers on the event path
  15476. i = 0;
  15477. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15478. lastElement = cur;
  15479. event.type = i > 1 ?
  15480. bubbleType :
  15481. special.bindType || type;
  15482. // jQuery handler
  15483. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15484. dataPriv.get( cur, "handle" );
  15485. if ( handle ) {
  15486. handle.apply( cur, data );
  15487. }
  15488. // Native handler
  15489. handle = ontype && cur[ ontype ];
  15490. if ( handle && handle.apply && acceptData( cur ) ) {
  15491. event.result = handle.apply( cur, data );
  15492. if ( event.result === false ) {
  15493. event.preventDefault();
  15494. }
  15495. }
  15496. }
  15497. event.type = type;
  15498. // If nobody prevented the default action, do it now
  15499. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15500. if ( ( !special._default ||
  15501. special._default.apply( eventPath.pop(), data ) === false ) &&
  15502. acceptData( elem ) ) {
  15503. // Call a native DOM method on the target with the same name as the event.
  15504. // Don't do default actions on window, that's where global variables be (#6170)
  15505. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15506. // Don't re-trigger an onFOO event when we call its FOO() method
  15507. tmp = elem[ ontype ];
  15508. if ( tmp ) {
  15509. elem[ ontype ] = null;
  15510. }
  15511. // Prevent re-triggering of the same event, since we already bubbled it above
  15512. jQuery.event.triggered = type;
  15513. if ( event.isPropagationStopped() ) {
  15514. lastElement.addEventListener( type, stopPropagationCallback );
  15515. }
  15516. elem[ type ]();
  15517. if ( event.isPropagationStopped() ) {
  15518. lastElement.removeEventListener( type, stopPropagationCallback );
  15519. }
  15520. jQuery.event.triggered = undefined;
  15521. if ( tmp ) {
  15522. elem[ ontype ] = tmp;
  15523. }
  15524. }
  15525. }
  15526. }
  15527. return event.result;
  15528. },
  15529. // Piggyback on a donor event to simulate a different one
  15530. // Used only for `focus(in | out)` events
  15531. simulate: function( type, elem, event ) {
  15532. var e = jQuery.extend(
  15533. new jQuery.Event(),
  15534. event,
  15535. {
  15536. type: type,
  15537. isSimulated: true
  15538. }
  15539. );
  15540. jQuery.event.trigger( e, null, elem );
  15541. }
  15542. } );
  15543. jQuery.fn.extend( {
  15544. trigger: function( type, data ) {
  15545. return this.each( function() {
  15546. jQuery.event.trigger( type, data, this );
  15547. } );
  15548. },
  15549. triggerHandler: function( type, data ) {
  15550. var elem = this[ 0 ];
  15551. if ( elem ) {
  15552. return jQuery.event.trigger( type, data, elem, true );
  15553. }
  15554. }
  15555. } );
  15556. // Support: Firefox <=44
  15557. // Firefox doesn't have focus(in | out) events
  15558. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15559. //
  15560. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15561. // focus(in | out) events fire after focus & blur events,
  15562. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15563. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15564. if ( !support.focusin ) {
  15565. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15566. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15567. var handler = function( event ) {
  15568. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15569. };
  15570. jQuery.event.special[ fix ] = {
  15571. setup: function() {
  15572. var doc = this.ownerDocument || this,
  15573. attaches = dataPriv.access( doc, fix );
  15574. if ( !attaches ) {
  15575. doc.addEventListener( orig, handler, true );
  15576. }
  15577. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15578. },
  15579. teardown: function() {
  15580. var doc = this.ownerDocument || this,
  15581. attaches = dataPriv.access( doc, fix ) - 1;
  15582. if ( !attaches ) {
  15583. doc.removeEventListener( orig, handler, true );
  15584. dataPriv.remove( doc, fix );
  15585. } else {
  15586. dataPriv.access( doc, fix, attaches );
  15587. }
  15588. }
  15589. };
  15590. } );
  15591. }
  15592. var location = window.location;
  15593. var nonce = Date.now();
  15594. var rquery = ( /\?/ );
  15595. // Cross-browser xml parsing
  15596. jQuery.parseXML = function( data ) {
  15597. var xml;
  15598. if ( !data || typeof data !== "string" ) {
  15599. return null;
  15600. }
  15601. // Support: IE 9 - 11 only
  15602. // IE throws on parseFromString with invalid input.
  15603. try {
  15604. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15605. } catch ( e ) {
  15606. xml = undefined;
  15607. }
  15608. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15609. jQuery.error( "Invalid XML: " + data );
  15610. }
  15611. return xml;
  15612. };
  15613. var
  15614. rbracket = /\[\]$/,
  15615. rCRLF = /\r?\n/g,
  15616. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15617. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15618. function buildParams( prefix, obj, traditional, add ) {
  15619. var name;
  15620. if ( Array.isArray( obj ) ) {
  15621. // Serialize array item.
  15622. jQuery.each( obj, function( i, v ) {
  15623. if ( traditional || rbracket.test( prefix ) ) {
  15624. // Treat each array item as a scalar.
  15625. add( prefix, v );
  15626. } else {
  15627. // Item is non-scalar (array or object), encode its numeric index.
  15628. buildParams(
  15629. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15630. v,
  15631. traditional,
  15632. add
  15633. );
  15634. }
  15635. } );
  15636. } else if ( !traditional && toType( obj ) === "object" ) {
  15637. // Serialize object item.
  15638. for ( name in obj ) {
  15639. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15640. }
  15641. } else {
  15642. // Serialize scalar item.
  15643. add( prefix, obj );
  15644. }
  15645. }
  15646. // Serialize an array of form elements or a set of
  15647. // key/values into a query string
  15648. jQuery.param = function( a, traditional ) {
  15649. var prefix,
  15650. s = [],
  15651. add = function( key, valueOrFunction ) {
  15652. // If value is a function, invoke it and use its return value
  15653. var value = isFunction( valueOrFunction ) ?
  15654. valueOrFunction() :
  15655. valueOrFunction;
  15656. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15657. encodeURIComponent( value == null ? "" : value );
  15658. };
  15659. if ( a == null ) {
  15660. return "";
  15661. }
  15662. // If an array was passed in, assume that it is an array of form elements.
  15663. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15664. // Serialize the form elements
  15665. jQuery.each( a, function() {
  15666. add( this.name, this.value );
  15667. } );
  15668. } else {
  15669. // If traditional, encode the "old" way (the way 1.3.2 or older
  15670. // did it), otherwise encode params recursively.
  15671. for ( prefix in a ) {
  15672. buildParams( prefix, a[ prefix ], traditional, add );
  15673. }
  15674. }
  15675. // Return the resulting serialization
  15676. return s.join( "&" );
  15677. };
  15678. jQuery.fn.extend( {
  15679. serialize: function() {
  15680. return jQuery.param( this.serializeArray() );
  15681. },
  15682. serializeArray: function() {
  15683. return this.map( function() {
  15684. // Can add propHook for "elements" to filter or add form elements
  15685. var elements = jQuery.prop( this, "elements" );
  15686. return elements ? jQuery.makeArray( elements ) : this;
  15687. } )
  15688. .filter( function() {
  15689. var type = this.type;
  15690. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15691. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15692. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15693. ( this.checked || !rcheckableType.test( type ) );
  15694. } )
  15695. .map( function( i, elem ) {
  15696. var val = jQuery( this ).val();
  15697. if ( val == null ) {
  15698. return null;
  15699. }
  15700. if ( Array.isArray( val ) ) {
  15701. return jQuery.map( val, function( val ) {
  15702. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15703. } );
  15704. }
  15705. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15706. } ).get();
  15707. }
  15708. } );
  15709. var
  15710. r20 = /%20/g,
  15711. rhash = /#.*$/,
  15712. rantiCache = /([?&])_=[^&]*/,
  15713. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15714. // #7653, #8125, #8152: local protocol detection
  15715. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15716. rnoContent = /^(?:GET|HEAD)$/,
  15717. rprotocol = /^\/\//,
  15718. /* Prefilters
  15719. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15720. * 2) These are called:
  15721. * - BEFORE asking for a transport
  15722. * - AFTER param serialization (s.data is a string if s.processData is true)
  15723. * 3) key is the dataType
  15724. * 4) the catchall symbol "*" can be used
  15725. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15726. */
  15727. prefilters = {},
  15728. /* Transports bindings
  15729. * 1) key is the dataType
  15730. * 2) the catchall symbol "*" can be used
  15731. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15732. */
  15733. transports = {},
  15734. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15735. allTypes = "*/".concat( "*" ),
  15736. // Anchor tag for parsing the document origin
  15737. originAnchor = document.createElement( "a" );
  15738. originAnchor.href = location.href;
  15739. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15740. function addToPrefiltersOrTransports( structure ) {
  15741. // dataTypeExpression is optional and defaults to "*"
  15742. return function( dataTypeExpression, func ) {
  15743. if ( typeof dataTypeExpression !== "string" ) {
  15744. func = dataTypeExpression;
  15745. dataTypeExpression = "*";
  15746. }
  15747. var dataType,
  15748. i = 0,
  15749. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15750. if ( isFunction( func ) ) {
  15751. // For each dataType in the dataTypeExpression
  15752. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15753. // Prepend if requested
  15754. if ( dataType[ 0 ] === "+" ) {
  15755. dataType = dataType.slice( 1 ) || "*";
  15756. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15757. // Otherwise append
  15758. } else {
  15759. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15760. }
  15761. }
  15762. }
  15763. };
  15764. }
  15765. // Base inspection function for prefilters and transports
  15766. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15767. var inspected = {},
  15768. seekingTransport = ( structure === transports );
  15769. function inspect( dataType ) {
  15770. var selected;
  15771. inspected[ dataType ] = true;
  15772. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15773. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15774. if ( typeof dataTypeOrTransport === "string" &&
  15775. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15776. options.dataTypes.unshift( dataTypeOrTransport );
  15777. inspect( dataTypeOrTransport );
  15778. return false;
  15779. } else if ( seekingTransport ) {
  15780. return !( selected = dataTypeOrTransport );
  15781. }
  15782. } );
  15783. return selected;
  15784. }
  15785. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15786. }
  15787. // A special extend for ajax options
  15788. // that takes "flat" options (not to be deep extended)
  15789. // Fixes #9887
  15790. function ajaxExtend( target, src ) {
  15791. var key, deep,
  15792. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15793. for ( key in src ) {
  15794. if ( src[ key ] !== undefined ) {
  15795. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15796. }
  15797. }
  15798. if ( deep ) {
  15799. jQuery.extend( true, target, deep );
  15800. }
  15801. return target;
  15802. }
  15803. /* Handles responses to an ajax request:
  15804. * - finds the right dataType (mediates between content-type and expected dataType)
  15805. * - returns the corresponding response
  15806. */
  15807. function ajaxHandleResponses( s, jqXHR, responses ) {
  15808. var ct, type, finalDataType, firstDataType,
  15809. contents = s.contents,
  15810. dataTypes = s.dataTypes;
  15811. // Remove auto dataType and get content-type in the process
  15812. while ( dataTypes[ 0 ] === "*" ) {
  15813. dataTypes.shift();
  15814. if ( ct === undefined ) {
  15815. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15816. }
  15817. }
  15818. // Check if we're dealing with a known content-type
  15819. if ( ct ) {
  15820. for ( type in contents ) {
  15821. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15822. dataTypes.unshift( type );
  15823. break;
  15824. }
  15825. }
  15826. }
  15827. // Check to see if we have a response for the expected dataType
  15828. if ( dataTypes[ 0 ] in responses ) {
  15829. finalDataType = dataTypes[ 0 ];
  15830. } else {
  15831. // Try convertible dataTypes
  15832. for ( type in responses ) {
  15833. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15834. finalDataType = type;
  15835. break;
  15836. }
  15837. if ( !firstDataType ) {
  15838. firstDataType = type;
  15839. }
  15840. }
  15841. // Or just use first one
  15842. finalDataType = finalDataType || firstDataType;
  15843. }
  15844. // If we found a dataType
  15845. // We add the dataType to the list if needed
  15846. // and return the corresponding response
  15847. if ( finalDataType ) {
  15848. if ( finalDataType !== dataTypes[ 0 ] ) {
  15849. dataTypes.unshift( finalDataType );
  15850. }
  15851. return responses[ finalDataType ];
  15852. }
  15853. }
  15854. /* Chain conversions given the request and the original response
  15855. * Also sets the responseXXX fields on the jqXHR instance
  15856. */
  15857. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15858. var conv2, current, conv, tmp, prev,
  15859. converters = {},
  15860. // Work with a copy of dataTypes in case we need to modify it for conversion
  15861. dataTypes = s.dataTypes.slice();
  15862. // Create converters map with lowercased keys
  15863. if ( dataTypes[ 1 ] ) {
  15864. for ( conv in s.converters ) {
  15865. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15866. }
  15867. }
  15868. current = dataTypes.shift();
  15869. // Convert to each sequential dataType
  15870. while ( current ) {
  15871. if ( s.responseFields[ current ] ) {
  15872. jqXHR[ s.responseFields[ current ] ] = response;
  15873. }
  15874. // Apply the dataFilter if provided
  15875. if ( !prev && isSuccess && s.dataFilter ) {
  15876. response = s.dataFilter( response, s.dataType );
  15877. }
  15878. prev = current;
  15879. current = dataTypes.shift();
  15880. if ( current ) {
  15881. // There's only work to do if current dataType is non-auto
  15882. if ( current === "*" ) {
  15883. current = prev;
  15884. // Convert response if prev dataType is non-auto and differs from current
  15885. } else if ( prev !== "*" && prev !== current ) {
  15886. // Seek a direct converter
  15887. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15888. // If none found, seek a pair
  15889. if ( !conv ) {
  15890. for ( conv2 in converters ) {
  15891. // If conv2 outputs current
  15892. tmp = conv2.split( " " );
  15893. if ( tmp[ 1 ] === current ) {
  15894. // If prev can be converted to accepted input
  15895. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15896. converters[ "* " + tmp[ 0 ] ];
  15897. if ( conv ) {
  15898. // Condense equivalence converters
  15899. if ( conv === true ) {
  15900. conv = converters[ conv2 ];
  15901. // Otherwise, insert the intermediate dataType
  15902. } else if ( converters[ conv2 ] !== true ) {
  15903. current = tmp[ 0 ];
  15904. dataTypes.unshift( tmp[ 1 ] );
  15905. }
  15906. break;
  15907. }
  15908. }
  15909. }
  15910. }
  15911. // Apply converter (if not an equivalence)
  15912. if ( conv !== true ) {
  15913. // Unless errors are allowed to bubble, catch and return them
  15914. if ( conv && s.throws ) {
  15915. response = conv( response );
  15916. } else {
  15917. try {
  15918. response = conv( response );
  15919. } catch ( e ) {
  15920. return {
  15921. state: "parsererror",
  15922. error: conv ? e : "No conversion from " + prev + " to " + current
  15923. };
  15924. }
  15925. }
  15926. }
  15927. }
  15928. }
  15929. }
  15930. return { state: "success", data: response };
  15931. }
  15932. jQuery.extend( {
  15933. // Counter for holding the number of active queries
  15934. active: 0,
  15935. // Last-Modified header cache for next request
  15936. lastModified: {},
  15937. etag: {},
  15938. ajaxSettings: {
  15939. url: location.href,
  15940. type: "GET",
  15941. isLocal: rlocalProtocol.test( location.protocol ),
  15942. global: true,
  15943. processData: true,
  15944. async: true,
  15945. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15946. /*
  15947. timeout: 0,
  15948. data: null,
  15949. dataType: null,
  15950. username: null,
  15951. password: null,
  15952. cache: null,
  15953. throws: false,
  15954. traditional: false,
  15955. headers: {},
  15956. */
  15957. accepts: {
  15958. "*": allTypes,
  15959. text: "text/plain",
  15960. html: "text/html",
  15961. xml: "application/xml, text/xml",
  15962. json: "application/json, text/javascript"
  15963. },
  15964. contents: {
  15965. xml: /\bxml\b/,
  15966. html: /\bhtml/,
  15967. json: /\bjson\b/
  15968. },
  15969. responseFields: {
  15970. xml: "responseXML",
  15971. text: "responseText",
  15972. json: "responseJSON"
  15973. },
  15974. // Data converters
  15975. // Keys separate source (or catchall "*") and destination types with a single space
  15976. converters: {
  15977. // Convert anything to text
  15978. "* text": String,
  15979. // Text to html (true = no transformation)
  15980. "text html": true,
  15981. // Evaluate text as a json expression
  15982. "text json": JSON.parse,
  15983. // Parse text as xml
  15984. "text xml": jQuery.parseXML
  15985. },
  15986. // For options that shouldn't be deep extended:
  15987. // you can add your own custom options here if
  15988. // and when you create one that shouldn't be
  15989. // deep extended (see ajaxExtend)
  15990. flatOptions: {
  15991. url: true,
  15992. context: true
  15993. }
  15994. },
  15995. // Creates a full fledged settings object into target
  15996. // with both ajaxSettings and settings fields.
  15997. // If target is omitted, writes into ajaxSettings.
  15998. ajaxSetup: function( target, settings ) {
  15999. return settings ?
  16000. // Building a settings object
  16001. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16002. // Extending ajaxSettings
  16003. ajaxExtend( jQuery.ajaxSettings, target );
  16004. },
  16005. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16006. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16007. // Main method
  16008. ajax: function( url, options ) {
  16009. // If url is an object, simulate pre-1.5 signature
  16010. if ( typeof url === "object" ) {
  16011. options = url;
  16012. url = undefined;
  16013. }
  16014. // Force options to be an object
  16015. options = options || {};
  16016. var transport,
  16017. // URL without anti-cache param
  16018. cacheURL,
  16019. // Response headers
  16020. responseHeadersString,
  16021. responseHeaders,
  16022. // timeout handle
  16023. timeoutTimer,
  16024. // Url cleanup var
  16025. urlAnchor,
  16026. // Request state (becomes false upon send and true upon completion)
  16027. completed,
  16028. // To know if global events are to be dispatched
  16029. fireGlobals,
  16030. // Loop variable
  16031. i,
  16032. // uncached part of the url
  16033. uncached,
  16034. // Create the final options object
  16035. s = jQuery.ajaxSetup( {}, options ),
  16036. // Callbacks context
  16037. callbackContext = s.context || s,
  16038. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16039. globalEventContext = s.context &&
  16040. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16041. jQuery( callbackContext ) :
  16042. jQuery.event,
  16043. // Deferreds
  16044. deferred = jQuery.Deferred(),
  16045. completeDeferred = jQuery.Callbacks( "once memory" ),
  16046. // Status-dependent callbacks
  16047. statusCode = s.statusCode || {},
  16048. // Headers (they are sent all at once)
  16049. requestHeaders = {},
  16050. requestHeadersNames = {},
  16051. // Default abort message
  16052. strAbort = "canceled",
  16053. // Fake xhr
  16054. jqXHR = {
  16055. readyState: 0,
  16056. // Builds headers hashtable if needed
  16057. getResponseHeader: function( key ) {
  16058. var match;
  16059. if ( completed ) {
  16060. if ( !responseHeaders ) {
  16061. responseHeaders = {};
  16062. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16063. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16064. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16065. .concat( match[ 2 ] );
  16066. }
  16067. }
  16068. match = responseHeaders[ key.toLowerCase() + " " ];
  16069. }
  16070. return match == null ? null : match.join( ", " );
  16071. },
  16072. // Raw string
  16073. getAllResponseHeaders: function() {
  16074. return completed ? responseHeadersString : null;
  16075. },
  16076. // Caches the header
  16077. setRequestHeader: function( name, value ) {
  16078. if ( completed == null ) {
  16079. name = requestHeadersNames[ name.toLowerCase() ] =
  16080. requestHeadersNames[ name.toLowerCase() ] || name;
  16081. requestHeaders[ name ] = value;
  16082. }
  16083. return this;
  16084. },
  16085. // Overrides response content-type header
  16086. overrideMimeType: function( type ) {
  16087. if ( completed == null ) {
  16088. s.mimeType = type;
  16089. }
  16090. return this;
  16091. },
  16092. // Status-dependent callbacks
  16093. statusCode: function( map ) {
  16094. var code;
  16095. if ( map ) {
  16096. if ( completed ) {
  16097. // Execute the appropriate callbacks
  16098. jqXHR.always( map[ jqXHR.status ] );
  16099. } else {
  16100. // Lazy-add the new callbacks in a way that preserves old ones
  16101. for ( code in map ) {
  16102. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16103. }
  16104. }
  16105. }
  16106. return this;
  16107. },
  16108. // Cancel the request
  16109. abort: function( statusText ) {
  16110. var finalText = statusText || strAbort;
  16111. if ( transport ) {
  16112. transport.abort( finalText );
  16113. }
  16114. done( 0, finalText );
  16115. return this;
  16116. }
  16117. };
  16118. // Attach deferreds
  16119. deferred.promise( jqXHR );
  16120. // Add protocol if not provided (prefilters might expect it)
  16121. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16122. // We also use the url parameter if available
  16123. s.url = ( ( url || s.url || location.href ) + "" )
  16124. .replace( rprotocol, location.protocol + "//" );
  16125. // Alias method option to type as per ticket #12004
  16126. s.type = options.method || options.type || s.method || s.type;
  16127. // Extract dataTypes list
  16128. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16129. // A cross-domain request is in order when the origin doesn't match the current origin.
  16130. if ( s.crossDomain == null ) {
  16131. urlAnchor = document.createElement( "a" );
  16132. // Support: IE <=8 - 11, Edge 12 - 15
  16133. // IE throws exception on accessing the href property if url is malformed,
  16134. // e.g. http://example.com:80x/
  16135. try {
  16136. urlAnchor.href = s.url;
  16137. // Support: IE <=8 - 11 only
  16138. // Anchor's host property isn't correctly set when s.url is relative
  16139. urlAnchor.href = urlAnchor.href;
  16140. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16141. urlAnchor.protocol + "//" + urlAnchor.host;
  16142. } catch ( e ) {
  16143. // If there is an error parsing the URL, assume it is crossDomain,
  16144. // it can be rejected by the transport if it is invalid
  16145. s.crossDomain = true;
  16146. }
  16147. }
  16148. // Convert data if not already a string
  16149. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16150. s.data = jQuery.param( s.data, s.traditional );
  16151. }
  16152. // Apply prefilters
  16153. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16154. // If request was aborted inside a prefilter, stop there
  16155. if ( completed ) {
  16156. return jqXHR;
  16157. }
  16158. // We can fire global events as of now if asked to
  16159. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16160. fireGlobals = jQuery.event && s.global;
  16161. // Watch for a new set of requests
  16162. if ( fireGlobals && jQuery.active++ === 0 ) {
  16163. jQuery.event.trigger( "ajaxStart" );
  16164. }
  16165. // Uppercase the type
  16166. s.type = s.type.toUpperCase();
  16167. // Determine if request has content
  16168. s.hasContent = !rnoContent.test( s.type );
  16169. // Save the URL in case we're toying with the If-Modified-Since
  16170. // and/or If-None-Match header later on
  16171. // Remove hash to simplify url manipulation
  16172. cacheURL = s.url.replace( rhash, "" );
  16173. // More options handling for requests with no content
  16174. if ( !s.hasContent ) {
  16175. // Remember the hash so we can put it back
  16176. uncached = s.url.slice( cacheURL.length );
  16177. // If data is available and should be processed, append data to url
  16178. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16179. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16180. // #9682: remove data so that it's not used in an eventual retry
  16181. delete s.data;
  16182. }
  16183. // Add or update anti-cache param if needed
  16184. if ( s.cache === false ) {
  16185. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16186. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16187. }
  16188. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16189. s.url = cacheURL + uncached;
  16190. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16191. } else if ( s.data && s.processData &&
  16192. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16193. s.data = s.data.replace( r20, "+" );
  16194. }
  16195. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16196. if ( s.ifModified ) {
  16197. if ( jQuery.lastModified[ cacheURL ] ) {
  16198. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16199. }
  16200. if ( jQuery.etag[ cacheURL ] ) {
  16201. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16202. }
  16203. }
  16204. // Set the correct header, if data is being sent
  16205. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16206. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16207. }
  16208. // Set the Accepts header for the server, depending on the dataType
  16209. jqXHR.setRequestHeader(
  16210. "Accept",
  16211. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16212. s.accepts[ s.dataTypes[ 0 ] ] +
  16213. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16214. s.accepts[ "*" ]
  16215. );
  16216. // Check for headers option
  16217. for ( i in s.headers ) {
  16218. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16219. }
  16220. // Allow custom headers/mimetypes and early abort
  16221. if ( s.beforeSend &&
  16222. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16223. // Abort if not done already and return
  16224. return jqXHR.abort();
  16225. }
  16226. // Aborting is no longer a cancellation
  16227. strAbort = "abort";
  16228. // Install callbacks on deferreds
  16229. completeDeferred.add( s.complete );
  16230. jqXHR.done( s.success );
  16231. jqXHR.fail( s.error );
  16232. // Get transport
  16233. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16234. // If no transport, we auto-abort
  16235. if ( !transport ) {
  16236. done( -1, "No Transport" );
  16237. } else {
  16238. jqXHR.readyState = 1;
  16239. // Send global event
  16240. if ( fireGlobals ) {
  16241. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16242. }
  16243. // If request was aborted inside ajaxSend, stop there
  16244. if ( completed ) {
  16245. return jqXHR;
  16246. }
  16247. // Timeout
  16248. if ( s.async && s.timeout > 0 ) {
  16249. timeoutTimer = window.setTimeout( function() {
  16250. jqXHR.abort( "timeout" );
  16251. }, s.timeout );
  16252. }
  16253. try {
  16254. completed = false;
  16255. transport.send( requestHeaders, done );
  16256. } catch ( e ) {
  16257. // Rethrow post-completion exceptions
  16258. if ( completed ) {
  16259. throw e;
  16260. }
  16261. // Propagate others as results
  16262. done( -1, e );
  16263. }
  16264. }
  16265. // Callback for when everything is done
  16266. function done( status, nativeStatusText, responses, headers ) {
  16267. var isSuccess, success, error, response, modified,
  16268. statusText = nativeStatusText;
  16269. // Ignore repeat invocations
  16270. if ( completed ) {
  16271. return;
  16272. }
  16273. completed = true;
  16274. // Clear timeout if it exists
  16275. if ( timeoutTimer ) {
  16276. window.clearTimeout( timeoutTimer );
  16277. }
  16278. // Dereference transport for early garbage collection
  16279. // (no matter how long the jqXHR object will be used)
  16280. transport = undefined;
  16281. // Cache response headers
  16282. responseHeadersString = headers || "";
  16283. // Set readyState
  16284. jqXHR.readyState = status > 0 ? 4 : 0;
  16285. // Determine if successful
  16286. isSuccess = status >= 200 && status < 300 || status === 304;
  16287. // Get response data
  16288. if ( responses ) {
  16289. response = ajaxHandleResponses( s, jqXHR, responses );
  16290. }
  16291. // Convert no matter what (that way responseXXX fields are always set)
  16292. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16293. // If successful, handle type chaining
  16294. if ( isSuccess ) {
  16295. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16296. if ( s.ifModified ) {
  16297. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16298. if ( modified ) {
  16299. jQuery.lastModified[ cacheURL ] = modified;
  16300. }
  16301. modified = jqXHR.getResponseHeader( "etag" );
  16302. if ( modified ) {
  16303. jQuery.etag[ cacheURL ] = modified;
  16304. }
  16305. }
  16306. // if no content
  16307. if ( status === 204 || s.type === "HEAD" ) {
  16308. statusText = "nocontent";
  16309. // if not modified
  16310. } else if ( status === 304 ) {
  16311. statusText = "notmodified";
  16312. // If we have data, let's convert it
  16313. } else {
  16314. statusText = response.state;
  16315. success = response.data;
  16316. error = response.error;
  16317. isSuccess = !error;
  16318. }
  16319. } else {
  16320. // Extract error from statusText and normalize for non-aborts
  16321. error = statusText;
  16322. if ( status || !statusText ) {
  16323. statusText = "error";
  16324. if ( status < 0 ) {
  16325. status = 0;
  16326. }
  16327. }
  16328. }
  16329. // Set data for the fake xhr object
  16330. jqXHR.status = status;
  16331. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16332. // Success/Error
  16333. if ( isSuccess ) {
  16334. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16335. } else {
  16336. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16337. }
  16338. // Status-dependent callbacks
  16339. jqXHR.statusCode( statusCode );
  16340. statusCode = undefined;
  16341. if ( fireGlobals ) {
  16342. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16343. [ jqXHR, s, isSuccess ? success : error ] );
  16344. }
  16345. // Complete
  16346. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16347. if ( fireGlobals ) {
  16348. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16349. // Handle the global AJAX counter
  16350. if ( !( --jQuery.active ) ) {
  16351. jQuery.event.trigger( "ajaxStop" );
  16352. }
  16353. }
  16354. }
  16355. return jqXHR;
  16356. },
  16357. getJSON: function( url, data, callback ) {
  16358. return jQuery.get( url, data, callback, "json" );
  16359. },
  16360. getScript: function( url, callback ) {
  16361. return jQuery.get( url, undefined, callback, "script" );
  16362. }
  16363. } );
  16364. jQuery.each( [ "get", "post" ], function( i, method ) {
  16365. jQuery[ method ] = function( url, data, callback, type ) {
  16366. // Shift arguments if data argument was omitted
  16367. if ( isFunction( data ) ) {
  16368. type = type || callback;
  16369. callback = data;
  16370. data = undefined;
  16371. }
  16372. // The url can be an options object (which then must have .url)
  16373. return jQuery.ajax( jQuery.extend( {
  16374. url: url,
  16375. type: method,
  16376. dataType: type,
  16377. data: data,
  16378. success: callback
  16379. }, jQuery.isPlainObject( url ) && url ) );
  16380. };
  16381. } );
  16382. jQuery._evalUrl = function( url, options ) {
  16383. return jQuery.ajax( {
  16384. url: url,
  16385. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16386. type: "GET",
  16387. dataType: "script",
  16388. cache: true,
  16389. async: false,
  16390. global: false,
  16391. // Only evaluate the response if it is successful (gh-4126)
  16392. // dataFilter is not invoked for failure responses, so using it instead
  16393. // of the default converter is kludgy but it works.
  16394. converters: {
  16395. "text script": function() {}
  16396. },
  16397. dataFilter: function( response ) {
  16398. jQuery.globalEval( response, options );
  16399. }
  16400. } );
  16401. };
  16402. jQuery.fn.extend( {
  16403. wrapAll: function( html ) {
  16404. var wrap;
  16405. if ( this[ 0 ] ) {
  16406. if ( isFunction( html ) ) {
  16407. html = html.call( this[ 0 ] );
  16408. }
  16409. // The elements to wrap the target around
  16410. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16411. if ( this[ 0 ].parentNode ) {
  16412. wrap.insertBefore( this[ 0 ] );
  16413. }
  16414. wrap.map( function() {
  16415. var elem = this;
  16416. while ( elem.firstElementChild ) {
  16417. elem = elem.firstElementChild;
  16418. }
  16419. return elem;
  16420. } ).append( this );
  16421. }
  16422. return this;
  16423. },
  16424. wrapInner: function( html ) {
  16425. if ( isFunction( html ) ) {
  16426. return this.each( function( i ) {
  16427. jQuery( this ).wrapInner( html.call( this, i ) );
  16428. } );
  16429. }
  16430. return this.each( function() {
  16431. var self = jQuery( this ),
  16432. contents = self.contents();
  16433. if ( contents.length ) {
  16434. contents.wrapAll( html );
  16435. } else {
  16436. self.append( html );
  16437. }
  16438. } );
  16439. },
  16440. wrap: function( html ) {
  16441. var htmlIsFunction = isFunction( html );
  16442. return this.each( function( i ) {
  16443. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16444. } );
  16445. },
  16446. unwrap: function( selector ) {
  16447. this.parent( selector ).not( "body" ).each( function() {
  16448. jQuery( this ).replaceWith( this.childNodes );
  16449. } );
  16450. return this;
  16451. }
  16452. } );
  16453. jQuery.expr.pseudos.hidden = function( elem ) {
  16454. return !jQuery.expr.pseudos.visible( elem );
  16455. };
  16456. jQuery.expr.pseudos.visible = function( elem ) {
  16457. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16458. };
  16459. jQuery.ajaxSettings.xhr = function() {
  16460. try {
  16461. return new window.XMLHttpRequest();
  16462. } catch ( e ) {}
  16463. };
  16464. var xhrSuccessStatus = {
  16465. // File protocol always yields status code 0, assume 200
  16466. 0: 200,
  16467. // Support: IE <=9 only
  16468. // #1450: sometimes IE returns 1223 when it should be 204
  16469. 1223: 204
  16470. },
  16471. xhrSupported = jQuery.ajaxSettings.xhr();
  16472. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16473. support.ajax = xhrSupported = !!xhrSupported;
  16474. jQuery.ajaxTransport( function( options ) {
  16475. var callback, errorCallback;
  16476. // Cross domain only allowed if supported through XMLHttpRequest
  16477. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16478. return {
  16479. send: function( headers, complete ) {
  16480. var i,
  16481. xhr = options.xhr();
  16482. xhr.open(
  16483. options.type,
  16484. options.url,
  16485. options.async,
  16486. options.username,
  16487. options.password
  16488. );
  16489. // Apply custom fields if provided
  16490. if ( options.xhrFields ) {
  16491. for ( i in options.xhrFields ) {
  16492. xhr[ i ] = options.xhrFields[ i ];
  16493. }
  16494. }
  16495. // Override mime type if needed
  16496. if ( options.mimeType && xhr.overrideMimeType ) {
  16497. xhr.overrideMimeType( options.mimeType );
  16498. }
  16499. // X-Requested-With header
  16500. // For cross-domain requests, seeing as conditions for a preflight are
  16501. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16502. // (it can always be set on a per-request basis or even using ajaxSetup)
  16503. // For same-domain requests, won't change header if already provided.
  16504. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16505. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16506. }
  16507. // Set headers
  16508. for ( i in headers ) {
  16509. xhr.setRequestHeader( i, headers[ i ] );
  16510. }
  16511. // Callback
  16512. callback = function( type ) {
  16513. return function() {
  16514. if ( callback ) {
  16515. callback = errorCallback = xhr.onload =
  16516. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16517. xhr.onreadystatechange = null;
  16518. if ( type === "abort" ) {
  16519. xhr.abort();
  16520. } else if ( type === "error" ) {
  16521. // Support: IE <=9 only
  16522. // On a manual native abort, IE9 throws
  16523. // errors on any property access that is not readyState
  16524. if ( typeof xhr.status !== "number" ) {
  16525. complete( 0, "error" );
  16526. } else {
  16527. complete(
  16528. // File: protocol always yields status 0; see #8605, #14207
  16529. xhr.status,
  16530. xhr.statusText
  16531. );
  16532. }
  16533. } else {
  16534. complete(
  16535. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16536. xhr.statusText,
  16537. // Support: IE <=9 only
  16538. // IE9 has no XHR2 but throws on binary (trac-11426)
  16539. // For XHR2 non-text, let the caller handle it (gh-2498)
  16540. ( xhr.responseType || "text" ) !== "text" ||
  16541. typeof xhr.responseText !== "string" ?
  16542. { binary: xhr.response } :
  16543. { text: xhr.responseText },
  16544. xhr.getAllResponseHeaders()
  16545. );
  16546. }
  16547. }
  16548. };
  16549. };
  16550. // Listen to events
  16551. xhr.onload = callback();
  16552. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16553. // Support: IE 9 only
  16554. // Use onreadystatechange to replace onabort
  16555. // to handle uncaught aborts
  16556. if ( xhr.onabort !== undefined ) {
  16557. xhr.onabort = errorCallback;
  16558. } else {
  16559. xhr.onreadystatechange = function() {
  16560. // Check readyState before timeout as it changes
  16561. if ( xhr.readyState === 4 ) {
  16562. // Allow onerror to be called first,
  16563. // but that will not handle a native abort
  16564. // Also, save errorCallback to a variable
  16565. // as xhr.onerror cannot be accessed
  16566. window.setTimeout( function() {
  16567. if ( callback ) {
  16568. errorCallback();
  16569. }
  16570. } );
  16571. }
  16572. };
  16573. }
  16574. // Create the abort callback
  16575. callback = callback( "abort" );
  16576. try {
  16577. // Do send the request (this may raise an exception)
  16578. xhr.send( options.hasContent && options.data || null );
  16579. } catch ( e ) {
  16580. // #14683: Only rethrow if this hasn't been notified as an error yet
  16581. if ( callback ) {
  16582. throw e;
  16583. }
  16584. }
  16585. },
  16586. abort: function() {
  16587. if ( callback ) {
  16588. callback();
  16589. }
  16590. }
  16591. };
  16592. }
  16593. } );
  16594. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16595. jQuery.ajaxPrefilter( function( s ) {
  16596. if ( s.crossDomain ) {
  16597. s.contents.script = false;
  16598. }
  16599. } );
  16600. // Install script dataType
  16601. jQuery.ajaxSetup( {
  16602. accepts: {
  16603. script: "text/javascript, application/javascript, " +
  16604. "application/ecmascript, application/x-ecmascript"
  16605. },
  16606. contents: {
  16607. script: /\b(?:java|ecma)script\b/
  16608. },
  16609. converters: {
  16610. "text script": function( text ) {
  16611. jQuery.globalEval( text );
  16612. return text;
  16613. }
  16614. }
  16615. } );
  16616. // Handle cache's special case and crossDomain
  16617. jQuery.ajaxPrefilter( "script", function( s ) {
  16618. if ( s.cache === undefined ) {
  16619. s.cache = false;
  16620. }
  16621. if ( s.crossDomain ) {
  16622. s.type = "GET";
  16623. }
  16624. } );
  16625. // Bind script tag hack transport
  16626. jQuery.ajaxTransport( "script", function( s ) {
  16627. // This transport only deals with cross domain or forced-by-attrs requests
  16628. if ( s.crossDomain || s.scriptAttrs ) {
  16629. var script, callback;
  16630. return {
  16631. send: function( _, complete ) {
  16632. script = jQuery( "<script>" )
  16633. .attr( s.scriptAttrs || {} )
  16634. .prop( { charset: s.scriptCharset, src: s.url } )
  16635. .on( "load error", callback = function( evt ) {
  16636. script.remove();
  16637. callback = null;
  16638. if ( evt ) {
  16639. complete( evt.type === "error" ? 404 : 200, evt.type );
  16640. }
  16641. } );
  16642. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16643. document.head.appendChild( script[ 0 ] );
  16644. },
  16645. abort: function() {
  16646. if ( callback ) {
  16647. callback();
  16648. }
  16649. }
  16650. };
  16651. }
  16652. } );
  16653. var oldCallbacks = [],
  16654. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16655. // Default jsonp settings
  16656. jQuery.ajaxSetup( {
  16657. jsonp: "callback",
  16658. jsonpCallback: function() {
  16659. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16660. this[ callback ] = true;
  16661. return callback;
  16662. }
  16663. } );
  16664. // Detect, normalize options and install callbacks for jsonp requests
  16665. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16666. var callbackName, overwritten, responseContainer,
  16667. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16668. "url" :
  16669. typeof s.data === "string" &&
  16670. ( s.contentType || "" )
  16671. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16672. rjsonp.test( s.data ) && "data"
  16673. );
  16674. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16675. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16676. // Get callback name, remembering preexisting value associated with it
  16677. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16678. s.jsonpCallback() :
  16679. s.jsonpCallback;
  16680. // Insert callback into url or form data
  16681. if ( jsonProp ) {
  16682. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16683. } else if ( s.jsonp !== false ) {
  16684. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16685. }
  16686. // Use data converter to retrieve json after script execution
  16687. s.converters[ "script json" ] = function() {
  16688. if ( !responseContainer ) {
  16689. jQuery.error( callbackName + " was not called" );
  16690. }
  16691. return responseContainer[ 0 ];
  16692. };
  16693. // Force json dataType
  16694. s.dataTypes[ 0 ] = "json";
  16695. // Install callback
  16696. overwritten = window[ callbackName ];
  16697. window[ callbackName ] = function() {
  16698. responseContainer = arguments;
  16699. };
  16700. // Clean-up function (fires after converters)
  16701. jqXHR.always( function() {
  16702. // If previous value didn't exist - remove it
  16703. if ( overwritten === undefined ) {
  16704. jQuery( window ).removeProp( callbackName );
  16705. // Otherwise restore preexisting value
  16706. } else {
  16707. window[ callbackName ] = overwritten;
  16708. }
  16709. // Save back as free
  16710. if ( s[ callbackName ] ) {
  16711. // Make sure that re-using the options doesn't screw things around
  16712. s.jsonpCallback = originalSettings.jsonpCallback;
  16713. // Save the callback name for future use
  16714. oldCallbacks.push( callbackName );
  16715. }
  16716. // Call if it was a function and we have a response
  16717. if ( responseContainer && isFunction( overwritten ) ) {
  16718. overwritten( responseContainer[ 0 ] );
  16719. }
  16720. responseContainer = overwritten = undefined;
  16721. } );
  16722. // Delegate to script
  16723. return "script";
  16724. }
  16725. } );
  16726. // Support: Safari 8 only
  16727. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16728. // collapse sibling forms: the second one becomes a child of the first one.
  16729. // Because of that, this security measure has to be disabled in Safari 8.
  16730. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16731. support.createHTMLDocument = ( function() {
  16732. var body = document.implementation.createHTMLDocument( "" ).body;
  16733. body.innerHTML = "<form></form><form></form>";
  16734. return body.childNodes.length === 2;
  16735. } )();
  16736. // Argument "data" should be string of html
  16737. // context (optional): If specified, the fragment will be created in this context,
  16738. // defaults to document
  16739. // keepScripts (optional): If true, will include scripts passed in the html string
  16740. jQuery.parseHTML = function( data, context, keepScripts ) {
  16741. if ( typeof data !== "string" ) {
  16742. return [];
  16743. }
  16744. if ( typeof context === "boolean" ) {
  16745. keepScripts = context;
  16746. context = false;
  16747. }
  16748. var base, parsed, scripts;
  16749. if ( !context ) {
  16750. // Stop scripts or inline event handlers from being executed immediately
  16751. // by using document.implementation
  16752. if ( support.createHTMLDocument ) {
  16753. context = document.implementation.createHTMLDocument( "" );
  16754. // Set the base href for the created document
  16755. // so any parsed elements with URLs
  16756. // are based on the document's URL (gh-2965)
  16757. base = context.createElement( "base" );
  16758. base.href = document.location.href;
  16759. context.head.appendChild( base );
  16760. } else {
  16761. context = document;
  16762. }
  16763. }
  16764. parsed = rsingleTag.exec( data );
  16765. scripts = !keepScripts && [];
  16766. // Single tag
  16767. if ( parsed ) {
  16768. return [ context.createElement( parsed[ 1 ] ) ];
  16769. }
  16770. parsed = buildFragment( [ data ], context, scripts );
  16771. if ( scripts && scripts.length ) {
  16772. jQuery( scripts ).remove();
  16773. }
  16774. return jQuery.merge( [], parsed.childNodes );
  16775. };
  16776. /**
  16777. * Load a url into a page
  16778. */
  16779. jQuery.fn.load = function( url, params, callback ) {
  16780. var selector, type, response,
  16781. self = this,
  16782. off = url.indexOf( " " );
  16783. if ( off > -1 ) {
  16784. selector = stripAndCollapse( url.slice( off ) );
  16785. url = url.slice( 0, off );
  16786. }
  16787. // If it's a function
  16788. if ( isFunction( params ) ) {
  16789. // We assume that it's the callback
  16790. callback = params;
  16791. params = undefined;
  16792. // Otherwise, build a param string
  16793. } else if ( params && typeof params === "object" ) {
  16794. type = "POST";
  16795. }
  16796. // If we have elements to modify, make the request
  16797. if ( self.length > 0 ) {
  16798. jQuery.ajax( {
  16799. url: url,
  16800. // If "type" variable is undefined, then "GET" method will be used.
  16801. // Make value of this field explicit since
  16802. // user can override it through ajaxSetup method
  16803. type: type || "GET",
  16804. dataType: "html",
  16805. data: params
  16806. } ).done( function( responseText ) {
  16807. // Save response for use in complete callback
  16808. response = arguments;
  16809. self.html( selector ?
  16810. // If a selector was specified, locate the right elements in a dummy div
  16811. // Exclude scripts to avoid IE 'Permission Denied' errors
  16812. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16813. // Otherwise use the full result
  16814. responseText );
  16815. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16816. // but they are ignored because response was set above.
  16817. // If it fails, this function gets "jqXHR", "status", "error"
  16818. } ).always( callback && function( jqXHR, status ) {
  16819. self.each( function() {
  16820. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16821. } );
  16822. } );
  16823. }
  16824. return this;
  16825. };
  16826. // Attach a bunch of functions for handling common AJAX events
  16827. jQuery.each( [
  16828. "ajaxStart",
  16829. "ajaxStop",
  16830. "ajaxComplete",
  16831. "ajaxError",
  16832. "ajaxSuccess",
  16833. "ajaxSend"
  16834. ], function( i, type ) {
  16835. jQuery.fn[ type ] = function( fn ) {
  16836. return this.on( type, fn );
  16837. };
  16838. } );
  16839. jQuery.expr.pseudos.animated = function( elem ) {
  16840. return jQuery.grep( jQuery.timers, function( fn ) {
  16841. return elem === fn.elem;
  16842. } ).length;
  16843. };
  16844. jQuery.offset = {
  16845. setOffset: function( elem, options, i ) {
  16846. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16847. position = jQuery.css( elem, "position" ),
  16848. curElem = jQuery( elem ),
  16849. props = {};
  16850. // Set position first, in-case top/left are set even on static elem
  16851. if ( position === "static" ) {
  16852. elem.style.position = "relative";
  16853. }
  16854. curOffset = curElem.offset();
  16855. curCSSTop = jQuery.css( elem, "top" );
  16856. curCSSLeft = jQuery.css( elem, "left" );
  16857. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16858. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16859. // Need to be able to calculate position if either
  16860. // top or left is auto and position is either absolute or fixed
  16861. if ( calculatePosition ) {
  16862. curPosition = curElem.position();
  16863. curTop = curPosition.top;
  16864. curLeft = curPosition.left;
  16865. } else {
  16866. curTop = parseFloat( curCSSTop ) || 0;
  16867. curLeft = parseFloat( curCSSLeft ) || 0;
  16868. }
  16869. if ( isFunction( options ) ) {
  16870. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16871. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16872. }
  16873. if ( options.top != null ) {
  16874. props.top = ( options.top - curOffset.top ) + curTop;
  16875. }
  16876. if ( options.left != null ) {
  16877. props.left = ( options.left - curOffset.left ) + curLeft;
  16878. }
  16879. if ( "using" in options ) {
  16880. options.using.call( elem, props );
  16881. } else {
  16882. curElem.css( props );
  16883. }
  16884. }
  16885. };
  16886. jQuery.fn.extend( {
  16887. // offset() relates an element's border box to the document origin
  16888. offset: function( options ) {
  16889. // Preserve chaining for setter
  16890. if ( arguments.length ) {
  16891. return options === undefined ?
  16892. this :
  16893. this.each( function( i ) {
  16894. jQuery.offset.setOffset( this, options, i );
  16895. } );
  16896. }
  16897. var rect, win,
  16898. elem = this[ 0 ];
  16899. if ( !elem ) {
  16900. return;
  16901. }
  16902. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16903. // Support: IE <=11 only
  16904. // Running getBoundingClientRect on a
  16905. // disconnected node in IE throws an error
  16906. if ( !elem.getClientRects().length ) {
  16907. return { top: 0, left: 0 };
  16908. }
  16909. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16910. rect = elem.getBoundingClientRect();
  16911. win = elem.ownerDocument.defaultView;
  16912. return {
  16913. top: rect.top + win.pageYOffset,
  16914. left: rect.left + win.pageXOffset
  16915. };
  16916. },
  16917. // position() relates an element's margin box to its offset parent's padding box
  16918. // This corresponds to the behavior of CSS absolute positioning
  16919. position: function() {
  16920. if ( !this[ 0 ] ) {
  16921. return;
  16922. }
  16923. var offsetParent, offset, doc,
  16924. elem = this[ 0 ],
  16925. parentOffset = { top: 0, left: 0 };
  16926. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16927. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16928. // Assume position:fixed implies availability of getBoundingClientRect
  16929. offset = elem.getBoundingClientRect();
  16930. } else {
  16931. offset = this.offset();
  16932. // Account for the *real* offset parent, which can be the document or its root element
  16933. // when a statically positioned element is identified
  16934. doc = elem.ownerDocument;
  16935. offsetParent = elem.offsetParent || doc.documentElement;
  16936. while ( offsetParent &&
  16937. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16938. jQuery.css( offsetParent, "position" ) === "static" ) {
  16939. offsetParent = offsetParent.parentNode;
  16940. }
  16941. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16942. // Incorporate borders into its offset, since they are outside its content origin
  16943. parentOffset = jQuery( offsetParent ).offset();
  16944. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16945. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16946. }
  16947. }
  16948. // Subtract parent offsets and element margins
  16949. return {
  16950. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16951. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16952. };
  16953. },
  16954. // This method will return documentElement in the following cases:
  16955. // 1) For the element inside the iframe without offsetParent, this method will return
  16956. // documentElement of the parent window
  16957. // 2) For the hidden or detached element
  16958. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16959. //
  16960. // but those exceptions were never presented as a real life use-cases
  16961. // and might be considered as more preferable results.
  16962. //
  16963. // This logic, however, is not guaranteed and can change at any point in the future
  16964. offsetParent: function() {
  16965. return this.map( function() {
  16966. var offsetParent = this.offsetParent;
  16967. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16968. offsetParent = offsetParent.offsetParent;
  16969. }
  16970. return offsetParent || documentElement;
  16971. } );
  16972. }
  16973. } );
  16974. // Create scrollLeft and scrollTop methods
  16975. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16976. var top = "pageYOffset" === prop;
  16977. jQuery.fn[ method ] = function( val ) {
  16978. return access( this, function( elem, method, val ) {
  16979. // Coalesce documents and windows
  16980. var win;
  16981. if ( isWindow( elem ) ) {
  16982. win = elem;
  16983. } else if ( elem.nodeType === 9 ) {
  16984. win = elem.defaultView;
  16985. }
  16986. if ( val === undefined ) {
  16987. return win ? win[ prop ] : elem[ method ];
  16988. }
  16989. if ( win ) {
  16990. win.scrollTo(
  16991. !top ? val : win.pageXOffset,
  16992. top ? val : win.pageYOffset
  16993. );
  16994. } else {
  16995. elem[ method ] = val;
  16996. }
  16997. }, method, val, arguments.length );
  16998. };
  16999. } );
  17000. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17001. // Add the top/left cssHooks using jQuery.fn.position
  17002. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17003. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17004. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17005. // rather than make the css module depend on the offset module, just check for it here
  17006. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17007. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17008. function( elem, computed ) {
  17009. if ( computed ) {
  17010. computed = curCSS( elem, prop );
  17011. // If curCSS returns percentage, fallback to offset
  17012. return rnumnonpx.test( computed ) ?
  17013. jQuery( elem ).position()[ prop ] + "px" :
  17014. computed;
  17015. }
  17016. }
  17017. );
  17018. } );
  17019. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17020. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17021. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17022. function( defaultExtra, funcName ) {
  17023. // Margin is only for outerHeight, outerWidth
  17024. jQuery.fn[ funcName ] = function( margin, value ) {
  17025. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17026. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17027. return access( this, function( elem, type, value ) {
  17028. var doc;
  17029. if ( isWindow( elem ) ) {
  17030. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17031. return funcName.indexOf( "outer" ) === 0 ?
  17032. elem[ "inner" + name ] :
  17033. elem.document.documentElement[ "client" + name ];
  17034. }
  17035. // Get document width or height
  17036. if ( elem.nodeType === 9 ) {
  17037. doc = elem.documentElement;
  17038. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17039. // whichever is greatest
  17040. return Math.max(
  17041. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17042. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17043. doc[ "client" + name ]
  17044. );
  17045. }
  17046. return value === undefined ?
  17047. // Get width or height on the element, requesting but not forcing parseFloat
  17048. jQuery.css( elem, type, extra ) :
  17049. // Set width or height on the element
  17050. jQuery.style( elem, type, value, extra );
  17051. }, type, chainable ? margin : undefined, chainable );
  17052. };
  17053. } );
  17054. } );
  17055. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17056. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17057. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17058. function( i, name ) {
  17059. // Handle event binding
  17060. jQuery.fn[ name ] = function( data, fn ) {
  17061. return arguments.length > 0 ?
  17062. this.on( name, null, data, fn ) :
  17063. this.trigger( name );
  17064. };
  17065. } );
  17066. jQuery.fn.extend( {
  17067. hover: function( fnOver, fnOut ) {
  17068. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17069. }
  17070. } );
  17071. jQuery.fn.extend( {
  17072. bind: function( types, data, fn ) {
  17073. return this.on( types, null, data, fn );
  17074. },
  17075. unbind: function( types, fn ) {
  17076. return this.off( types, null, fn );
  17077. },
  17078. delegate: function( selector, types, data, fn ) {
  17079. return this.on( types, selector, data, fn );
  17080. },
  17081. undelegate: function( selector, types, fn ) {
  17082. // ( namespace ) or ( selector, types [, fn] )
  17083. return arguments.length === 1 ?
  17084. this.off( selector, "**" ) :
  17085. this.off( types, selector || "**", fn );
  17086. }
  17087. } );
  17088. // Bind a function to a context, optionally partially applying any
  17089. // arguments.
  17090. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17091. // However, it is not slated for removal any time soon
  17092. jQuery.proxy = function( fn, context ) {
  17093. var tmp, args, proxy;
  17094. if ( typeof context === "string" ) {
  17095. tmp = fn[ context ];
  17096. context = fn;
  17097. fn = tmp;
  17098. }
  17099. // Quick check to determine if target is callable, in the spec
  17100. // this throws a TypeError, but we will just return undefined.
  17101. if ( !isFunction( fn ) ) {
  17102. return undefined;
  17103. }
  17104. // Simulated bind
  17105. args = slice.call( arguments, 2 );
  17106. proxy = function() {
  17107. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17108. };
  17109. // Set the guid of unique handler to the same of original handler, so it can be removed
  17110. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17111. return proxy;
  17112. };
  17113. jQuery.holdReady = function( hold ) {
  17114. if ( hold ) {
  17115. jQuery.readyWait++;
  17116. } else {
  17117. jQuery.ready( true );
  17118. }
  17119. };
  17120. jQuery.isArray = Array.isArray;
  17121. jQuery.parseJSON = JSON.parse;
  17122. jQuery.nodeName = nodeName;
  17123. jQuery.isFunction = isFunction;
  17124. jQuery.isWindow = isWindow;
  17125. jQuery.camelCase = camelCase;
  17126. jQuery.type = toType;
  17127. jQuery.now = Date.now;
  17128. jQuery.isNumeric = function( obj ) {
  17129. // As of jQuery 3.0, isNumeric is limited to
  17130. // strings and numbers (primitives or objects)
  17131. // that can be coerced to finite numbers (gh-2662)
  17132. var type = jQuery.type( obj );
  17133. return ( type === "number" || type === "string" ) &&
  17134. // parseFloat NaNs numeric-cast false positives ("")
  17135. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17136. // subtraction forces infinities to NaN
  17137. !isNaN( obj - parseFloat( obj ) );
  17138. };
  17139. // Register as a named AMD module, since jQuery can be concatenated with other
  17140. // files that may use define, but not via a proper concatenation script that
  17141. // understands anonymous AMD modules. A named AMD is safest and most robust
  17142. // way to register. Lowercase jquery is used because AMD module names are
  17143. // derived from file names, and jQuery is normally delivered in a lowercase
  17144. // file name. Do this after creating the global so that if an AMD module wants
  17145. // to call noConflict to hide this version of jQuery, it will work.
  17146. // Note that for maximum portability, libraries that are not jQuery should
  17147. // declare themselves as anonymous modules, and avoid setting a global if an
  17148. // AMD loader is present. jQuery is a special case. For more information, see
  17149. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17150. if ( true ) {
  17151. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17152. return jQuery;
  17153. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17154. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17155. }
  17156. var
  17157. // Map over jQuery in case of overwrite
  17158. _jQuery = window.jQuery,
  17159. // Map over the $ in case of overwrite
  17160. _$ = window.$;
  17161. jQuery.noConflict = function( deep ) {
  17162. if ( window.$ === jQuery ) {
  17163. window.$ = _$;
  17164. }
  17165. if ( deep && window.jQuery === jQuery ) {
  17166. window.jQuery = _jQuery;
  17167. }
  17168. return jQuery;
  17169. };
  17170. // Expose jQuery and $ identifiers, even in AMD
  17171. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17172. // and CommonJS for browser emulators (#13566)
  17173. if ( !noGlobal ) {
  17174. window.jQuery = window.$ = jQuery;
  17175. }
  17176. return jQuery;
  17177. } );
  17178. /***/ }),
  17179. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17180. /*!************************************************!*\
  17181. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17182. \************************************************/
  17183. /*! exports provided: default */
  17184. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17185. "use strict";
  17186. __webpack_require__.r(__webpack_exports__);
  17187. var classCallCheck = function (instance, Constructor) {
  17188. if (!(instance instanceof Constructor)) {
  17189. throw new TypeError("Cannot call a class as a function");
  17190. }
  17191. };
  17192. var createClass = function () {
  17193. function defineProperties(target, props) {
  17194. for (var i = 0; i < props.length; i++) {
  17195. var descriptor = props[i];
  17196. descriptor.enumerable = descriptor.enumerable || false;
  17197. descriptor.configurable = true;
  17198. if ("value" in descriptor) descriptor.writable = true;
  17199. Object.defineProperty(target, descriptor.key, descriptor);
  17200. }
  17201. }
  17202. return function (Constructor, protoProps, staticProps) {
  17203. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17204. if (staticProps) defineProperties(Constructor, staticProps);
  17205. return Constructor;
  17206. };
  17207. }();
  17208. var _extends = Object.assign || function (target) {
  17209. for (var i = 1; i < arguments.length; i++) {
  17210. var source = arguments[i];
  17211. for (var key in source) {
  17212. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17213. target[key] = source[key];
  17214. }
  17215. }
  17216. }
  17217. return target;
  17218. };
  17219. var inherits = function (subClass, superClass) {
  17220. if (typeof superClass !== "function" && superClass !== null) {
  17221. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17222. }
  17223. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17224. constructor: {
  17225. value: subClass,
  17226. enumerable: false,
  17227. writable: true,
  17228. configurable: true
  17229. }
  17230. });
  17231. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17232. };
  17233. var possibleConstructorReturn = function (self, call) {
  17234. if (!self) {
  17235. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17236. }
  17237. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17238. };
  17239. var Connector = function () {
  17240. /**
  17241. * Create a new class instance.
  17242. */
  17243. function Connector(options) {
  17244. classCallCheck(this, Connector);
  17245. /**
  17246. * Default connector options.
  17247. */
  17248. this._defaultOptions = {
  17249. auth: {
  17250. headers: {}
  17251. },
  17252. authEndpoint: '/broadcasting/auth',
  17253. broadcaster: 'pusher',
  17254. csrfToken: null,
  17255. host: null,
  17256. key: null,
  17257. namespace: 'App.Events'
  17258. };
  17259. this.setOptions(options);
  17260. this.connect();
  17261. }
  17262. /**
  17263. * Merge the custom options with the defaults.
  17264. */
  17265. createClass(Connector, [{
  17266. key: 'setOptions',
  17267. value: function setOptions(options) {
  17268. this.options = _extends(this._defaultOptions, options);
  17269. if (this.csrfToken()) {
  17270. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17271. }
  17272. return options;
  17273. }
  17274. /**
  17275. * Extract the CSRF token from the page.
  17276. */
  17277. }, {
  17278. key: 'csrfToken',
  17279. value: function csrfToken() {
  17280. var selector = void 0;
  17281. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17282. return window['Laravel'].csrfToken;
  17283. } else if (this.options.csrfToken) {
  17284. return this.options.csrfToken;
  17285. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17286. return selector.getAttribute('content');
  17287. }
  17288. return null;
  17289. }
  17290. }]);
  17291. return Connector;
  17292. }();
  17293. /**
  17294. * This class represents a basic channel.
  17295. */
  17296. var Channel = function () {
  17297. function Channel() {
  17298. classCallCheck(this, Channel);
  17299. }
  17300. createClass(Channel, [{
  17301. key: 'listenForWhisper',
  17302. /**
  17303. * Listen for a whisper event on the channel instance.
  17304. */
  17305. value: function listenForWhisper(event, callback) {
  17306. return this.listen('.client-' + event, callback);
  17307. }
  17308. /**
  17309. * Listen for an event on the channel instance.
  17310. */
  17311. }, {
  17312. key: 'notification',
  17313. value: function notification(callback) {
  17314. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17315. }
  17316. /**
  17317. * Stop listening for a whispser event on the channel instance.
  17318. */
  17319. }, {
  17320. key: 'stopListeningForWhisper',
  17321. value: function stopListeningForWhisper(event) {
  17322. return this.stopListening('.client-' + event);
  17323. }
  17324. }]);
  17325. return Channel;
  17326. }();
  17327. /**
  17328. * Event name formatter
  17329. */
  17330. var EventFormatter = function () {
  17331. /**
  17332. * Create a new class instance.
  17333. */
  17334. function EventFormatter(namespace) {
  17335. classCallCheck(this, EventFormatter);
  17336. this.setNamespace(namespace);
  17337. }
  17338. /**
  17339. * Format the given event name.
  17340. */
  17341. createClass(EventFormatter, [{
  17342. key: 'format',
  17343. value: function format(event) {
  17344. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17345. return event.substr(1);
  17346. } else if (this.namespace) {
  17347. event = this.namespace + '.' + event;
  17348. }
  17349. return event.replace(/\./g, '\\');
  17350. }
  17351. /**
  17352. * Set the event namespace.
  17353. */
  17354. }, {
  17355. key: 'setNamespace',
  17356. value: function setNamespace(value) {
  17357. this.namespace = value;
  17358. }
  17359. }]);
  17360. return EventFormatter;
  17361. }();
  17362. /**
  17363. * This class represents a Pusher channel.
  17364. */
  17365. var PusherChannel = function (_Channel) {
  17366. inherits(PusherChannel, _Channel);
  17367. /**
  17368. * Create a new class instance.
  17369. */
  17370. function PusherChannel(pusher, name, options) {
  17371. classCallCheck(this, PusherChannel);
  17372. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17373. _this.name = name;
  17374. _this.pusher = pusher;
  17375. _this.options = options;
  17376. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17377. _this.subscribe();
  17378. return _this;
  17379. }
  17380. /**
  17381. * Subscribe to a Pusher channel.
  17382. */
  17383. createClass(PusherChannel, [{
  17384. key: 'subscribe',
  17385. value: function subscribe() {
  17386. this.subscription = this.pusher.subscribe(this.name);
  17387. }
  17388. /**
  17389. * Unsubscribe from a Pusher channel.
  17390. */
  17391. }, {
  17392. key: 'unsubscribe',
  17393. value: function unsubscribe() {
  17394. this.pusher.unsubscribe(this.name);
  17395. }
  17396. /**
  17397. * Listen for an event on the channel instance.
  17398. */
  17399. }, {
  17400. key: 'listen',
  17401. value: function listen(event, callback) {
  17402. this.on(this.eventFormatter.format(event), callback);
  17403. return this;
  17404. }
  17405. /**
  17406. * Stop listening for an event on the channel instance.
  17407. */
  17408. }, {
  17409. key: 'stopListening',
  17410. value: function stopListening(event) {
  17411. this.subscription.unbind(this.eventFormatter.format(event));
  17412. return this;
  17413. }
  17414. /**
  17415. * Bind a channel to an event.
  17416. */
  17417. }, {
  17418. key: 'on',
  17419. value: function on(event, callback) {
  17420. this.subscription.bind(event, callback);
  17421. return this;
  17422. }
  17423. }]);
  17424. return PusherChannel;
  17425. }(Channel);
  17426. /**
  17427. * This class represents a Pusher private channel.
  17428. */
  17429. var PusherPrivateChannel = function (_PusherChannel) {
  17430. inherits(PusherPrivateChannel, _PusherChannel);
  17431. function PusherPrivateChannel() {
  17432. classCallCheck(this, PusherPrivateChannel);
  17433. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17434. }
  17435. createClass(PusherPrivateChannel, [{
  17436. key: 'whisper',
  17437. /**
  17438. * Trigger client event on the channel.
  17439. */
  17440. value: function whisper(eventName, data) {
  17441. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17442. return this;
  17443. }
  17444. }]);
  17445. return PusherPrivateChannel;
  17446. }(PusherChannel);
  17447. /**
  17448. * This class represents a Pusher presence channel.
  17449. */
  17450. var PusherPresenceChannel = function (_PusherChannel) {
  17451. inherits(PusherPresenceChannel, _PusherChannel);
  17452. function PusherPresenceChannel() {
  17453. classCallCheck(this, PusherPresenceChannel);
  17454. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17455. }
  17456. createClass(PusherPresenceChannel, [{
  17457. key: 'here',
  17458. /**
  17459. * Register a callback to be called anytime the member list changes.
  17460. */
  17461. value: function here(callback) {
  17462. this.on('pusher:subscription_succeeded', function (data) {
  17463. callback(Object.keys(data.members).map(function (k) {
  17464. return data.members[k];
  17465. }));
  17466. });
  17467. return this;
  17468. }
  17469. /**
  17470. * Listen for someone joining the channel.
  17471. */
  17472. }, {
  17473. key: 'joining',
  17474. value: function joining(callback) {
  17475. this.on('pusher:member_added', function (member) {
  17476. callback(member.info);
  17477. });
  17478. return this;
  17479. }
  17480. /**
  17481. * Listen for someone leaving the channel.
  17482. */
  17483. }, {
  17484. key: 'leaving',
  17485. value: function leaving(callback) {
  17486. this.on('pusher:member_removed', function (member) {
  17487. callback(member.info);
  17488. });
  17489. return this;
  17490. }
  17491. /**
  17492. * Trigger client event on the channel.
  17493. */
  17494. }, {
  17495. key: 'whisper',
  17496. value: function whisper(eventName, data) {
  17497. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17498. return this;
  17499. }
  17500. }]);
  17501. return PusherPresenceChannel;
  17502. }(PusherChannel);
  17503. /**
  17504. * This class represents a Socket.io channel.
  17505. */
  17506. var SocketIoChannel = function (_Channel) {
  17507. inherits(SocketIoChannel, _Channel);
  17508. /**
  17509. * Create a new class instance.
  17510. */
  17511. function SocketIoChannel(socket, name, options) {
  17512. classCallCheck(this, SocketIoChannel);
  17513. /**
  17514. * The event callbacks applied to the channel.
  17515. */
  17516. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17517. _this.events = {};
  17518. _this.name = name;
  17519. _this.socket = socket;
  17520. _this.options = options;
  17521. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17522. _this.subscribe();
  17523. _this.configureReconnector();
  17524. return _this;
  17525. }
  17526. /**
  17527. * Subscribe to a Socket.io channel.
  17528. */
  17529. createClass(SocketIoChannel, [{
  17530. key: 'subscribe',
  17531. value: function subscribe() {
  17532. this.socket.emit('subscribe', {
  17533. channel: this.name,
  17534. auth: this.options.auth || {}
  17535. });
  17536. }
  17537. /**
  17538. * Unsubscribe from channel and ubind event callbacks.
  17539. */
  17540. }, {
  17541. key: 'unsubscribe',
  17542. value: function unsubscribe() {
  17543. this.unbind();
  17544. this.socket.emit('unsubscribe', {
  17545. channel: this.name,
  17546. auth: this.options.auth || {}
  17547. });
  17548. }
  17549. /**
  17550. * Listen for an event on the channel instance.
  17551. */
  17552. }, {
  17553. key: 'listen',
  17554. value: function listen(event, callback) {
  17555. this.on(this.eventFormatter.format(event), callback);
  17556. return this;
  17557. }
  17558. /**
  17559. * Stop listening for an event on the channel instance.
  17560. */
  17561. }, {
  17562. key: 'stopListening',
  17563. value: function stopListening(event) {
  17564. var name = this.eventFormatter.format(event);
  17565. this.socket.removeListener(name);
  17566. delete this.events[name];
  17567. return this;
  17568. }
  17569. /**
  17570. * Bind the channel's socket to an event and store the callback.
  17571. */
  17572. }, {
  17573. key: 'on',
  17574. value: function on(event, callback) {
  17575. var _this2 = this;
  17576. var listener = function listener(channel, data) {
  17577. if (_this2.name == channel) {
  17578. callback(data);
  17579. }
  17580. };
  17581. this.socket.on(event, listener);
  17582. this.bind(event, listener);
  17583. }
  17584. /**
  17585. * Attach a 'reconnect' listener and bind the event.
  17586. */
  17587. }, {
  17588. key: 'configureReconnector',
  17589. value: function configureReconnector() {
  17590. var _this3 = this;
  17591. var listener = function listener() {
  17592. _this3.subscribe();
  17593. };
  17594. this.socket.on('reconnect', listener);
  17595. this.bind('reconnect', listener);
  17596. }
  17597. /**
  17598. * Bind the channel's socket to an event and store the callback.
  17599. */
  17600. }, {
  17601. key: 'bind',
  17602. value: function bind(event, callback) {
  17603. this.events[event] = this.events[event] || [];
  17604. this.events[event].push(callback);
  17605. }
  17606. /**
  17607. * Unbind the channel's socket from all stored event callbacks.
  17608. */
  17609. }, {
  17610. key: 'unbind',
  17611. value: function unbind() {
  17612. var _this4 = this;
  17613. Object.keys(this.events).forEach(function (event) {
  17614. _this4.events[event].forEach(function (callback) {
  17615. _this4.socket.removeListener(event, callback);
  17616. });
  17617. delete _this4.events[event];
  17618. });
  17619. }
  17620. }]);
  17621. return SocketIoChannel;
  17622. }(Channel);
  17623. /**
  17624. * This class represents a Socket.io presence channel.
  17625. */
  17626. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17627. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17628. function SocketIoPrivateChannel() {
  17629. classCallCheck(this, SocketIoPrivateChannel);
  17630. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17631. }
  17632. createClass(SocketIoPrivateChannel, [{
  17633. key: 'whisper',
  17634. /**
  17635. * Trigger client event on the channel.
  17636. */
  17637. value: function whisper(eventName, data) {
  17638. this.socket.emit('client event', {
  17639. channel: this.name,
  17640. event: 'client-' + eventName,
  17641. data: data
  17642. });
  17643. return this;
  17644. }
  17645. }]);
  17646. return SocketIoPrivateChannel;
  17647. }(SocketIoChannel);
  17648. /**
  17649. * This class represents a Socket.io presence channel.
  17650. */
  17651. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17652. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17653. function SocketIoPresenceChannel() {
  17654. classCallCheck(this, SocketIoPresenceChannel);
  17655. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17656. }
  17657. createClass(SocketIoPresenceChannel, [{
  17658. key: 'here',
  17659. /**
  17660. * Register a callback to be called anytime the member list changes.
  17661. */
  17662. value: function here(callback) {
  17663. this.on('presence:subscribed', function (members) {
  17664. callback(members.map(function (m) {
  17665. return m.user_info;
  17666. }));
  17667. });
  17668. return this;
  17669. }
  17670. /**
  17671. * Listen for someone joining the channel.
  17672. */
  17673. }, {
  17674. key: 'joining',
  17675. value: function joining(callback) {
  17676. this.on('presence:joining', function (member) {
  17677. return callback(member.user_info);
  17678. });
  17679. return this;
  17680. }
  17681. /**
  17682. * Listen for someone leaving the channel.
  17683. */
  17684. }, {
  17685. key: 'leaving',
  17686. value: function leaving(callback) {
  17687. this.on('presence:leaving', function (member) {
  17688. return callback(member.user_info);
  17689. });
  17690. return this;
  17691. }
  17692. }]);
  17693. return SocketIoPresenceChannel;
  17694. }(SocketIoPrivateChannel);
  17695. /**
  17696. * This class represents a null channel.
  17697. */
  17698. var NullChannel = function (_Channel) {
  17699. inherits(NullChannel, _Channel);
  17700. function NullChannel() {
  17701. classCallCheck(this, NullChannel);
  17702. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17703. }
  17704. createClass(NullChannel, [{
  17705. key: 'subscribe',
  17706. /**
  17707. * Subscribe to a channel.
  17708. */
  17709. value: function subscribe() {}
  17710. //
  17711. /**
  17712. * Unsubscribe from a channel.
  17713. */
  17714. }, {
  17715. key: 'unsubscribe',
  17716. value: function unsubscribe() {}
  17717. //
  17718. /**
  17719. * Listen for an event on the channel instance.
  17720. */
  17721. }, {
  17722. key: 'listen',
  17723. value: function listen(event, callback) {
  17724. return this;
  17725. }
  17726. /**
  17727. * Stop listening for an event on the channel instance.
  17728. */
  17729. }, {
  17730. key: 'stopListening',
  17731. value: function stopListening(event) {
  17732. return this;
  17733. }
  17734. /**
  17735. * Bind a channel to an event.
  17736. */
  17737. }, {
  17738. key: 'on',
  17739. value: function on(event, callback) {
  17740. return this;
  17741. }
  17742. }]);
  17743. return NullChannel;
  17744. }(Channel);
  17745. /**
  17746. * This class represents a null private channel.
  17747. */
  17748. var NullPrivateChannel = function (_NullChannel) {
  17749. inherits(NullPrivateChannel, _NullChannel);
  17750. function NullPrivateChannel() {
  17751. classCallCheck(this, NullPrivateChannel);
  17752. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17753. }
  17754. createClass(NullPrivateChannel, [{
  17755. key: 'whisper',
  17756. /**
  17757. * Trigger client event on the channel.
  17758. */
  17759. value: function whisper(eventName, data) {
  17760. return this;
  17761. }
  17762. }]);
  17763. return NullPrivateChannel;
  17764. }(NullChannel);
  17765. /**
  17766. * This class represents a null presence channel.
  17767. */
  17768. var NullPresenceChannel = function (_NullChannel) {
  17769. inherits(NullPresenceChannel, _NullChannel);
  17770. function NullPresenceChannel() {
  17771. classCallCheck(this, NullPresenceChannel);
  17772. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17773. }
  17774. createClass(NullPresenceChannel, [{
  17775. key: 'here',
  17776. /**
  17777. * Register a callback to be called anytime the member list changes.
  17778. */
  17779. value: function here(callback) {
  17780. return this;
  17781. }
  17782. /**
  17783. * Listen for someone joining the channel.
  17784. */
  17785. }, {
  17786. key: 'joining',
  17787. value: function joining(callback) {
  17788. return this;
  17789. }
  17790. /**
  17791. * Listen for someone leaving the channel.
  17792. */
  17793. }, {
  17794. key: 'leaving',
  17795. value: function leaving(callback) {
  17796. return this;
  17797. }
  17798. /**
  17799. * Trigger client event on the channel.
  17800. */
  17801. }, {
  17802. key: 'whisper',
  17803. value: function whisper(eventName, data) {
  17804. return this;
  17805. }
  17806. }]);
  17807. return NullPresenceChannel;
  17808. }(NullChannel);
  17809. /**
  17810. * This class creates a connector to Pusher.
  17811. */
  17812. var PusherConnector = function (_Connector) {
  17813. inherits(PusherConnector, _Connector);
  17814. function PusherConnector() {
  17815. classCallCheck(this, PusherConnector);
  17816. /**
  17817. * All of the subscribed channel names.
  17818. */
  17819. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17820. _this.channels = {};
  17821. return _this;
  17822. }
  17823. /**
  17824. * Create a fresh Pusher connection.
  17825. */
  17826. createClass(PusherConnector, [{
  17827. key: 'connect',
  17828. value: function connect() {
  17829. if (typeof this.options.client !== 'undefined') {
  17830. this.pusher = this.options.client;
  17831. } else {
  17832. this.pusher = new Pusher(this.options.key, this.options);
  17833. }
  17834. }
  17835. /**
  17836. * Listen for an event on a channel instance.
  17837. */
  17838. }, {
  17839. key: 'listen',
  17840. value: function listen(name, event, callback) {
  17841. return this.channel(name).listen(event, callback);
  17842. }
  17843. /**
  17844. * Get a channel instance by name.
  17845. */
  17846. }, {
  17847. key: 'channel',
  17848. value: function channel(name) {
  17849. if (!this.channels[name]) {
  17850. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17851. }
  17852. return this.channels[name];
  17853. }
  17854. /**
  17855. * Get a private channel instance by name.
  17856. */
  17857. }, {
  17858. key: 'privateChannel',
  17859. value: function privateChannel(name) {
  17860. if (!this.channels['private-' + name]) {
  17861. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17862. }
  17863. return this.channels['private-' + name];
  17864. }
  17865. /**
  17866. * Get a presence channel instance by name.
  17867. */
  17868. }, {
  17869. key: 'presenceChannel',
  17870. value: function presenceChannel(name) {
  17871. if (!this.channels['presence-' + name]) {
  17872. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17873. }
  17874. return this.channels['presence-' + name];
  17875. }
  17876. /**
  17877. * Leave the given channel, as well as its private and presence variants.
  17878. */
  17879. }, {
  17880. key: 'leave',
  17881. value: function leave(name) {
  17882. var _this2 = this;
  17883. var channels = [name, 'private-' + name, 'presence-' + name];
  17884. channels.forEach(function (name, index) {
  17885. _this2.leaveChannel(name);
  17886. });
  17887. }
  17888. /**
  17889. * Leave the given channel.
  17890. */
  17891. }, {
  17892. key: 'leaveChannel',
  17893. value: function leaveChannel(name) {
  17894. if (this.channels[name]) {
  17895. this.channels[name].unsubscribe();
  17896. delete this.channels[name];
  17897. }
  17898. }
  17899. /**
  17900. * Get the socket ID for the connection.
  17901. */
  17902. }, {
  17903. key: 'socketId',
  17904. value: function socketId() {
  17905. return this.pusher.connection.socket_id;
  17906. }
  17907. /**
  17908. * Disconnect Pusher connection.
  17909. */
  17910. }, {
  17911. key: 'disconnect',
  17912. value: function disconnect() {
  17913. this.pusher.disconnect();
  17914. }
  17915. }]);
  17916. return PusherConnector;
  17917. }(Connector);
  17918. /**
  17919. * This class creates a connnector to a Socket.io server.
  17920. */
  17921. var SocketIoConnector = function (_Connector) {
  17922. inherits(SocketIoConnector, _Connector);
  17923. function SocketIoConnector() {
  17924. classCallCheck(this, SocketIoConnector);
  17925. /**
  17926. * All of the subscribed channel names.
  17927. */
  17928. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17929. _this.channels = {};
  17930. return _this;
  17931. }
  17932. /**
  17933. * Create a fresh Socket.io connection.
  17934. */
  17935. createClass(SocketIoConnector, [{
  17936. key: 'connect',
  17937. value: function connect() {
  17938. var io = this.getSocketIO();
  17939. this.socket = io(this.options.host, this.options);
  17940. return this.socket;
  17941. }
  17942. /**
  17943. * Get socket.io module from global scope or options.
  17944. */
  17945. }, {
  17946. key: 'getSocketIO',
  17947. value: function getSocketIO() {
  17948. if (typeof this.options.client !== 'undefined') {
  17949. return this.options.client;
  17950. }
  17951. if (typeof io !== 'undefined') {
  17952. return io;
  17953. }
  17954. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17955. }
  17956. /**
  17957. * Listen for an event on a channel instance.
  17958. */
  17959. }, {
  17960. key: 'listen',
  17961. value: function listen(name, event, callback) {
  17962. return this.channel(name).listen(event, callback);
  17963. }
  17964. /**
  17965. * Get a channel instance by name.
  17966. */
  17967. }, {
  17968. key: 'channel',
  17969. value: function channel(name) {
  17970. if (!this.channels[name]) {
  17971. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17972. }
  17973. return this.channels[name];
  17974. }
  17975. /**
  17976. * Get a private channel instance by name.
  17977. */
  17978. }, {
  17979. key: 'privateChannel',
  17980. value: function privateChannel(name) {
  17981. if (!this.channels['private-' + name]) {
  17982. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17983. }
  17984. return this.channels['private-' + name];
  17985. }
  17986. /**
  17987. * Get a presence channel instance by name.
  17988. */
  17989. }, {
  17990. key: 'presenceChannel',
  17991. value: function presenceChannel(name) {
  17992. if (!this.channels['presence-' + name]) {
  17993. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17994. }
  17995. return this.channels['presence-' + name];
  17996. }
  17997. /**
  17998. * Leave the given channel, as well as its private and presence variants.
  17999. */
  18000. }, {
  18001. key: 'leave',
  18002. value: function leave(name) {
  18003. var _this2 = this;
  18004. var channels = [name, 'private-' + name, 'presence-' + name];
  18005. channels.forEach(function (name) {
  18006. _this2.leaveChannel(name);
  18007. });
  18008. }
  18009. /**
  18010. * Leave the given channel.
  18011. */
  18012. }, {
  18013. key: 'leaveChannel',
  18014. value: function leaveChannel(name) {
  18015. if (this.channels[name]) {
  18016. this.channels[name].unsubscribe();
  18017. delete this.channels[name];
  18018. }
  18019. }
  18020. /**
  18021. * Get the socket ID for the connection.
  18022. */
  18023. }, {
  18024. key: 'socketId',
  18025. value: function socketId() {
  18026. return this.socket.id;
  18027. }
  18028. /**
  18029. * Disconnect Socketio connection.
  18030. */
  18031. }, {
  18032. key: 'disconnect',
  18033. value: function disconnect() {
  18034. this.socket.disconnect();
  18035. }
  18036. }]);
  18037. return SocketIoConnector;
  18038. }(Connector);
  18039. /**
  18040. * This class creates a null connector.
  18041. */
  18042. var NullConnector = function (_Connector) {
  18043. inherits(NullConnector, _Connector);
  18044. function NullConnector() {
  18045. classCallCheck(this, NullConnector);
  18046. /**
  18047. * All of the subscribed channel names.
  18048. */
  18049. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18050. _this.channels = {};
  18051. return _this;
  18052. }
  18053. /**
  18054. * Create a fresh connection.
  18055. */
  18056. createClass(NullConnector, [{
  18057. key: 'connect',
  18058. value: function connect() {}
  18059. //
  18060. /**
  18061. * Listen for an event on a channel instance.
  18062. */
  18063. }, {
  18064. key: 'listen',
  18065. value: function listen(name, event, callback) {
  18066. return new NullChannel();
  18067. }
  18068. /**
  18069. * Get a channel instance by name.
  18070. */
  18071. }, {
  18072. key: 'channel',
  18073. value: function channel(name) {
  18074. return new NullChannel();
  18075. }
  18076. /**
  18077. * Get a private channel instance by name.
  18078. */
  18079. }, {
  18080. key: 'privateChannel',
  18081. value: function privateChannel(name) {
  18082. return new NullPrivateChannel();
  18083. }
  18084. /**
  18085. * Get a presence channel instance by name.
  18086. */
  18087. }, {
  18088. key: 'presenceChannel',
  18089. value: function presenceChannel(name) {
  18090. return new NullPresenceChannel();
  18091. }
  18092. /**
  18093. * Leave the given channel, as well as its private and presence variants.
  18094. */
  18095. }, {
  18096. key: 'leave',
  18097. value: function leave(name) {}
  18098. //
  18099. /**
  18100. * Leave the given channel.
  18101. */
  18102. }, {
  18103. key: 'leaveChannel',
  18104. value: function leaveChannel(name) {}
  18105. //
  18106. /**
  18107. * Get the socket ID for the connection.
  18108. */
  18109. }, {
  18110. key: 'socketId',
  18111. value: function socketId() {
  18112. return 'fake-socket-id';
  18113. }
  18114. /**
  18115. * Disconnect the connection.
  18116. */
  18117. }, {
  18118. key: 'disconnect',
  18119. value: function disconnect() {
  18120. //
  18121. }
  18122. }]);
  18123. return NullConnector;
  18124. }(Connector);
  18125. /**
  18126. * This class is the primary API for interacting with broadcasting.
  18127. */
  18128. var Echo = function () {
  18129. /**
  18130. * Create a new class instance.
  18131. */
  18132. function Echo(options) {
  18133. classCallCheck(this, Echo);
  18134. this.options = options;
  18135. this.connect();
  18136. if (!this.options.withoutInterceptors) {
  18137. this.registerInterceptors();
  18138. }
  18139. }
  18140. /**
  18141. * Get a channel instance by name.
  18142. */
  18143. createClass(Echo, [{
  18144. key: 'channel',
  18145. value: function channel(_channel) {
  18146. return this.connector.channel(_channel);
  18147. }
  18148. /**
  18149. * Create a new connection.
  18150. */
  18151. }, {
  18152. key: 'connect',
  18153. value: function connect() {
  18154. if (this.options.broadcaster == 'pusher') {
  18155. this.connector = new PusherConnector(this.options);
  18156. } else if (this.options.broadcaster == 'socket.io') {
  18157. this.connector = new SocketIoConnector(this.options);
  18158. } else if (this.options.broadcaster == 'null') {
  18159. this.connector = new NullConnector(this.options);
  18160. } else if (typeof this.options.broadcaster == 'function') {
  18161. this.connector = new this.options.broadcaster(this.options);
  18162. }
  18163. }
  18164. /**
  18165. * Disconnect from the Echo server.
  18166. */
  18167. }, {
  18168. key: 'disconnect',
  18169. value: function disconnect() {
  18170. this.connector.disconnect();
  18171. }
  18172. /**
  18173. * Get a presence channel instance by name.
  18174. */
  18175. }, {
  18176. key: 'join',
  18177. value: function join(channel) {
  18178. return this.connector.presenceChannel(channel);
  18179. }
  18180. /**
  18181. * Leave the given channel, as well as its private and presence variants.
  18182. */
  18183. }, {
  18184. key: 'leave',
  18185. value: function leave(channel) {
  18186. this.connector.leave(channel);
  18187. }
  18188. /**
  18189. * Leave the given channel.
  18190. */
  18191. }, {
  18192. key: 'leaveChannel',
  18193. value: function leaveChannel(channel) {
  18194. this.connector.leaveChannel(channel);
  18195. }
  18196. /**
  18197. * Listen for an event on a channel instance.
  18198. */
  18199. }, {
  18200. key: 'listen',
  18201. value: function listen(channel, event, callback) {
  18202. return this.connector.listen(channel, event, callback);
  18203. }
  18204. /**
  18205. * Get a private channel instance by name.
  18206. */
  18207. }, {
  18208. key: 'private',
  18209. value: function _private(channel) {
  18210. return this.connector.privateChannel(channel);
  18211. }
  18212. /**
  18213. * Get the Socket ID for the connection.
  18214. */
  18215. }, {
  18216. key: 'socketId',
  18217. value: function socketId() {
  18218. return this.connector.socketId();
  18219. }
  18220. /**
  18221. * Register 3rd party request interceptiors. These are used to automatically
  18222. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18223. */
  18224. }, {
  18225. key: 'registerInterceptors',
  18226. value: function registerInterceptors() {
  18227. if (typeof Vue === 'function' && Vue.http) {
  18228. this.registerVueRequestInterceptor();
  18229. }
  18230. if (typeof axios === 'function') {
  18231. this.registerAxiosRequestInterceptor();
  18232. }
  18233. if (typeof jQuery === 'function') {
  18234. this.registerjQueryAjaxSetup();
  18235. }
  18236. }
  18237. /**
  18238. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18239. */
  18240. }, {
  18241. key: 'registerVueRequestInterceptor',
  18242. value: function registerVueRequestInterceptor() {
  18243. var _this = this;
  18244. Vue.http.interceptors.push(function (request, next) {
  18245. if (_this.socketId()) {
  18246. request.headers.set('X-Socket-ID', _this.socketId());
  18247. }
  18248. next();
  18249. });
  18250. }
  18251. /**
  18252. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18253. */
  18254. }, {
  18255. key: 'registerAxiosRequestInterceptor',
  18256. value: function registerAxiosRequestInterceptor() {
  18257. var _this2 = this;
  18258. axios.interceptors.request.use(function (config) {
  18259. if (_this2.socketId()) {
  18260. config.headers['X-Socket-Id'] = _this2.socketId();
  18261. }
  18262. return config;
  18263. });
  18264. }
  18265. /**
  18266. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18267. */
  18268. }, {
  18269. key: 'registerjQueryAjaxSetup',
  18270. value: function registerjQueryAjaxSetup() {
  18271. var _this3 = this;
  18272. if (typeof jQuery.ajax != 'undefined') {
  18273. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18274. if (_this3.socketId()) {
  18275. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18276. }
  18277. });
  18278. }
  18279. }
  18280. }]);
  18281. return Echo;
  18282. }();
  18283. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18284. /***/ }),
  18285. /***/ "./node_modules/lodash/lodash.js":
  18286. /*!***************************************!*\
  18287. !*** ./node_modules/lodash/lodash.js ***!
  18288. \***************************************/
  18289. /*! no static exports found */
  18290. /***/ (function(module, exports, __webpack_require__) {
  18291. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18292. * @license
  18293. * Lodash <https://lodash.com/>
  18294. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18295. * Released under MIT license <https://lodash.com/license>
  18296. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18297. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18298. */
  18299. ;(function() {
  18300. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18301. var undefined;
  18302. /** Used as the semantic version number. */
  18303. var VERSION = '4.17.15';
  18304. /** Used as the size to enable large array optimizations. */
  18305. var LARGE_ARRAY_SIZE = 200;
  18306. /** Error message constants. */
  18307. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18308. FUNC_ERROR_TEXT = 'Expected a function';
  18309. /** Used to stand-in for `undefined` hash values. */
  18310. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18311. /** Used as the maximum memoize cache size. */
  18312. var MAX_MEMOIZE_SIZE = 500;
  18313. /** Used as the internal argument placeholder. */
  18314. var PLACEHOLDER = '__lodash_placeholder__';
  18315. /** Used to compose bitmasks for cloning. */
  18316. var CLONE_DEEP_FLAG = 1,
  18317. CLONE_FLAT_FLAG = 2,
  18318. CLONE_SYMBOLS_FLAG = 4;
  18319. /** Used to compose bitmasks for value comparisons. */
  18320. var COMPARE_PARTIAL_FLAG = 1,
  18321. COMPARE_UNORDERED_FLAG = 2;
  18322. /** Used to compose bitmasks for function metadata. */
  18323. var WRAP_BIND_FLAG = 1,
  18324. WRAP_BIND_KEY_FLAG = 2,
  18325. WRAP_CURRY_BOUND_FLAG = 4,
  18326. WRAP_CURRY_FLAG = 8,
  18327. WRAP_CURRY_RIGHT_FLAG = 16,
  18328. WRAP_PARTIAL_FLAG = 32,
  18329. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18330. WRAP_ARY_FLAG = 128,
  18331. WRAP_REARG_FLAG = 256,
  18332. WRAP_FLIP_FLAG = 512;
  18333. /** Used as default options for `_.truncate`. */
  18334. var DEFAULT_TRUNC_LENGTH = 30,
  18335. DEFAULT_TRUNC_OMISSION = '...';
  18336. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18337. var HOT_COUNT = 800,
  18338. HOT_SPAN = 16;
  18339. /** Used to indicate the type of lazy iteratees. */
  18340. var LAZY_FILTER_FLAG = 1,
  18341. LAZY_MAP_FLAG = 2,
  18342. LAZY_WHILE_FLAG = 3;
  18343. /** Used as references for various `Number` constants. */
  18344. var INFINITY = 1 / 0,
  18345. MAX_SAFE_INTEGER = 9007199254740991,
  18346. MAX_INTEGER = 1.7976931348623157e+308,
  18347. NAN = 0 / 0;
  18348. /** Used as references for the maximum length and index of an array. */
  18349. var MAX_ARRAY_LENGTH = 4294967295,
  18350. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18351. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18352. /** Used to associate wrap methods with their bit flags. */
  18353. var wrapFlags = [
  18354. ['ary', WRAP_ARY_FLAG],
  18355. ['bind', WRAP_BIND_FLAG],
  18356. ['bindKey', WRAP_BIND_KEY_FLAG],
  18357. ['curry', WRAP_CURRY_FLAG],
  18358. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18359. ['flip', WRAP_FLIP_FLAG],
  18360. ['partial', WRAP_PARTIAL_FLAG],
  18361. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18362. ['rearg', WRAP_REARG_FLAG]
  18363. ];
  18364. /** `Object#toString` result references. */
  18365. var argsTag = '[object Arguments]',
  18366. arrayTag = '[object Array]',
  18367. asyncTag = '[object AsyncFunction]',
  18368. boolTag = '[object Boolean]',
  18369. dateTag = '[object Date]',
  18370. domExcTag = '[object DOMException]',
  18371. errorTag = '[object Error]',
  18372. funcTag = '[object Function]',
  18373. genTag = '[object GeneratorFunction]',
  18374. mapTag = '[object Map]',
  18375. numberTag = '[object Number]',
  18376. nullTag = '[object Null]',
  18377. objectTag = '[object Object]',
  18378. promiseTag = '[object Promise]',
  18379. proxyTag = '[object Proxy]',
  18380. regexpTag = '[object RegExp]',
  18381. setTag = '[object Set]',
  18382. stringTag = '[object String]',
  18383. symbolTag = '[object Symbol]',
  18384. undefinedTag = '[object Undefined]',
  18385. weakMapTag = '[object WeakMap]',
  18386. weakSetTag = '[object WeakSet]';
  18387. var arrayBufferTag = '[object ArrayBuffer]',
  18388. dataViewTag = '[object DataView]',
  18389. float32Tag = '[object Float32Array]',
  18390. float64Tag = '[object Float64Array]',
  18391. int8Tag = '[object Int8Array]',
  18392. int16Tag = '[object Int16Array]',
  18393. int32Tag = '[object Int32Array]',
  18394. uint8Tag = '[object Uint8Array]',
  18395. uint8ClampedTag = '[object Uint8ClampedArray]',
  18396. uint16Tag = '[object Uint16Array]',
  18397. uint32Tag = '[object Uint32Array]';
  18398. /** Used to match empty string literals in compiled template source. */
  18399. var reEmptyStringLeading = /\b__p \+= '';/g,
  18400. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18401. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18402. /** Used to match HTML entities and HTML characters. */
  18403. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18404. reUnescapedHtml = /[&<>"']/g,
  18405. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18406. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18407. /** Used to match template delimiters. */
  18408. var reEscape = /<%-([\s\S]+?)%>/g,
  18409. reEvaluate = /<%([\s\S]+?)%>/g,
  18410. reInterpolate = /<%=([\s\S]+?)%>/g;
  18411. /** Used to match property names within property paths. */
  18412. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18413. reIsPlainProp = /^\w*$/,
  18414. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18415. /**
  18416. * Used to match `RegExp`
  18417. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18418. */
  18419. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18420. reHasRegExpChar = RegExp(reRegExpChar.source);
  18421. /** Used to match leading and trailing whitespace. */
  18422. var reTrim = /^\s+|\s+$/g,
  18423. reTrimStart = /^\s+/,
  18424. reTrimEnd = /\s+$/;
  18425. /** Used to match wrap detail comments. */
  18426. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18427. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18428. reSplitDetails = /,? & /;
  18429. /** Used to match words composed of alphanumeric characters. */
  18430. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18431. /** Used to match backslashes in property paths. */
  18432. var reEscapeChar = /\\(\\)?/g;
  18433. /**
  18434. * Used to match
  18435. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18436. */
  18437. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18438. /** Used to match `RegExp` flags from their coerced string values. */
  18439. var reFlags = /\w*$/;
  18440. /** Used to detect bad signed hexadecimal string values. */
  18441. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18442. /** Used to detect binary string values. */
  18443. var reIsBinary = /^0b[01]+$/i;
  18444. /** Used to detect host constructors (Safari). */
  18445. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18446. /** Used to detect octal string values. */
  18447. var reIsOctal = /^0o[0-7]+$/i;
  18448. /** Used to detect unsigned integer values. */
  18449. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18450. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18451. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18452. /** Used to ensure capturing order of template delimiters. */
  18453. var reNoMatch = /($^)/;
  18454. /** Used to match unescaped characters in compiled string literals. */
  18455. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18456. /** Used to compose unicode character classes. */
  18457. var rsAstralRange = '\\ud800-\\udfff',
  18458. rsComboMarksRange = '\\u0300-\\u036f',
  18459. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18460. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18461. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18462. rsDingbatRange = '\\u2700-\\u27bf',
  18463. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18464. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18465. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18466. rsPunctuationRange = '\\u2000-\\u206f',
  18467. 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',
  18468. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18469. rsVarRange = '\\ufe0e\\ufe0f',
  18470. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18471. /** Used to compose unicode capture groups. */
  18472. var rsApos = "['\u2019]",
  18473. rsAstral = '[' + rsAstralRange + ']',
  18474. rsBreak = '[' + rsBreakRange + ']',
  18475. rsCombo = '[' + rsComboRange + ']',
  18476. rsDigits = '\\d+',
  18477. rsDingbat = '[' + rsDingbatRange + ']',
  18478. rsLower = '[' + rsLowerRange + ']',
  18479. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18480. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18481. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18482. rsNonAstral = '[^' + rsAstralRange + ']',
  18483. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18484. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18485. rsUpper = '[' + rsUpperRange + ']',
  18486. rsZWJ = '\\u200d';
  18487. /** Used to compose unicode regexes. */
  18488. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18489. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18490. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18491. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18492. reOptMod = rsModifier + '?',
  18493. rsOptVar = '[' + rsVarRange + ']?',
  18494. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18495. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18496. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18497. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18498. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18499. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18500. /** Used to match apostrophes. */
  18501. var reApos = RegExp(rsApos, 'g');
  18502. /**
  18503. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18504. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18505. */
  18506. var reComboMark = RegExp(rsCombo, 'g');
  18507. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18508. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18509. /** Used to match complex or compound words. */
  18510. var reUnicodeWord = RegExp([
  18511. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18512. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18513. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18514. rsUpper + '+' + rsOptContrUpper,
  18515. rsOrdUpper,
  18516. rsOrdLower,
  18517. rsDigits,
  18518. rsEmoji
  18519. ].join('|'), 'g');
  18520. /** 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/). */
  18521. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18522. /** Used to detect strings that need a more robust regexp to match words. */
  18523. 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 ]/;
  18524. /** Used to assign default `context` object properties. */
  18525. var contextProps = [
  18526. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18527. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18528. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18529. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18530. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18531. ];
  18532. /** Used to make template sourceURLs easier to identify. */
  18533. var templateCounter = -1;
  18534. /** Used to identify `toStringTag` values of typed arrays. */
  18535. var typedArrayTags = {};
  18536. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18537. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18538. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18539. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18540. typedArrayTags[uint32Tag] = true;
  18541. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18542. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18543. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18544. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18545. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18546. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18547. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18548. typedArrayTags[weakMapTag] = false;
  18549. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18550. var cloneableTags = {};
  18551. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18552. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18553. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18554. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18555. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18556. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18557. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18558. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18559. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18560. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18561. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18562. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18563. cloneableTags[weakMapTag] = false;
  18564. /** Used to map Latin Unicode letters to basic Latin letters. */
  18565. var deburredLetters = {
  18566. // Latin-1 Supplement block.
  18567. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18568. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18569. '\xc7': 'C', '\xe7': 'c',
  18570. '\xd0': 'D', '\xf0': 'd',
  18571. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18572. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18573. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18574. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18575. '\xd1': 'N', '\xf1': 'n',
  18576. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18577. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18578. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18579. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18580. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18581. '\xc6': 'Ae', '\xe6': 'ae',
  18582. '\xde': 'Th', '\xfe': 'th',
  18583. '\xdf': 'ss',
  18584. // Latin Extended-A block.
  18585. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18586. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18587. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18588. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18589. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18590. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18591. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18592. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18593. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18594. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18595. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18596. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18597. '\u0134': 'J', '\u0135': 'j',
  18598. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18599. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18600. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18601. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18602. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18603. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18604. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18605. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18606. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18607. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18608. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18609. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18610. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18611. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18612. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18613. '\u0174': 'W', '\u0175': 'w',
  18614. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18615. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18616. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18617. '\u0132': 'IJ', '\u0133': 'ij',
  18618. '\u0152': 'Oe', '\u0153': 'oe',
  18619. '\u0149': "'n", '\u017f': 's'
  18620. };
  18621. /** Used to map characters to HTML entities. */
  18622. var htmlEscapes = {
  18623. '&': '&amp;',
  18624. '<': '&lt;',
  18625. '>': '&gt;',
  18626. '"': '&quot;',
  18627. "'": '&#39;'
  18628. };
  18629. /** Used to map HTML entities to characters. */
  18630. var htmlUnescapes = {
  18631. '&amp;': '&',
  18632. '&lt;': '<',
  18633. '&gt;': '>',
  18634. '&quot;': '"',
  18635. '&#39;': "'"
  18636. };
  18637. /** Used to escape characters for inclusion in compiled string literals. */
  18638. var stringEscapes = {
  18639. '\\': '\\',
  18640. "'": "'",
  18641. '\n': 'n',
  18642. '\r': 'r',
  18643. '\u2028': 'u2028',
  18644. '\u2029': 'u2029'
  18645. };
  18646. /** Built-in method references without a dependency on `root`. */
  18647. var freeParseFloat = parseFloat,
  18648. freeParseInt = parseInt;
  18649. /** Detect free variable `global` from Node.js. */
  18650. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18651. /** Detect free variable `self`. */
  18652. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18653. /** Used as a reference to the global object. */
  18654. var root = freeGlobal || freeSelf || Function('return this')();
  18655. /** Detect free variable `exports`. */
  18656. var freeExports = true && exports && !exports.nodeType && exports;
  18657. /** Detect free variable `module`. */
  18658. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18659. /** Detect the popular CommonJS extension `module.exports`. */
  18660. var moduleExports = freeModule && freeModule.exports === freeExports;
  18661. /** Detect free variable `process` from Node.js. */
  18662. var freeProcess = moduleExports && freeGlobal.process;
  18663. /** Used to access faster Node.js helpers. */
  18664. var nodeUtil = (function() {
  18665. try {
  18666. // Use `util.types` for Node.js 10+.
  18667. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18668. if (types) {
  18669. return types;
  18670. }
  18671. // Legacy `process.binding('util')` for Node.js < 10.
  18672. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18673. } catch (e) {}
  18674. }());
  18675. /* Node.js helper references. */
  18676. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18677. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18678. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18679. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18680. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18681. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18682. /*--------------------------------------------------------------------------*/
  18683. /**
  18684. * A faster alternative to `Function#apply`, this function invokes `func`
  18685. * with the `this` binding of `thisArg` and the arguments of `args`.
  18686. *
  18687. * @private
  18688. * @param {Function} func The function to invoke.
  18689. * @param {*} thisArg The `this` binding of `func`.
  18690. * @param {Array} args The arguments to invoke `func` with.
  18691. * @returns {*} Returns the result of `func`.
  18692. */
  18693. function apply(func, thisArg, args) {
  18694. switch (args.length) {
  18695. case 0: return func.call(thisArg);
  18696. case 1: return func.call(thisArg, args[0]);
  18697. case 2: return func.call(thisArg, args[0], args[1]);
  18698. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18699. }
  18700. return func.apply(thisArg, args);
  18701. }
  18702. /**
  18703. * A specialized version of `baseAggregator` for arrays.
  18704. *
  18705. * @private
  18706. * @param {Array} [array] The array to iterate over.
  18707. * @param {Function} setter The function to set `accumulator` values.
  18708. * @param {Function} iteratee The iteratee to transform keys.
  18709. * @param {Object} accumulator The initial aggregated object.
  18710. * @returns {Function} Returns `accumulator`.
  18711. */
  18712. function arrayAggregator(array, setter, iteratee, accumulator) {
  18713. var index = -1,
  18714. length = array == null ? 0 : array.length;
  18715. while (++index < length) {
  18716. var value = array[index];
  18717. setter(accumulator, value, iteratee(value), array);
  18718. }
  18719. return accumulator;
  18720. }
  18721. /**
  18722. * A specialized version of `_.forEach` for arrays without support for
  18723. * iteratee shorthands.
  18724. *
  18725. * @private
  18726. * @param {Array} [array] The array to iterate over.
  18727. * @param {Function} iteratee The function invoked per iteration.
  18728. * @returns {Array} Returns `array`.
  18729. */
  18730. function arrayEach(array, iteratee) {
  18731. var index = -1,
  18732. length = array == null ? 0 : array.length;
  18733. while (++index < length) {
  18734. if (iteratee(array[index], index, array) === false) {
  18735. break;
  18736. }
  18737. }
  18738. return array;
  18739. }
  18740. /**
  18741. * A specialized version of `_.forEachRight` for arrays without support for
  18742. * iteratee shorthands.
  18743. *
  18744. * @private
  18745. * @param {Array} [array] The array to iterate over.
  18746. * @param {Function} iteratee The function invoked per iteration.
  18747. * @returns {Array} Returns `array`.
  18748. */
  18749. function arrayEachRight(array, iteratee) {
  18750. var length = array == null ? 0 : array.length;
  18751. while (length--) {
  18752. if (iteratee(array[length], length, array) === false) {
  18753. break;
  18754. }
  18755. }
  18756. return array;
  18757. }
  18758. /**
  18759. * A specialized version of `_.every` for arrays without support for
  18760. * iteratee shorthands.
  18761. *
  18762. * @private
  18763. * @param {Array} [array] The array to iterate over.
  18764. * @param {Function} predicate The function invoked per iteration.
  18765. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18766. * else `false`.
  18767. */
  18768. function arrayEvery(array, predicate) {
  18769. var index = -1,
  18770. length = array == null ? 0 : array.length;
  18771. while (++index < length) {
  18772. if (!predicate(array[index], index, array)) {
  18773. return false;
  18774. }
  18775. }
  18776. return true;
  18777. }
  18778. /**
  18779. * A specialized version of `_.filter` for arrays without support for
  18780. * iteratee shorthands.
  18781. *
  18782. * @private
  18783. * @param {Array} [array] The array to iterate over.
  18784. * @param {Function} predicate The function invoked per iteration.
  18785. * @returns {Array} Returns the new filtered array.
  18786. */
  18787. function arrayFilter(array, predicate) {
  18788. var index = -1,
  18789. length = array == null ? 0 : array.length,
  18790. resIndex = 0,
  18791. result = [];
  18792. while (++index < length) {
  18793. var value = array[index];
  18794. if (predicate(value, index, array)) {
  18795. result[resIndex++] = value;
  18796. }
  18797. }
  18798. return result;
  18799. }
  18800. /**
  18801. * A specialized version of `_.includes` for arrays without support for
  18802. * specifying an index to search from.
  18803. *
  18804. * @private
  18805. * @param {Array} [array] The array to inspect.
  18806. * @param {*} target The value to search for.
  18807. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18808. */
  18809. function arrayIncludes(array, value) {
  18810. var length = array == null ? 0 : array.length;
  18811. return !!length && baseIndexOf(array, value, 0) > -1;
  18812. }
  18813. /**
  18814. * This function is like `arrayIncludes` except that it accepts a comparator.
  18815. *
  18816. * @private
  18817. * @param {Array} [array] The array to inspect.
  18818. * @param {*} target The value to search for.
  18819. * @param {Function} comparator The comparator invoked per element.
  18820. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18821. */
  18822. function arrayIncludesWith(array, value, comparator) {
  18823. var index = -1,
  18824. length = array == null ? 0 : array.length;
  18825. while (++index < length) {
  18826. if (comparator(value, array[index])) {
  18827. return true;
  18828. }
  18829. }
  18830. return false;
  18831. }
  18832. /**
  18833. * A specialized version of `_.map` for arrays without support for iteratee
  18834. * shorthands.
  18835. *
  18836. * @private
  18837. * @param {Array} [array] The array to iterate over.
  18838. * @param {Function} iteratee The function invoked per iteration.
  18839. * @returns {Array} Returns the new mapped array.
  18840. */
  18841. function arrayMap(array, iteratee) {
  18842. var index = -1,
  18843. length = array == null ? 0 : array.length,
  18844. result = Array(length);
  18845. while (++index < length) {
  18846. result[index] = iteratee(array[index], index, array);
  18847. }
  18848. return result;
  18849. }
  18850. /**
  18851. * Appends the elements of `values` to `array`.
  18852. *
  18853. * @private
  18854. * @param {Array} array The array to modify.
  18855. * @param {Array} values The values to append.
  18856. * @returns {Array} Returns `array`.
  18857. */
  18858. function arrayPush(array, values) {
  18859. var index = -1,
  18860. length = values.length,
  18861. offset = array.length;
  18862. while (++index < length) {
  18863. array[offset + index] = values[index];
  18864. }
  18865. return array;
  18866. }
  18867. /**
  18868. * A specialized version of `_.reduce` for arrays without support for
  18869. * iteratee shorthands.
  18870. *
  18871. * @private
  18872. * @param {Array} [array] The array to iterate over.
  18873. * @param {Function} iteratee The function invoked per iteration.
  18874. * @param {*} [accumulator] The initial value.
  18875. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18876. * the initial value.
  18877. * @returns {*} Returns the accumulated value.
  18878. */
  18879. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18880. var index = -1,
  18881. length = array == null ? 0 : array.length;
  18882. if (initAccum && length) {
  18883. accumulator = array[++index];
  18884. }
  18885. while (++index < length) {
  18886. accumulator = iteratee(accumulator, array[index], index, array);
  18887. }
  18888. return accumulator;
  18889. }
  18890. /**
  18891. * A specialized version of `_.reduceRight` for arrays without support for
  18892. * iteratee shorthands.
  18893. *
  18894. * @private
  18895. * @param {Array} [array] The array to iterate over.
  18896. * @param {Function} iteratee The function invoked per iteration.
  18897. * @param {*} [accumulator] The initial value.
  18898. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18899. * the initial value.
  18900. * @returns {*} Returns the accumulated value.
  18901. */
  18902. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18903. var length = array == null ? 0 : array.length;
  18904. if (initAccum && length) {
  18905. accumulator = array[--length];
  18906. }
  18907. while (length--) {
  18908. accumulator = iteratee(accumulator, array[length], length, array);
  18909. }
  18910. return accumulator;
  18911. }
  18912. /**
  18913. * A specialized version of `_.some` for arrays without support for iteratee
  18914. * shorthands.
  18915. *
  18916. * @private
  18917. * @param {Array} [array] The array to iterate over.
  18918. * @param {Function} predicate The function invoked per iteration.
  18919. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18920. * else `false`.
  18921. */
  18922. function arraySome(array, predicate) {
  18923. var index = -1,
  18924. length = array == null ? 0 : array.length;
  18925. while (++index < length) {
  18926. if (predicate(array[index], index, array)) {
  18927. return true;
  18928. }
  18929. }
  18930. return false;
  18931. }
  18932. /**
  18933. * Gets the size of an ASCII `string`.
  18934. *
  18935. * @private
  18936. * @param {string} string The string inspect.
  18937. * @returns {number} Returns the string size.
  18938. */
  18939. var asciiSize = baseProperty('length');
  18940. /**
  18941. * Converts an ASCII `string` to an array.
  18942. *
  18943. * @private
  18944. * @param {string} string The string to convert.
  18945. * @returns {Array} Returns the converted array.
  18946. */
  18947. function asciiToArray(string) {
  18948. return string.split('');
  18949. }
  18950. /**
  18951. * Splits an ASCII `string` into an array of its words.
  18952. *
  18953. * @private
  18954. * @param {string} The string to inspect.
  18955. * @returns {Array} Returns the words of `string`.
  18956. */
  18957. function asciiWords(string) {
  18958. return string.match(reAsciiWord) || [];
  18959. }
  18960. /**
  18961. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18962. * without support for iteratee shorthands, which iterates over `collection`
  18963. * using `eachFunc`.
  18964. *
  18965. * @private
  18966. * @param {Array|Object} collection The collection to inspect.
  18967. * @param {Function} predicate The function invoked per iteration.
  18968. * @param {Function} eachFunc The function to iterate over `collection`.
  18969. * @returns {*} Returns the found element or its key, else `undefined`.
  18970. */
  18971. function baseFindKey(collection, predicate, eachFunc) {
  18972. var result;
  18973. eachFunc(collection, function(value, key, collection) {
  18974. if (predicate(value, key, collection)) {
  18975. result = key;
  18976. return false;
  18977. }
  18978. });
  18979. return result;
  18980. }
  18981. /**
  18982. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18983. * support for iteratee shorthands.
  18984. *
  18985. * @private
  18986. * @param {Array} array The array to inspect.
  18987. * @param {Function} predicate The function invoked per iteration.
  18988. * @param {number} fromIndex The index to search from.
  18989. * @param {boolean} [fromRight] Specify iterating from right to left.
  18990. * @returns {number} Returns the index of the matched value, else `-1`.
  18991. */
  18992. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18993. var length = array.length,
  18994. index = fromIndex + (fromRight ? 1 : -1);
  18995. while ((fromRight ? index-- : ++index < length)) {
  18996. if (predicate(array[index], index, array)) {
  18997. return index;
  18998. }
  18999. }
  19000. return -1;
  19001. }
  19002. /**
  19003. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19004. *
  19005. * @private
  19006. * @param {Array} array The array to inspect.
  19007. * @param {*} value The value to search for.
  19008. * @param {number} fromIndex The index to search from.
  19009. * @returns {number} Returns the index of the matched value, else `-1`.
  19010. */
  19011. function baseIndexOf(array, value, fromIndex) {
  19012. return value === value
  19013. ? strictIndexOf(array, value, fromIndex)
  19014. : baseFindIndex(array, baseIsNaN, fromIndex);
  19015. }
  19016. /**
  19017. * This function is like `baseIndexOf` except that it accepts a comparator.
  19018. *
  19019. * @private
  19020. * @param {Array} array The array to inspect.
  19021. * @param {*} value The value to search for.
  19022. * @param {number} fromIndex The index to search from.
  19023. * @param {Function} comparator The comparator invoked per element.
  19024. * @returns {number} Returns the index of the matched value, else `-1`.
  19025. */
  19026. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19027. var index = fromIndex - 1,
  19028. length = array.length;
  19029. while (++index < length) {
  19030. if (comparator(array[index], value)) {
  19031. return index;
  19032. }
  19033. }
  19034. return -1;
  19035. }
  19036. /**
  19037. * The base implementation of `_.isNaN` without support for number objects.
  19038. *
  19039. * @private
  19040. * @param {*} value The value to check.
  19041. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19042. */
  19043. function baseIsNaN(value) {
  19044. return value !== value;
  19045. }
  19046. /**
  19047. * The base implementation of `_.mean` and `_.meanBy` without support for
  19048. * iteratee shorthands.
  19049. *
  19050. * @private
  19051. * @param {Array} array The array to iterate over.
  19052. * @param {Function} iteratee The function invoked per iteration.
  19053. * @returns {number} Returns the mean.
  19054. */
  19055. function baseMean(array, iteratee) {
  19056. var length = array == null ? 0 : array.length;
  19057. return length ? (baseSum(array, iteratee) / length) : NAN;
  19058. }
  19059. /**
  19060. * The base implementation of `_.property` without support for deep paths.
  19061. *
  19062. * @private
  19063. * @param {string} key The key of the property to get.
  19064. * @returns {Function} Returns the new accessor function.
  19065. */
  19066. function baseProperty(key) {
  19067. return function(object) {
  19068. return object == null ? undefined : object[key];
  19069. };
  19070. }
  19071. /**
  19072. * The base implementation of `_.propertyOf` without support for deep paths.
  19073. *
  19074. * @private
  19075. * @param {Object} object The object to query.
  19076. * @returns {Function} Returns the new accessor function.
  19077. */
  19078. function basePropertyOf(object) {
  19079. return function(key) {
  19080. return object == null ? undefined : object[key];
  19081. };
  19082. }
  19083. /**
  19084. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19085. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19086. *
  19087. * @private
  19088. * @param {Array|Object} collection The collection to iterate over.
  19089. * @param {Function} iteratee The function invoked per iteration.
  19090. * @param {*} accumulator The initial value.
  19091. * @param {boolean} initAccum Specify using the first or last element of
  19092. * `collection` as the initial value.
  19093. * @param {Function} eachFunc The function to iterate over `collection`.
  19094. * @returns {*} Returns the accumulated value.
  19095. */
  19096. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19097. eachFunc(collection, function(value, index, collection) {
  19098. accumulator = initAccum
  19099. ? (initAccum = false, value)
  19100. : iteratee(accumulator, value, index, collection);
  19101. });
  19102. return accumulator;
  19103. }
  19104. /**
  19105. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19106. * sort order of `array` and replaces criteria objects with their corresponding
  19107. * values.
  19108. *
  19109. * @private
  19110. * @param {Array} array The array to sort.
  19111. * @param {Function} comparer The function to define sort order.
  19112. * @returns {Array} Returns `array`.
  19113. */
  19114. function baseSortBy(array, comparer) {
  19115. var length = array.length;
  19116. array.sort(comparer);
  19117. while (length--) {
  19118. array[length] = array[length].value;
  19119. }
  19120. return array;
  19121. }
  19122. /**
  19123. * The base implementation of `_.sum` and `_.sumBy` without support for
  19124. * iteratee shorthands.
  19125. *
  19126. * @private
  19127. * @param {Array} array The array to iterate over.
  19128. * @param {Function} iteratee The function invoked per iteration.
  19129. * @returns {number} Returns the sum.
  19130. */
  19131. function baseSum(array, iteratee) {
  19132. var result,
  19133. index = -1,
  19134. length = array.length;
  19135. while (++index < length) {
  19136. var current = iteratee(array[index]);
  19137. if (current !== undefined) {
  19138. result = result === undefined ? current : (result + current);
  19139. }
  19140. }
  19141. return result;
  19142. }
  19143. /**
  19144. * The base implementation of `_.times` without support for iteratee shorthands
  19145. * or max array length checks.
  19146. *
  19147. * @private
  19148. * @param {number} n The number of times to invoke `iteratee`.
  19149. * @param {Function} iteratee The function invoked per iteration.
  19150. * @returns {Array} Returns the array of results.
  19151. */
  19152. function baseTimes(n, iteratee) {
  19153. var index = -1,
  19154. result = Array(n);
  19155. while (++index < n) {
  19156. result[index] = iteratee(index);
  19157. }
  19158. return result;
  19159. }
  19160. /**
  19161. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19162. * of key-value pairs for `object` corresponding to the property names of `props`.
  19163. *
  19164. * @private
  19165. * @param {Object} object The object to query.
  19166. * @param {Array} props The property names to get values for.
  19167. * @returns {Object} Returns the key-value pairs.
  19168. */
  19169. function baseToPairs(object, props) {
  19170. return arrayMap(props, function(key) {
  19171. return [key, object[key]];
  19172. });
  19173. }
  19174. /**
  19175. * The base implementation of `_.unary` without support for storing metadata.
  19176. *
  19177. * @private
  19178. * @param {Function} func The function to cap arguments for.
  19179. * @returns {Function} Returns the new capped function.
  19180. */
  19181. function baseUnary(func) {
  19182. return function(value) {
  19183. return func(value);
  19184. };
  19185. }
  19186. /**
  19187. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19188. * array of `object` property values corresponding to the property names
  19189. * of `props`.
  19190. *
  19191. * @private
  19192. * @param {Object} object The object to query.
  19193. * @param {Array} props The property names to get values for.
  19194. * @returns {Object} Returns the array of property values.
  19195. */
  19196. function baseValues(object, props) {
  19197. return arrayMap(props, function(key) {
  19198. return object[key];
  19199. });
  19200. }
  19201. /**
  19202. * Checks if a `cache` value for `key` exists.
  19203. *
  19204. * @private
  19205. * @param {Object} cache The cache to query.
  19206. * @param {string} key The key of the entry to check.
  19207. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19208. */
  19209. function cacheHas(cache, key) {
  19210. return cache.has(key);
  19211. }
  19212. /**
  19213. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19214. * that is not found in the character symbols.
  19215. *
  19216. * @private
  19217. * @param {Array} strSymbols The string symbols to inspect.
  19218. * @param {Array} chrSymbols The character symbols to find.
  19219. * @returns {number} Returns the index of the first unmatched string symbol.
  19220. */
  19221. function charsStartIndex(strSymbols, chrSymbols) {
  19222. var index = -1,
  19223. length = strSymbols.length;
  19224. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19225. return index;
  19226. }
  19227. /**
  19228. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19229. * that is not found in the character symbols.
  19230. *
  19231. * @private
  19232. * @param {Array} strSymbols The string symbols to inspect.
  19233. * @param {Array} chrSymbols The character symbols to find.
  19234. * @returns {number} Returns the index of the last unmatched string symbol.
  19235. */
  19236. function charsEndIndex(strSymbols, chrSymbols) {
  19237. var index = strSymbols.length;
  19238. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19239. return index;
  19240. }
  19241. /**
  19242. * Gets the number of `placeholder` occurrences in `array`.
  19243. *
  19244. * @private
  19245. * @param {Array} array The array to inspect.
  19246. * @param {*} placeholder The placeholder to search for.
  19247. * @returns {number} Returns the placeholder count.
  19248. */
  19249. function countHolders(array, placeholder) {
  19250. var length = array.length,
  19251. result = 0;
  19252. while (length--) {
  19253. if (array[length] === placeholder) {
  19254. ++result;
  19255. }
  19256. }
  19257. return result;
  19258. }
  19259. /**
  19260. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19261. * letters to basic Latin letters.
  19262. *
  19263. * @private
  19264. * @param {string} letter The matched letter to deburr.
  19265. * @returns {string} Returns the deburred letter.
  19266. */
  19267. var deburrLetter = basePropertyOf(deburredLetters);
  19268. /**
  19269. * Used by `_.escape` to convert characters to HTML entities.
  19270. *
  19271. * @private
  19272. * @param {string} chr The matched character to escape.
  19273. * @returns {string} Returns the escaped character.
  19274. */
  19275. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19276. /**
  19277. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19278. *
  19279. * @private
  19280. * @param {string} chr The matched character to escape.
  19281. * @returns {string} Returns the escaped character.
  19282. */
  19283. function escapeStringChar(chr) {
  19284. return '\\' + stringEscapes[chr];
  19285. }
  19286. /**
  19287. * Gets the value at `key` of `object`.
  19288. *
  19289. * @private
  19290. * @param {Object} [object] The object to query.
  19291. * @param {string} key The key of the property to get.
  19292. * @returns {*} Returns the property value.
  19293. */
  19294. function getValue(object, key) {
  19295. return object == null ? undefined : object[key];
  19296. }
  19297. /**
  19298. * Checks if `string` contains Unicode symbols.
  19299. *
  19300. * @private
  19301. * @param {string} string The string to inspect.
  19302. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19303. */
  19304. function hasUnicode(string) {
  19305. return reHasUnicode.test(string);
  19306. }
  19307. /**
  19308. * Checks if `string` contains a word composed of Unicode symbols.
  19309. *
  19310. * @private
  19311. * @param {string} string The string to inspect.
  19312. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19313. */
  19314. function hasUnicodeWord(string) {
  19315. return reHasUnicodeWord.test(string);
  19316. }
  19317. /**
  19318. * Converts `iterator` to an array.
  19319. *
  19320. * @private
  19321. * @param {Object} iterator The iterator to convert.
  19322. * @returns {Array} Returns the converted array.
  19323. */
  19324. function iteratorToArray(iterator) {
  19325. var data,
  19326. result = [];
  19327. while (!(data = iterator.next()).done) {
  19328. result.push(data.value);
  19329. }
  19330. return result;
  19331. }
  19332. /**
  19333. * Converts `map` to its key-value pairs.
  19334. *
  19335. * @private
  19336. * @param {Object} map The map to convert.
  19337. * @returns {Array} Returns the key-value pairs.
  19338. */
  19339. function mapToArray(map) {
  19340. var index = -1,
  19341. result = Array(map.size);
  19342. map.forEach(function(value, key) {
  19343. result[++index] = [key, value];
  19344. });
  19345. return result;
  19346. }
  19347. /**
  19348. * Creates a unary function that invokes `func` with its argument transformed.
  19349. *
  19350. * @private
  19351. * @param {Function} func The function to wrap.
  19352. * @param {Function} transform The argument transform.
  19353. * @returns {Function} Returns the new function.
  19354. */
  19355. function overArg(func, transform) {
  19356. return function(arg) {
  19357. return func(transform(arg));
  19358. };
  19359. }
  19360. /**
  19361. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19362. * and returns an array of their indexes.
  19363. *
  19364. * @private
  19365. * @param {Array} array The array to modify.
  19366. * @param {*} placeholder The placeholder to replace.
  19367. * @returns {Array} Returns the new array of placeholder indexes.
  19368. */
  19369. function replaceHolders(array, placeholder) {
  19370. var index = -1,
  19371. length = array.length,
  19372. resIndex = 0,
  19373. result = [];
  19374. while (++index < length) {
  19375. var value = array[index];
  19376. if (value === placeholder || value === PLACEHOLDER) {
  19377. array[index] = PLACEHOLDER;
  19378. result[resIndex++] = index;
  19379. }
  19380. }
  19381. return result;
  19382. }
  19383. /**
  19384. * Converts `set` to an array of its values.
  19385. *
  19386. * @private
  19387. * @param {Object} set The set to convert.
  19388. * @returns {Array} Returns the values.
  19389. */
  19390. function setToArray(set) {
  19391. var index = -1,
  19392. result = Array(set.size);
  19393. set.forEach(function(value) {
  19394. result[++index] = value;
  19395. });
  19396. return result;
  19397. }
  19398. /**
  19399. * Converts `set` to its value-value pairs.
  19400. *
  19401. * @private
  19402. * @param {Object} set The set to convert.
  19403. * @returns {Array} Returns the value-value pairs.
  19404. */
  19405. function setToPairs(set) {
  19406. var index = -1,
  19407. result = Array(set.size);
  19408. set.forEach(function(value) {
  19409. result[++index] = [value, value];
  19410. });
  19411. return result;
  19412. }
  19413. /**
  19414. * A specialized version of `_.indexOf` which performs strict equality
  19415. * comparisons of values, i.e. `===`.
  19416. *
  19417. * @private
  19418. * @param {Array} array The array to inspect.
  19419. * @param {*} value The value to search for.
  19420. * @param {number} fromIndex The index to search from.
  19421. * @returns {number} Returns the index of the matched value, else `-1`.
  19422. */
  19423. function strictIndexOf(array, value, fromIndex) {
  19424. var index = fromIndex - 1,
  19425. length = array.length;
  19426. while (++index < length) {
  19427. if (array[index] === value) {
  19428. return index;
  19429. }
  19430. }
  19431. return -1;
  19432. }
  19433. /**
  19434. * A specialized version of `_.lastIndexOf` which performs strict equality
  19435. * comparisons of values, i.e. `===`.
  19436. *
  19437. * @private
  19438. * @param {Array} array The array to inspect.
  19439. * @param {*} value The value to search for.
  19440. * @param {number} fromIndex The index to search from.
  19441. * @returns {number} Returns the index of the matched value, else `-1`.
  19442. */
  19443. function strictLastIndexOf(array, value, fromIndex) {
  19444. var index = fromIndex + 1;
  19445. while (index--) {
  19446. if (array[index] === value) {
  19447. return index;
  19448. }
  19449. }
  19450. return index;
  19451. }
  19452. /**
  19453. * Gets the number of symbols in `string`.
  19454. *
  19455. * @private
  19456. * @param {string} string The string to inspect.
  19457. * @returns {number} Returns the string size.
  19458. */
  19459. function stringSize(string) {
  19460. return hasUnicode(string)
  19461. ? unicodeSize(string)
  19462. : asciiSize(string);
  19463. }
  19464. /**
  19465. * Converts `string` to an array.
  19466. *
  19467. * @private
  19468. * @param {string} string The string to convert.
  19469. * @returns {Array} Returns the converted array.
  19470. */
  19471. function stringToArray(string) {
  19472. return hasUnicode(string)
  19473. ? unicodeToArray(string)
  19474. : asciiToArray(string);
  19475. }
  19476. /**
  19477. * Used by `_.unescape` to convert HTML entities to characters.
  19478. *
  19479. * @private
  19480. * @param {string} chr The matched character to unescape.
  19481. * @returns {string} Returns the unescaped character.
  19482. */
  19483. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19484. /**
  19485. * Gets the size of a Unicode `string`.
  19486. *
  19487. * @private
  19488. * @param {string} string The string inspect.
  19489. * @returns {number} Returns the string size.
  19490. */
  19491. function unicodeSize(string) {
  19492. var result = reUnicode.lastIndex = 0;
  19493. while (reUnicode.test(string)) {
  19494. ++result;
  19495. }
  19496. return result;
  19497. }
  19498. /**
  19499. * Converts a Unicode `string` to an array.
  19500. *
  19501. * @private
  19502. * @param {string} string The string to convert.
  19503. * @returns {Array} Returns the converted array.
  19504. */
  19505. function unicodeToArray(string) {
  19506. return string.match(reUnicode) || [];
  19507. }
  19508. /**
  19509. * Splits a Unicode `string` into an array of its words.
  19510. *
  19511. * @private
  19512. * @param {string} The string to inspect.
  19513. * @returns {Array} Returns the words of `string`.
  19514. */
  19515. function unicodeWords(string) {
  19516. return string.match(reUnicodeWord) || [];
  19517. }
  19518. /*--------------------------------------------------------------------------*/
  19519. /**
  19520. * Create a new pristine `lodash` function using the `context` object.
  19521. *
  19522. * @static
  19523. * @memberOf _
  19524. * @since 1.1.0
  19525. * @category Util
  19526. * @param {Object} [context=root] The context object.
  19527. * @returns {Function} Returns a new `lodash` function.
  19528. * @example
  19529. *
  19530. * _.mixin({ 'foo': _.constant('foo') });
  19531. *
  19532. * var lodash = _.runInContext();
  19533. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19534. *
  19535. * _.isFunction(_.foo);
  19536. * // => true
  19537. * _.isFunction(_.bar);
  19538. * // => false
  19539. *
  19540. * lodash.isFunction(lodash.foo);
  19541. * // => false
  19542. * lodash.isFunction(lodash.bar);
  19543. * // => true
  19544. *
  19545. * // Create a suped-up `defer` in Node.js.
  19546. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19547. */
  19548. var runInContext = (function runInContext(context) {
  19549. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19550. /** Built-in constructor references. */
  19551. var Array = context.Array,
  19552. Date = context.Date,
  19553. Error = context.Error,
  19554. Function = context.Function,
  19555. Math = context.Math,
  19556. Object = context.Object,
  19557. RegExp = context.RegExp,
  19558. String = context.String,
  19559. TypeError = context.TypeError;
  19560. /** Used for built-in method references. */
  19561. var arrayProto = Array.prototype,
  19562. funcProto = Function.prototype,
  19563. objectProto = Object.prototype;
  19564. /** Used to detect overreaching core-js shims. */
  19565. var coreJsData = context['__core-js_shared__'];
  19566. /** Used to resolve the decompiled source of functions. */
  19567. var funcToString = funcProto.toString;
  19568. /** Used to check objects for own properties. */
  19569. var hasOwnProperty = objectProto.hasOwnProperty;
  19570. /** Used to generate unique IDs. */
  19571. var idCounter = 0;
  19572. /** Used to detect methods masquerading as native. */
  19573. var maskSrcKey = (function() {
  19574. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19575. return uid ? ('Symbol(src)_1.' + uid) : '';
  19576. }());
  19577. /**
  19578. * Used to resolve the
  19579. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19580. * of values.
  19581. */
  19582. var nativeObjectToString = objectProto.toString;
  19583. /** Used to infer the `Object` constructor. */
  19584. var objectCtorString = funcToString.call(Object);
  19585. /** Used to restore the original `_` reference in `_.noConflict`. */
  19586. var oldDash = root._;
  19587. /** Used to detect if a method is native. */
  19588. var reIsNative = RegExp('^' +
  19589. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19590. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19591. );
  19592. /** Built-in value references. */
  19593. var Buffer = moduleExports ? context.Buffer : undefined,
  19594. Symbol = context.Symbol,
  19595. Uint8Array = context.Uint8Array,
  19596. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19597. getPrototype = overArg(Object.getPrototypeOf, Object),
  19598. objectCreate = Object.create,
  19599. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19600. splice = arrayProto.splice,
  19601. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19602. symIterator = Symbol ? Symbol.iterator : undefined,
  19603. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19604. var defineProperty = (function() {
  19605. try {
  19606. var func = getNative(Object, 'defineProperty');
  19607. func({}, '', {});
  19608. return func;
  19609. } catch (e) {}
  19610. }());
  19611. /** Mocked built-ins. */
  19612. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19613. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19614. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19615. /* Built-in method references for those with the same name as other `lodash` methods. */
  19616. var nativeCeil = Math.ceil,
  19617. nativeFloor = Math.floor,
  19618. nativeGetSymbols = Object.getOwnPropertySymbols,
  19619. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19620. nativeIsFinite = context.isFinite,
  19621. nativeJoin = arrayProto.join,
  19622. nativeKeys = overArg(Object.keys, Object),
  19623. nativeMax = Math.max,
  19624. nativeMin = Math.min,
  19625. nativeNow = Date.now,
  19626. nativeParseInt = context.parseInt,
  19627. nativeRandom = Math.random,
  19628. nativeReverse = arrayProto.reverse;
  19629. /* Built-in method references that are verified to be native. */
  19630. var DataView = getNative(context, 'DataView'),
  19631. Map = getNative(context, 'Map'),
  19632. Promise = getNative(context, 'Promise'),
  19633. Set = getNative(context, 'Set'),
  19634. WeakMap = getNative(context, 'WeakMap'),
  19635. nativeCreate = getNative(Object, 'create');
  19636. /** Used to store function metadata. */
  19637. var metaMap = WeakMap && new WeakMap;
  19638. /** Used to lookup unminified function names. */
  19639. var realNames = {};
  19640. /** Used to detect maps, sets, and weakmaps. */
  19641. var dataViewCtorString = toSource(DataView),
  19642. mapCtorString = toSource(Map),
  19643. promiseCtorString = toSource(Promise),
  19644. setCtorString = toSource(Set),
  19645. weakMapCtorString = toSource(WeakMap);
  19646. /** Used to convert symbols to primitives and strings. */
  19647. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19648. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19649. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19650. /*------------------------------------------------------------------------*/
  19651. /**
  19652. * Creates a `lodash` object which wraps `value` to enable implicit method
  19653. * chain sequences. Methods that operate on and return arrays, collections,
  19654. * and functions can be chained together. Methods that retrieve a single value
  19655. * or may return a primitive value will automatically end the chain sequence
  19656. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19657. * with `_#value`.
  19658. *
  19659. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19660. * enabled using `_.chain`.
  19661. *
  19662. * The execution of chained methods is lazy, that is, it's deferred until
  19663. * `_#value` is implicitly or explicitly called.
  19664. *
  19665. * Lazy evaluation allows several methods to support shortcut fusion.
  19666. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19667. * the creation of intermediate arrays and can greatly reduce the number of
  19668. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19669. * fusion if the section is applied to an array and iteratees accept only
  19670. * one argument. The heuristic for whether a section qualifies for shortcut
  19671. * fusion is subject to change.
  19672. *
  19673. * Chaining is supported in custom builds as long as the `_#value` method is
  19674. * directly or indirectly included in the build.
  19675. *
  19676. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19677. *
  19678. * The wrapper `Array` methods are:
  19679. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19680. *
  19681. * The wrapper `String` methods are:
  19682. * `replace` and `split`
  19683. *
  19684. * The wrapper methods that support shortcut fusion are:
  19685. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19686. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19687. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19688. *
  19689. * The chainable wrapper methods are:
  19690. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19691. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19692. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19693. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19694. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19695. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19696. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19697. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19698. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19699. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19700. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19701. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19702. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19703. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19704. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19705. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19706. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19707. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19708. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19709. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19710. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19711. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19712. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19713. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19714. *
  19715. * The wrapper methods that are **not** chainable by default are:
  19716. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19717. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19718. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19719. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19720. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19721. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19722. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19723. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19724. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19725. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19726. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19727. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19728. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19729. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19730. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19731. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19732. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19733. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19734. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19735. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19736. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19737. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19738. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19739. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19740. * `upperFirst`, `value`, and `words`
  19741. *
  19742. * @name _
  19743. * @constructor
  19744. * @category Seq
  19745. * @param {*} value The value to wrap in a `lodash` instance.
  19746. * @returns {Object} Returns the new `lodash` wrapper instance.
  19747. * @example
  19748. *
  19749. * function square(n) {
  19750. * return n * n;
  19751. * }
  19752. *
  19753. * var wrapped = _([1, 2, 3]);
  19754. *
  19755. * // Returns an unwrapped value.
  19756. * wrapped.reduce(_.add);
  19757. * // => 6
  19758. *
  19759. * // Returns a wrapped value.
  19760. * var squares = wrapped.map(square);
  19761. *
  19762. * _.isArray(squares);
  19763. * // => false
  19764. *
  19765. * _.isArray(squares.value());
  19766. * // => true
  19767. */
  19768. function lodash(value) {
  19769. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19770. if (value instanceof LodashWrapper) {
  19771. return value;
  19772. }
  19773. if (hasOwnProperty.call(value, '__wrapped__')) {
  19774. return wrapperClone(value);
  19775. }
  19776. }
  19777. return new LodashWrapper(value);
  19778. }
  19779. /**
  19780. * The base implementation of `_.create` without support for assigning
  19781. * properties to the created object.
  19782. *
  19783. * @private
  19784. * @param {Object} proto The object to inherit from.
  19785. * @returns {Object} Returns the new object.
  19786. */
  19787. var baseCreate = (function() {
  19788. function object() {}
  19789. return function(proto) {
  19790. if (!isObject(proto)) {
  19791. return {};
  19792. }
  19793. if (objectCreate) {
  19794. return objectCreate(proto);
  19795. }
  19796. object.prototype = proto;
  19797. var result = new object;
  19798. object.prototype = undefined;
  19799. return result;
  19800. };
  19801. }());
  19802. /**
  19803. * The function whose prototype chain sequence wrappers inherit from.
  19804. *
  19805. * @private
  19806. */
  19807. function baseLodash() {
  19808. // No operation performed.
  19809. }
  19810. /**
  19811. * The base constructor for creating `lodash` wrapper objects.
  19812. *
  19813. * @private
  19814. * @param {*} value The value to wrap.
  19815. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19816. */
  19817. function LodashWrapper(value, chainAll) {
  19818. this.__wrapped__ = value;
  19819. this.__actions__ = [];
  19820. this.__chain__ = !!chainAll;
  19821. this.__index__ = 0;
  19822. this.__values__ = undefined;
  19823. }
  19824. /**
  19825. * By default, the template delimiters used by lodash are like those in
  19826. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19827. * following template settings to use alternative delimiters.
  19828. *
  19829. * @static
  19830. * @memberOf _
  19831. * @type {Object}
  19832. */
  19833. lodash.templateSettings = {
  19834. /**
  19835. * Used to detect `data` property values to be HTML-escaped.
  19836. *
  19837. * @memberOf _.templateSettings
  19838. * @type {RegExp}
  19839. */
  19840. 'escape': reEscape,
  19841. /**
  19842. * Used to detect code to be evaluated.
  19843. *
  19844. * @memberOf _.templateSettings
  19845. * @type {RegExp}
  19846. */
  19847. 'evaluate': reEvaluate,
  19848. /**
  19849. * Used to detect `data` property values to inject.
  19850. *
  19851. * @memberOf _.templateSettings
  19852. * @type {RegExp}
  19853. */
  19854. 'interpolate': reInterpolate,
  19855. /**
  19856. * Used to reference the data object in the template text.
  19857. *
  19858. * @memberOf _.templateSettings
  19859. * @type {string}
  19860. */
  19861. 'variable': '',
  19862. /**
  19863. * Used to import variables into the compiled template.
  19864. *
  19865. * @memberOf _.templateSettings
  19866. * @type {Object}
  19867. */
  19868. 'imports': {
  19869. /**
  19870. * A reference to the `lodash` function.
  19871. *
  19872. * @memberOf _.templateSettings.imports
  19873. * @type {Function}
  19874. */
  19875. '_': lodash
  19876. }
  19877. };
  19878. // Ensure wrappers are instances of `baseLodash`.
  19879. lodash.prototype = baseLodash.prototype;
  19880. lodash.prototype.constructor = lodash;
  19881. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19882. LodashWrapper.prototype.constructor = LodashWrapper;
  19883. /*------------------------------------------------------------------------*/
  19884. /**
  19885. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19886. *
  19887. * @private
  19888. * @constructor
  19889. * @param {*} value The value to wrap.
  19890. */
  19891. function LazyWrapper(value) {
  19892. this.__wrapped__ = value;
  19893. this.__actions__ = [];
  19894. this.__dir__ = 1;
  19895. this.__filtered__ = false;
  19896. this.__iteratees__ = [];
  19897. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19898. this.__views__ = [];
  19899. }
  19900. /**
  19901. * Creates a clone of the lazy wrapper object.
  19902. *
  19903. * @private
  19904. * @name clone
  19905. * @memberOf LazyWrapper
  19906. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19907. */
  19908. function lazyClone() {
  19909. var result = new LazyWrapper(this.__wrapped__);
  19910. result.__actions__ = copyArray(this.__actions__);
  19911. result.__dir__ = this.__dir__;
  19912. result.__filtered__ = this.__filtered__;
  19913. result.__iteratees__ = copyArray(this.__iteratees__);
  19914. result.__takeCount__ = this.__takeCount__;
  19915. result.__views__ = copyArray(this.__views__);
  19916. return result;
  19917. }
  19918. /**
  19919. * Reverses the direction of lazy iteration.
  19920. *
  19921. * @private
  19922. * @name reverse
  19923. * @memberOf LazyWrapper
  19924. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19925. */
  19926. function lazyReverse() {
  19927. if (this.__filtered__) {
  19928. var result = new LazyWrapper(this);
  19929. result.__dir__ = -1;
  19930. result.__filtered__ = true;
  19931. } else {
  19932. result = this.clone();
  19933. result.__dir__ *= -1;
  19934. }
  19935. return result;
  19936. }
  19937. /**
  19938. * Extracts the unwrapped value from its lazy wrapper.
  19939. *
  19940. * @private
  19941. * @name value
  19942. * @memberOf LazyWrapper
  19943. * @returns {*} Returns the unwrapped value.
  19944. */
  19945. function lazyValue() {
  19946. var array = this.__wrapped__.value(),
  19947. dir = this.__dir__,
  19948. isArr = isArray(array),
  19949. isRight = dir < 0,
  19950. arrLength = isArr ? array.length : 0,
  19951. view = getView(0, arrLength, this.__views__),
  19952. start = view.start,
  19953. end = view.end,
  19954. length = end - start,
  19955. index = isRight ? end : (start - 1),
  19956. iteratees = this.__iteratees__,
  19957. iterLength = iteratees.length,
  19958. resIndex = 0,
  19959. takeCount = nativeMin(length, this.__takeCount__);
  19960. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19961. return baseWrapperValue(array, this.__actions__);
  19962. }
  19963. var result = [];
  19964. outer:
  19965. while (length-- && resIndex < takeCount) {
  19966. index += dir;
  19967. var iterIndex = -1,
  19968. value = array[index];
  19969. while (++iterIndex < iterLength) {
  19970. var data = iteratees[iterIndex],
  19971. iteratee = data.iteratee,
  19972. type = data.type,
  19973. computed = iteratee(value);
  19974. if (type == LAZY_MAP_FLAG) {
  19975. value = computed;
  19976. } else if (!computed) {
  19977. if (type == LAZY_FILTER_FLAG) {
  19978. continue outer;
  19979. } else {
  19980. break outer;
  19981. }
  19982. }
  19983. }
  19984. result[resIndex++] = value;
  19985. }
  19986. return result;
  19987. }
  19988. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19989. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19990. LazyWrapper.prototype.constructor = LazyWrapper;
  19991. /*------------------------------------------------------------------------*/
  19992. /**
  19993. * Creates a hash object.
  19994. *
  19995. * @private
  19996. * @constructor
  19997. * @param {Array} [entries] The key-value pairs to cache.
  19998. */
  19999. function Hash(entries) {
  20000. var index = -1,
  20001. length = entries == null ? 0 : entries.length;
  20002. this.clear();
  20003. while (++index < length) {
  20004. var entry = entries[index];
  20005. this.set(entry[0], entry[1]);
  20006. }
  20007. }
  20008. /**
  20009. * Removes all key-value entries from the hash.
  20010. *
  20011. * @private
  20012. * @name clear
  20013. * @memberOf Hash
  20014. */
  20015. function hashClear() {
  20016. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20017. this.size = 0;
  20018. }
  20019. /**
  20020. * Removes `key` and its value from the hash.
  20021. *
  20022. * @private
  20023. * @name delete
  20024. * @memberOf Hash
  20025. * @param {Object} hash The hash to modify.
  20026. * @param {string} key The key of the value to remove.
  20027. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20028. */
  20029. function hashDelete(key) {
  20030. var result = this.has(key) && delete this.__data__[key];
  20031. this.size -= result ? 1 : 0;
  20032. return result;
  20033. }
  20034. /**
  20035. * Gets the hash value for `key`.
  20036. *
  20037. * @private
  20038. * @name get
  20039. * @memberOf Hash
  20040. * @param {string} key The key of the value to get.
  20041. * @returns {*} Returns the entry value.
  20042. */
  20043. function hashGet(key) {
  20044. var data = this.__data__;
  20045. if (nativeCreate) {
  20046. var result = data[key];
  20047. return result === HASH_UNDEFINED ? undefined : result;
  20048. }
  20049. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20050. }
  20051. /**
  20052. * Checks if a hash value for `key` exists.
  20053. *
  20054. * @private
  20055. * @name has
  20056. * @memberOf Hash
  20057. * @param {string} key The key of the entry to check.
  20058. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20059. */
  20060. function hashHas(key) {
  20061. var data = this.__data__;
  20062. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20063. }
  20064. /**
  20065. * Sets the hash `key` to `value`.
  20066. *
  20067. * @private
  20068. * @name set
  20069. * @memberOf Hash
  20070. * @param {string} key The key of the value to set.
  20071. * @param {*} value The value to set.
  20072. * @returns {Object} Returns the hash instance.
  20073. */
  20074. function hashSet(key, value) {
  20075. var data = this.__data__;
  20076. this.size += this.has(key) ? 0 : 1;
  20077. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20078. return this;
  20079. }
  20080. // Add methods to `Hash`.
  20081. Hash.prototype.clear = hashClear;
  20082. Hash.prototype['delete'] = hashDelete;
  20083. Hash.prototype.get = hashGet;
  20084. Hash.prototype.has = hashHas;
  20085. Hash.prototype.set = hashSet;
  20086. /*------------------------------------------------------------------------*/
  20087. /**
  20088. * Creates an list cache object.
  20089. *
  20090. * @private
  20091. * @constructor
  20092. * @param {Array} [entries] The key-value pairs to cache.
  20093. */
  20094. function ListCache(entries) {
  20095. var index = -1,
  20096. length = entries == null ? 0 : entries.length;
  20097. this.clear();
  20098. while (++index < length) {
  20099. var entry = entries[index];
  20100. this.set(entry[0], entry[1]);
  20101. }
  20102. }
  20103. /**
  20104. * Removes all key-value entries from the list cache.
  20105. *
  20106. * @private
  20107. * @name clear
  20108. * @memberOf ListCache
  20109. */
  20110. function listCacheClear() {
  20111. this.__data__ = [];
  20112. this.size = 0;
  20113. }
  20114. /**
  20115. * Removes `key` and its value from the list cache.
  20116. *
  20117. * @private
  20118. * @name delete
  20119. * @memberOf ListCache
  20120. * @param {string} key The key of the value to remove.
  20121. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20122. */
  20123. function listCacheDelete(key) {
  20124. var data = this.__data__,
  20125. index = assocIndexOf(data, key);
  20126. if (index < 0) {
  20127. return false;
  20128. }
  20129. var lastIndex = data.length - 1;
  20130. if (index == lastIndex) {
  20131. data.pop();
  20132. } else {
  20133. splice.call(data, index, 1);
  20134. }
  20135. --this.size;
  20136. return true;
  20137. }
  20138. /**
  20139. * Gets the list cache value for `key`.
  20140. *
  20141. * @private
  20142. * @name get
  20143. * @memberOf ListCache
  20144. * @param {string} key The key of the value to get.
  20145. * @returns {*} Returns the entry value.
  20146. */
  20147. function listCacheGet(key) {
  20148. var data = this.__data__,
  20149. index = assocIndexOf(data, key);
  20150. return index < 0 ? undefined : data[index][1];
  20151. }
  20152. /**
  20153. * Checks if a list cache value for `key` exists.
  20154. *
  20155. * @private
  20156. * @name has
  20157. * @memberOf ListCache
  20158. * @param {string} key The key of the entry to check.
  20159. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20160. */
  20161. function listCacheHas(key) {
  20162. return assocIndexOf(this.__data__, key) > -1;
  20163. }
  20164. /**
  20165. * Sets the list cache `key` to `value`.
  20166. *
  20167. * @private
  20168. * @name set
  20169. * @memberOf ListCache
  20170. * @param {string} key The key of the value to set.
  20171. * @param {*} value The value to set.
  20172. * @returns {Object} Returns the list cache instance.
  20173. */
  20174. function listCacheSet(key, value) {
  20175. var data = this.__data__,
  20176. index = assocIndexOf(data, key);
  20177. if (index < 0) {
  20178. ++this.size;
  20179. data.push([key, value]);
  20180. } else {
  20181. data[index][1] = value;
  20182. }
  20183. return this;
  20184. }
  20185. // Add methods to `ListCache`.
  20186. ListCache.prototype.clear = listCacheClear;
  20187. ListCache.prototype['delete'] = listCacheDelete;
  20188. ListCache.prototype.get = listCacheGet;
  20189. ListCache.prototype.has = listCacheHas;
  20190. ListCache.prototype.set = listCacheSet;
  20191. /*------------------------------------------------------------------------*/
  20192. /**
  20193. * Creates a map cache object to store key-value pairs.
  20194. *
  20195. * @private
  20196. * @constructor
  20197. * @param {Array} [entries] The key-value pairs to cache.
  20198. */
  20199. function MapCache(entries) {
  20200. var index = -1,
  20201. length = entries == null ? 0 : entries.length;
  20202. this.clear();
  20203. while (++index < length) {
  20204. var entry = entries[index];
  20205. this.set(entry[0], entry[1]);
  20206. }
  20207. }
  20208. /**
  20209. * Removes all key-value entries from the map.
  20210. *
  20211. * @private
  20212. * @name clear
  20213. * @memberOf MapCache
  20214. */
  20215. function mapCacheClear() {
  20216. this.size = 0;
  20217. this.__data__ = {
  20218. 'hash': new Hash,
  20219. 'map': new (Map || ListCache),
  20220. 'string': new Hash
  20221. };
  20222. }
  20223. /**
  20224. * Removes `key` and its value from the map.
  20225. *
  20226. * @private
  20227. * @name delete
  20228. * @memberOf MapCache
  20229. * @param {string} key The key of the value to remove.
  20230. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20231. */
  20232. function mapCacheDelete(key) {
  20233. var result = getMapData(this, key)['delete'](key);
  20234. this.size -= result ? 1 : 0;
  20235. return result;
  20236. }
  20237. /**
  20238. * Gets the map value for `key`.
  20239. *
  20240. * @private
  20241. * @name get
  20242. * @memberOf MapCache
  20243. * @param {string} key The key of the value to get.
  20244. * @returns {*} Returns the entry value.
  20245. */
  20246. function mapCacheGet(key) {
  20247. return getMapData(this, key).get(key);
  20248. }
  20249. /**
  20250. * Checks if a map value for `key` exists.
  20251. *
  20252. * @private
  20253. * @name has
  20254. * @memberOf MapCache
  20255. * @param {string} key The key of the entry to check.
  20256. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20257. */
  20258. function mapCacheHas(key) {
  20259. return getMapData(this, key).has(key);
  20260. }
  20261. /**
  20262. * Sets the map `key` to `value`.
  20263. *
  20264. * @private
  20265. * @name set
  20266. * @memberOf MapCache
  20267. * @param {string} key The key of the value to set.
  20268. * @param {*} value The value to set.
  20269. * @returns {Object} Returns the map cache instance.
  20270. */
  20271. function mapCacheSet(key, value) {
  20272. var data = getMapData(this, key),
  20273. size = data.size;
  20274. data.set(key, value);
  20275. this.size += data.size == size ? 0 : 1;
  20276. return this;
  20277. }
  20278. // Add methods to `MapCache`.
  20279. MapCache.prototype.clear = mapCacheClear;
  20280. MapCache.prototype['delete'] = mapCacheDelete;
  20281. MapCache.prototype.get = mapCacheGet;
  20282. MapCache.prototype.has = mapCacheHas;
  20283. MapCache.prototype.set = mapCacheSet;
  20284. /*------------------------------------------------------------------------*/
  20285. /**
  20286. *
  20287. * Creates an array cache object to store unique values.
  20288. *
  20289. * @private
  20290. * @constructor
  20291. * @param {Array} [values] The values to cache.
  20292. */
  20293. function SetCache(values) {
  20294. var index = -1,
  20295. length = values == null ? 0 : values.length;
  20296. this.__data__ = new MapCache;
  20297. while (++index < length) {
  20298. this.add(values[index]);
  20299. }
  20300. }
  20301. /**
  20302. * Adds `value` to the array cache.
  20303. *
  20304. * @private
  20305. * @name add
  20306. * @memberOf SetCache
  20307. * @alias push
  20308. * @param {*} value The value to cache.
  20309. * @returns {Object} Returns the cache instance.
  20310. */
  20311. function setCacheAdd(value) {
  20312. this.__data__.set(value, HASH_UNDEFINED);
  20313. return this;
  20314. }
  20315. /**
  20316. * Checks if `value` is in the array cache.
  20317. *
  20318. * @private
  20319. * @name has
  20320. * @memberOf SetCache
  20321. * @param {*} value The value to search for.
  20322. * @returns {number} Returns `true` if `value` is found, else `false`.
  20323. */
  20324. function setCacheHas(value) {
  20325. return this.__data__.has(value);
  20326. }
  20327. // Add methods to `SetCache`.
  20328. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20329. SetCache.prototype.has = setCacheHas;
  20330. /*------------------------------------------------------------------------*/
  20331. /**
  20332. * Creates a stack cache object to store key-value pairs.
  20333. *
  20334. * @private
  20335. * @constructor
  20336. * @param {Array} [entries] The key-value pairs to cache.
  20337. */
  20338. function Stack(entries) {
  20339. var data = this.__data__ = new ListCache(entries);
  20340. this.size = data.size;
  20341. }
  20342. /**
  20343. * Removes all key-value entries from the stack.
  20344. *
  20345. * @private
  20346. * @name clear
  20347. * @memberOf Stack
  20348. */
  20349. function stackClear() {
  20350. this.__data__ = new ListCache;
  20351. this.size = 0;
  20352. }
  20353. /**
  20354. * Removes `key` and its value from the stack.
  20355. *
  20356. * @private
  20357. * @name delete
  20358. * @memberOf Stack
  20359. * @param {string} key The key of the value to remove.
  20360. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20361. */
  20362. function stackDelete(key) {
  20363. var data = this.__data__,
  20364. result = data['delete'](key);
  20365. this.size = data.size;
  20366. return result;
  20367. }
  20368. /**
  20369. * Gets the stack value for `key`.
  20370. *
  20371. * @private
  20372. * @name get
  20373. * @memberOf Stack
  20374. * @param {string} key The key of the value to get.
  20375. * @returns {*} Returns the entry value.
  20376. */
  20377. function stackGet(key) {
  20378. return this.__data__.get(key);
  20379. }
  20380. /**
  20381. * Checks if a stack value for `key` exists.
  20382. *
  20383. * @private
  20384. * @name has
  20385. * @memberOf Stack
  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 stackHas(key) {
  20390. return this.__data__.has(key);
  20391. }
  20392. /**
  20393. * Sets the stack `key` to `value`.
  20394. *
  20395. * @private
  20396. * @name set
  20397. * @memberOf Stack
  20398. * @param {string} key The key of the value to set.
  20399. * @param {*} value The value to set.
  20400. * @returns {Object} Returns the stack cache instance.
  20401. */
  20402. function stackSet(key, value) {
  20403. var data = this.__data__;
  20404. if (data instanceof ListCache) {
  20405. var pairs = data.__data__;
  20406. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20407. pairs.push([key, value]);
  20408. this.size = ++data.size;
  20409. return this;
  20410. }
  20411. data = this.__data__ = new MapCache(pairs);
  20412. }
  20413. data.set(key, value);
  20414. this.size = data.size;
  20415. return this;
  20416. }
  20417. // Add methods to `Stack`.
  20418. Stack.prototype.clear = stackClear;
  20419. Stack.prototype['delete'] = stackDelete;
  20420. Stack.prototype.get = stackGet;
  20421. Stack.prototype.has = stackHas;
  20422. Stack.prototype.set = stackSet;
  20423. /*------------------------------------------------------------------------*/
  20424. /**
  20425. * Creates an array of the enumerable property names of the array-like `value`.
  20426. *
  20427. * @private
  20428. * @param {*} value The value to query.
  20429. * @param {boolean} inherited Specify returning inherited property names.
  20430. * @returns {Array} Returns the array of property names.
  20431. */
  20432. function arrayLikeKeys(value, inherited) {
  20433. var isArr = isArray(value),
  20434. isArg = !isArr && isArguments(value),
  20435. isBuff = !isArr && !isArg && isBuffer(value),
  20436. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20437. skipIndexes = isArr || isArg || isBuff || isType,
  20438. result = skipIndexes ? baseTimes(value.length, String) : [],
  20439. length = result.length;
  20440. for (var key in value) {
  20441. if ((inherited || hasOwnProperty.call(value, key)) &&
  20442. !(skipIndexes && (
  20443. // Safari 9 has enumerable `arguments.length` in strict mode.
  20444. key == 'length' ||
  20445. // Node.js 0.10 has enumerable non-index properties on buffers.
  20446. (isBuff && (key == 'offset' || key == 'parent')) ||
  20447. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20448. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20449. // Skip index properties.
  20450. isIndex(key, length)
  20451. ))) {
  20452. result.push(key);
  20453. }
  20454. }
  20455. return result;
  20456. }
  20457. /**
  20458. * A specialized version of `_.sample` for arrays.
  20459. *
  20460. * @private
  20461. * @param {Array} array The array to sample.
  20462. * @returns {*} Returns the random element.
  20463. */
  20464. function arraySample(array) {
  20465. var length = array.length;
  20466. return length ? array[baseRandom(0, length - 1)] : undefined;
  20467. }
  20468. /**
  20469. * A specialized version of `_.sampleSize` for arrays.
  20470. *
  20471. * @private
  20472. * @param {Array} array The array to sample.
  20473. * @param {number} n The number of elements to sample.
  20474. * @returns {Array} Returns the random elements.
  20475. */
  20476. function arraySampleSize(array, n) {
  20477. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20478. }
  20479. /**
  20480. * A specialized version of `_.shuffle` for arrays.
  20481. *
  20482. * @private
  20483. * @param {Array} array The array to shuffle.
  20484. * @returns {Array} Returns the new shuffled array.
  20485. */
  20486. function arrayShuffle(array) {
  20487. return shuffleSelf(copyArray(array));
  20488. }
  20489. /**
  20490. * This function is like `assignValue` except that it doesn't assign
  20491. * `undefined` values.
  20492. *
  20493. * @private
  20494. * @param {Object} object The object to modify.
  20495. * @param {string} key The key of the property to assign.
  20496. * @param {*} value The value to assign.
  20497. */
  20498. function assignMergeValue(object, key, value) {
  20499. if ((value !== undefined && !eq(object[key], value)) ||
  20500. (value === undefined && !(key in object))) {
  20501. baseAssignValue(object, key, value);
  20502. }
  20503. }
  20504. /**
  20505. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20506. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20507. * for equality comparisons.
  20508. *
  20509. * @private
  20510. * @param {Object} object The object to modify.
  20511. * @param {string} key The key of the property to assign.
  20512. * @param {*} value The value to assign.
  20513. */
  20514. function assignValue(object, key, value) {
  20515. var objValue = object[key];
  20516. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20517. (value === undefined && !(key in object))) {
  20518. baseAssignValue(object, key, value);
  20519. }
  20520. }
  20521. /**
  20522. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20523. *
  20524. * @private
  20525. * @param {Array} array The array to inspect.
  20526. * @param {*} key The key to search for.
  20527. * @returns {number} Returns the index of the matched value, else `-1`.
  20528. */
  20529. function assocIndexOf(array, key) {
  20530. var length = array.length;
  20531. while (length--) {
  20532. if (eq(array[length][0], key)) {
  20533. return length;
  20534. }
  20535. }
  20536. return -1;
  20537. }
  20538. /**
  20539. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20540. * by `iteratee` and values set by `setter`.
  20541. *
  20542. * @private
  20543. * @param {Array|Object} collection The collection to iterate over.
  20544. * @param {Function} setter The function to set `accumulator` values.
  20545. * @param {Function} iteratee The iteratee to transform keys.
  20546. * @param {Object} accumulator The initial aggregated object.
  20547. * @returns {Function} Returns `accumulator`.
  20548. */
  20549. function baseAggregator(collection, setter, iteratee, accumulator) {
  20550. baseEach(collection, function(value, key, collection) {
  20551. setter(accumulator, value, iteratee(value), collection);
  20552. });
  20553. return accumulator;
  20554. }
  20555. /**
  20556. * The base implementation of `_.assign` without support for multiple sources
  20557. * or `customizer` functions.
  20558. *
  20559. * @private
  20560. * @param {Object} object The destination object.
  20561. * @param {Object} source The source object.
  20562. * @returns {Object} Returns `object`.
  20563. */
  20564. function baseAssign(object, source) {
  20565. return object && copyObject(source, keys(source), object);
  20566. }
  20567. /**
  20568. * The base implementation of `_.assignIn` without support for multiple sources
  20569. * or `customizer` functions.
  20570. *
  20571. * @private
  20572. * @param {Object} object The destination object.
  20573. * @param {Object} source The source object.
  20574. * @returns {Object} Returns `object`.
  20575. */
  20576. function baseAssignIn(object, source) {
  20577. return object && copyObject(source, keysIn(source), object);
  20578. }
  20579. /**
  20580. * The base implementation of `assignValue` and `assignMergeValue` without
  20581. * value checks.
  20582. *
  20583. * @private
  20584. * @param {Object} object The object to modify.
  20585. * @param {string} key The key of the property to assign.
  20586. * @param {*} value The value to assign.
  20587. */
  20588. function baseAssignValue(object, key, value) {
  20589. if (key == '__proto__' && defineProperty) {
  20590. defineProperty(object, key, {
  20591. 'configurable': true,
  20592. 'enumerable': true,
  20593. 'value': value,
  20594. 'writable': true
  20595. });
  20596. } else {
  20597. object[key] = value;
  20598. }
  20599. }
  20600. /**
  20601. * The base implementation of `_.at` without support for individual paths.
  20602. *
  20603. * @private
  20604. * @param {Object} object The object to iterate over.
  20605. * @param {string[]} paths The property paths to pick.
  20606. * @returns {Array} Returns the picked elements.
  20607. */
  20608. function baseAt(object, paths) {
  20609. var index = -1,
  20610. length = paths.length,
  20611. result = Array(length),
  20612. skip = object == null;
  20613. while (++index < length) {
  20614. result[index] = skip ? undefined : get(object, paths[index]);
  20615. }
  20616. return result;
  20617. }
  20618. /**
  20619. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20620. *
  20621. * @private
  20622. * @param {number} number The number to clamp.
  20623. * @param {number} [lower] The lower bound.
  20624. * @param {number} upper The upper bound.
  20625. * @returns {number} Returns the clamped number.
  20626. */
  20627. function baseClamp(number, lower, upper) {
  20628. if (number === number) {
  20629. if (upper !== undefined) {
  20630. number = number <= upper ? number : upper;
  20631. }
  20632. if (lower !== undefined) {
  20633. number = number >= lower ? number : lower;
  20634. }
  20635. }
  20636. return number;
  20637. }
  20638. /**
  20639. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20640. * traversed objects.
  20641. *
  20642. * @private
  20643. * @param {*} value The value to clone.
  20644. * @param {boolean} bitmask The bitmask flags.
  20645. * 1 - Deep clone
  20646. * 2 - Flatten inherited properties
  20647. * 4 - Clone symbols
  20648. * @param {Function} [customizer] The function to customize cloning.
  20649. * @param {string} [key] The key of `value`.
  20650. * @param {Object} [object] The parent object of `value`.
  20651. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20652. * @returns {*} Returns the cloned value.
  20653. */
  20654. function baseClone(value, bitmask, customizer, key, object, stack) {
  20655. var result,
  20656. isDeep = bitmask & CLONE_DEEP_FLAG,
  20657. isFlat = bitmask & CLONE_FLAT_FLAG,
  20658. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20659. if (customizer) {
  20660. result = object ? customizer(value, key, object, stack) : customizer(value);
  20661. }
  20662. if (result !== undefined) {
  20663. return result;
  20664. }
  20665. if (!isObject(value)) {
  20666. return value;
  20667. }
  20668. var isArr = isArray(value);
  20669. if (isArr) {
  20670. result = initCloneArray(value);
  20671. if (!isDeep) {
  20672. return copyArray(value, result);
  20673. }
  20674. } else {
  20675. var tag = getTag(value),
  20676. isFunc = tag == funcTag || tag == genTag;
  20677. if (isBuffer(value)) {
  20678. return cloneBuffer(value, isDeep);
  20679. }
  20680. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20681. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20682. if (!isDeep) {
  20683. return isFlat
  20684. ? copySymbolsIn(value, baseAssignIn(result, value))
  20685. : copySymbols(value, baseAssign(result, value));
  20686. }
  20687. } else {
  20688. if (!cloneableTags[tag]) {
  20689. return object ? value : {};
  20690. }
  20691. result = initCloneByTag(value, tag, isDeep);
  20692. }
  20693. }
  20694. // Check for circular references and return its corresponding clone.
  20695. stack || (stack = new Stack);
  20696. var stacked = stack.get(value);
  20697. if (stacked) {
  20698. return stacked;
  20699. }
  20700. stack.set(value, result);
  20701. if (isSet(value)) {
  20702. value.forEach(function(subValue) {
  20703. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20704. });
  20705. } else if (isMap(value)) {
  20706. value.forEach(function(subValue, key) {
  20707. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20708. });
  20709. }
  20710. var keysFunc = isFull
  20711. ? (isFlat ? getAllKeysIn : getAllKeys)
  20712. : (isFlat ? keysIn : keys);
  20713. var props = isArr ? undefined : keysFunc(value);
  20714. arrayEach(props || value, function(subValue, key) {
  20715. if (props) {
  20716. key = subValue;
  20717. subValue = value[key];
  20718. }
  20719. // Recursively populate clone (susceptible to call stack limits).
  20720. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20721. });
  20722. return result;
  20723. }
  20724. /**
  20725. * The base implementation of `_.conforms` which doesn't clone `source`.
  20726. *
  20727. * @private
  20728. * @param {Object} source The object of property predicates to conform to.
  20729. * @returns {Function} Returns the new spec function.
  20730. */
  20731. function baseConforms(source) {
  20732. var props = keys(source);
  20733. return function(object) {
  20734. return baseConformsTo(object, source, props);
  20735. };
  20736. }
  20737. /**
  20738. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20739. *
  20740. * @private
  20741. * @param {Object} object The object to inspect.
  20742. * @param {Object} source The object of property predicates to conform to.
  20743. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20744. */
  20745. function baseConformsTo(object, source, props) {
  20746. var length = props.length;
  20747. if (object == null) {
  20748. return !length;
  20749. }
  20750. object = Object(object);
  20751. while (length--) {
  20752. var key = props[length],
  20753. predicate = source[key],
  20754. value = object[key];
  20755. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20756. return false;
  20757. }
  20758. }
  20759. return true;
  20760. }
  20761. /**
  20762. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20763. * to provide to `func`.
  20764. *
  20765. * @private
  20766. * @param {Function} func The function to delay.
  20767. * @param {number} wait The number of milliseconds to delay invocation.
  20768. * @param {Array} args The arguments to provide to `func`.
  20769. * @returns {number|Object} Returns the timer id or timeout object.
  20770. */
  20771. function baseDelay(func, wait, args) {
  20772. if (typeof func != 'function') {
  20773. throw new TypeError(FUNC_ERROR_TEXT);
  20774. }
  20775. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20776. }
  20777. /**
  20778. * The base implementation of methods like `_.difference` without support
  20779. * for excluding multiple arrays or iteratee shorthands.
  20780. *
  20781. * @private
  20782. * @param {Array} array The array to inspect.
  20783. * @param {Array} values The values to exclude.
  20784. * @param {Function} [iteratee] The iteratee invoked per element.
  20785. * @param {Function} [comparator] The comparator invoked per element.
  20786. * @returns {Array} Returns the new array of filtered values.
  20787. */
  20788. function baseDifference(array, values, iteratee, comparator) {
  20789. var index = -1,
  20790. includes = arrayIncludes,
  20791. isCommon = true,
  20792. length = array.length,
  20793. result = [],
  20794. valuesLength = values.length;
  20795. if (!length) {
  20796. return result;
  20797. }
  20798. if (iteratee) {
  20799. values = arrayMap(values, baseUnary(iteratee));
  20800. }
  20801. if (comparator) {
  20802. includes = arrayIncludesWith;
  20803. isCommon = false;
  20804. }
  20805. else if (values.length >= LARGE_ARRAY_SIZE) {
  20806. includes = cacheHas;
  20807. isCommon = false;
  20808. values = new SetCache(values);
  20809. }
  20810. outer:
  20811. while (++index < length) {
  20812. var value = array[index],
  20813. computed = iteratee == null ? value : iteratee(value);
  20814. value = (comparator || value !== 0) ? value : 0;
  20815. if (isCommon && computed === computed) {
  20816. var valuesIndex = valuesLength;
  20817. while (valuesIndex--) {
  20818. if (values[valuesIndex] === computed) {
  20819. continue outer;
  20820. }
  20821. }
  20822. result.push(value);
  20823. }
  20824. else if (!includes(values, computed, comparator)) {
  20825. result.push(value);
  20826. }
  20827. }
  20828. return result;
  20829. }
  20830. /**
  20831. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20832. *
  20833. * @private
  20834. * @param {Array|Object} collection The collection to iterate over.
  20835. * @param {Function} iteratee The function invoked per iteration.
  20836. * @returns {Array|Object} Returns `collection`.
  20837. */
  20838. var baseEach = createBaseEach(baseForOwn);
  20839. /**
  20840. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20841. *
  20842. * @private
  20843. * @param {Array|Object} collection The collection to iterate over.
  20844. * @param {Function} iteratee The function invoked per iteration.
  20845. * @returns {Array|Object} Returns `collection`.
  20846. */
  20847. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20848. /**
  20849. * The base implementation of `_.every` without support for iteratee shorthands.
  20850. *
  20851. * @private
  20852. * @param {Array|Object} collection The collection to iterate over.
  20853. * @param {Function} predicate The function invoked per iteration.
  20854. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20855. * else `false`
  20856. */
  20857. function baseEvery(collection, predicate) {
  20858. var result = true;
  20859. baseEach(collection, function(value, index, collection) {
  20860. result = !!predicate(value, index, collection);
  20861. return result;
  20862. });
  20863. return result;
  20864. }
  20865. /**
  20866. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20867. * `comparator` to determine the extremum value.
  20868. *
  20869. * @private
  20870. * @param {Array} array The array to iterate over.
  20871. * @param {Function} iteratee The iteratee invoked per iteration.
  20872. * @param {Function} comparator The comparator used to compare values.
  20873. * @returns {*} Returns the extremum value.
  20874. */
  20875. function baseExtremum(array, iteratee, comparator) {
  20876. var index = -1,
  20877. length = array.length;
  20878. while (++index < length) {
  20879. var value = array[index],
  20880. current = iteratee(value);
  20881. if (current != null && (computed === undefined
  20882. ? (current === current && !isSymbol(current))
  20883. : comparator(current, computed)
  20884. )) {
  20885. var computed = current,
  20886. result = value;
  20887. }
  20888. }
  20889. return result;
  20890. }
  20891. /**
  20892. * The base implementation of `_.fill` without an iteratee call guard.
  20893. *
  20894. * @private
  20895. * @param {Array} array The array to fill.
  20896. * @param {*} value The value to fill `array` with.
  20897. * @param {number} [start=0] The start position.
  20898. * @param {number} [end=array.length] The end position.
  20899. * @returns {Array} Returns `array`.
  20900. */
  20901. function baseFill(array, value, start, end) {
  20902. var length = array.length;
  20903. start = toInteger(start);
  20904. if (start < 0) {
  20905. start = -start > length ? 0 : (length + start);
  20906. }
  20907. end = (end === undefined || end > length) ? length : toInteger(end);
  20908. if (end < 0) {
  20909. end += length;
  20910. }
  20911. end = start > end ? 0 : toLength(end);
  20912. while (start < end) {
  20913. array[start++] = value;
  20914. }
  20915. return array;
  20916. }
  20917. /**
  20918. * The base implementation of `_.filter` without support for iteratee shorthands.
  20919. *
  20920. * @private
  20921. * @param {Array|Object} collection The collection to iterate over.
  20922. * @param {Function} predicate The function invoked per iteration.
  20923. * @returns {Array} Returns the new filtered array.
  20924. */
  20925. function baseFilter(collection, predicate) {
  20926. var result = [];
  20927. baseEach(collection, function(value, index, collection) {
  20928. if (predicate(value, index, collection)) {
  20929. result.push(value);
  20930. }
  20931. });
  20932. return result;
  20933. }
  20934. /**
  20935. * The base implementation of `_.flatten` with support for restricting flattening.
  20936. *
  20937. * @private
  20938. * @param {Array} array The array to flatten.
  20939. * @param {number} depth The maximum recursion depth.
  20940. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20941. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20942. * @param {Array} [result=[]] The initial result value.
  20943. * @returns {Array} Returns the new flattened array.
  20944. */
  20945. function baseFlatten(array, depth, predicate, isStrict, result) {
  20946. var index = -1,
  20947. length = array.length;
  20948. predicate || (predicate = isFlattenable);
  20949. result || (result = []);
  20950. while (++index < length) {
  20951. var value = array[index];
  20952. if (depth > 0 && predicate(value)) {
  20953. if (depth > 1) {
  20954. // Recursively flatten arrays (susceptible to call stack limits).
  20955. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20956. } else {
  20957. arrayPush(result, value);
  20958. }
  20959. } else if (!isStrict) {
  20960. result[result.length] = value;
  20961. }
  20962. }
  20963. return result;
  20964. }
  20965. /**
  20966. * The base implementation of `baseForOwn` which iterates over `object`
  20967. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20968. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20969. *
  20970. * @private
  20971. * @param {Object} object The object to iterate over.
  20972. * @param {Function} iteratee The function invoked per iteration.
  20973. * @param {Function} keysFunc The function to get the keys of `object`.
  20974. * @returns {Object} Returns `object`.
  20975. */
  20976. var baseFor = createBaseFor();
  20977. /**
  20978. * This function is like `baseFor` except that it iterates over properties
  20979. * in the opposite order.
  20980. *
  20981. * @private
  20982. * @param {Object} object The object to iterate over.
  20983. * @param {Function} iteratee The function invoked per iteration.
  20984. * @param {Function} keysFunc The function to get the keys of `object`.
  20985. * @returns {Object} Returns `object`.
  20986. */
  20987. var baseForRight = createBaseFor(true);
  20988. /**
  20989. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20990. *
  20991. * @private
  20992. * @param {Object} object The object to iterate over.
  20993. * @param {Function} iteratee The function invoked per iteration.
  20994. * @returns {Object} Returns `object`.
  20995. */
  20996. function baseForOwn(object, iteratee) {
  20997. return object && baseFor(object, iteratee, keys);
  20998. }
  20999. /**
  21000. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21001. *
  21002. * @private
  21003. * @param {Object} object The object to iterate over.
  21004. * @param {Function} iteratee The function invoked per iteration.
  21005. * @returns {Object} Returns `object`.
  21006. */
  21007. function baseForOwnRight(object, iteratee) {
  21008. return object && baseForRight(object, iteratee, keys);
  21009. }
  21010. /**
  21011. * The base implementation of `_.functions` which creates an array of
  21012. * `object` function property names filtered from `props`.
  21013. *
  21014. * @private
  21015. * @param {Object} object The object to inspect.
  21016. * @param {Array} props The property names to filter.
  21017. * @returns {Array} Returns the function names.
  21018. */
  21019. function baseFunctions(object, props) {
  21020. return arrayFilter(props, function(key) {
  21021. return isFunction(object[key]);
  21022. });
  21023. }
  21024. /**
  21025. * The base implementation of `_.get` without support for default values.
  21026. *
  21027. * @private
  21028. * @param {Object} object The object to query.
  21029. * @param {Array|string} path The path of the property to get.
  21030. * @returns {*} Returns the resolved value.
  21031. */
  21032. function baseGet(object, path) {
  21033. path = castPath(path, object);
  21034. var index = 0,
  21035. length = path.length;
  21036. while (object != null && index < length) {
  21037. object = object[toKey(path[index++])];
  21038. }
  21039. return (index && index == length) ? object : undefined;
  21040. }
  21041. /**
  21042. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21043. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21044. * symbols of `object`.
  21045. *
  21046. * @private
  21047. * @param {Object} object The object to query.
  21048. * @param {Function} keysFunc The function to get the keys of `object`.
  21049. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21050. * @returns {Array} Returns the array of property names and symbols.
  21051. */
  21052. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21053. var result = keysFunc(object);
  21054. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21055. }
  21056. /**
  21057. * The base implementation of `getTag` without fallbacks for buggy environments.
  21058. *
  21059. * @private
  21060. * @param {*} value The value to query.
  21061. * @returns {string} Returns the `toStringTag`.
  21062. */
  21063. function baseGetTag(value) {
  21064. if (value == null) {
  21065. return value === undefined ? undefinedTag : nullTag;
  21066. }
  21067. return (symToStringTag && symToStringTag in Object(value))
  21068. ? getRawTag(value)
  21069. : objectToString(value);
  21070. }
  21071. /**
  21072. * The base implementation of `_.gt` which doesn't coerce arguments.
  21073. *
  21074. * @private
  21075. * @param {*} value The value to compare.
  21076. * @param {*} other The other value to compare.
  21077. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21078. * else `false`.
  21079. */
  21080. function baseGt(value, other) {
  21081. return value > other;
  21082. }
  21083. /**
  21084. * The base implementation of `_.has` without support for deep paths.
  21085. *
  21086. * @private
  21087. * @param {Object} [object] The object to query.
  21088. * @param {Array|string} key The key to check.
  21089. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21090. */
  21091. function baseHas(object, key) {
  21092. return object != null && hasOwnProperty.call(object, key);
  21093. }
  21094. /**
  21095. * The base implementation of `_.hasIn` without support for deep paths.
  21096. *
  21097. * @private
  21098. * @param {Object} [object] The object to query.
  21099. * @param {Array|string} key The key to check.
  21100. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21101. */
  21102. function baseHasIn(object, key) {
  21103. return object != null && key in Object(object);
  21104. }
  21105. /**
  21106. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21107. *
  21108. * @private
  21109. * @param {number} number The number to check.
  21110. * @param {number} start The start of the range.
  21111. * @param {number} end The end of the range.
  21112. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21113. */
  21114. function baseInRange(number, start, end) {
  21115. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21116. }
  21117. /**
  21118. * The base implementation of methods like `_.intersection`, without support
  21119. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21120. *
  21121. * @private
  21122. * @param {Array} arrays The arrays to inspect.
  21123. * @param {Function} [iteratee] The iteratee invoked per element.
  21124. * @param {Function} [comparator] The comparator invoked per element.
  21125. * @returns {Array} Returns the new array of shared values.
  21126. */
  21127. function baseIntersection(arrays, iteratee, comparator) {
  21128. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21129. length = arrays[0].length,
  21130. othLength = arrays.length,
  21131. othIndex = othLength,
  21132. caches = Array(othLength),
  21133. maxLength = Infinity,
  21134. result = [];
  21135. while (othIndex--) {
  21136. var array = arrays[othIndex];
  21137. if (othIndex && iteratee) {
  21138. array = arrayMap(array, baseUnary(iteratee));
  21139. }
  21140. maxLength = nativeMin(array.length, maxLength);
  21141. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21142. ? new SetCache(othIndex && array)
  21143. : undefined;
  21144. }
  21145. array = arrays[0];
  21146. var index = -1,
  21147. seen = caches[0];
  21148. outer:
  21149. while (++index < length && result.length < maxLength) {
  21150. var value = array[index],
  21151. computed = iteratee ? iteratee(value) : value;
  21152. value = (comparator || value !== 0) ? value : 0;
  21153. if (!(seen
  21154. ? cacheHas(seen, computed)
  21155. : includes(result, computed, comparator)
  21156. )) {
  21157. othIndex = othLength;
  21158. while (--othIndex) {
  21159. var cache = caches[othIndex];
  21160. if (!(cache
  21161. ? cacheHas(cache, computed)
  21162. : includes(arrays[othIndex], computed, comparator))
  21163. ) {
  21164. continue outer;
  21165. }
  21166. }
  21167. if (seen) {
  21168. seen.push(computed);
  21169. }
  21170. result.push(value);
  21171. }
  21172. }
  21173. return result;
  21174. }
  21175. /**
  21176. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21177. * `object` with values transformed by `iteratee` and set by `setter`.
  21178. *
  21179. * @private
  21180. * @param {Object} object The object to iterate over.
  21181. * @param {Function} setter The function to set `accumulator` values.
  21182. * @param {Function} iteratee The iteratee to transform values.
  21183. * @param {Object} accumulator The initial inverted object.
  21184. * @returns {Function} Returns `accumulator`.
  21185. */
  21186. function baseInverter(object, setter, iteratee, accumulator) {
  21187. baseForOwn(object, function(value, key, object) {
  21188. setter(accumulator, iteratee(value), key, object);
  21189. });
  21190. return accumulator;
  21191. }
  21192. /**
  21193. * The base implementation of `_.invoke` without support for individual
  21194. * method arguments.
  21195. *
  21196. * @private
  21197. * @param {Object} object The object to query.
  21198. * @param {Array|string} path The path of the method to invoke.
  21199. * @param {Array} args The arguments to invoke the method with.
  21200. * @returns {*} Returns the result of the invoked method.
  21201. */
  21202. function baseInvoke(object, path, args) {
  21203. path = castPath(path, object);
  21204. object = parent(object, path);
  21205. var func = object == null ? object : object[toKey(last(path))];
  21206. return func == null ? undefined : apply(func, object, args);
  21207. }
  21208. /**
  21209. * The base implementation of `_.isArguments`.
  21210. *
  21211. * @private
  21212. * @param {*} value The value to check.
  21213. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21214. */
  21215. function baseIsArguments(value) {
  21216. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21217. }
  21218. /**
  21219. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21220. *
  21221. * @private
  21222. * @param {*} value The value to check.
  21223. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21224. */
  21225. function baseIsArrayBuffer(value) {
  21226. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21227. }
  21228. /**
  21229. * The base implementation of `_.isDate` without Node.js optimizations.
  21230. *
  21231. * @private
  21232. * @param {*} value The value to check.
  21233. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21234. */
  21235. function baseIsDate(value) {
  21236. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21237. }
  21238. /**
  21239. * The base implementation of `_.isEqual` which supports partial comparisons
  21240. * and tracks traversed objects.
  21241. *
  21242. * @private
  21243. * @param {*} value The value to compare.
  21244. * @param {*} other The other value to compare.
  21245. * @param {boolean} bitmask The bitmask flags.
  21246. * 1 - Unordered comparison
  21247. * 2 - Partial comparison
  21248. * @param {Function} [customizer] The function to customize comparisons.
  21249. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21250. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21251. */
  21252. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21253. if (value === other) {
  21254. return true;
  21255. }
  21256. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21257. return value !== value && other !== other;
  21258. }
  21259. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21260. }
  21261. /**
  21262. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21263. * deep comparisons and tracks traversed objects enabling objects with circular
  21264. * references to be compared.
  21265. *
  21266. * @private
  21267. * @param {Object} object The object to compare.
  21268. * @param {Object} other The other object to compare.
  21269. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21270. * @param {Function} customizer The function to customize comparisons.
  21271. * @param {Function} equalFunc The function to determine equivalents of values.
  21272. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21273. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21274. */
  21275. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21276. var objIsArr = isArray(object),
  21277. othIsArr = isArray(other),
  21278. objTag = objIsArr ? arrayTag : getTag(object),
  21279. othTag = othIsArr ? arrayTag : getTag(other);
  21280. objTag = objTag == argsTag ? objectTag : objTag;
  21281. othTag = othTag == argsTag ? objectTag : othTag;
  21282. var objIsObj = objTag == objectTag,
  21283. othIsObj = othTag == objectTag,
  21284. isSameTag = objTag == othTag;
  21285. if (isSameTag && isBuffer(object)) {
  21286. if (!isBuffer(other)) {
  21287. return false;
  21288. }
  21289. objIsArr = true;
  21290. objIsObj = false;
  21291. }
  21292. if (isSameTag && !objIsObj) {
  21293. stack || (stack = new Stack);
  21294. return (objIsArr || isTypedArray(object))
  21295. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21296. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21297. }
  21298. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21299. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21300. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21301. if (objIsWrapped || othIsWrapped) {
  21302. var objUnwrapped = objIsWrapped ? object.value() : object,
  21303. othUnwrapped = othIsWrapped ? other.value() : other;
  21304. stack || (stack = new Stack);
  21305. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21306. }
  21307. }
  21308. if (!isSameTag) {
  21309. return false;
  21310. }
  21311. stack || (stack = new Stack);
  21312. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21313. }
  21314. /**
  21315. * The base implementation of `_.isMap` without Node.js optimizations.
  21316. *
  21317. * @private
  21318. * @param {*} value The value to check.
  21319. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21320. */
  21321. function baseIsMap(value) {
  21322. return isObjectLike(value) && getTag(value) == mapTag;
  21323. }
  21324. /**
  21325. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21326. *
  21327. * @private
  21328. * @param {Object} object The object to inspect.
  21329. * @param {Object} source The object of property values to match.
  21330. * @param {Array} matchData The property names, values, and compare flags to match.
  21331. * @param {Function} [customizer] The function to customize comparisons.
  21332. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21333. */
  21334. function baseIsMatch(object, source, matchData, customizer) {
  21335. var index = matchData.length,
  21336. length = index,
  21337. noCustomizer = !customizer;
  21338. if (object == null) {
  21339. return !length;
  21340. }
  21341. object = Object(object);
  21342. while (index--) {
  21343. var data = matchData[index];
  21344. if ((noCustomizer && data[2])
  21345. ? data[1] !== object[data[0]]
  21346. : !(data[0] in object)
  21347. ) {
  21348. return false;
  21349. }
  21350. }
  21351. while (++index < length) {
  21352. data = matchData[index];
  21353. var key = data[0],
  21354. objValue = object[key],
  21355. srcValue = data[1];
  21356. if (noCustomizer && data[2]) {
  21357. if (objValue === undefined && !(key in object)) {
  21358. return false;
  21359. }
  21360. } else {
  21361. var stack = new Stack;
  21362. if (customizer) {
  21363. var result = customizer(objValue, srcValue, key, object, source, stack);
  21364. }
  21365. if (!(result === undefined
  21366. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21367. : result
  21368. )) {
  21369. return false;
  21370. }
  21371. }
  21372. }
  21373. return true;
  21374. }
  21375. /**
  21376. * The base implementation of `_.isNative` without bad shim checks.
  21377. *
  21378. * @private
  21379. * @param {*} value The value to check.
  21380. * @returns {boolean} Returns `true` if `value` is a native function,
  21381. * else `false`.
  21382. */
  21383. function baseIsNative(value) {
  21384. if (!isObject(value) || isMasked(value)) {
  21385. return false;
  21386. }
  21387. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21388. return pattern.test(toSource(value));
  21389. }
  21390. /**
  21391. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21392. *
  21393. * @private
  21394. * @param {*} value The value to check.
  21395. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21396. */
  21397. function baseIsRegExp(value) {
  21398. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21399. }
  21400. /**
  21401. * The base implementation of `_.isSet` without Node.js optimizations.
  21402. *
  21403. * @private
  21404. * @param {*} value The value to check.
  21405. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21406. */
  21407. function baseIsSet(value) {
  21408. return isObjectLike(value) && getTag(value) == setTag;
  21409. }
  21410. /**
  21411. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21412. *
  21413. * @private
  21414. * @param {*} value The value to check.
  21415. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21416. */
  21417. function baseIsTypedArray(value) {
  21418. return isObjectLike(value) &&
  21419. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21420. }
  21421. /**
  21422. * The base implementation of `_.iteratee`.
  21423. *
  21424. * @private
  21425. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21426. * @returns {Function} Returns the iteratee.
  21427. */
  21428. function baseIteratee(value) {
  21429. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21430. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21431. if (typeof value == 'function') {
  21432. return value;
  21433. }
  21434. if (value == null) {
  21435. return identity;
  21436. }
  21437. if (typeof value == 'object') {
  21438. return isArray(value)
  21439. ? baseMatchesProperty(value[0], value[1])
  21440. : baseMatches(value);
  21441. }
  21442. return property(value);
  21443. }
  21444. /**
  21445. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21446. *
  21447. * @private
  21448. * @param {Object} object The object to query.
  21449. * @returns {Array} Returns the array of property names.
  21450. */
  21451. function baseKeys(object) {
  21452. if (!isPrototype(object)) {
  21453. return nativeKeys(object);
  21454. }
  21455. var result = [];
  21456. for (var key in Object(object)) {
  21457. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21458. result.push(key);
  21459. }
  21460. }
  21461. return result;
  21462. }
  21463. /**
  21464. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21465. *
  21466. * @private
  21467. * @param {Object} object The object to query.
  21468. * @returns {Array} Returns the array of property names.
  21469. */
  21470. function baseKeysIn(object) {
  21471. if (!isObject(object)) {
  21472. return nativeKeysIn(object);
  21473. }
  21474. var isProto = isPrototype(object),
  21475. result = [];
  21476. for (var key in object) {
  21477. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21478. result.push(key);
  21479. }
  21480. }
  21481. return result;
  21482. }
  21483. /**
  21484. * The base implementation of `_.lt` which doesn't coerce arguments.
  21485. *
  21486. * @private
  21487. * @param {*} value The value to compare.
  21488. * @param {*} other The other value to compare.
  21489. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21490. * else `false`.
  21491. */
  21492. function baseLt(value, other) {
  21493. return value < other;
  21494. }
  21495. /**
  21496. * The base implementation of `_.map` without support for iteratee shorthands.
  21497. *
  21498. * @private
  21499. * @param {Array|Object} collection The collection to iterate over.
  21500. * @param {Function} iteratee The function invoked per iteration.
  21501. * @returns {Array} Returns the new mapped array.
  21502. */
  21503. function baseMap(collection, iteratee) {
  21504. var index = -1,
  21505. result = isArrayLike(collection) ? Array(collection.length) : [];
  21506. baseEach(collection, function(value, key, collection) {
  21507. result[++index] = iteratee(value, key, collection);
  21508. });
  21509. return result;
  21510. }
  21511. /**
  21512. * The base implementation of `_.matches` which doesn't clone `source`.
  21513. *
  21514. * @private
  21515. * @param {Object} source The object of property values to match.
  21516. * @returns {Function} Returns the new spec function.
  21517. */
  21518. function baseMatches(source) {
  21519. var matchData = getMatchData(source);
  21520. if (matchData.length == 1 && matchData[0][2]) {
  21521. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21522. }
  21523. return function(object) {
  21524. return object === source || baseIsMatch(object, source, matchData);
  21525. };
  21526. }
  21527. /**
  21528. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21529. *
  21530. * @private
  21531. * @param {string} path The path of the property to get.
  21532. * @param {*} srcValue The value to match.
  21533. * @returns {Function} Returns the new spec function.
  21534. */
  21535. function baseMatchesProperty(path, srcValue) {
  21536. if (isKey(path) && isStrictComparable(srcValue)) {
  21537. return matchesStrictComparable(toKey(path), srcValue);
  21538. }
  21539. return function(object) {
  21540. var objValue = get(object, path);
  21541. return (objValue === undefined && objValue === srcValue)
  21542. ? hasIn(object, path)
  21543. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21544. };
  21545. }
  21546. /**
  21547. * The base implementation of `_.merge` without support for multiple sources.
  21548. *
  21549. * @private
  21550. * @param {Object} object The destination object.
  21551. * @param {Object} source The source object.
  21552. * @param {number} srcIndex The index of `source`.
  21553. * @param {Function} [customizer] The function to customize merged values.
  21554. * @param {Object} [stack] Tracks traversed source values and their merged
  21555. * counterparts.
  21556. */
  21557. function baseMerge(object, source, srcIndex, customizer, stack) {
  21558. if (object === source) {
  21559. return;
  21560. }
  21561. baseFor(source, function(srcValue, key) {
  21562. stack || (stack = new Stack);
  21563. if (isObject(srcValue)) {
  21564. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21565. }
  21566. else {
  21567. var newValue = customizer
  21568. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21569. : undefined;
  21570. if (newValue === undefined) {
  21571. newValue = srcValue;
  21572. }
  21573. assignMergeValue(object, key, newValue);
  21574. }
  21575. }, keysIn);
  21576. }
  21577. /**
  21578. * A specialized version of `baseMerge` for arrays and objects which performs
  21579. * deep merges and tracks traversed objects enabling objects with circular
  21580. * references to be merged.
  21581. *
  21582. * @private
  21583. * @param {Object} object The destination object.
  21584. * @param {Object} source The source object.
  21585. * @param {string} key The key of the value to merge.
  21586. * @param {number} srcIndex The index of `source`.
  21587. * @param {Function} mergeFunc The function to merge values.
  21588. * @param {Function} [customizer] The function to customize assigned values.
  21589. * @param {Object} [stack] Tracks traversed source values and their merged
  21590. * counterparts.
  21591. */
  21592. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21593. var objValue = safeGet(object, key),
  21594. srcValue = safeGet(source, key),
  21595. stacked = stack.get(srcValue);
  21596. if (stacked) {
  21597. assignMergeValue(object, key, stacked);
  21598. return;
  21599. }
  21600. var newValue = customizer
  21601. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21602. : undefined;
  21603. var isCommon = newValue === undefined;
  21604. if (isCommon) {
  21605. var isArr = isArray(srcValue),
  21606. isBuff = !isArr && isBuffer(srcValue),
  21607. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21608. newValue = srcValue;
  21609. if (isArr || isBuff || isTyped) {
  21610. if (isArray(objValue)) {
  21611. newValue = objValue;
  21612. }
  21613. else if (isArrayLikeObject(objValue)) {
  21614. newValue = copyArray(objValue);
  21615. }
  21616. else if (isBuff) {
  21617. isCommon = false;
  21618. newValue = cloneBuffer(srcValue, true);
  21619. }
  21620. else if (isTyped) {
  21621. isCommon = false;
  21622. newValue = cloneTypedArray(srcValue, true);
  21623. }
  21624. else {
  21625. newValue = [];
  21626. }
  21627. }
  21628. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21629. newValue = objValue;
  21630. if (isArguments(objValue)) {
  21631. newValue = toPlainObject(objValue);
  21632. }
  21633. else if (!isObject(objValue) || isFunction(objValue)) {
  21634. newValue = initCloneObject(srcValue);
  21635. }
  21636. }
  21637. else {
  21638. isCommon = false;
  21639. }
  21640. }
  21641. if (isCommon) {
  21642. // Recursively merge objects and arrays (susceptible to call stack limits).
  21643. stack.set(srcValue, newValue);
  21644. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21645. stack['delete'](srcValue);
  21646. }
  21647. assignMergeValue(object, key, newValue);
  21648. }
  21649. /**
  21650. * The base implementation of `_.nth` which doesn't coerce arguments.
  21651. *
  21652. * @private
  21653. * @param {Array} array The array to query.
  21654. * @param {number} n The index of the element to return.
  21655. * @returns {*} Returns the nth element of `array`.
  21656. */
  21657. function baseNth(array, n) {
  21658. var length = array.length;
  21659. if (!length) {
  21660. return;
  21661. }
  21662. n += n < 0 ? length : 0;
  21663. return isIndex(n, length) ? array[n] : undefined;
  21664. }
  21665. /**
  21666. * The base implementation of `_.orderBy` without param guards.
  21667. *
  21668. * @private
  21669. * @param {Array|Object} collection The collection to iterate over.
  21670. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21671. * @param {string[]} orders The sort orders of `iteratees`.
  21672. * @returns {Array} Returns the new sorted array.
  21673. */
  21674. function baseOrderBy(collection, iteratees, orders) {
  21675. var index = -1;
  21676. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21677. var result = baseMap(collection, function(value, key, collection) {
  21678. var criteria = arrayMap(iteratees, function(iteratee) {
  21679. return iteratee(value);
  21680. });
  21681. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21682. });
  21683. return baseSortBy(result, function(object, other) {
  21684. return compareMultiple(object, other, orders);
  21685. });
  21686. }
  21687. /**
  21688. * The base implementation of `_.pick` without support for individual
  21689. * property identifiers.
  21690. *
  21691. * @private
  21692. * @param {Object} object The source object.
  21693. * @param {string[]} paths The property paths to pick.
  21694. * @returns {Object} Returns the new object.
  21695. */
  21696. function basePick(object, paths) {
  21697. return basePickBy(object, paths, function(value, path) {
  21698. return hasIn(object, path);
  21699. });
  21700. }
  21701. /**
  21702. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21703. *
  21704. * @private
  21705. * @param {Object} object The source object.
  21706. * @param {string[]} paths The property paths to pick.
  21707. * @param {Function} predicate The function invoked per property.
  21708. * @returns {Object} Returns the new object.
  21709. */
  21710. function basePickBy(object, paths, predicate) {
  21711. var index = -1,
  21712. length = paths.length,
  21713. result = {};
  21714. while (++index < length) {
  21715. var path = paths[index],
  21716. value = baseGet(object, path);
  21717. if (predicate(value, path)) {
  21718. baseSet(result, castPath(path, object), value);
  21719. }
  21720. }
  21721. return result;
  21722. }
  21723. /**
  21724. * A specialized version of `baseProperty` which supports deep paths.
  21725. *
  21726. * @private
  21727. * @param {Array|string} path The path of the property to get.
  21728. * @returns {Function} Returns the new accessor function.
  21729. */
  21730. function basePropertyDeep(path) {
  21731. return function(object) {
  21732. return baseGet(object, path);
  21733. };
  21734. }
  21735. /**
  21736. * The base implementation of `_.pullAllBy` without support for iteratee
  21737. * shorthands.
  21738. *
  21739. * @private
  21740. * @param {Array} array The array to modify.
  21741. * @param {Array} values The values to remove.
  21742. * @param {Function} [iteratee] The iteratee invoked per element.
  21743. * @param {Function} [comparator] The comparator invoked per element.
  21744. * @returns {Array} Returns `array`.
  21745. */
  21746. function basePullAll(array, values, iteratee, comparator) {
  21747. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21748. index = -1,
  21749. length = values.length,
  21750. seen = array;
  21751. if (array === values) {
  21752. values = copyArray(values);
  21753. }
  21754. if (iteratee) {
  21755. seen = arrayMap(array, baseUnary(iteratee));
  21756. }
  21757. while (++index < length) {
  21758. var fromIndex = 0,
  21759. value = values[index],
  21760. computed = iteratee ? iteratee(value) : value;
  21761. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21762. if (seen !== array) {
  21763. splice.call(seen, fromIndex, 1);
  21764. }
  21765. splice.call(array, fromIndex, 1);
  21766. }
  21767. }
  21768. return array;
  21769. }
  21770. /**
  21771. * The base implementation of `_.pullAt` without support for individual
  21772. * indexes or capturing the removed elements.
  21773. *
  21774. * @private
  21775. * @param {Array} array The array to modify.
  21776. * @param {number[]} indexes The indexes of elements to remove.
  21777. * @returns {Array} Returns `array`.
  21778. */
  21779. function basePullAt(array, indexes) {
  21780. var length = array ? indexes.length : 0,
  21781. lastIndex = length - 1;
  21782. while (length--) {
  21783. var index = indexes[length];
  21784. if (length == lastIndex || index !== previous) {
  21785. var previous = index;
  21786. if (isIndex(index)) {
  21787. splice.call(array, index, 1);
  21788. } else {
  21789. baseUnset(array, index);
  21790. }
  21791. }
  21792. }
  21793. return array;
  21794. }
  21795. /**
  21796. * The base implementation of `_.random` without support for returning
  21797. * floating-point numbers.
  21798. *
  21799. * @private
  21800. * @param {number} lower The lower bound.
  21801. * @param {number} upper The upper bound.
  21802. * @returns {number} Returns the random number.
  21803. */
  21804. function baseRandom(lower, upper) {
  21805. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21806. }
  21807. /**
  21808. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21809. * coerce arguments.
  21810. *
  21811. * @private
  21812. * @param {number} start The start of the range.
  21813. * @param {number} end The end of the range.
  21814. * @param {number} step The value to increment or decrement by.
  21815. * @param {boolean} [fromRight] Specify iterating from right to left.
  21816. * @returns {Array} Returns the range of numbers.
  21817. */
  21818. function baseRange(start, end, step, fromRight) {
  21819. var index = -1,
  21820. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21821. result = Array(length);
  21822. while (length--) {
  21823. result[fromRight ? length : ++index] = start;
  21824. start += step;
  21825. }
  21826. return result;
  21827. }
  21828. /**
  21829. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21830. *
  21831. * @private
  21832. * @param {string} string The string to repeat.
  21833. * @param {number} n The number of times to repeat the string.
  21834. * @returns {string} Returns the repeated string.
  21835. */
  21836. function baseRepeat(string, n) {
  21837. var result = '';
  21838. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21839. return result;
  21840. }
  21841. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21842. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21843. do {
  21844. if (n % 2) {
  21845. result += string;
  21846. }
  21847. n = nativeFloor(n / 2);
  21848. if (n) {
  21849. string += string;
  21850. }
  21851. } while (n);
  21852. return result;
  21853. }
  21854. /**
  21855. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21856. *
  21857. * @private
  21858. * @param {Function} func The function to apply a rest parameter to.
  21859. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21860. * @returns {Function} Returns the new function.
  21861. */
  21862. function baseRest(func, start) {
  21863. return setToString(overRest(func, start, identity), func + '');
  21864. }
  21865. /**
  21866. * The base implementation of `_.sample`.
  21867. *
  21868. * @private
  21869. * @param {Array|Object} collection The collection to sample.
  21870. * @returns {*} Returns the random element.
  21871. */
  21872. function baseSample(collection) {
  21873. return arraySample(values(collection));
  21874. }
  21875. /**
  21876. * The base implementation of `_.sampleSize` without param guards.
  21877. *
  21878. * @private
  21879. * @param {Array|Object} collection The collection to sample.
  21880. * @param {number} n The number of elements to sample.
  21881. * @returns {Array} Returns the random elements.
  21882. */
  21883. function baseSampleSize(collection, n) {
  21884. var array = values(collection);
  21885. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21886. }
  21887. /**
  21888. * The base implementation of `_.set`.
  21889. *
  21890. * @private
  21891. * @param {Object} object The object to modify.
  21892. * @param {Array|string} path The path of the property to set.
  21893. * @param {*} value The value to set.
  21894. * @param {Function} [customizer] The function to customize path creation.
  21895. * @returns {Object} Returns `object`.
  21896. */
  21897. function baseSet(object, path, value, customizer) {
  21898. if (!isObject(object)) {
  21899. return object;
  21900. }
  21901. path = castPath(path, object);
  21902. var index = -1,
  21903. length = path.length,
  21904. lastIndex = length - 1,
  21905. nested = object;
  21906. while (nested != null && ++index < length) {
  21907. var key = toKey(path[index]),
  21908. newValue = value;
  21909. if (index != lastIndex) {
  21910. var objValue = nested[key];
  21911. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21912. if (newValue === undefined) {
  21913. newValue = isObject(objValue)
  21914. ? objValue
  21915. : (isIndex(path[index + 1]) ? [] : {});
  21916. }
  21917. }
  21918. assignValue(nested, key, newValue);
  21919. nested = nested[key];
  21920. }
  21921. return object;
  21922. }
  21923. /**
  21924. * The base implementation of `setData` without support for hot loop shorting.
  21925. *
  21926. * @private
  21927. * @param {Function} func The function to associate metadata with.
  21928. * @param {*} data The metadata.
  21929. * @returns {Function} Returns `func`.
  21930. */
  21931. var baseSetData = !metaMap ? identity : function(func, data) {
  21932. metaMap.set(func, data);
  21933. return func;
  21934. };
  21935. /**
  21936. * The base implementation of `setToString` without support for hot loop shorting.
  21937. *
  21938. * @private
  21939. * @param {Function} func The function to modify.
  21940. * @param {Function} string The `toString` result.
  21941. * @returns {Function} Returns `func`.
  21942. */
  21943. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21944. return defineProperty(func, 'toString', {
  21945. 'configurable': true,
  21946. 'enumerable': false,
  21947. 'value': constant(string),
  21948. 'writable': true
  21949. });
  21950. };
  21951. /**
  21952. * The base implementation of `_.shuffle`.
  21953. *
  21954. * @private
  21955. * @param {Array|Object} collection The collection to shuffle.
  21956. * @returns {Array} Returns the new shuffled array.
  21957. */
  21958. function baseShuffle(collection) {
  21959. return shuffleSelf(values(collection));
  21960. }
  21961. /**
  21962. * The base implementation of `_.slice` without an iteratee call guard.
  21963. *
  21964. * @private
  21965. * @param {Array} array The array to slice.
  21966. * @param {number} [start=0] The start position.
  21967. * @param {number} [end=array.length] The end position.
  21968. * @returns {Array} Returns the slice of `array`.
  21969. */
  21970. function baseSlice(array, start, end) {
  21971. var index = -1,
  21972. length = array.length;
  21973. if (start < 0) {
  21974. start = -start > length ? 0 : (length + start);
  21975. }
  21976. end = end > length ? length : end;
  21977. if (end < 0) {
  21978. end += length;
  21979. }
  21980. length = start > end ? 0 : ((end - start) >>> 0);
  21981. start >>>= 0;
  21982. var result = Array(length);
  21983. while (++index < length) {
  21984. result[index] = array[index + start];
  21985. }
  21986. return result;
  21987. }
  21988. /**
  21989. * The base implementation of `_.some` without support for iteratee shorthands.
  21990. *
  21991. * @private
  21992. * @param {Array|Object} collection The collection to iterate over.
  21993. * @param {Function} predicate The function invoked per iteration.
  21994. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21995. * else `false`.
  21996. */
  21997. function baseSome(collection, predicate) {
  21998. var result;
  21999. baseEach(collection, function(value, index, collection) {
  22000. result = predicate(value, index, collection);
  22001. return !result;
  22002. });
  22003. return !!result;
  22004. }
  22005. /**
  22006. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22007. * performs a binary search of `array` to determine the index at which `value`
  22008. * should be inserted into `array` in order to maintain its sort order.
  22009. *
  22010. * @private
  22011. * @param {Array} array The sorted array to inspect.
  22012. * @param {*} value The value to evaluate.
  22013. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22014. * @returns {number} Returns the index at which `value` should be inserted
  22015. * into `array`.
  22016. */
  22017. function baseSortedIndex(array, value, retHighest) {
  22018. var low = 0,
  22019. high = array == null ? low : array.length;
  22020. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22021. while (low < high) {
  22022. var mid = (low + high) >>> 1,
  22023. computed = array[mid];
  22024. if (computed !== null && !isSymbol(computed) &&
  22025. (retHighest ? (computed <= value) : (computed < value))) {
  22026. low = mid + 1;
  22027. } else {
  22028. high = mid;
  22029. }
  22030. }
  22031. return high;
  22032. }
  22033. return baseSortedIndexBy(array, value, identity, retHighest);
  22034. }
  22035. /**
  22036. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22037. * which invokes `iteratee` for `value` and each element of `array` to compute
  22038. * their sort ranking. The iteratee is invoked with one argument; (value).
  22039. *
  22040. * @private
  22041. * @param {Array} array The sorted array to inspect.
  22042. * @param {*} value The value to evaluate.
  22043. * @param {Function} iteratee The iteratee invoked per element.
  22044. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22045. * @returns {number} Returns the index at which `value` should be inserted
  22046. * into `array`.
  22047. */
  22048. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22049. value = iteratee(value);
  22050. var low = 0,
  22051. high = array == null ? 0 : array.length,
  22052. valIsNaN = value !== value,
  22053. valIsNull = value === null,
  22054. valIsSymbol = isSymbol(value),
  22055. valIsUndefined = value === undefined;
  22056. while (low < high) {
  22057. var mid = nativeFloor((low + high) / 2),
  22058. computed = iteratee(array[mid]),
  22059. othIsDefined = computed !== undefined,
  22060. othIsNull = computed === null,
  22061. othIsReflexive = computed === computed,
  22062. othIsSymbol = isSymbol(computed);
  22063. if (valIsNaN) {
  22064. var setLow = retHighest || othIsReflexive;
  22065. } else if (valIsUndefined) {
  22066. setLow = othIsReflexive && (retHighest || othIsDefined);
  22067. } else if (valIsNull) {
  22068. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22069. } else if (valIsSymbol) {
  22070. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22071. } else if (othIsNull || othIsSymbol) {
  22072. setLow = false;
  22073. } else {
  22074. setLow = retHighest ? (computed <= value) : (computed < value);
  22075. }
  22076. if (setLow) {
  22077. low = mid + 1;
  22078. } else {
  22079. high = mid;
  22080. }
  22081. }
  22082. return nativeMin(high, MAX_ARRAY_INDEX);
  22083. }
  22084. /**
  22085. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22086. * support for iteratee shorthands.
  22087. *
  22088. * @private
  22089. * @param {Array} array The array to inspect.
  22090. * @param {Function} [iteratee] The iteratee invoked per element.
  22091. * @returns {Array} Returns the new duplicate free array.
  22092. */
  22093. function baseSortedUniq(array, iteratee) {
  22094. var index = -1,
  22095. length = array.length,
  22096. resIndex = 0,
  22097. result = [];
  22098. while (++index < length) {
  22099. var value = array[index],
  22100. computed = iteratee ? iteratee(value) : value;
  22101. if (!index || !eq(computed, seen)) {
  22102. var seen = computed;
  22103. result[resIndex++] = value === 0 ? 0 : value;
  22104. }
  22105. }
  22106. return result;
  22107. }
  22108. /**
  22109. * The base implementation of `_.toNumber` which doesn't ensure correct
  22110. * conversions of binary, hexadecimal, or octal string values.
  22111. *
  22112. * @private
  22113. * @param {*} value The value to process.
  22114. * @returns {number} Returns the number.
  22115. */
  22116. function baseToNumber(value) {
  22117. if (typeof value == 'number') {
  22118. return value;
  22119. }
  22120. if (isSymbol(value)) {
  22121. return NAN;
  22122. }
  22123. return +value;
  22124. }
  22125. /**
  22126. * The base implementation of `_.toString` which doesn't convert nullish
  22127. * values to empty strings.
  22128. *
  22129. * @private
  22130. * @param {*} value The value to process.
  22131. * @returns {string} Returns the string.
  22132. */
  22133. function baseToString(value) {
  22134. // Exit early for strings to avoid a performance hit in some environments.
  22135. if (typeof value == 'string') {
  22136. return value;
  22137. }
  22138. if (isArray(value)) {
  22139. // Recursively convert values (susceptible to call stack limits).
  22140. return arrayMap(value, baseToString) + '';
  22141. }
  22142. if (isSymbol(value)) {
  22143. return symbolToString ? symbolToString.call(value) : '';
  22144. }
  22145. var result = (value + '');
  22146. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22147. }
  22148. /**
  22149. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22150. *
  22151. * @private
  22152. * @param {Array} array The array to inspect.
  22153. * @param {Function} [iteratee] The iteratee invoked per element.
  22154. * @param {Function} [comparator] The comparator invoked per element.
  22155. * @returns {Array} Returns the new duplicate free array.
  22156. */
  22157. function baseUniq(array, iteratee, comparator) {
  22158. var index = -1,
  22159. includes = arrayIncludes,
  22160. length = array.length,
  22161. isCommon = true,
  22162. result = [],
  22163. seen = result;
  22164. if (comparator) {
  22165. isCommon = false;
  22166. includes = arrayIncludesWith;
  22167. }
  22168. else if (length >= LARGE_ARRAY_SIZE) {
  22169. var set = iteratee ? null : createSet(array);
  22170. if (set) {
  22171. return setToArray(set);
  22172. }
  22173. isCommon = false;
  22174. includes = cacheHas;
  22175. seen = new SetCache;
  22176. }
  22177. else {
  22178. seen = iteratee ? [] : result;
  22179. }
  22180. outer:
  22181. while (++index < length) {
  22182. var value = array[index],
  22183. computed = iteratee ? iteratee(value) : value;
  22184. value = (comparator || value !== 0) ? value : 0;
  22185. if (isCommon && computed === computed) {
  22186. var seenIndex = seen.length;
  22187. while (seenIndex--) {
  22188. if (seen[seenIndex] === computed) {
  22189. continue outer;
  22190. }
  22191. }
  22192. if (iteratee) {
  22193. seen.push(computed);
  22194. }
  22195. result.push(value);
  22196. }
  22197. else if (!includes(seen, computed, comparator)) {
  22198. if (seen !== result) {
  22199. seen.push(computed);
  22200. }
  22201. result.push(value);
  22202. }
  22203. }
  22204. return result;
  22205. }
  22206. /**
  22207. * The base implementation of `_.unset`.
  22208. *
  22209. * @private
  22210. * @param {Object} object The object to modify.
  22211. * @param {Array|string} path The property path to unset.
  22212. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22213. */
  22214. function baseUnset(object, path) {
  22215. path = castPath(path, object);
  22216. object = parent(object, path);
  22217. return object == null || delete object[toKey(last(path))];
  22218. }
  22219. /**
  22220. * The base implementation of `_.update`.
  22221. *
  22222. * @private
  22223. * @param {Object} object The object to modify.
  22224. * @param {Array|string} path The path of the property to update.
  22225. * @param {Function} updater The function to produce the updated value.
  22226. * @param {Function} [customizer] The function to customize path creation.
  22227. * @returns {Object} Returns `object`.
  22228. */
  22229. function baseUpdate(object, path, updater, customizer) {
  22230. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22231. }
  22232. /**
  22233. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22234. * without support for iteratee shorthands.
  22235. *
  22236. * @private
  22237. * @param {Array} array The array to query.
  22238. * @param {Function} predicate The function invoked per iteration.
  22239. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22240. * @param {boolean} [fromRight] Specify iterating from right to left.
  22241. * @returns {Array} Returns the slice of `array`.
  22242. */
  22243. function baseWhile(array, predicate, isDrop, fromRight) {
  22244. var length = array.length,
  22245. index = fromRight ? length : -1;
  22246. while ((fromRight ? index-- : ++index < length) &&
  22247. predicate(array[index], index, array)) {}
  22248. return isDrop
  22249. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22250. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22251. }
  22252. /**
  22253. * The base implementation of `wrapperValue` which returns the result of
  22254. * performing a sequence of actions on the unwrapped `value`, where each
  22255. * successive action is supplied the return value of the previous.
  22256. *
  22257. * @private
  22258. * @param {*} value The unwrapped value.
  22259. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22260. * @returns {*} Returns the resolved value.
  22261. */
  22262. function baseWrapperValue(value, actions) {
  22263. var result = value;
  22264. if (result instanceof LazyWrapper) {
  22265. result = result.value();
  22266. }
  22267. return arrayReduce(actions, function(result, action) {
  22268. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22269. }, result);
  22270. }
  22271. /**
  22272. * The base implementation of methods like `_.xor`, without support for
  22273. * iteratee shorthands, that accepts an array of arrays to inspect.
  22274. *
  22275. * @private
  22276. * @param {Array} arrays The arrays to inspect.
  22277. * @param {Function} [iteratee] The iteratee invoked per element.
  22278. * @param {Function} [comparator] The comparator invoked per element.
  22279. * @returns {Array} Returns the new array of values.
  22280. */
  22281. function baseXor(arrays, iteratee, comparator) {
  22282. var length = arrays.length;
  22283. if (length < 2) {
  22284. return length ? baseUniq(arrays[0]) : [];
  22285. }
  22286. var index = -1,
  22287. result = Array(length);
  22288. while (++index < length) {
  22289. var array = arrays[index],
  22290. othIndex = -1;
  22291. while (++othIndex < length) {
  22292. if (othIndex != index) {
  22293. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22294. }
  22295. }
  22296. }
  22297. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22298. }
  22299. /**
  22300. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22301. *
  22302. * @private
  22303. * @param {Array} props The property identifiers.
  22304. * @param {Array} values The property values.
  22305. * @param {Function} assignFunc The function to assign values.
  22306. * @returns {Object} Returns the new object.
  22307. */
  22308. function baseZipObject(props, values, assignFunc) {
  22309. var index = -1,
  22310. length = props.length,
  22311. valsLength = values.length,
  22312. result = {};
  22313. while (++index < length) {
  22314. var value = index < valsLength ? values[index] : undefined;
  22315. assignFunc(result, props[index], value);
  22316. }
  22317. return result;
  22318. }
  22319. /**
  22320. * Casts `value` to an empty array if it's not an array like object.
  22321. *
  22322. * @private
  22323. * @param {*} value The value to inspect.
  22324. * @returns {Array|Object} Returns the cast array-like object.
  22325. */
  22326. function castArrayLikeObject(value) {
  22327. return isArrayLikeObject(value) ? value : [];
  22328. }
  22329. /**
  22330. * Casts `value` to `identity` if it's not a function.
  22331. *
  22332. * @private
  22333. * @param {*} value The value to inspect.
  22334. * @returns {Function} Returns cast function.
  22335. */
  22336. function castFunction(value) {
  22337. return typeof value == 'function' ? value : identity;
  22338. }
  22339. /**
  22340. * Casts `value` to a path array if it's not one.
  22341. *
  22342. * @private
  22343. * @param {*} value The value to inspect.
  22344. * @param {Object} [object] The object to query keys on.
  22345. * @returns {Array} Returns the cast property path array.
  22346. */
  22347. function castPath(value, object) {
  22348. if (isArray(value)) {
  22349. return value;
  22350. }
  22351. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22352. }
  22353. /**
  22354. * A `baseRest` alias which can be replaced with `identity` by module
  22355. * replacement plugins.
  22356. *
  22357. * @private
  22358. * @type {Function}
  22359. * @param {Function} func The function to apply a rest parameter to.
  22360. * @returns {Function} Returns the new function.
  22361. */
  22362. var castRest = baseRest;
  22363. /**
  22364. * Casts `array` to a slice if it's needed.
  22365. *
  22366. * @private
  22367. * @param {Array} array The array to inspect.
  22368. * @param {number} start The start position.
  22369. * @param {number} [end=array.length] The end position.
  22370. * @returns {Array} Returns the cast slice.
  22371. */
  22372. function castSlice(array, start, end) {
  22373. var length = array.length;
  22374. end = end === undefined ? length : end;
  22375. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22376. }
  22377. /**
  22378. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22379. *
  22380. * @private
  22381. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22382. */
  22383. var clearTimeout = ctxClearTimeout || function(id) {
  22384. return root.clearTimeout(id);
  22385. };
  22386. /**
  22387. * Creates a clone of `buffer`.
  22388. *
  22389. * @private
  22390. * @param {Buffer} buffer The buffer to clone.
  22391. * @param {boolean} [isDeep] Specify a deep clone.
  22392. * @returns {Buffer} Returns the cloned buffer.
  22393. */
  22394. function cloneBuffer(buffer, isDeep) {
  22395. if (isDeep) {
  22396. return buffer.slice();
  22397. }
  22398. var length = buffer.length,
  22399. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22400. buffer.copy(result);
  22401. return result;
  22402. }
  22403. /**
  22404. * Creates a clone of `arrayBuffer`.
  22405. *
  22406. * @private
  22407. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22408. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22409. */
  22410. function cloneArrayBuffer(arrayBuffer) {
  22411. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22412. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22413. return result;
  22414. }
  22415. /**
  22416. * Creates a clone of `dataView`.
  22417. *
  22418. * @private
  22419. * @param {Object} dataView The data view to clone.
  22420. * @param {boolean} [isDeep] Specify a deep clone.
  22421. * @returns {Object} Returns the cloned data view.
  22422. */
  22423. function cloneDataView(dataView, isDeep) {
  22424. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22425. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22426. }
  22427. /**
  22428. * Creates a clone of `regexp`.
  22429. *
  22430. * @private
  22431. * @param {Object} regexp The regexp to clone.
  22432. * @returns {Object} Returns the cloned regexp.
  22433. */
  22434. function cloneRegExp(regexp) {
  22435. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22436. result.lastIndex = regexp.lastIndex;
  22437. return result;
  22438. }
  22439. /**
  22440. * Creates a clone of the `symbol` object.
  22441. *
  22442. * @private
  22443. * @param {Object} symbol The symbol object to clone.
  22444. * @returns {Object} Returns the cloned symbol object.
  22445. */
  22446. function cloneSymbol(symbol) {
  22447. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22448. }
  22449. /**
  22450. * Creates a clone of `typedArray`.
  22451. *
  22452. * @private
  22453. * @param {Object} typedArray The typed array to clone.
  22454. * @param {boolean} [isDeep] Specify a deep clone.
  22455. * @returns {Object} Returns the cloned typed array.
  22456. */
  22457. function cloneTypedArray(typedArray, isDeep) {
  22458. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22459. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22460. }
  22461. /**
  22462. * Compares values to sort them in ascending order.
  22463. *
  22464. * @private
  22465. * @param {*} value The value to compare.
  22466. * @param {*} other The other value to compare.
  22467. * @returns {number} Returns the sort order indicator for `value`.
  22468. */
  22469. function compareAscending(value, other) {
  22470. if (value !== other) {
  22471. var valIsDefined = value !== undefined,
  22472. valIsNull = value === null,
  22473. valIsReflexive = value === value,
  22474. valIsSymbol = isSymbol(value);
  22475. var othIsDefined = other !== undefined,
  22476. othIsNull = other === null,
  22477. othIsReflexive = other === other,
  22478. othIsSymbol = isSymbol(other);
  22479. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22480. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22481. (valIsNull && othIsDefined && othIsReflexive) ||
  22482. (!valIsDefined && othIsReflexive) ||
  22483. !valIsReflexive) {
  22484. return 1;
  22485. }
  22486. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22487. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22488. (othIsNull && valIsDefined && valIsReflexive) ||
  22489. (!othIsDefined && valIsReflexive) ||
  22490. !othIsReflexive) {
  22491. return -1;
  22492. }
  22493. }
  22494. return 0;
  22495. }
  22496. /**
  22497. * Used by `_.orderBy` to compare multiple properties of a value to another
  22498. * and stable sort them.
  22499. *
  22500. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22501. * specify an order of "desc" for descending or "asc" for ascending sort order
  22502. * of corresponding values.
  22503. *
  22504. * @private
  22505. * @param {Object} object The object to compare.
  22506. * @param {Object} other The other object to compare.
  22507. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22508. * @returns {number} Returns the sort order indicator for `object`.
  22509. */
  22510. function compareMultiple(object, other, orders) {
  22511. var index = -1,
  22512. objCriteria = object.criteria,
  22513. othCriteria = other.criteria,
  22514. length = objCriteria.length,
  22515. ordersLength = orders.length;
  22516. while (++index < length) {
  22517. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22518. if (result) {
  22519. if (index >= ordersLength) {
  22520. return result;
  22521. }
  22522. var order = orders[index];
  22523. return result * (order == 'desc' ? -1 : 1);
  22524. }
  22525. }
  22526. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22527. // that causes it, under certain circumstances, to provide the same value for
  22528. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22529. // for more details.
  22530. //
  22531. // This also ensures a stable sort in V8 and other engines.
  22532. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22533. return object.index - other.index;
  22534. }
  22535. /**
  22536. * Creates an array that is the composition of partially applied arguments,
  22537. * placeholders, and provided arguments into a single array of arguments.
  22538. *
  22539. * @private
  22540. * @param {Array} args The provided arguments.
  22541. * @param {Array} partials The arguments to prepend to those provided.
  22542. * @param {Array} holders The `partials` placeholder indexes.
  22543. * @params {boolean} [isCurried] Specify composing for a curried function.
  22544. * @returns {Array} Returns the new array of composed arguments.
  22545. */
  22546. function composeArgs(args, partials, holders, isCurried) {
  22547. var argsIndex = -1,
  22548. argsLength = args.length,
  22549. holdersLength = holders.length,
  22550. leftIndex = -1,
  22551. leftLength = partials.length,
  22552. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22553. result = Array(leftLength + rangeLength),
  22554. isUncurried = !isCurried;
  22555. while (++leftIndex < leftLength) {
  22556. result[leftIndex] = partials[leftIndex];
  22557. }
  22558. while (++argsIndex < holdersLength) {
  22559. if (isUncurried || argsIndex < argsLength) {
  22560. result[holders[argsIndex]] = args[argsIndex];
  22561. }
  22562. }
  22563. while (rangeLength--) {
  22564. result[leftIndex++] = args[argsIndex++];
  22565. }
  22566. return result;
  22567. }
  22568. /**
  22569. * This function is like `composeArgs` except that the arguments composition
  22570. * is tailored for `_.partialRight`.
  22571. *
  22572. * @private
  22573. * @param {Array} args The provided arguments.
  22574. * @param {Array} partials The arguments to append to those provided.
  22575. * @param {Array} holders The `partials` placeholder indexes.
  22576. * @params {boolean} [isCurried] Specify composing for a curried function.
  22577. * @returns {Array} Returns the new array of composed arguments.
  22578. */
  22579. function composeArgsRight(args, partials, holders, isCurried) {
  22580. var argsIndex = -1,
  22581. argsLength = args.length,
  22582. holdersIndex = -1,
  22583. holdersLength = holders.length,
  22584. rightIndex = -1,
  22585. rightLength = partials.length,
  22586. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22587. result = Array(rangeLength + rightLength),
  22588. isUncurried = !isCurried;
  22589. while (++argsIndex < rangeLength) {
  22590. result[argsIndex] = args[argsIndex];
  22591. }
  22592. var offset = argsIndex;
  22593. while (++rightIndex < rightLength) {
  22594. result[offset + rightIndex] = partials[rightIndex];
  22595. }
  22596. while (++holdersIndex < holdersLength) {
  22597. if (isUncurried || argsIndex < argsLength) {
  22598. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22599. }
  22600. }
  22601. return result;
  22602. }
  22603. /**
  22604. * Copies the values of `source` to `array`.
  22605. *
  22606. * @private
  22607. * @param {Array} source The array to copy values from.
  22608. * @param {Array} [array=[]] The array to copy values to.
  22609. * @returns {Array} Returns `array`.
  22610. */
  22611. function copyArray(source, array) {
  22612. var index = -1,
  22613. length = source.length;
  22614. array || (array = Array(length));
  22615. while (++index < length) {
  22616. array[index] = source[index];
  22617. }
  22618. return array;
  22619. }
  22620. /**
  22621. * Copies properties of `source` to `object`.
  22622. *
  22623. * @private
  22624. * @param {Object} source The object to copy properties from.
  22625. * @param {Array} props The property identifiers to copy.
  22626. * @param {Object} [object={}] The object to copy properties to.
  22627. * @param {Function} [customizer] The function to customize copied values.
  22628. * @returns {Object} Returns `object`.
  22629. */
  22630. function copyObject(source, props, object, customizer) {
  22631. var isNew = !object;
  22632. object || (object = {});
  22633. var index = -1,
  22634. length = props.length;
  22635. while (++index < length) {
  22636. var key = props[index];
  22637. var newValue = customizer
  22638. ? customizer(object[key], source[key], key, object, source)
  22639. : undefined;
  22640. if (newValue === undefined) {
  22641. newValue = source[key];
  22642. }
  22643. if (isNew) {
  22644. baseAssignValue(object, key, newValue);
  22645. } else {
  22646. assignValue(object, key, newValue);
  22647. }
  22648. }
  22649. return object;
  22650. }
  22651. /**
  22652. * Copies own symbols of `source` to `object`.
  22653. *
  22654. * @private
  22655. * @param {Object} source The object to copy symbols from.
  22656. * @param {Object} [object={}] The object to copy symbols to.
  22657. * @returns {Object} Returns `object`.
  22658. */
  22659. function copySymbols(source, object) {
  22660. return copyObject(source, getSymbols(source), object);
  22661. }
  22662. /**
  22663. * Copies own and inherited symbols of `source` to `object`.
  22664. *
  22665. * @private
  22666. * @param {Object} source The object to copy symbols from.
  22667. * @param {Object} [object={}] The object to copy symbols to.
  22668. * @returns {Object} Returns `object`.
  22669. */
  22670. function copySymbolsIn(source, object) {
  22671. return copyObject(source, getSymbolsIn(source), object);
  22672. }
  22673. /**
  22674. * Creates a function like `_.groupBy`.
  22675. *
  22676. * @private
  22677. * @param {Function} setter The function to set accumulator values.
  22678. * @param {Function} [initializer] The accumulator object initializer.
  22679. * @returns {Function} Returns the new aggregator function.
  22680. */
  22681. function createAggregator(setter, initializer) {
  22682. return function(collection, iteratee) {
  22683. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22684. accumulator = initializer ? initializer() : {};
  22685. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22686. };
  22687. }
  22688. /**
  22689. * Creates a function like `_.assign`.
  22690. *
  22691. * @private
  22692. * @param {Function} assigner The function to assign values.
  22693. * @returns {Function} Returns the new assigner function.
  22694. */
  22695. function createAssigner(assigner) {
  22696. return baseRest(function(object, sources) {
  22697. var index = -1,
  22698. length = sources.length,
  22699. customizer = length > 1 ? sources[length - 1] : undefined,
  22700. guard = length > 2 ? sources[2] : undefined;
  22701. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22702. ? (length--, customizer)
  22703. : undefined;
  22704. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22705. customizer = length < 3 ? undefined : customizer;
  22706. length = 1;
  22707. }
  22708. object = Object(object);
  22709. while (++index < length) {
  22710. var source = sources[index];
  22711. if (source) {
  22712. assigner(object, source, index, customizer);
  22713. }
  22714. }
  22715. return object;
  22716. });
  22717. }
  22718. /**
  22719. * Creates a `baseEach` or `baseEachRight` function.
  22720. *
  22721. * @private
  22722. * @param {Function} eachFunc The function to iterate over a collection.
  22723. * @param {boolean} [fromRight] Specify iterating from right to left.
  22724. * @returns {Function} Returns the new base function.
  22725. */
  22726. function createBaseEach(eachFunc, fromRight) {
  22727. return function(collection, iteratee) {
  22728. if (collection == null) {
  22729. return collection;
  22730. }
  22731. if (!isArrayLike(collection)) {
  22732. return eachFunc(collection, iteratee);
  22733. }
  22734. var length = collection.length,
  22735. index = fromRight ? length : -1,
  22736. iterable = Object(collection);
  22737. while ((fromRight ? index-- : ++index < length)) {
  22738. if (iteratee(iterable[index], index, iterable) === false) {
  22739. break;
  22740. }
  22741. }
  22742. return collection;
  22743. };
  22744. }
  22745. /**
  22746. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22747. *
  22748. * @private
  22749. * @param {boolean} [fromRight] Specify iterating from right to left.
  22750. * @returns {Function} Returns the new base function.
  22751. */
  22752. function createBaseFor(fromRight) {
  22753. return function(object, iteratee, keysFunc) {
  22754. var index = -1,
  22755. iterable = Object(object),
  22756. props = keysFunc(object),
  22757. length = props.length;
  22758. while (length--) {
  22759. var key = props[fromRight ? length : ++index];
  22760. if (iteratee(iterable[key], key, iterable) === false) {
  22761. break;
  22762. }
  22763. }
  22764. return object;
  22765. };
  22766. }
  22767. /**
  22768. * Creates a function that wraps `func` to invoke it with the optional `this`
  22769. * binding of `thisArg`.
  22770. *
  22771. * @private
  22772. * @param {Function} func The function to wrap.
  22773. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22774. * @param {*} [thisArg] The `this` binding of `func`.
  22775. * @returns {Function} Returns the new wrapped function.
  22776. */
  22777. function createBind(func, bitmask, thisArg) {
  22778. var isBind = bitmask & WRAP_BIND_FLAG,
  22779. Ctor = createCtor(func);
  22780. function wrapper() {
  22781. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22782. return fn.apply(isBind ? thisArg : this, arguments);
  22783. }
  22784. return wrapper;
  22785. }
  22786. /**
  22787. * Creates a function like `_.lowerFirst`.
  22788. *
  22789. * @private
  22790. * @param {string} methodName The name of the `String` case method to use.
  22791. * @returns {Function} Returns the new case function.
  22792. */
  22793. function createCaseFirst(methodName) {
  22794. return function(string) {
  22795. string = toString(string);
  22796. var strSymbols = hasUnicode(string)
  22797. ? stringToArray(string)
  22798. : undefined;
  22799. var chr = strSymbols
  22800. ? strSymbols[0]
  22801. : string.charAt(0);
  22802. var trailing = strSymbols
  22803. ? castSlice(strSymbols, 1).join('')
  22804. : string.slice(1);
  22805. return chr[methodName]() + trailing;
  22806. };
  22807. }
  22808. /**
  22809. * Creates a function like `_.camelCase`.
  22810. *
  22811. * @private
  22812. * @param {Function} callback The function to combine each word.
  22813. * @returns {Function} Returns the new compounder function.
  22814. */
  22815. function createCompounder(callback) {
  22816. return function(string) {
  22817. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22818. };
  22819. }
  22820. /**
  22821. * Creates a function that produces an instance of `Ctor` regardless of
  22822. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22823. *
  22824. * @private
  22825. * @param {Function} Ctor The constructor to wrap.
  22826. * @returns {Function} Returns the new wrapped function.
  22827. */
  22828. function createCtor(Ctor) {
  22829. return function() {
  22830. // Use a `switch` statement to work with class constructors. See
  22831. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22832. // for more details.
  22833. var args = arguments;
  22834. switch (args.length) {
  22835. case 0: return new Ctor;
  22836. case 1: return new Ctor(args[0]);
  22837. case 2: return new Ctor(args[0], args[1]);
  22838. case 3: return new Ctor(args[0], args[1], args[2]);
  22839. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22840. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22841. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22842. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22843. }
  22844. var thisBinding = baseCreate(Ctor.prototype),
  22845. result = Ctor.apply(thisBinding, args);
  22846. // Mimic the constructor's `return` behavior.
  22847. // See https://es5.github.io/#x13.2.2 for more details.
  22848. return isObject(result) ? result : thisBinding;
  22849. };
  22850. }
  22851. /**
  22852. * Creates a function that wraps `func` to enable currying.
  22853. *
  22854. * @private
  22855. * @param {Function} func The function to wrap.
  22856. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22857. * @param {number} arity The arity of `func`.
  22858. * @returns {Function} Returns the new wrapped function.
  22859. */
  22860. function createCurry(func, bitmask, arity) {
  22861. var Ctor = createCtor(func);
  22862. function wrapper() {
  22863. var length = arguments.length,
  22864. args = Array(length),
  22865. index = length,
  22866. placeholder = getHolder(wrapper);
  22867. while (index--) {
  22868. args[index] = arguments[index];
  22869. }
  22870. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22871. ? []
  22872. : replaceHolders(args, placeholder);
  22873. length -= holders.length;
  22874. if (length < arity) {
  22875. return createRecurry(
  22876. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22877. args, holders, undefined, undefined, arity - length);
  22878. }
  22879. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22880. return apply(fn, this, args);
  22881. }
  22882. return wrapper;
  22883. }
  22884. /**
  22885. * Creates a `_.find` or `_.findLast` function.
  22886. *
  22887. * @private
  22888. * @param {Function} findIndexFunc The function to find the collection index.
  22889. * @returns {Function} Returns the new find function.
  22890. */
  22891. function createFind(findIndexFunc) {
  22892. return function(collection, predicate, fromIndex) {
  22893. var iterable = Object(collection);
  22894. if (!isArrayLike(collection)) {
  22895. var iteratee = getIteratee(predicate, 3);
  22896. collection = keys(collection);
  22897. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22898. }
  22899. var index = findIndexFunc(collection, predicate, fromIndex);
  22900. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22901. };
  22902. }
  22903. /**
  22904. * Creates a `_.flow` or `_.flowRight` function.
  22905. *
  22906. * @private
  22907. * @param {boolean} [fromRight] Specify iterating from right to left.
  22908. * @returns {Function} Returns the new flow function.
  22909. */
  22910. function createFlow(fromRight) {
  22911. return flatRest(function(funcs) {
  22912. var length = funcs.length,
  22913. index = length,
  22914. prereq = LodashWrapper.prototype.thru;
  22915. if (fromRight) {
  22916. funcs.reverse();
  22917. }
  22918. while (index--) {
  22919. var func = funcs[index];
  22920. if (typeof func != 'function') {
  22921. throw new TypeError(FUNC_ERROR_TEXT);
  22922. }
  22923. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22924. var wrapper = new LodashWrapper([], true);
  22925. }
  22926. }
  22927. index = wrapper ? index : length;
  22928. while (++index < length) {
  22929. func = funcs[index];
  22930. var funcName = getFuncName(func),
  22931. data = funcName == 'wrapper' ? getData(func) : undefined;
  22932. if (data && isLaziable(data[0]) &&
  22933. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22934. !data[4].length && data[9] == 1
  22935. ) {
  22936. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22937. } else {
  22938. wrapper = (func.length == 1 && isLaziable(func))
  22939. ? wrapper[funcName]()
  22940. : wrapper.thru(func);
  22941. }
  22942. }
  22943. return function() {
  22944. var args = arguments,
  22945. value = args[0];
  22946. if (wrapper && args.length == 1 && isArray(value)) {
  22947. return wrapper.plant(value).value();
  22948. }
  22949. var index = 0,
  22950. result = length ? funcs[index].apply(this, args) : value;
  22951. while (++index < length) {
  22952. result = funcs[index].call(this, result);
  22953. }
  22954. return result;
  22955. };
  22956. });
  22957. }
  22958. /**
  22959. * Creates a function that wraps `func` to invoke it with optional `this`
  22960. * binding of `thisArg`, partial application, and currying.
  22961. *
  22962. * @private
  22963. * @param {Function|string} func The function or method name to wrap.
  22964. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22965. * @param {*} [thisArg] The `this` binding of `func`.
  22966. * @param {Array} [partials] The arguments to prepend to those provided to
  22967. * the new function.
  22968. * @param {Array} [holders] The `partials` placeholder indexes.
  22969. * @param {Array} [partialsRight] The arguments to append to those provided
  22970. * to the new function.
  22971. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22972. * @param {Array} [argPos] The argument positions of the new function.
  22973. * @param {number} [ary] The arity cap of `func`.
  22974. * @param {number} [arity] The arity of `func`.
  22975. * @returns {Function} Returns the new wrapped function.
  22976. */
  22977. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22978. var isAry = bitmask & WRAP_ARY_FLAG,
  22979. isBind = bitmask & WRAP_BIND_FLAG,
  22980. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22981. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22982. isFlip = bitmask & WRAP_FLIP_FLAG,
  22983. Ctor = isBindKey ? undefined : createCtor(func);
  22984. function wrapper() {
  22985. var length = arguments.length,
  22986. args = Array(length),
  22987. index = length;
  22988. while (index--) {
  22989. args[index] = arguments[index];
  22990. }
  22991. if (isCurried) {
  22992. var placeholder = getHolder(wrapper),
  22993. holdersCount = countHolders(args, placeholder);
  22994. }
  22995. if (partials) {
  22996. args = composeArgs(args, partials, holders, isCurried);
  22997. }
  22998. if (partialsRight) {
  22999. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23000. }
  23001. length -= holdersCount;
  23002. if (isCurried && length < arity) {
  23003. var newHolders = replaceHolders(args, placeholder);
  23004. return createRecurry(
  23005. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23006. args, newHolders, argPos, ary, arity - length
  23007. );
  23008. }
  23009. var thisBinding = isBind ? thisArg : this,
  23010. fn = isBindKey ? thisBinding[func] : func;
  23011. length = args.length;
  23012. if (argPos) {
  23013. args = reorder(args, argPos);
  23014. } else if (isFlip && length > 1) {
  23015. args.reverse();
  23016. }
  23017. if (isAry && ary < length) {
  23018. args.length = ary;
  23019. }
  23020. if (this && this !== root && this instanceof wrapper) {
  23021. fn = Ctor || createCtor(fn);
  23022. }
  23023. return fn.apply(thisBinding, args);
  23024. }
  23025. return wrapper;
  23026. }
  23027. /**
  23028. * Creates a function like `_.invertBy`.
  23029. *
  23030. * @private
  23031. * @param {Function} setter The function to set accumulator values.
  23032. * @param {Function} toIteratee The function to resolve iteratees.
  23033. * @returns {Function} Returns the new inverter function.
  23034. */
  23035. function createInverter(setter, toIteratee) {
  23036. return function(object, iteratee) {
  23037. return baseInverter(object, setter, toIteratee(iteratee), {});
  23038. };
  23039. }
  23040. /**
  23041. * Creates a function that performs a mathematical operation on two values.
  23042. *
  23043. * @private
  23044. * @param {Function} operator The function to perform the operation.
  23045. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23046. * @returns {Function} Returns the new mathematical operation function.
  23047. */
  23048. function createMathOperation(operator, defaultValue) {
  23049. return function(value, other) {
  23050. var result;
  23051. if (value === undefined && other === undefined) {
  23052. return defaultValue;
  23053. }
  23054. if (value !== undefined) {
  23055. result = value;
  23056. }
  23057. if (other !== undefined) {
  23058. if (result === undefined) {
  23059. return other;
  23060. }
  23061. if (typeof value == 'string' || typeof other == 'string') {
  23062. value = baseToString(value);
  23063. other = baseToString(other);
  23064. } else {
  23065. value = baseToNumber(value);
  23066. other = baseToNumber(other);
  23067. }
  23068. result = operator(value, other);
  23069. }
  23070. return result;
  23071. };
  23072. }
  23073. /**
  23074. * Creates a function like `_.over`.
  23075. *
  23076. * @private
  23077. * @param {Function} arrayFunc The function to iterate over iteratees.
  23078. * @returns {Function} Returns the new over function.
  23079. */
  23080. function createOver(arrayFunc) {
  23081. return flatRest(function(iteratees) {
  23082. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23083. return baseRest(function(args) {
  23084. var thisArg = this;
  23085. return arrayFunc(iteratees, function(iteratee) {
  23086. return apply(iteratee, thisArg, args);
  23087. });
  23088. });
  23089. });
  23090. }
  23091. /**
  23092. * Creates the padding for `string` based on `length`. The `chars` string
  23093. * is truncated if the number of characters exceeds `length`.
  23094. *
  23095. * @private
  23096. * @param {number} length The padding length.
  23097. * @param {string} [chars=' '] The string used as padding.
  23098. * @returns {string} Returns the padding for `string`.
  23099. */
  23100. function createPadding(length, chars) {
  23101. chars = chars === undefined ? ' ' : baseToString(chars);
  23102. var charsLength = chars.length;
  23103. if (charsLength < 2) {
  23104. return charsLength ? baseRepeat(chars, length) : chars;
  23105. }
  23106. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23107. return hasUnicode(chars)
  23108. ? castSlice(stringToArray(result), 0, length).join('')
  23109. : result.slice(0, length);
  23110. }
  23111. /**
  23112. * Creates a function that wraps `func` to invoke it with the `this` binding
  23113. * of `thisArg` and `partials` prepended to the arguments it receives.
  23114. *
  23115. * @private
  23116. * @param {Function} func The function to wrap.
  23117. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23118. * @param {*} thisArg The `this` binding of `func`.
  23119. * @param {Array} partials The arguments to prepend to those provided to
  23120. * the new function.
  23121. * @returns {Function} Returns the new wrapped function.
  23122. */
  23123. function createPartial(func, bitmask, thisArg, partials) {
  23124. var isBind = bitmask & WRAP_BIND_FLAG,
  23125. Ctor = createCtor(func);
  23126. function wrapper() {
  23127. var argsIndex = -1,
  23128. argsLength = arguments.length,
  23129. leftIndex = -1,
  23130. leftLength = partials.length,
  23131. args = Array(leftLength + argsLength),
  23132. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23133. while (++leftIndex < leftLength) {
  23134. args[leftIndex] = partials[leftIndex];
  23135. }
  23136. while (argsLength--) {
  23137. args[leftIndex++] = arguments[++argsIndex];
  23138. }
  23139. return apply(fn, isBind ? thisArg : this, args);
  23140. }
  23141. return wrapper;
  23142. }
  23143. /**
  23144. * Creates a `_.range` or `_.rangeRight` function.
  23145. *
  23146. * @private
  23147. * @param {boolean} [fromRight] Specify iterating from right to left.
  23148. * @returns {Function} Returns the new range function.
  23149. */
  23150. function createRange(fromRight) {
  23151. return function(start, end, step) {
  23152. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23153. end = step = undefined;
  23154. }
  23155. // Ensure the sign of `-0` is preserved.
  23156. start = toFinite(start);
  23157. if (end === undefined) {
  23158. end = start;
  23159. start = 0;
  23160. } else {
  23161. end = toFinite(end);
  23162. }
  23163. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23164. return baseRange(start, end, step, fromRight);
  23165. };
  23166. }
  23167. /**
  23168. * Creates a function that performs a relational operation on two values.
  23169. *
  23170. * @private
  23171. * @param {Function} operator The function to perform the operation.
  23172. * @returns {Function} Returns the new relational operation function.
  23173. */
  23174. function createRelationalOperation(operator) {
  23175. return function(value, other) {
  23176. if (!(typeof value == 'string' && typeof other == 'string')) {
  23177. value = toNumber(value);
  23178. other = toNumber(other);
  23179. }
  23180. return operator(value, other);
  23181. };
  23182. }
  23183. /**
  23184. * Creates a function that wraps `func` to continue currying.
  23185. *
  23186. * @private
  23187. * @param {Function} func The function to wrap.
  23188. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23189. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23190. * @param {*} placeholder The placeholder value.
  23191. * @param {*} [thisArg] The `this` binding of `func`.
  23192. * @param {Array} [partials] The arguments to prepend to those provided to
  23193. * the new function.
  23194. * @param {Array} [holders] The `partials` placeholder indexes.
  23195. * @param {Array} [argPos] The argument positions of the new function.
  23196. * @param {number} [ary] The arity cap of `func`.
  23197. * @param {number} [arity] The arity of `func`.
  23198. * @returns {Function} Returns the new wrapped function.
  23199. */
  23200. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23201. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23202. newHolders = isCurry ? holders : undefined,
  23203. newHoldersRight = isCurry ? undefined : holders,
  23204. newPartials = isCurry ? partials : undefined,
  23205. newPartialsRight = isCurry ? undefined : partials;
  23206. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23207. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23208. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23209. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23210. }
  23211. var newData = [
  23212. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23213. newHoldersRight, argPos, ary, arity
  23214. ];
  23215. var result = wrapFunc.apply(undefined, newData);
  23216. if (isLaziable(func)) {
  23217. setData(result, newData);
  23218. }
  23219. result.placeholder = placeholder;
  23220. return setWrapToString(result, func, bitmask);
  23221. }
  23222. /**
  23223. * Creates a function like `_.round`.
  23224. *
  23225. * @private
  23226. * @param {string} methodName The name of the `Math` method to use when rounding.
  23227. * @returns {Function} Returns the new round function.
  23228. */
  23229. function createRound(methodName) {
  23230. var func = Math[methodName];
  23231. return function(number, precision) {
  23232. number = toNumber(number);
  23233. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23234. if (precision && nativeIsFinite(number)) {
  23235. // Shift with exponential notation to avoid floating-point issues.
  23236. // See [MDN](https://mdn.io/round#Examples) for more details.
  23237. var pair = (toString(number) + 'e').split('e'),
  23238. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23239. pair = (toString(value) + 'e').split('e');
  23240. return +(pair[0] + 'e' + (+pair[1] - precision));
  23241. }
  23242. return func(number);
  23243. };
  23244. }
  23245. /**
  23246. * Creates a set object of `values`.
  23247. *
  23248. * @private
  23249. * @param {Array} values The values to add to the set.
  23250. * @returns {Object} Returns the new set.
  23251. */
  23252. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23253. return new Set(values);
  23254. };
  23255. /**
  23256. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23257. *
  23258. * @private
  23259. * @param {Function} keysFunc The function to get the keys of a given object.
  23260. * @returns {Function} Returns the new pairs function.
  23261. */
  23262. function createToPairs(keysFunc) {
  23263. return function(object) {
  23264. var tag = getTag(object);
  23265. if (tag == mapTag) {
  23266. return mapToArray(object);
  23267. }
  23268. if (tag == setTag) {
  23269. return setToPairs(object);
  23270. }
  23271. return baseToPairs(object, keysFunc(object));
  23272. };
  23273. }
  23274. /**
  23275. * Creates a function that either curries or invokes `func` with optional
  23276. * `this` binding and partially applied arguments.
  23277. *
  23278. * @private
  23279. * @param {Function|string} func The function or method name to wrap.
  23280. * @param {number} bitmask The bitmask flags.
  23281. * 1 - `_.bind`
  23282. * 2 - `_.bindKey`
  23283. * 4 - `_.curry` or `_.curryRight` of a bound function
  23284. * 8 - `_.curry`
  23285. * 16 - `_.curryRight`
  23286. * 32 - `_.partial`
  23287. * 64 - `_.partialRight`
  23288. * 128 - `_.rearg`
  23289. * 256 - `_.ary`
  23290. * 512 - `_.flip`
  23291. * @param {*} [thisArg] The `this` binding of `func`.
  23292. * @param {Array} [partials] The arguments to be partially applied.
  23293. * @param {Array} [holders] The `partials` placeholder indexes.
  23294. * @param {Array} [argPos] The argument positions of the new function.
  23295. * @param {number} [ary] The arity cap of `func`.
  23296. * @param {number} [arity] The arity of `func`.
  23297. * @returns {Function} Returns the new wrapped function.
  23298. */
  23299. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23300. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23301. if (!isBindKey && typeof func != 'function') {
  23302. throw new TypeError(FUNC_ERROR_TEXT);
  23303. }
  23304. var length = partials ? partials.length : 0;
  23305. if (!length) {
  23306. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23307. partials = holders = undefined;
  23308. }
  23309. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23310. arity = arity === undefined ? arity : toInteger(arity);
  23311. length -= holders ? holders.length : 0;
  23312. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23313. var partialsRight = partials,
  23314. holdersRight = holders;
  23315. partials = holders = undefined;
  23316. }
  23317. var data = isBindKey ? undefined : getData(func);
  23318. var newData = [
  23319. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23320. argPos, ary, arity
  23321. ];
  23322. if (data) {
  23323. mergeData(newData, data);
  23324. }
  23325. func = newData[0];
  23326. bitmask = newData[1];
  23327. thisArg = newData[2];
  23328. partials = newData[3];
  23329. holders = newData[4];
  23330. arity = newData[9] = newData[9] === undefined
  23331. ? (isBindKey ? 0 : func.length)
  23332. : nativeMax(newData[9] - length, 0);
  23333. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23334. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23335. }
  23336. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23337. var result = createBind(func, bitmask, thisArg);
  23338. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23339. result = createCurry(func, bitmask, arity);
  23340. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23341. result = createPartial(func, bitmask, thisArg, partials);
  23342. } else {
  23343. result = createHybrid.apply(undefined, newData);
  23344. }
  23345. var setter = data ? baseSetData : setData;
  23346. return setWrapToString(setter(result, newData), func, bitmask);
  23347. }
  23348. /**
  23349. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23350. * of source objects to the destination object for all destination properties
  23351. * that resolve to `undefined`.
  23352. *
  23353. * @private
  23354. * @param {*} objValue The destination value.
  23355. * @param {*} srcValue The source value.
  23356. * @param {string} key The key of the property to assign.
  23357. * @param {Object} object The parent object of `objValue`.
  23358. * @returns {*} Returns the value to assign.
  23359. */
  23360. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23361. if (objValue === undefined ||
  23362. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23363. return srcValue;
  23364. }
  23365. return objValue;
  23366. }
  23367. /**
  23368. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23369. * objects into destination objects that are passed thru.
  23370. *
  23371. * @private
  23372. * @param {*} objValue The destination value.
  23373. * @param {*} srcValue The source value.
  23374. * @param {string} key The key of the property to merge.
  23375. * @param {Object} object The parent object of `objValue`.
  23376. * @param {Object} source The parent object of `srcValue`.
  23377. * @param {Object} [stack] Tracks traversed source values and their merged
  23378. * counterparts.
  23379. * @returns {*} Returns the value to assign.
  23380. */
  23381. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23382. if (isObject(objValue) && isObject(srcValue)) {
  23383. // Recursively merge objects and arrays (susceptible to call stack limits).
  23384. stack.set(srcValue, objValue);
  23385. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23386. stack['delete'](srcValue);
  23387. }
  23388. return objValue;
  23389. }
  23390. /**
  23391. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23392. * objects.
  23393. *
  23394. * @private
  23395. * @param {*} value The value to inspect.
  23396. * @param {string} key The key of the property to inspect.
  23397. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23398. */
  23399. function customOmitClone(value) {
  23400. return isPlainObject(value) ? undefined : value;
  23401. }
  23402. /**
  23403. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23404. * partial deep comparisons.
  23405. *
  23406. * @private
  23407. * @param {Array} array The array to compare.
  23408. * @param {Array} other The other array to compare.
  23409. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23410. * @param {Function} customizer The function to customize comparisons.
  23411. * @param {Function} equalFunc The function to determine equivalents of values.
  23412. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23413. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23414. */
  23415. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23416. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23417. arrLength = array.length,
  23418. othLength = other.length;
  23419. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23420. return false;
  23421. }
  23422. // Assume cyclic values are equal.
  23423. var stacked = stack.get(array);
  23424. if (stacked && stack.get(other)) {
  23425. return stacked == other;
  23426. }
  23427. var index = -1,
  23428. result = true,
  23429. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23430. stack.set(array, other);
  23431. stack.set(other, array);
  23432. // Ignore non-index properties.
  23433. while (++index < arrLength) {
  23434. var arrValue = array[index],
  23435. othValue = other[index];
  23436. if (customizer) {
  23437. var compared = isPartial
  23438. ? customizer(othValue, arrValue, index, other, array, stack)
  23439. : customizer(arrValue, othValue, index, array, other, stack);
  23440. }
  23441. if (compared !== undefined) {
  23442. if (compared) {
  23443. continue;
  23444. }
  23445. result = false;
  23446. break;
  23447. }
  23448. // Recursively compare arrays (susceptible to call stack limits).
  23449. if (seen) {
  23450. if (!arraySome(other, function(othValue, othIndex) {
  23451. if (!cacheHas(seen, othIndex) &&
  23452. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23453. return seen.push(othIndex);
  23454. }
  23455. })) {
  23456. result = false;
  23457. break;
  23458. }
  23459. } else if (!(
  23460. arrValue === othValue ||
  23461. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23462. )) {
  23463. result = false;
  23464. break;
  23465. }
  23466. }
  23467. stack['delete'](array);
  23468. stack['delete'](other);
  23469. return result;
  23470. }
  23471. /**
  23472. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23473. * the same `toStringTag`.
  23474. *
  23475. * **Note:** This function only supports comparing values with tags of
  23476. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23477. *
  23478. * @private
  23479. * @param {Object} object The object to compare.
  23480. * @param {Object} other The other object to compare.
  23481. * @param {string} tag The `toStringTag` of the objects to compare.
  23482. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23483. * @param {Function} customizer The function to customize comparisons.
  23484. * @param {Function} equalFunc The function to determine equivalents of values.
  23485. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23486. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23487. */
  23488. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23489. switch (tag) {
  23490. case dataViewTag:
  23491. if ((object.byteLength != other.byteLength) ||
  23492. (object.byteOffset != other.byteOffset)) {
  23493. return false;
  23494. }
  23495. object = object.buffer;
  23496. other = other.buffer;
  23497. case arrayBufferTag:
  23498. if ((object.byteLength != other.byteLength) ||
  23499. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23500. return false;
  23501. }
  23502. return true;
  23503. case boolTag:
  23504. case dateTag:
  23505. case numberTag:
  23506. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23507. // Invalid dates are coerced to `NaN`.
  23508. return eq(+object, +other);
  23509. case errorTag:
  23510. return object.name == other.name && object.message == other.message;
  23511. case regexpTag:
  23512. case stringTag:
  23513. // Coerce regexes to strings and treat strings, primitives and objects,
  23514. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23515. // for more details.
  23516. return object == (other + '');
  23517. case mapTag:
  23518. var convert = mapToArray;
  23519. case setTag:
  23520. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23521. convert || (convert = setToArray);
  23522. if (object.size != other.size && !isPartial) {
  23523. return false;
  23524. }
  23525. // Assume cyclic values are equal.
  23526. var stacked = stack.get(object);
  23527. if (stacked) {
  23528. return stacked == other;
  23529. }
  23530. bitmask |= COMPARE_UNORDERED_FLAG;
  23531. // Recursively compare objects (susceptible to call stack limits).
  23532. stack.set(object, other);
  23533. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23534. stack['delete'](object);
  23535. return result;
  23536. case symbolTag:
  23537. if (symbolValueOf) {
  23538. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23539. }
  23540. }
  23541. return false;
  23542. }
  23543. /**
  23544. * A specialized version of `baseIsEqualDeep` for objects with support for
  23545. * partial deep comparisons.
  23546. *
  23547. * @private
  23548. * @param {Object} object The object to compare.
  23549. * @param {Object} other The other object to compare.
  23550. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23551. * @param {Function} customizer The function to customize comparisons.
  23552. * @param {Function} equalFunc The function to determine equivalents of values.
  23553. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23554. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23555. */
  23556. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23557. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23558. objProps = getAllKeys(object),
  23559. objLength = objProps.length,
  23560. othProps = getAllKeys(other),
  23561. othLength = othProps.length;
  23562. if (objLength != othLength && !isPartial) {
  23563. return false;
  23564. }
  23565. var index = objLength;
  23566. while (index--) {
  23567. var key = objProps[index];
  23568. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23569. return false;
  23570. }
  23571. }
  23572. // Assume cyclic values are equal.
  23573. var stacked = stack.get(object);
  23574. if (stacked && stack.get(other)) {
  23575. return stacked == other;
  23576. }
  23577. var result = true;
  23578. stack.set(object, other);
  23579. stack.set(other, object);
  23580. var skipCtor = isPartial;
  23581. while (++index < objLength) {
  23582. key = objProps[index];
  23583. var objValue = object[key],
  23584. othValue = other[key];
  23585. if (customizer) {
  23586. var compared = isPartial
  23587. ? customizer(othValue, objValue, key, other, object, stack)
  23588. : customizer(objValue, othValue, key, object, other, stack);
  23589. }
  23590. // Recursively compare objects (susceptible to call stack limits).
  23591. if (!(compared === undefined
  23592. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23593. : compared
  23594. )) {
  23595. result = false;
  23596. break;
  23597. }
  23598. skipCtor || (skipCtor = key == 'constructor');
  23599. }
  23600. if (result && !skipCtor) {
  23601. var objCtor = object.constructor,
  23602. othCtor = other.constructor;
  23603. // Non `Object` object instances with different constructors are not equal.
  23604. if (objCtor != othCtor &&
  23605. ('constructor' in object && 'constructor' in other) &&
  23606. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23607. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23608. result = false;
  23609. }
  23610. }
  23611. stack['delete'](object);
  23612. stack['delete'](other);
  23613. return result;
  23614. }
  23615. /**
  23616. * A specialized version of `baseRest` which flattens the rest array.
  23617. *
  23618. * @private
  23619. * @param {Function} func The function to apply a rest parameter to.
  23620. * @returns {Function} Returns the new function.
  23621. */
  23622. function flatRest(func) {
  23623. return setToString(overRest(func, undefined, flatten), func + '');
  23624. }
  23625. /**
  23626. * Creates an array of own enumerable property names and symbols of `object`.
  23627. *
  23628. * @private
  23629. * @param {Object} object The object to query.
  23630. * @returns {Array} Returns the array of property names and symbols.
  23631. */
  23632. function getAllKeys(object) {
  23633. return baseGetAllKeys(object, keys, getSymbols);
  23634. }
  23635. /**
  23636. * Creates an array of own and inherited enumerable property names and
  23637. * symbols of `object`.
  23638. *
  23639. * @private
  23640. * @param {Object} object The object to query.
  23641. * @returns {Array} Returns the array of property names and symbols.
  23642. */
  23643. function getAllKeysIn(object) {
  23644. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23645. }
  23646. /**
  23647. * Gets metadata for `func`.
  23648. *
  23649. * @private
  23650. * @param {Function} func The function to query.
  23651. * @returns {*} Returns the metadata for `func`.
  23652. */
  23653. var getData = !metaMap ? noop : function(func) {
  23654. return metaMap.get(func);
  23655. };
  23656. /**
  23657. * Gets the name of `func`.
  23658. *
  23659. * @private
  23660. * @param {Function} func The function to query.
  23661. * @returns {string} Returns the function name.
  23662. */
  23663. function getFuncName(func) {
  23664. var result = (func.name + ''),
  23665. array = realNames[result],
  23666. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23667. while (length--) {
  23668. var data = array[length],
  23669. otherFunc = data.func;
  23670. if (otherFunc == null || otherFunc == func) {
  23671. return data.name;
  23672. }
  23673. }
  23674. return result;
  23675. }
  23676. /**
  23677. * Gets the argument placeholder value for `func`.
  23678. *
  23679. * @private
  23680. * @param {Function} func The function to inspect.
  23681. * @returns {*} Returns the placeholder value.
  23682. */
  23683. function getHolder(func) {
  23684. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23685. return object.placeholder;
  23686. }
  23687. /**
  23688. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23689. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23690. * If arguments are provided, the chosen function is invoked with them and
  23691. * its result is returned.
  23692. *
  23693. * @private
  23694. * @param {*} [value] The value to convert to an iteratee.
  23695. * @param {number} [arity] The arity of the created iteratee.
  23696. * @returns {Function} Returns the chosen function or its result.
  23697. */
  23698. function getIteratee() {
  23699. var result = lodash.iteratee || iteratee;
  23700. result = result === iteratee ? baseIteratee : result;
  23701. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23702. }
  23703. /**
  23704. * Gets the data for `map`.
  23705. *
  23706. * @private
  23707. * @param {Object} map The map to query.
  23708. * @param {string} key The reference key.
  23709. * @returns {*} Returns the map data.
  23710. */
  23711. function getMapData(map, key) {
  23712. var data = map.__data__;
  23713. return isKeyable(key)
  23714. ? data[typeof key == 'string' ? 'string' : 'hash']
  23715. : data.map;
  23716. }
  23717. /**
  23718. * Gets the property names, values, and compare flags of `object`.
  23719. *
  23720. * @private
  23721. * @param {Object} object The object to query.
  23722. * @returns {Array} Returns the match data of `object`.
  23723. */
  23724. function getMatchData(object) {
  23725. var result = keys(object),
  23726. length = result.length;
  23727. while (length--) {
  23728. var key = result[length],
  23729. value = object[key];
  23730. result[length] = [key, value, isStrictComparable(value)];
  23731. }
  23732. return result;
  23733. }
  23734. /**
  23735. * Gets the native function at `key` of `object`.
  23736. *
  23737. * @private
  23738. * @param {Object} object The object to query.
  23739. * @param {string} key The key of the method to get.
  23740. * @returns {*} Returns the function if it's native, else `undefined`.
  23741. */
  23742. function getNative(object, key) {
  23743. var value = getValue(object, key);
  23744. return baseIsNative(value) ? value : undefined;
  23745. }
  23746. /**
  23747. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23748. *
  23749. * @private
  23750. * @param {*} value The value to query.
  23751. * @returns {string} Returns the raw `toStringTag`.
  23752. */
  23753. function getRawTag(value) {
  23754. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23755. tag = value[symToStringTag];
  23756. try {
  23757. value[symToStringTag] = undefined;
  23758. var unmasked = true;
  23759. } catch (e) {}
  23760. var result = nativeObjectToString.call(value);
  23761. if (unmasked) {
  23762. if (isOwn) {
  23763. value[symToStringTag] = tag;
  23764. } else {
  23765. delete value[symToStringTag];
  23766. }
  23767. }
  23768. return result;
  23769. }
  23770. /**
  23771. * Creates an array of the own enumerable symbols of `object`.
  23772. *
  23773. * @private
  23774. * @param {Object} object The object to query.
  23775. * @returns {Array} Returns the array of symbols.
  23776. */
  23777. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23778. if (object == null) {
  23779. return [];
  23780. }
  23781. object = Object(object);
  23782. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23783. return propertyIsEnumerable.call(object, symbol);
  23784. });
  23785. };
  23786. /**
  23787. * Creates an array of the own and inherited enumerable symbols of `object`.
  23788. *
  23789. * @private
  23790. * @param {Object} object The object to query.
  23791. * @returns {Array} Returns the array of symbols.
  23792. */
  23793. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23794. var result = [];
  23795. while (object) {
  23796. arrayPush(result, getSymbols(object));
  23797. object = getPrototype(object);
  23798. }
  23799. return result;
  23800. };
  23801. /**
  23802. * Gets the `toStringTag` of `value`.
  23803. *
  23804. * @private
  23805. * @param {*} value The value to query.
  23806. * @returns {string} Returns the `toStringTag`.
  23807. */
  23808. var getTag = baseGetTag;
  23809. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23810. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23811. (Map && getTag(new Map) != mapTag) ||
  23812. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23813. (Set && getTag(new Set) != setTag) ||
  23814. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23815. getTag = function(value) {
  23816. var result = baseGetTag(value),
  23817. Ctor = result == objectTag ? value.constructor : undefined,
  23818. ctorString = Ctor ? toSource(Ctor) : '';
  23819. if (ctorString) {
  23820. switch (ctorString) {
  23821. case dataViewCtorString: return dataViewTag;
  23822. case mapCtorString: return mapTag;
  23823. case promiseCtorString: return promiseTag;
  23824. case setCtorString: return setTag;
  23825. case weakMapCtorString: return weakMapTag;
  23826. }
  23827. }
  23828. return result;
  23829. };
  23830. }
  23831. /**
  23832. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23833. *
  23834. * @private
  23835. * @param {number} start The start of the view.
  23836. * @param {number} end The end of the view.
  23837. * @param {Array} transforms The transformations to apply to the view.
  23838. * @returns {Object} Returns an object containing the `start` and `end`
  23839. * positions of the view.
  23840. */
  23841. function getView(start, end, transforms) {
  23842. var index = -1,
  23843. length = transforms.length;
  23844. while (++index < length) {
  23845. var data = transforms[index],
  23846. size = data.size;
  23847. switch (data.type) {
  23848. case 'drop': start += size; break;
  23849. case 'dropRight': end -= size; break;
  23850. case 'take': end = nativeMin(end, start + size); break;
  23851. case 'takeRight': start = nativeMax(start, end - size); break;
  23852. }
  23853. }
  23854. return { 'start': start, 'end': end };
  23855. }
  23856. /**
  23857. * Extracts wrapper details from the `source` body comment.
  23858. *
  23859. * @private
  23860. * @param {string} source The source to inspect.
  23861. * @returns {Array} Returns the wrapper details.
  23862. */
  23863. function getWrapDetails(source) {
  23864. var match = source.match(reWrapDetails);
  23865. return match ? match[1].split(reSplitDetails) : [];
  23866. }
  23867. /**
  23868. * Checks if `path` exists on `object`.
  23869. *
  23870. * @private
  23871. * @param {Object} object The object to query.
  23872. * @param {Array|string} path The path to check.
  23873. * @param {Function} hasFunc The function to check properties.
  23874. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23875. */
  23876. function hasPath(object, path, hasFunc) {
  23877. path = castPath(path, object);
  23878. var index = -1,
  23879. length = path.length,
  23880. result = false;
  23881. while (++index < length) {
  23882. var key = toKey(path[index]);
  23883. if (!(result = object != null && hasFunc(object, key))) {
  23884. break;
  23885. }
  23886. object = object[key];
  23887. }
  23888. if (result || ++index != length) {
  23889. return result;
  23890. }
  23891. length = object == null ? 0 : object.length;
  23892. return !!length && isLength(length) && isIndex(key, length) &&
  23893. (isArray(object) || isArguments(object));
  23894. }
  23895. /**
  23896. * Initializes an array clone.
  23897. *
  23898. * @private
  23899. * @param {Array} array The array to clone.
  23900. * @returns {Array} Returns the initialized clone.
  23901. */
  23902. function initCloneArray(array) {
  23903. var length = array.length,
  23904. result = new array.constructor(length);
  23905. // Add properties assigned by `RegExp#exec`.
  23906. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23907. result.index = array.index;
  23908. result.input = array.input;
  23909. }
  23910. return result;
  23911. }
  23912. /**
  23913. * Initializes an object clone.
  23914. *
  23915. * @private
  23916. * @param {Object} object The object to clone.
  23917. * @returns {Object} Returns the initialized clone.
  23918. */
  23919. function initCloneObject(object) {
  23920. return (typeof object.constructor == 'function' && !isPrototype(object))
  23921. ? baseCreate(getPrototype(object))
  23922. : {};
  23923. }
  23924. /**
  23925. * Initializes an object clone based on its `toStringTag`.
  23926. *
  23927. * **Note:** This function only supports cloning values with tags of
  23928. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23929. *
  23930. * @private
  23931. * @param {Object} object The object to clone.
  23932. * @param {string} tag The `toStringTag` of the object to clone.
  23933. * @param {boolean} [isDeep] Specify a deep clone.
  23934. * @returns {Object} Returns the initialized clone.
  23935. */
  23936. function initCloneByTag(object, tag, isDeep) {
  23937. var Ctor = object.constructor;
  23938. switch (tag) {
  23939. case arrayBufferTag:
  23940. return cloneArrayBuffer(object);
  23941. case boolTag:
  23942. case dateTag:
  23943. return new Ctor(+object);
  23944. case dataViewTag:
  23945. return cloneDataView(object, isDeep);
  23946. case float32Tag: case float64Tag:
  23947. case int8Tag: case int16Tag: case int32Tag:
  23948. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23949. return cloneTypedArray(object, isDeep);
  23950. case mapTag:
  23951. return new Ctor;
  23952. case numberTag:
  23953. case stringTag:
  23954. return new Ctor(object);
  23955. case regexpTag:
  23956. return cloneRegExp(object);
  23957. case setTag:
  23958. return new Ctor;
  23959. case symbolTag:
  23960. return cloneSymbol(object);
  23961. }
  23962. }
  23963. /**
  23964. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23965. *
  23966. * @private
  23967. * @param {string} source The source to modify.
  23968. * @returns {Array} details The details to insert.
  23969. * @returns {string} Returns the modified source.
  23970. */
  23971. function insertWrapDetails(source, details) {
  23972. var length = details.length;
  23973. if (!length) {
  23974. return source;
  23975. }
  23976. var lastIndex = length - 1;
  23977. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23978. details = details.join(length > 2 ? ', ' : ' ');
  23979. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23980. }
  23981. /**
  23982. * Checks if `value` is a flattenable `arguments` object or array.
  23983. *
  23984. * @private
  23985. * @param {*} value The value to check.
  23986. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23987. */
  23988. function isFlattenable(value) {
  23989. return isArray(value) || isArguments(value) ||
  23990. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23991. }
  23992. /**
  23993. * Checks if `value` is a valid array-like index.
  23994. *
  23995. * @private
  23996. * @param {*} value The value to check.
  23997. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23998. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23999. */
  24000. function isIndex(value, length) {
  24001. var type = typeof value;
  24002. length = length == null ? MAX_SAFE_INTEGER : length;
  24003. return !!length &&
  24004. (type == 'number' ||
  24005. (type != 'symbol' && reIsUint.test(value))) &&
  24006. (value > -1 && value % 1 == 0 && value < length);
  24007. }
  24008. /**
  24009. * Checks if the given arguments are from an iteratee call.
  24010. *
  24011. * @private
  24012. * @param {*} value The potential iteratee value argument.
  24013. * @param {*} index The potential iteratee index or key argument.
  24014. * @param {*} object The potential iteratee object argument.
  24015. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24016. * else `false`.
  24017. */
  24018. function isIterateeCall(value, index, object) {
  24019. if (!isObject(object)) {
  24020. return false;
  24021. }
  24022. var type = typeof index;
  24023. if (type == 'number'
  24024. ? (isArrayLike(object) && isIndex(index, object.length))
  24025. : (type == 'string' && index in object)
  24026. ) {
  24027. return eq(object[index], value);
  24028. }
  24029. return false;
  24030. }
  24031. /**
  24032. * Checks if `value` is a property name and not a property path.
  24033. *
  24034. * @private
  24035. * @param {*} value The value to check.
  24036. * @param {Object} [object] The object to query keys on.
  24037. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24038. */
  24039. function isKey(value, object) {
  24040. if (isArray(value)) {
  24041. return false;
  24042. }
  24043. var type = typeof value;
  24044. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24045. value == null || isSymbol(value)) {
  24046. return true;
  24047. }
  24048. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24049. (object != null && value in Object(object));
  24050. }
  24051. /**
  24052. * Checks if `value` is suitable for use as unique object key.
  24053. *
  24054. * @private
  24055. * @param {*} value The value to check.
  24056. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24057. */
  24058. function isKeyable(value) {
  24059. var type = typeof value;
  24060. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24061. ? (value !== '__proto__')
  24062. : (value === null);
  24063. }
  24064. /**
  24065. * Checks if `func` has a lazy counterpart.
  24066. *
  24067. * @private
  24068. * @param {Function} func The function to check.
  24069. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24070. * else `false`.
  24071. */
  24072. function isLaziable(func) {
  24073. var funcName = getFuncName(func),
  24074. other = lodash[funcName];
  24075. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24076. return false;
  24077. }
  24078. if (func === other) {
  24079. return true;
  24080. }
  24081. var data = getData(other);
  24082. return !!data && func === data[0];
  24083. }
  24084. /**
  24085. * Checks if `func` has its source masked.
  24086. *
  24087. * @private
  24088. * @param {Function} func The function to check.
  24089. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24090. */
  24091. function isMasked(func) {
  24092. return !!maskSrcKey && (maskSrcKey in func);
  24093. }
  24094. /**
  24095. * Checks if `func` is capable of being masked.
  24096. *
  24097. * @private
  24098. * @param {*} value The value to check.
  24099. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24100. */
  24101. var isMaskable = coreJsData ? isFunction : stubFalse;
  24102. /**
  24103. * Checks if `value` is likely a prototype object.
  24104. *
  24105. * @private
  24106. * @param {*} value The value to check.
  24107. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24108. */
  24109. function isPrototype(value) {
  24110. var Ctor = value && value.constructor,
  24111. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24112. return value === proto;
  24113. }
  24114. /**
  24115. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24116. *
  24117. * @private
  24118. * @param {*} value The value to check.
  24119. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24120. * equality comparisons, else `false`.
  24121. */
  24122. function isStrictComparable(value) {
  24123. return value === value && !isObject(value);
  24124. }
  24125. /**
  24126. * A specialized version of `matchesProperty` for source values suitable
  24127. * for strict equality comparisons, i.e. `===`.
  24128. *
  24129. * @private
  24130. * @param {string} key The key of the property to get.
  24131. * @param {*} srcValue The value to match.
  24132. * @returns {Function} Returns the new spec function.
  24133. */
  24134. function matchesStrictComparable(key, srcValue) {
  24135. return function(object) {
  24136. if (object == null) {
  24137. return false;
  24138. }
  24139. return object[key] === srcValue &&
  24140. (srcValue !== undefined || (key in Object(object)));
  24141. };
  24142. }
  24143. /**
  24144. * A specialized version of `_.memoize` which clears the memoized function's
  24145. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24146. *
  24147. * @private
  24148. * @param {Function} func The function to have its output memoized.
  24149. * @returns {Function} Returns the new memoized function.
  24150. */
  24151. function memoizeCapped(func) {
  24152. var result = memoize(func, function(key) {
  24153. if (cache.size === MAX_MEMOIZE_SIZE) {
  24154. cache.clear();
  24155. }
  24156. return key;
  24157. });
  24158. var cache = result.cache;
  24159. return result;
  24160. }
  24161. /**
  24162. * Merges the function metadata of `source` into `data`.
  24163. *
  24164. * Merging metadata reduces the number of wrappers used to invoke a function.
  24165. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24166. * may be applied regardless of execution order. Methods like `_.ary` and
  24167. * `_.rearg` modify function arguments, making the order in which they are
  24168. * executed important, preventing the merging of metadata. However, we make
  24169. * an exception for a safe combined case where curried functions have `_.ary`
  24170. * and or `_.rearg` applied.
  24171. *
  24172. * @private
  24173. * @param {Array} data The destination metadata.
  24174. * @param {Array} source The source metadata.
  24175. * @returns {Array} Returns `data`.
  24176. */
  24177. function mergeData(data, source) {
  24178. var bitmask = data[1],
  24179. srcBitmask = source[1],
  24180. newBitmask = bitmask | srcBitmask,
  24181. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24182. var isCombo =
  24183. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24184. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24185. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24186. // Exit early if metadata can't be merged.
  24187. if (!(isCommon || isCombo)) {
  24188. return data;
  24189. }
  24190. // Use source `thisArg` if available.
  24191. if (srcBitmask & WRAP_BIND_FLAG) {
  24192. data[2] = source[2];
  24193. // Set when currying a bound function.
  24194. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24195. }
  24196. // Compose partial arguments.
  24197. var value = source[3];
  24198. if (value) {
  24199. var partials = data[3];
  24200. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24201. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24202. }
  24203. // Compose partial right arguments.
  24204. value = source[5];
  24205. if (value) {
  24206. partials = data[5];
  24207. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24208. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24209. }
  24210. // Use source `argPos` if available.
  24211. value = source[7];
  24212. if (value) {
  24213. data[7] = value;
  24214. }
  24215. // Use source `ary` if it's smaller.
  24216. if (srcBitmask & WRAP_ARY_FLAG) {
  24217. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24218. }
  24219. // Use source `arity` if one is not provided.
  24220. if (data[9] == null) {
  24221. data[9] = source[9];
  24222. }
  24223. // Use source `func` and merge bitmasks.
  24224. data[0] = source[0];
  24225. data[1] = newBitmask;
  24226. return data;
  24227. }
  24228. /**
  24229. * This function is like
  24230. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24231. * except that it includes inherited enumerable properties.
  24232. *
  24233. * @private
  24234. * @param {Object} object The object to query.
  24235. * @returns {Array} Returns the array of property names.
  24236. */
  24237. function nativeKeysIn(object) {
  24238. var result = [];
  24239. if (object != null) {
  24240. for (var key in Object(object)) {
  24241. result.push(key);
  24242. }
  24243. }
  24244. return result;
  24245. }
  24246. /**
  24247. * Converts `value` to a string using `Object.prototype.toString`.
  24248. *
  24249. * @private
  24250. * @param {*} value The value to convert.
  24251. * @returns {string} Returns the converted string.
  24252. */
  24253. function objectToString(value) {
  24254. return nativeObjectToString.call(value);
  24255. }
  24256. /**
  24257. * A specialized version of `baseRest` which transforms the rest array.
  24258. *
  24259. * @private
  24260. * @param {Function} func The function to apply a rest parameter to.
  24261. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24262. * @param {Function} transform The rest array transform.
  24263. * @returns {Function} Returns the new function.
  24264. */
  24265. function overRest(func, start, transform) {
  24266. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24267. return function() {
  24268. var args = arguments,
  24269. index = -1,
  24270. length = nativeMax(args.length - start, 0),
  24271. array = Array(length);
  24272. while (++index < length) {
  24273. array[index] = args[start + index];
  24274. }
  24275. index = -1;
  24276. var otherArgs = Array(start + 1);
  24277. while (++index < start) {
  24278. otherArgs[index] = args[index];
  24279. }
  24280. otherArgs[start] = transform(array);
  24281. return apply(func, this, otherArgs);
  24282. };
  24283. }
  24284. /**
  24285. * Gets the parent value at `path` of `object`.
  24286. *
  24287. * @private
  24288. * @param {Object} object The object to query.
  24289. * @param {Array} path The path to get the parent value of.
  24290. * @returns {*} Returns the parent value.
  24291. */
  24292. function parent(object, path) {
  24293. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24294. }
  24295. /**
  24296. * Reorder `array` according to the specified indexes where the element at
  24297. * the first index is assigned as the first element, the element at
  24298. * the second index is assigned as the second element, and so on.
  24299. *
  24300. * @private
  24301. * @param {Array} array The array to reorder.
  24302. * @param {Array} indexes The arranged array indexes.
  24303. * @returns {Array} Returns `array`.
  24304. */
  24305. function reorder(array, indexes) {
  24306. var arrLength = array.length,
  24307. length = nativeMin(indexes.length, arrLength),
  24308. oldArray = copyArray(array);
  24309. while (length--) {
  24310. var index = indexes[length];
  24311. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24312. }
  24313. return array;
  24314. }
  24315. /**
  24316. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24317. *
  24318. * @private
  24319. * @param {Object} object The object to query.
  24320. * @param {string} key The key of the property to get.
  24321. * @returns {*} Returns the property value.
  24322. */
  24323. function safeGet(object, key) {
  24324. if (key === 'constructor' && typeof object[key] === 'function') {
  24325. return;
  24326. }
  24327. if (key == '__proto__') {
  24328. return;
  24329. }
  24330. return object[key];
  24331. }
  24332. /**
  24333. * Sets metadata for `func`.
  24334. *
  24335. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24336. * period of time, it will trip its breaker and transition to an identity
  24337. * function to avoid garbage collection pauses in V8. See
  24338. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24339. * for more details.
  24340. *
  24341. * @private
  24342. * @param {Function} func The function to associate metadata with.
  24343. * @param {*} data The metadata.
  24344. * @returns {Function} Returns `func`.
  24345. */
  24346. var setData = shortOut(baseSetData);
  24347. /**
  24348. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24349. *
  24350. * @private
  24351. * @param {Function} func The function to delay.
  24352. * @param {number} wait The number of milliseconds to delay invocation.
  24353. * @returns {number|Object} Returns the timer id or timeout object.
  24354. */
  24355. var setTimeout = ctxSetTimeout || function(func, wait) {
  24356. return root.setTimeout(func, wait);
  24357. };
  24358. /**
  24359. * Sets the `toString` method of `func` to return `string`.
  24360. *
  24361. * @private
  24362. * @param {Function} func The function to modify.
  24363. * @param {Function} string The `toString` result.
  24364. * @returns {Function} Returns `func`.
  24365. */
  24366. var setToString = shortOut(baseSetToString);
  24367. /**
  24368. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24369. * with wrapper details in a comment at the top of the source body.
  24370. *
  24371. * @private
  24372. * @param {Function} wrapper The function to modify.
  24373. * @param {Function} reference The reference function.
  24374. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24375. * @returns {Function} Returns `wrapper`.
  24376. */
  24377. function setWrapToString(wrapper, reference, bitmask) {
  24378. var source = (reference + '');
  24379. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24380. }
  24381. /**
  24382. * Creates a function that'll short out and invoke `identity` instead
  24383. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24384. * milliseconds.
  24385. *
  24386. * @private
  24387. * @param {Function} func The function to restrict.
  24388. * @returns {Function} Returns the new shortable function.
  24389. */
  24390. function shortOut(func) {
  24391. var count = 0,
  24392. lastCalled = 0;
  24393. return function() {
  24394. var stamp = nativeNow(),
  24395. remaining = HOT_SPAN - (stamp - lastCalled);
  24396. lastCalled = stamp;
  24397. if (remaining > 0) {
  24398. if (++count >= HOT_COUNT) {
  24399. return arguments[0];
  24400. }
  24401. } else {
  24402. count = 0;
  24403. }
  24404. return func.apply(undefined, arguments);
  24405. };
  24406. }
  24407. /**
  24408. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24409. *
  24410. * @private
  24411. * @param {Array} array The array to shuffle.
  24412. * @param {number} [size=array.length] The size of `array`.
  24413. * @returns {Array} Returns `array`.
  24414. */
  24415. function shuffleSelf(array, size) {
  24416. var index = -1,
  24417. length = array.length,
  24418. lastIndex = length - 1;
  24419. size = size === undefined ? length : size;
  24420. while (++index < size) {
  24421. var rand = baseRandom(index, lastIndex),
  24422. value = array[rand];
  24423. array[rand] = array[index];
  24424. array[index] = value;
  24425. }
  24426. array.length = size;
  24427. return array;
  24428. }
  24429. /**
  24430. * Converts `string` to a property path array.
  24431. *
  24432. * @private
  24433. * @param {string} string The string to convert.
  24434. * @returns {Array} Returns the property path array.
  24435. */
  24436. var stringToPath = memoizeCapped(function(string) {
  24437. var result = [];
  24438. if (string.charCodeAt(0) === 46 /* . */) {
  24439. result.push('');
  24440. }
  24441. string.replace(rePropName, function(match, number, quote, subString) {
  24442. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24443. });
  24444. return result;
  24445. });
  24446. /**
  24447. * Converts `value` to a string key if it's not a string or symbol.
  24448. *
  24449. * @private
  24450. * @param {*} value The value to inspect.
  24451. * @returns {string|symbol} Returns the key.
  24452. */
  24453. function toKey(value) {
  24454. if (typeof value == 'string' || isSymbol(value)) {
  24455. return value;
  24456. }
  24457. var result = (value + '');
  24458. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24459. }
  24460. /**
  24461. * Converts `func` to its source code.
  24462. *
  24463. * @private
  24464. * @param {Function} func The function to convert.
  24465. * @returns {string} Returns the source code.
  24466. */
  24467. function toSource(func) {
  24468. if (func != null) {
  24469. try {
  24470. return funcToString.call(func);
  24471. } catch (e) {}
  24472. try {
  24473. return (func + '');
  24474. } catch (e) {}
  24475. }
  24476. return '';
  24477. }
  24478. /**
  24479. * Updates wrapper `details` based on `bitmask` flags.
  24480. *
  24481. * @private
  24482. * @returns {Array} details The details to modify.
  24483. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24484. * @returns {Array} Returns `details`.
  24485. */
  24486. function updateWrapDetails(details, bitmask) {
  24487. arrayEach(wrapFlags, function(pair) {
  24488. var value = '_.' + pair[0];
  24489. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24490. details.push(value);
  24491. }
  24492. });
  24493. return details.sort();
  24494. }
  24495. /**
  24496. * Creates a clone of `wrapper`.
  24497. *
  24498. * @private
  24499. * @param {Object} wrapper The wrapper to clone.
  24500. * @returns {Object} Returns the cloned wrapper.
  24501. */
  24502. function wrapperClone(wrapper) {
  24503. if (wrapper instanceof LazyWrapper) {
  24504. return wrapper.clone();
  24505. }
  24506. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24507. result.__actions__ = copyArray(wrapper.__actions__);
  24508. result.__index__ = wrapper.__index__;
  24509. result.__values__ = wrapper.__values__;
  24510. return result;
  24511. }
  24512. /*------------------------------------------------------------------------*/
  24513. /**
  24514. * Creates an array of elements split into groups the length of `size`.
  24515. * If `array` can't be split evenly, the final chunk will be the remaining
  24516. * elements.
  24517. *
  24518. * @static
  24519. * @memberOf _
  24520. * @since 3.0.0
  24521. * @category Array
  24522. * @param {Array} array The array to process.
  24523. * @param {number} [size=1] The length of each chunk
  24524. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24525. * @returns {Array} Returns the new array of chunks.
  24526. * @example
  24527. *
  24528. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24529. * // => [['a', 'b'], ['c', 'd']]
  24530. *
  24531. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24532. * // => [['a', 'b', 'c'], ['d']]
  24533. */
  24534. function chunk(array, size, guard) {
  24535. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24536. size = 1;
  24537. } else {
  24538. size = nativeMax(toInteger(size), 0);
  24539. }
  24540. var length = array == null ? 0 : array.length;
  24541. if (!length || size < 1) {
  24542. return [];
  24543. }
  24544. var index = 0,
  24545. resIndex = 0,
  24546. result = Array(nativeCeil(length / size));
  24547. while (index < length) {
  24548. result[resIndex++] = baseSlice(array, index, (index += size));
  24549. }
  24550. return result;
  24551. }
  24552. /**
  24553. * Creates an array with all falsey values removed. The values `false`, `null`,
  24554. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24555. *
  24556. * @static
  24557. * @memberOf _
  24558. * @since 0.1.0
  24559. * @category Array
  24560. * @param {Array} array The array to compact.
  24561. * @returns {Array} Returns the new array of filtered values.
  24562. * @example
  24563. *
  24564. * _.compact([0, 1, false, 2, '', 3]);
  24565. * // => [1, 2, 3]
  24566. */
  24567. function compact(array) {
  24568. var index = -1,
  24569. length = array == null ? 0 : array.length,
  24570. resIndex = 0,
  24571. result = [];
  24572. while (++index < length) {
  24573. var value = array[index];
  24574. if (value) {
  24575. result[resIndex++] = value;
  24576. }
  24577. }
  24578. return result;
  24579. }
  24580. /**
  24581. * Creates a new array concatenating `array` with any additional arrays
  24582. * and/or values.
  24583. *
  24584. * @static
  24585. * @memberOf _
  24586. * @since 4.0.0
  24587. * @category Array
  24588. * @param {Array} array The array to concatenate.
  24589. * @param {...*} [values] The values to concatenate.
  24590. * @returns {Array} Returns the new concatenated array.
  24591. * @example
  24592. *
  24593. * var array = [1];
  24594. * var other = _.concat(array, 2, [3], [[4]]);
  24595. *
  24596. * console.log(other);
  24597. * // => [1, 2, 3, [4]]
  24598. *
  24599. * console.log(array);
  24600. * // => [1]
  24601. */
  24602. function concat() {
  24603. var length = arguments.length;
  24604. if (!length) {
  24605. return [];
  24606. }
  24607. var args = Array(length - 1),
  24608. array = arguments[0],
  24609. index = length;
  24610. while (index--) {
  24611. args[index - 1] = arguments[index];
  24612. }
  24613. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24614. }
  24615. /**
  24616. * Creates an array of `array` values not included in the other given arrays
  24617. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24618. * for equality comparisons. The order and references of result values are
  24619. * determined by the first array.
  24620. *
  24621. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24622. *
  24623. * @static
  24624. * @memberOf _
  24625. * @since 0.1.0
  24626. * @category Array
  24627. * @param {Array} array The array to inspect.
  24628. * @param {...Array} [values] The values to exclude.
  24629. * @returns {Array} Returns the new array of filtered values.
  24630. * @see _.without, _.xor
  24631. * @example
  24632. *
  24633. * _.difference([2, 1], [2, 3]);
  24634. * // => [1]
  24635. */
  24636. var difference = baseRest(function(array, values) {
  24637. return isArrayLikeObject(array)
  24638. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24639. : [];
  24640. });
  24641. /**
  24642. * This method is like `_.difference` except that it accepts `iteratee` which
  24643. * is invoked for each element of `array` and `values` to generate the criterion
  24644. * by which they're compared. The order and references of result values are
  24645. * determined by the first array. The iteratee is invoked with one argument:
  24646. * (value).
  24647. *
  24648. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24649. *
  24650. * @static
  24651. * @memberOf _
  24652. * @since 4.0.0
  24653. * @category Array
  24654. * @param {Array} array The array to inspect.
  24655. * @param {...Array} [values] The values to exclude.
  24656. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24657. * @returns {Array} Returns the new array of filtered values.
  24658. * @example
  24659. *
  24660. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24661. * // => [1.2]
  24662. *
  24663. * // The `_.property` iteratee shorthand.
  24664. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24665. * // => [{ 'x': 2 }]
  24666. */
  24667. var differenceBy = baseRest(function(array, values) {
  24668. var iteratee = last(values);
  24669. if (isArrayLikeObject(iteratee)) {
  24670. iteratee = undefined;
  24671. }
  24672. return isArrayLikeObject(array)
  24673. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24674. : [];
  24675. });
  24676. /**
  24677. * This method is like `_.difference` except that it accepts `comparator`
  24678. * which is invoked to compare elements of `array` to `values`. The order and
  24679. * references of result values are determined by the first array. The comparator
  24680. * is invoked with two arguments: (arrVal, othVal).
  24681. *
  24682. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24683. *
  24684. * @static
  24685. * @memberOf _
  24686. * @since 4.0.0
  24687. * @category Array
  24688. * @param {Array} array The array to inspect.
  24689. * @param {...Array} [values] The values to exclude.
  24690. * @param {Function} [comparator] The comparator invoked per element.
  24691. * @returns {Array} Returns the new array of filtered values.
  24692. * @example
  24693. *
  24694. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24695. *
  24696. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24697. * // => [{ 'x': 2, 'y': 1 }]
  24698. */
  24699. var differenceWith = baseRest(function(array, values) {
  24700. var comparator = last(values);
  24701. if (isArrayLikeObject(comparator)) {
  24702. comparator = undefined;
  24703. }
  24704. return isArrayLikeObject(array)
  24705. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24706. : [];
  24707. });
  24708. /**
  24709. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24710. *
  24711. * @static
  24712. * @memberOf _
  24713. * @since 0.5.0
  24714. * @category Array
  24715. * @param {Array} array The array to query.
  24716. * @param {number} [n=1] The number of elements to drop.
  24717. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24718. * @returns {Array} Returns the slice of `array`.
  24719. * @example
  24720. *
  24721. * _.drop([1, 2, 3]);
  24722. * // => [2, 3]
  24723. *
  24724. * _.drop([1, 2, 3], 2);
  24725. * // => [3]
  24726. *
  24727. * _.drop([1, 2, 3], 5);
  24728. * // => []
  24729. *
  24730. * _.drop([1, 2, 3], 0);
  24731. * // => [1, 2, 3]
  24732. */
  24733. function drop(array, n, guard) {
  24734. var length = array == null ? 0 : array.length;
  24735. if (!length) {
  24736. return [];
  24737. }
  24738. n = (guard || n === undefined) ? 1 : toInteger(n);
  24739. return baseSlice(array, n < 0 ? 0 : n, length);
  24740. }
  24741. /**
  24742. * Creates a slice of `array` with `n` elements dropped from the end.
  24743. *
  24744. * @static
  24745. * @memberOf _
  24746. * @since 3.0.0
  24747. * @category Array
  24748. * @param {Array} array The array to query.
  24749. * @param {number} [n=1] The number of elements to drop.
  24750. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24751. * @returns {Array} Returns the slice of `array`.
  24752. * @example
  24753. *
  24754. * _.dropRight([1, 2, 3]);
  24755. * // => [1, 2]
  24756. *
  24757. * _.dropRight([1, 2, 3], 2);
  24758. * // => [1]
  24759. *
  24760. * _.dropRight([1, 2, 3], 5);
  24761. * // => []
  24762. *
  24763. * _.dropRight([1, 2, 3], 0);
  24764. * // => [1, 2, 3]
  24765. */
  24766. function dropRight(array, n, guard) {
  24767. var length = array == null ? 0 : array.length;
  24768. if (!length) {
  24769. return [];
  24770. }
  24771. n = (guard || n === undefined) ? 1 : toInteger(n);
  24772. n = length - n;
  24773. return baseSlice(array, 0, n < 0 ? 0 : n);
  24774. }
  24775. /**
  24776. * Creates a slice of `array` excluding elements dropped from the end.
  24777. * Elements are dropped until `predicate` returns falsey. The predicate is
  24778. * invoked with three arguments: (value, index, array).
  24779. *
  24780. * @static
  24781. * @memberOf _
  24782. * @since 3.0.0
  24783. * @category Array
  24784. * @param {Array} array The array to query.
  24785. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24786. * @returns {Array} Returns the slice of `array`.
  24787. * @example
  24788. *
  24789. * var users = [
  24790. * { 'user': 'barney', 'active': true },
  24791. * { 'user': 'fred', 'active': false },
  24792. * { 'user': 'pebbles', 'active': false }
  24793. * ];
  24794. *
  24795. * _.dropRightWhile(users, function(o) { return !o.active; });
  24796. * // => objects for ['barney']
  24797. *
  24798. * // The `_.matches` iteratee shorthand.
  24799. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24800. * // => objects for ['barney', 'fred']
  24801. *
  24802. * // The `_.matchesProperty` iteratee shorthand.
  24803. * _.dropRightWhile(users, ['active', false]);
  24804. * // => objects for ['barney']
  24805. *
  24806. * // The `_.property` iteratee shorthand.
  24807. * _.dropRightWhile(users, 'active');
  24808. * // => objects for ['barney', 'fred', 'pebbles']
  24809. */
  24810. function dropRightWhile(array, predicate) {
  24811. return (array && array.length)
  24812. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24813. : [];
  24814. }
  24815. /**
  24816. * Creates a slice of `array` excluding elements dropped from the beginning.
  24817. * Elements are dropped until `predicate` returns falsey. The predicate is
  24818. * invoked with three arguments: (value, index, array).
  24819. *
  24820. * @static
  24821. * @memberOf _
  24822. * @since 3.0.0
  24823. * @category Array
  24824. * @param {Array} array The array to query.
  24825. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24826. * @returns {Array} Returns the slice of `array`.
  24827. * @example
  24828. *
  24829. * var users = [
  24830. * { 'user': 'barney', 'active': false },
  24831. * { 'user': 'fred', 'active': false },
  24832. * { 'user': 'pebbles', 'active': true }
  24833. * ];
  24834. *
  24835. * _.dropWhile(users, function(o) { return !o.active; });
  24836. * // => objects for ['pebbles']
  24837. *
  24838. * // The `_.matches` iteratee shorthand.
  24839. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24840. * // => objects for ['fred', 'pebbles']
  24841. *
  24842. * // The `_.matchesProperty` iteratee shorthand.
  24843. * _.dropWhile(users, ['active', false]);
  24844. * // => objects for ['pebbles']
  24845. *
  24846. * // The `_.property` iteratee shorthand.
  24847. * _.dropWhile(users, 'active');
  24848. * // => objects for ['barney', 'fred', 'pebbles']
  24849. */
  24850. function dropWhile(array, predicate) {
  24851. return (array && array.length)
  24852. ? baseWhile(array, getIteratee(predicate, 3), true)
  24853. : [];
  24854. }
  24855. /**
  24856. * Fills elements of `array` with `value` from `start` up to, but not
  24857. * including, `end`.
  24858. *
  24859. * **Note:** This method mutates `array`.
  24860. *
  24861. * @static
  24862. * @memberOf _
  24863. * @since 3.2.0
  24864. * @category Array
  24865. * @param {Array} array The array to fill.
  24866. * @param {*} value The value to fill `array` with.
  24867. * @param {number} [start=0] The start position.
  24868. * @param {number} [end=array.length] The end position.
  24869. * @returns {Array} Returns `array`.
  24870. * @example
  24871. *
  24872. * var array = [1, 2, 3];
  24873. *
  24874. * _.fill(array, 'a');
  24875. * console.log(array);
  24876. * // => ['a', 'a', 'a']
  24877. *
  24878. * _.fill(Array(3), 2);
  24879. * // => [2, 2, 2]
  24880. *
  24881. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24882. * // => [4, '*', '*', 10]
  24883. */
  24884. function fill(array, value, start, end) {
  24885. var length = array == null ? 0 : array.length;
  24886. if (!length) {
  24887. return [];
  24888. }
  24889. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24890. start = 0;
  24891. end = length;
  24892. }
  24893. return baseFill(array, value, start, end);
  24894. }
  24895. /**
  24896. * This method is like `_.find` except that it returns the index of the first
  24897. * element `predicate` returns truthy for instead of the element itself.
  24898. *
  24899. * @static
  24900. * @memberOf _
  24901. * @since 1.1.0
  24902. * @category Array
  24903. * @param {Array} array The array to inspect.
  24904. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24905. * @param {number} [fromIndex=0] The index to search from.
  24906. * @returns {number} Returns the index of the found element, else `-1`.
  24907. * @example
  24908. *
  24909. * var users = [
  24910. * { 'user': 'barney', 'active': false },
  24911. * { 'user': 'fred', 'active': false },
  24912. * { 'user': 'pebbles', 'active': true }
  24913. * ];
  24914. *
  24915. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24916. * // => 0
  24917. *
  24918. * // The `_.matches` iteratee shorthand.
  24919. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24920. * // => 1
  24921. *
  24922. * // The `_.matchesProperty` iteratee shorthand.
  24923. * _.findIndex(users, ['active', false]);
  24924. * // => 0
  24925. *
  24926. * // The `_.property` iteratee shorthand.
  24927. * _.findIndex(users, 'active');
  24928. * // => 2
  24929. */
  24930. function findIndex(array, predicate, fromIndex) {
  24931. var length = array == null ? 0 : array.length;
  24932. if (!length) {
  24933. return -1;
  24934. }
  24935. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24936. if (index < 0) {
  24937. index = nativeMax(length + index, 0);
  24938. }
  24939. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24940. }
  24941. /**
  24942. * This method is like `_.findIndex` except that it iterates over elements
  24943. * of `collection` from right to left.
  24944. *
  24945. * @static
  24946. * @memberOf _
  24947. * @since 2.0.0
  24948. * @category Array
  24949. * @param {Array} array The array to inspect.
  24950. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24951. * @param {number} [fromIndex=array.length-1] The index to search from.
  24952. * @returns {number} Returns the index of the found element, else `-1`.
  24953. * @example
  24954. *
  24955. * var users = [
  24956. * { 'user': 'barney', 'active': true },
  24957. * { 'user': 'fred', 'active': false },
  24958. * { 'user': 'pebbles', 'active': false }
  24959. * ];
  24960. *
  24961. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24962. * // => 2
  24963. *
  24964. * // The `_.matches` iteratee shorthand.
  24965. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24966. * // => 0
  24967. *
  24968. * // The `_.matchesProperty` iteratee shorthand.
  24969. * _.findLastIndex(users, ['active', false]);
  24970. * // => 2
  24971. *
  24972. * // The `_.property` iteratee shorthand.
  24973. * _.findLastIndex(users, 'active');
  24974. * // => 0
  24975. */
  24976. function findLastIndex(array, predicate, fromIndex) {
  24977. var length = array == null ? 0 : array.length;
  24978. if (!length) {
  24979. return -1;
  24980. }
  24981. var index = length - 1;
  24982. if (fromIndex !== undefined) {
  24983. index = toInteger(fromIndex);
  24984. index = fromIndex < 0
  24985. ? nativeMax(length + index, 0)
  24986. : nativeMin(index, length - 1);
  24987. }
  24988. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24989. }
  24990. /**
  24991. * Flattens `array` a single level deep.
  24992. *
  24993. * @static
  24994. * @memberOf _
  24995. * @since 0.1.0
  24996. * @category Array
  24997. * @param {Array} array The array to flatten.
  24998. * @returns {Array} Returns the new flattened array.
  24999. * @example
  25000. *
  25001. * _.flatten([1, [2, [3, [4]], 5]]);
  25002. * // => [1, 2, [3, [4]], 5]
  25003. */
  25004. function flatten(array) {
  25005. var length = array == null ? 0 : array.length;
  25006. return length ? baseFlatten(array, 1) : [];
  25007. }
  25008. /**
  25009. * Recursively flattens `array`.
  25010. *
  25011. * @static
  25012. * @memberOf _
  25013. * @since 3.0.0
  25014. * @category Array
  25015. * @param {Array} array The array to flatten.
  25016. * @returns {Array} Returns the new flattened array.
  25017. * @example
  25018. *
  25019. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25020. * // => [1, 2, 3, 4, 5]
  25021. */
  25022. function flattenDeep(array) {
  25023. var length = array == null ? 0 : array.length;
  25024. return length ? baseFlatten(array, INFINITY) : [];
  25025. }
  25026. /**
  25027. * Recursively flatten `array` up to `depth` times.
  25028. *
  25029. * @static
  25030. * @memberOf _
  25031. * @since 4.4.0
  25032. * @category Array
  25033. * @param {Array} array The array to flatten.
  25034. * @param {number} [depth=1] The maximum recursion depth.
  25035. * @returns {Array} Returns the new flattened array.
  25036. * @example
  25037. *
  25038. * var array = [1, [2, [3, [4]], 5]];
  25039. *
  25040. * _.flattenDepth(array, 1);
  25041. * // => [1, 2, [3, [4]], 5]
  25042. *
  25043. * _.flattenDepth(array, 2);
  25044. * // => [1, 2, 3, [4], 5]
  25045. */
  25046. function flattenDepth(array, depth) {
  25047. var length = array == null ? 0 : array.length;
  25048. if (!length) {
  25049. return [];
  25050. }
  25051. depth = depth === undefined ? 1 : toInteger(depth);
  25052. return baseFlatten(array, depth);
  25053. }
  25054. /**
  25055. * The inverse of `_.toPairs`; this method returns an object composed
  25056. * from key-value `pairs`.
  25057. *
  25058. * @static
  25059. * @memberOf _
  25060. * @since 4.0.0
  25061. * @category Array
  25062. * @param {Array} pairs The key-value pairs.
  25063. * @returns {Object} Returns the new object.
  25064. * @example
  25065. *
  25066. * _.fromPairs([['a', 1], ['b', 2]]);
  25067. * // => { 'a': 1, 'b': 2 }
  25068. */
  25069. function fromPairs(pairs) {
  25070. var index = -1,
  25071. length = pairs == null ? 0 : pairs.length,
  25072. result = {};
  25073. while (++index < length) {
  25074. var pair = pairs[index];
  25075. result[pair[0]] = pair[1];
  25076. }
  25077. return result;
  25078. }
  25079. /**
  25080. * Gets the first element of `array`.
  25081. *
  25082. * @static
  25083. * @memberOf _
  25084. * @since 0.1.0
  25085. * @alias first
  25086. * @category Array
  25087. * @param {Array} array The array to query.
  25088. * @returns {*} Returns the first element of `array`.
  25089. * @example
  25090. *
  25091. * _.head([1, 2, 3]);
  25092. * // => 1
  25093. *
  25094. * _.head([]);
  25095. * // => undefined
  25096. */
  25097. function head(array) {
  25098. return (array && array.length) ? array[0] : undefined;
  25099. }
  25100. /**
  25101. * Gets the index at which the first occurrence of `value` is found in `array`
  25102. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25103. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25104. * offset from the end of `array`.
  25105. *
  25106. * @static
  25107. * @memberOf _
  25108. * @since 0.1.0
  25109. * @category Array
  25110. * @param {Array} array The array to inspect.
  25111. * @param {*} value The value to search for.
  25112. * @param {number} [fromIndex=0] The index to search from.
  25113. * @returns {number} Returns the index of the matched value, else `-1`.
  25114. * @example
  25115. *
  25116. * _.indexOf([1, 2, 1, 2], 2);
  25117. * // => 1
  25118. *
  25119. * // Search from the `fromIndex`.
  25120. * _.indexOf([1, 2, 1, 2], 2, 2);
  25121. * // => 3
  25122. */
  25123. function indexOf(array, value, fromIndex) {
  25124. var length = array == null ? 0 : array.length;
  25125. if (!length) {
  25126. return -1;
  25127. }
  25128. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25129. if (index < 0) {
  25130. index = nativeMax(length + index, 0);
  25131. }
  25132. return baseIndexOf(array, value, index);
  25133. }
  25134. /**
  25135. * Gets all but the last element of `array`.
  25136. *
  25137. * @static
  25138. * @memberOf _
  25139. * @since 0.1.0
  25140. * @category Array
  25141. * @param {Array} array The array to query.
  25142. * @returns {Array} Returns the slice of `array`.
  25143. * @example
  25144. *
  25145. * _.initial([1, 2, 3]);
  25146. * // => [1, 2]
  25147. */
  25148. function initial(array) {
  25149. var length = array == null ? 0 : array.length;
  25150. return length ? baseSlice(array, 0, -1) : [];
  25151. }
  25152. /**
  25153. * Creates an array of unique values that are included in all given arrays
  25154. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25155. * for equality comparisons. The order and references of result values are
  25156. * determined by the first array.
  25157. *
  25158. * @static
  25159. * @memberOf _
  25160. * @since 0.1.0
  25161. * @category Array
  25162. * @param {...Array} [arrays] The arrays to inspect.
  25163. * @returns {Array} Returns the new array of intersecting values.
  25164. * @example
  25165. *
  25166. * _.intersection([2, 1], [2, 3]);
  25167. * // => [2]
  25168. */
  25169. var intersection = baseRest(function(arrays) {
  25170. var mapped = arrayMap(arrays, castArrayLikeObject);
  25171. return (mapped.length && mapped[0] === arrays[0])
  25172. ? baseIntersection(mapped)
  25173. : [];
  25174. });
  25175. /**
  25176. * This method is like `_.intersection` except that it accepts `iteratee`
  25177. * which is invoked for each element of each `arrays` to generate the criterion
  25178. * by which they're compared. The order and references of result values are
  25179. * determined by the first array. The iteratee is invoked with one argument:
  25180. * (value).
  25181. *
  25182. * @static
  25183. * @memberOf _
  25184. * @since 4.0.0
  25185. * @category Array
  25186. * @param {...Array} [arrays] The arrays to inspect.
  25187. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25188. * @returns {Array} Returns the new array of intersecting values.
  25189. * @example
  25190. *
  25191. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25192. * // => [2.1]
  25193. *
  25194. * // The `_.property` iteratee shorthand.
  25195. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25196. * // => [{ 'x': 1 }]
  25197. */
  25198. var intersectionBy = baseRest(function(arrays) {
  25199. var iteratee = last(arrays),
  25200. mapped = arrayMap(arrays, castArrayLikeObject);
  25201. if (iteratee === last(mapped)) {
  25202. iteratee = undefined;
  25203. } else {
  25204. mapped.pop();
  25205. }
  25206. return (mapped.length && mapped[0] === arrays[0])
  25207. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25208. : [];
  25209. });
  25210. /**
  25211. * This method is like `_.intersection` except that it accepts `comparator`
  25212. * which is invoked to compare elements of `arrays`. The order and references
  25213. * of result values are determined by the first array. The comparator is
  25214. * invoked with two arguments: (arrVal, othVal).
  25215. *
  25216. * @static
  25217. * @memberOf _
  25218. * @since 4.0.0
  25219. * @category Array
  25220. * @param {...Array} [arrays] The arrays to inspect.
  25221. * @param {Function} [comparator] The comparator invoked per element.
  25222. * @returns {Array} Returns the new array of intersecting values.
  25223. * @example
  25224. *
  25225. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25226. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25227. *
  25228. * _.intersectionWith(objects, others, _.isEqual);
  25229. * // => [{ 'x': 1, 'y': 2 }]
  25230. */
  25231. var intersectionWith = baseRest(function(arrays) {
  25232. var comparator = last(arrays),
  25233. mapped = arrayMap(arrays, castArrayLikeObject);
  25234. comparator = typeof comparator == 'function' ? comparator : undefined;
  25235. if (comparator) {
  25236. mapped.pop();
  25237. }
  25238. return (mapped.length && mapped[0] === arrays[0])
  25239. ? baseIntersection(mapped, undefined, comparator)
  25240. : [];
  25241. });
  25242. /**
  25243. * Converts all elements in `array` into a string separated by `separator`.
  25244. *
  25245. * @static
  25246. * @memberOf _
  25247. * @since 4.0.0
  25248. * @category Array
  25249. * @param {Array} array The array to convert.
  25250. * @param {string} [separator=','] The element separator.
  25251. * @returns {string} Returns the joined string.
  25252. * @example
  25253. *
  25254. * _.join(['a', 'b', 'c'], '~');
  25255. * // => 'a~b~c'
  25256. */
  25257. function join(array, separator) {
  25258. return array == null ? '' : nativeJoin.call(array, separator);
  25259. }
  25260. /**
  25261. * Gets the last element of `array`.
  25262. *
  25263. * @static
  25264. * @memberOf _
  25265. * @since 0.1.0
  25266. * @category Array
  25267. * @param {Array} array The array to query.
  25268. * @returns {*} Returns the last element of `array`.
  25269. * @example
  25270. *
  25271. * _.last([1, 2, 3]);
  25272. * // => 3
  25273. */
  25274. function last(array) {
  25275. var length = array == null ? 0 : array.length;
  25276. return length ? array[length - 1] : undefined;
  25277. }
  25278. /**
  25279. * This method is like `_.indexOf` except that it iterates over elements of
  25280. * `array` from right to left.
  25281. *
  25282. * @static
  25283. * @memberOf _
  25284. * @since 0.1.0
  25285. * @category Array
  25286. * @param {Array} array The array to inspect.
  25287. * @param {*} value The value to search for.
  25288. * @param {number} [fromIndex=array.length-1] The index to search from.
  25289. * @returns {number} Returns the index of the matched value, else `-1`.
  25290. * @example
  25291. *
  25292. * _.lastIndexOf([1, 2, 1, 2], 2);
  25293. * // => 3
  25294. *
  25295. * // Search from the `fromIndex`.
  25296. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25297. * // => 1
  25298. */
  25299. function lastIndexOf(array, value, fromIndex) {
  25300. var length = array == null ? 0 : array.length;
  25301. if (!length) {
  25302. return -1;
  25303. }
  25304. var index = length;
  25305. if (fromIndex !== undefined) {
  25306. index = toInteger(fromIndex);
  25307. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25308. }
  25309. return value === value
  25310. ? strictLastIndexOf(array, value, index)
  25311. : baseFindIndex(array, baseIsNaN, index, true);
  25312. }
  25313. /**
  25314. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25315. * element from the end is returned.
  25316. *
  25317. * @static
  25318. * @memberOf _
  25319. * @since 4.11.0
  25320. * @category Array
  25321. * @param {Array} array The array to query.
  25322. * @param {number} [n=0] The index of the element to return.
  25323. * @returns {*} Returns the nth element of `array`.
  25324. * @example
  25325. *
  25326. * var array = ['a', 'b', 'c', 'd'];
  25327. *
  25328. * _.nth(array, 1);
  25329. * // => 'b'
  25330. *
  25331. * _.nth(array, -2);
  25332. * // => 'c';
  25333. */
  25334. function nth(array, n) {
  25335. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25336. }
  25337. /**
  25338. * Removes all given values from `array` using
  25339. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25340. * for equality comparisons.
  25341. *
  25342. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25343. * to remove elements from an array by predicate.
  25344. *
  25345. * @static
  25346. * @memberOf _
  25347. * @since 2.0.0
  25348. * @category Array
  25349. * @param {Array} array The array to modify.
  25350. * @param {...*} [values] The values to remove.
  25351. * @returns {Array} Returns `array`.
  25352. * @example
  25353. *
  25354. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25355. *
  25356. * _.pull(array, 'a', 'c');
  25357. * console.log(array);
  25358. * // => ['b', 'b']
  25359. */
  25360. var pull = baseRest(pullAll);
  25361. /**
  25362. * This method is like `_.pull` except that it accepts an array of values to remove.
  25363. *
  25364. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25365. *
  25366. * @static
  25367. * @memberOf _
  25368. * @since 4.0.0
  25369. * @category Array
  25370. * @param {Array} array The array to modify.
  25371. * @param {Array} values The values to remove.
  25372. * @returns {Array} Returns `array`.
  25373. * @example
  25374. *
  25375. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25376. *
  25377. * _.pullAll(array, ['a', 'c']);
  25378. * console.log(array);
  25379. * // => ['b', 'b']
  25380. */
  25381. function pullAll(array, values) {
  25382. return (array && array.length && values && values.length)
  25383. ? basePullAll(array, values)
  25384. : array;
  25385. }
  25386. /**
  25387. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25388. * invoked for each element of `array` and `values` to generate the criterion
  25389. * by which they're compared. The iteratee is invoked with one argument: (value).
  25390. *
  25391. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25392. *
  25393. * @static
  25394. * @memberOf _
  25395. * @since 4.0.0
  25396. * @category Array
  25397. * @param {Array} array The array to modify.
  25398. * @param {Array} values The values to remove.
  25399. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25400. * @returns {Array} Returns `array`.
  25401. * @example
  25402. *
  25403. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25404. *
  25405. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25406. * console.log(array);
  25407. * // => [{ 'x': 2 }]
  25408. */
  25409. function pullAllBy(array, values, iteratee) {
  25410. return (array && array.length && values && values.length)
  25411. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25412. : array;
  25413. }
  25414. /**
  25415. * This method is like `_.pullAll` except that it accepts `comparator` which
  25416. * is invoked to compare elements of `array` to `values`. The comparator is
  25417. * invoked with two arguments: (arrVal, othVal).
  25418. *
  25419. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25420. *
  25421. * @static
  25422. * @memberOf _
  25423. * @since 4.6.0
  25424. * @category Array
  25425. * @param {Array} array The array to modify.
  25426. * @param {Array} values The values to remove.
  25427. * @param {Function} [comparator] The comparator invoked per element.
  25428. * @returns {Array} Returns `array`.
  25429. * @example
  25430. *
  25431. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25432. *
  25433. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25434. * console.log(array);
  25435. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25436. */
  25437. function pullAllWith(array, values, comparator) {
  25438. return (array && array.length && values && values.length)
  25439. ? basePullAll(array, values, undefined, comparator)
  25440. : array;
  25441. }
  25442. /**
  25443. * Removes elements from `array` corresponding to `indexes` and returns an
  25444. * array of removed elements.
  25445. *
  25446. * **Note:** Unlike `_.at`, this method mutates `array`.
  25447. *
  25448. * @static
  25449. * @memberOf _
  25450. * @since 3.0.0
  25451. * @category Array
  25452. * @param {Array} array The array to modify.
  25453. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25454. * @returns {Array} Returns the new array of removed elements.
  25455. * @example
  25456. *
  25457. * var array = ['a', 'b', 'c', 'd'];
  25458. * var pulled = _.pullAt(array, [1, 3]);
  25459. *
  25460. * console.log(array);
  25461. * // => ['a', 'c']
  25462. *
  25463. * console.log(pulled);
  25464. * // => ['b', 'd']
  25465. */
  25466. var pullAt = flatRest(function(array, indexes) {
  25467. var length = array == null ? 0 : array.length,
  25468. result = baseAt(array, indexes);
  25469. basePullAt(array, arrayMap(indexes, function(index) {
  25470. return isIndex(index, length) ? +index : index;
  25471. }).sort(compareAscending));
  25472. return result;
  25473. });
  25474. /**
  25475. * Removes all elements from `array` that `predicate` returns truthy for
  25476. * and returns an array of the removed elements. The predicate is invoked
  25477. * with three arguments: (value, index, array).
  25478. *
  25479. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25480. * to pull elements from an array by value.
  25481. *
  25482. * @static
  25483. * @memberOf _
  25484. * @since 2.0.0
  25485. * @category Array
  25486. * @param {Array} array The array to modify.
  25487. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25488. * @returns {Array} Returns the new array of removed elements.
  25489. * @example
  25490. *
  25491. * var array = [1, 2, 3, 4];
  25492. * var evens = _.remove(array, function(n) {
  25493. * return n % 2 == 0;
  25494. * });
  25495. *
  25496. * console.log(array);
  25497. * // => [1, 3]
  25498. *
  25499. * console.log(evens);
  25500. * // => [2, 4]
  25501. */
  25502. function remove(array, predicate) {
  25503. var result = [];
  25504. if (!(array && array.length)) {
  25505. return result;
  25506. }
  25507. var index = -1,
  25508. indexes = [],
  25509. length = array.length;
  25510. predicate = getIteratee(predicate, 3);
  25511. while (++index < length) {
  25512. var value = array[index];
  25513. if (predicate(value, index, array)) {
  25514. result.push(value);
  25515. indexes.push(index);
  25516. }
  25517. }
  25518. basePullAt(array, indexes);
  25519. return result;
  25520. }
  25521. /**
  25522. * Reverses `array` so that the first element becomes the last, the second
  25523. * element becomes the second to last, and so on.
  25524. *
  25525. * **Note:** This method mutates `array` and is based on
  25526. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25527. *
  25528. * @static
  25529. * @memberOf _
  25530. * @since 4.0.0
  25531. * @category Array
  25532. * @param {Array} array The array to modify.
  25533. * @returns {Array} Returns `array`.
  25534. * @example
  25535. *
  25536. * var array = [1, 2, 3];
  25537. *
  25538. * _.reverse(array);
  25539. * // => [3, 2, 1]
  25540. *
  25541. * console.log(array);
  25542. * // => [3, 2, 1]
  25543. */
  25544. function reverse(array) {
  25545. return array == null ? array : nativeReverse.call(array);
  25546. }
  25547. /**
  25548. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25549. *
  25550. * **Note:** This method is used instead of
  25551. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25552. * returned.
  25553. *
  25554. * @static
  25555. * @memberOf _
  25556. * @since 3.0.0
  25557. * @category Array
  25558. * @param {Array} array The array to slice.
  25559. * @param {number} [start=0] The start position.
  25560. * @param {number} [end=array.length] The end position.
  25561. * @returns {Array} Returns the slice of `array`.
  25562. */
  25563. function slice(array, start, end) {
  25564. var length = array == null ? 0 : array.length;
  25565. if (!length) {
  25566. return [];
  25567. }
  25568. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25569. start = 0;
  25570. end = length;
  25571. }
  25572. else {
  25573. start = start == null ? 0 : toInteger(start);
  25574. end = end === undefined ? length : toInteger(end);
  25575. }
  25576. return baseSlice(array, start, end);
  25577. }
  25578. /**
  25579. * Uses a binary search to determine the lowest index at which `value`
  25580. * should be inserted into `array` in order to maintain its sort order.
  25581. *
  25582. * @static
  25583. * @memberOf _
  25584. * @since 0.1.0
  25585. * @category Array
  25586. * @param {Array} array The sorted array to inspect.
  25587. * @param {*} value The value to evaluate.
  25588. * @returns {number} Returns the index at which `value` should be inserted
  25589. * into `array`.
  25590. * @example
  25591. *
  25592. * _.sortedIndex([30, 50], 40);
  25593. * // => 1
  25594. */
  25595. function sortedIndex(array, value) {
  25596. return baseSortedIndex(array, value);
  25597. }
  25598. /**
  25599. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25600. * which is invoked for `value` and each element of `array` to compute their
  25601. * sort ranking. The iteratee is invoked with one argument: (value).
  25602. *
  25603. * @static
  25604. * @memberOf _
  25605. * @since 4.0.0
  25606. * @category Array
  25607. * @param {Array} array The sorted array to inspect.
  25608. * @param {*} value The value to evaluate.
  25609. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25610. * @returns {number} Returns the index at which `value` should be inserted
  25611. * into `array`.
  25612. * @example
  25613. *
  25614. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25615. *
  25616. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25617. * // => 0
  25618. *
  25619. * // The `_.property` iteratee shorthand.
  25620. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25621. * // => 0
  25622. */
  25623. function sortedIndexBy(array, value, iteratee) {
  25624. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25625. }
  25626. /**
  25627. * This method is like `_.indexOf` except that it performs a binary
  25628. * search on a sorted `array`.
  25629. *
  25630. * @static
  25631. * @memberOf _
  25632. * @since 4.0.0
  25633. * @category Array
  25634. * @param {Array} array The array to inspect.
  25635. * @param {*} value The value to search for.
  25636. * @returns {number} Returns the index of the matched value, else `-1`.
  25637. * @example
  25638. *
  25639. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25640. * // => 1
  25641. */
  25642. function sortedIndexOf(array, value) {
  25643. var length = array == null ? 0 : array.length;
  25644. if (length) {
  25645. var index = baseSortedIndex(array, value);
  25646. if (index < length && eq(array[index], value)) {
  25647. return index;
  25648. }
  25649. }
  25650. return -1;
  25651. }
  25652. /**
  25653. * This method is like `_.sortedIndex` except that it returns the highest
  25654. * index at which `value` should be inserted into `array` in order to
  25655. * maintain its sort order.
  25656. *
  25657. * @static
  25658. * @memberOf _
  25659. * @since 3.0.0
  25660. * @category Array
  25661. * @param {Array} array The sorted array to inspect.
  25662. * @param {*} value The value to evaluate.
  25663. * @returns {number} Returns the index at which `value` should be inserted
  25664. * into `array`.
  25665. * @example
  25666. *
  25667. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25668. * // => 4
  25669. */
  25670. function sortedLastIndex(array, value) {
  25671. return baseSortedIndex(array, value, true);
  25672. }
  25673. /**
  25674. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25675. * which is invoked for `value` and each element of `array` to compute their
  25676. * sort ranking. The iteratee is invoked with one argument: (value).
  25677. *
  25678. * @static
  25679. * @memberOf _
  25680. * @since 4.0.0
  25681. * @category Array
  25682. * @param {Array} array The sorted array to inspect.
  25683. * @param {*} value The value to evaluate.
  25684. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25685. * @returns {number} Returns the index at which `value` should be inserted
  25686. * into `array`.
  25687. * @example
  25688. *
  25689. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25690. *
  25691. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25692. * // => 1
  25693. *
  25694. * // The `_.property` iteratee shorthand.
  25695. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25696. * // => 1
  25697. */
  25698. function sortedLastIndexBy(array, value, iteratee) {
  25699. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25700. }
  25701. /**
  25702. * This method is like `_.lastIndexOf` except that it performs a binary
  25703. * search on a sorted `array`.
  25704. *
  25705. * @static
  25706. * @memberOf _
  25707. * @since 4.0.0
  25708. * @category Array
  25709. * @param {Array} array The array to inspect.
  25710. * @param {*} value The value to search for.
  25711. * @returns {number} Returns the index of the matched value, else `-1`.
  25712. * @example
  25713. *
  25714. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25715. * // => 3
  25716. */
  25717. function sortedLastIndexOf(array, value) {
  25718. var length = array == null ? 0 : array.length;
  25719. if (length) {
  25720. var index = baseSortedIndex(array, value, true) - 1;
  25721. if (eq(array[index], value)) {
  25722. return index;
  25723. }
  25724. }
  25725. return -1;
  25726. }
  25727. /**
  25728. * This method is like `_.uniq` except that it's designed and optimized
  25729. * for sorted arrays.
  25730. *
  25731. * @static
  25732. * @memberOf _
  25733. * @since 4.0.0
  25734. * @category Array
  25735. * @param {Array} array The array to inspect.
  25736. * @returns {Array} Returns the new duplicate free array.
  25737. * @example
  25738. *
  25739. * _.sortedUniq([1, 1, 2]);
  25740. * // => [1, 2]
  25741. */
  25742. function sortedUniq(array) {
  25743. return (array && array.length)
  25744. ? baseSortedUniq(array)
  25745. : [];
  25746. }
  25747. /**
  25748. * This method is like `_.uniqBy` except that it's designed and optimized
  25749. * for sorted arrays.
  25750. *
  25751. * @static
  25752. * @memberOf _
  25753. * @since 4.0.0
  25754. * @category Array
  25755. * @param {Array} array The array to inspect.
  25756. * @param {Function} [iteratee] The iteratee invoked per element.
  25757. * @returns {Array} Returns the new duplicate free array.
  25758. * @example
  25759. *
  25760. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25761. * // => [1.1, 2.3]
  25762. */
  25763. function sortedUniqBy(array, iteratee) {
  25764. return (array && array.length)
  25765. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25766. : [];
  25767. }
  25768. /**
  25769. * Gets all but the first element of `array`.
  25770. *
  25771. * @static
  25772. * @memberOf _
  25773. * @since 4.0.0
  25774. * @category Array
  25775. * @param {Array} array The array to query.
  25776. * @returns {Array} Returns the slice of `array`.
  25777. * @example
  25778. *
  25779. * _.tail([1, 2, 3]);
  25780. * // => [2, 3]
  25781. */
  25782. function tail(array) {
  25783. var length = array == null ? 0 : array.length;
  25784. return length ? baseSlice(array, 1, length) : [];
  25785. }
  25786. /**
  25787. * Creates a slice of `array` with `n` elements taken from the beginning.
  25788. *
  25789. * @static
  25790. * @memberOf _
  25791. * @since 0.1.0
  25792. * @category Array
  25793. * @param {Array} array The array to query.
  25794. * @param {number} [n=1] The number of elements to take.
  25795. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25796. * @returns {Array} Returns the slice of `array`.
  25797. * @example
  25798. *
  25799. * _.take([1, 2, 3]);
  25800. * // => [1]
  25801. *
  25802. * _.take([1, 2, 3], 2);
  25803. * // => [1, 2]
  25804. *
  25805. * _.take([1, 2, 3], 5);
  25806. * // => [1, 2, 3]
  25807. *
  25808. * _.take([1, 2, 3], 0);
  25809. * // => []
  25810. */
  25811. function take(array, n, guard) {
  25812. if (!(array && array.length)) {
  25813. return [];
  25814. }
  25815. n = (guard || n === undefined) ? 1 : toInteger(n);
  25816. return baseSlice(array, 0, n < 0 ? 0 : n);
  25817. }
  25818. /**
  25819. * Creates a slice of `array` with `n` elements taken from the end.
  25820. *
  25821. * @static
  25822. * @memberOf _
  25823. * @since 3.0.0
  25824. * @category Array
  25825. * @param {Array} array The array to query.
  25826. * @param {number} [n=1] The number of elements to take.
  25827. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25828. * @returns {Array} Returns the slice of `array`.
  25829. * @example
  25830. *
  25831. * _.takeRight([1, 2, 3]);
  25832. * // => [3]
  25833. *
  25834. * _.takeRight([1, 2, 3], 2);
  25835. * // => [2, 3]
  25836. *
  25837. * _.takeRight([1, 2, 3], 5);
  25838. * // => [1, 2, 3]
  25839. *
  25840. * _.takeRight([1, 2, 3], 0);
  25841. * // => []
  25842. */
  25843. function takeRight(array, n, guard) {
  25844. var length = array == null ? 0 : array.length;
  25845. if (!length) {
  25846. return [];
  25847. }
  25848. n = (guard || n === undefined) ? 1 : toInteger(n);
  25849. n = length - n;
  25850. return baseSlice(array, n < 0 ? 0 : n, length);
  25851. }
  25852. /**
  25853. * Creates a slice of `array` with elements taken from the end. Elements are
  25854. * taken until `predicate` returns falsey. The predicate is invoked with
  25855. * three arguments: (value, index, array).
  25856. *
  25857. * @static
  25858. * @memberOf _
  25859. * @since 3.0.0
  25860. * @category Array
  25861. * @param {Array} array The array to query.
  25862. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25863. * @returns {Array} Returns the slice of `array`.
  25864. * @example
  25865. *
  25866. * var users = [
  25867. * { 'user': 'barney', 'active': true },
  25868. * { 'user': 'fred', 'active': false },
  25869. * { 'user': 'pebbles', 'active': false }
  25870. * ];
  25871. *
  25872. * _.takeRightWhile(users, function(o) { return !o.active; });
  25873. * // => objects for ['fred', 'pebbles']
  25874. *
  25875. * // The `_.matches` iteratee shorthand.
  25876. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25877. * // => objects for ['pebbles']
  25878. *
  25879. * // The `_.matchesProperty` iteratee shorthand.
  25880. * _.takeRightWhile(users, ['active', false]);
  25881. * // => objects for ['fred', 'pebbles']
  25882. *
  25883. * // The `_.property` iteratee shorthand.
  25884. * _.takeRightWhile(users, 'active');
  25885. * // => []
  25886. */
  25887. function takeRightWhile(array, predicate) {
  25888. return (array && array.length)
  25889. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25890. : [];
  25891. }
  25892. /**
  25893. * Creates a slice of `array` with elements taken from the beginning. Elements
  25894. * are taken until `predicate` returns falsey. The predicate is invoked with
  25895. * three arguments: (value, index, array).
  25896. *
  25897. * @static
  25898. * @memberOf _
  25899. * @since 3.0.0
  25900. * @category Array
  25901. * @param {Array} array The array to query.
  25902. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25903. * @returns {Array} Returns the slice of `array`.
  25904. * @example
  25905. *
  25906. * var users = [
  25907. * { 'user': 'barney', 'active': false },
  25908. * { 'user': 'fred', 'active': false },
  25909. * { 'user': 'pebbles', 'active': true }
  25910. * ];
  25911. *
  25912. * _.takeWhile(users, function(o) { return !o.active; });
  25913. * // => objects for ['barney', 'fred']
  25914. *
  25915. * // The `_.matches` iteratee shorthand.
  25916. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25917. * // => objects for ['barney']
  25918. *
  25919. * // The `_.matchesProperty` iteratee shorthand.
  25920. * _.takeWhile(users, ['active', false]);
  25921. * // => objects for ['barney', 'fred']
  25922. *
  25923. * // The `_.property` iteratee shorthand.
  25924. * _.takeWhile(users, 'active');
  25925. * // => []
  25926. */
  25927. function takeWhile(array, predicate) {
  25928. return (array && array.length)
  25929. ? baseWhile(array, getIteratee(predicate, 3))
  25930. : [];
  25931. }
  25932. /**
  25933. * Creates an array of unique values, in order, from all given arrays using
  25934. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25935. * for equality comparisons.
  25936. *
  25937. * @static
  25938. * @memberOf _
  25939. * @since 0.1.0
  25940. * @category Array
  25941. * @param {...Array} [arrays] The arrays to inspect.
  25942. * @returns {Array} Returns the new array of combined values.
  25943. * @example
  25944. *
  25945. * _.union([2], [1, 2]);
  25946. * // => [2, 1]
  25947. */
  25948. var union = baseRest(function(arrays) {
  25949. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25950. });
  25951. /**
  25952. * This method is like `_.union` except that it accepts `iteratee` which is
  25953. * invoked for each element of each `arrays` to generate the criterion by
  25954. * which uniqueness is computed. Result values are chosen from the first
  25955. * array in which the value occurs. The iteratee is invoked with one argument:
  25956. * (value).
  25957. *
  25958. * @static
  25959. * @memberOf _
  25960. * @since 4.0.0
  25961. * @category Array
  25962. * @param {...Array} [arrays] The arrays to inspect.
  25963. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25964. * @returns {Array} Returns the new array of combined values.
  25965. * @example
  25966. *
  25967. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25968. * // => [2.1, 1.2]
  25969. *
  25970. * // The `_.property` iteratee shorthand.
  25971. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25972. * // => [{ 'x': 1 }, { 'x': 2 }]
  25973. */
  25974. var unionBy = baseRest(function(arrays) {
  25975. var iteratee = last(arrays);
  25976. if (isArrayLikeObject(iteratee)) {
  25977. iteratee = undefined;
  25978. }
  25979. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25980. });
  25981. /**
  25982. * This method is like `_.union` except that it accepts `comparator` which
  25983. * is invoked to compare elements of `arrays`. Result values are chosen from
  25984. * the first array in which the value occurs. The comparator is invoked
  25985. * with two arguments: (arrVal, othVal).
  25986. *
  25987. * @static
  25988. * @memberOf _
  25989. * @since 4.0.0
  25990. * @category Array
  25991. * @param {...Array} [arrays] The arrays to inspect.
  25992. * @param {Function} [comparator] The comparator invoked per element.
  25993. * @returns {Array} Returns the new array of combined values.
  25994. * @example
  25995. *
  25996. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25997. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25998. *
  25999. * _.unionWith(objects, others, _.isEqual);
  26000. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26001. */
  26002. var unionWith = baseRest(function(arrays) {
  26003. var comparator = last(arrays);
  26004. comparator = typeof comparator == 'function' ? comparator : undefined;
  26005. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26006. });
  26007. /**
  26008. * Creates a duplicate-free version of an array, using
  26009. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26010. * for equality comparisons, in which only the first occurrence of each element
  26011. * is kept. The order of result values is determined by the order they occur
  26012. * in the array.
  26013. *
  26014. * @static
  26015. * @memberOf _
  26016. * @since 0.1.0
  26017. * @category Array
  26018. * @param {Array} array The array to inspect.
  26019. * @returns {Array} Returns the new duplicate free array.
  26020. * @example
  26021. *
  26022. * _.uniq([2, 1, 2]);
  26023. * // => [2, 1]
  26024. */
  26025. function uniq(array) {
  26026. return (array && array.length) ? baseUniq(array) : [];
  26027. }
  26028. /**
  26029. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26030. * invoked for each element in `array` to generate the criterion by which
  26031. * uniqueness is computed. The order of result values is determined by the
  26032. * order they occur in the array. The iteratee is invoked with one argument:
  26033. * (value).
  26034. *
  26035. * @static
  26036. * @memberOf _
  26037. * @since 4.0.0
  26038. * @category Array
  26039. * @param {Array} array The array to inspect.
  26040. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26041. * @returns {Array} Returns the new duplicate free array.
  26042. * @example
  26043. *
  26044. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26045. * // => [2.1, 1.2]
  26046. *
  26047. * // The `_.property` iteratee shorthand.
  26048. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26049. * // => [{ 'x': 1 }, { 'x': 2 }]
  26050. */
  26051. function uniqBy(array, iteratee) {
  26052. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26053. }
  26054. /**
  26055. * This method is like `_.uniq` except that it accepts `comparator` which
  26056. * is invoked to compare elements of `array`. The order of result values is
  26057. * determined by the order they occur in the array.The comparator is invoked
  26058. * with two arguments: (arrVal, othVal).
  26059. *
  26060. * @static
  26061. * @memberOf _
  26062. * @since 4.0.0
  26063. * @category Array
  26064. * @param {Array} array The array to inspect.
  26065. * @param {Function} [comparator] The comparator invoked per element.
  26066. * @returns {Array} Returns the new duplicate free array.
  26067. * @example
  26068. *
  26069. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26070. *
  26071. * _.uniqWith(objects, _.isEqual);
  26072. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26073. */
  26074. function uniqWith(array, comparator) {
  26075. comparator = typeof comparator == 'function' ? comparator : undefined;
  26076. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26077. }
  26078. /**
  26079. * This method is like `_.zip` except that it accepts an array of grouped
  26080. * elements and creates an array regrouping the elements to their pre-zip
  26081. * configuration.
  26082. *
  26083. * @static
  26084. * @memberOf _
  26085. * @since 1.2.0
  26086. * @category Array
  26087. * @param {Array} array The array of grouped elements to process.
  26088. * @returns {Array} Returns the new array of regrouped elements.
  26089. * @example
  26090. *
  26091. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26092. * // => [['a', 1, true], ['b', 2, false]]
  26093. *
  26094. * _.unzip(zipped);
  26095. * // => [['a', 'b'], [1, 2], [true, false]]
  26096. */
  26097. function unzip(array) {
  26098. if (!(array && array.length)) {
  26099. return [];
  26100. }
  26101. var length = 0;
  26102. array = arrayFilter(array, function(group) {
  26103. if (isArrayLikeObject(group)) {
  26104. length = nativeMax(group.length, length);
  26105. return true;
  26106. }
  26107. });
  26108. return baseTimes(length, function(index) {
  26109. return arrayMap(array, baseProperty(index));
  26110. });
  26111. }
  26112. /**
  26113. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26114. * how regrouped values should be combined. The iteratee is invoked with the
  26115. * elements of each group: (...group).
  26116. *
  26117. * @static
  26118. * @memberOf _
  26119. * @since 3.8.0
  26120. * @category Array
  26121. * @param {Array} array The array of grouped elements to process.
  26122. * @param {Function} [iteratee=_.identity] The function to combine
  26123. * regrouped values.
  26124. * @returns {Array} Returns the new array of regrouped elements.
  26125. * @example
  26126. *
  26127. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26128. * // => [[1, 10, 100], [2, 20, 200]]
  26129. *
  26130. * _.unzipWith(zipped, _.add);
  26131. * // => [3, 30, 300]
  26132. */
  26133. function unzipWith(array, iteratee) {
  26134. if (!(array && array.length)) {
  26135. return [];
  26136. }
  26137. var result = unzip(array);
  26138. if (iteratee == null) {
  26139. return result;
  26140. }
  26141. return arrayMap(result, function(group) {
  26142. return apply(iteratee, undefined, group);
  26143. });
  26144. }
  26145. /**
  26146. * Creates an array excluding all given values using
  26147. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26148. * for equality comparisons.
  26149. *
  26150. * **Note:** Unlike `_.pull`, this method returns a new array.
  26151. *
  26152. * @static
  26153. * @memberOf _
  26154. * @since 0.1.0
  26155. * @category Array
  26156. * @param {Array} array The array to inspect.
  26157. * @param {...*} [values] The values to exclude.
  26158. * @returns {Array} Returns the new array of filtered values.
  26159. * @see _.difference, _.xor
  26160. * @example
  26161. *
  26162. * _.without([2, 1, 2, 3], 1, 2);
  26163. * // => [3]
  26164. */
  26165. var without = baseRest(function(array, values) {
  26166. return isArrayLikeObject(array)
  26167. ? baseDifference(array, values)
  26168. : [];
  26169. });
  26170. /**
  26171. * Creates an array of unique values that is the
  26172. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26173. * of the given arrays. The order of result values is determined by the order
  26174. * they occur in the arrays.
  26175. *
  26176. * @static
  26177. * @memberOf _
  26178. * @since 2.4.0
  26179. * @category Array
  26180. * @param {...Array} [arrays] The arrays to inspect.
  26181. * @returns {Array} Returns the new array of filtered values.
  26182. * @see _.difference, _.without
  26183. * @example
  26184. *
  26185. * _.xor([2, 1], [2, 3]);
  26186. * // => [1, 3]
  26187. */
  26188. var xor = baseRest(function(arrays) {
  26189. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26190. });
  26191. /**
  26192. * This method is like `_.xor` except that it accepts `iteratee` which is
  26193. * invoked for each element of each `arrays` to generate the criterion by
  26194. * which by which they're compared. The order of result values is determined
  26195. * by the order they occur in the arrays. The iteratee is invoked with one
  26196. * argument: (value).
  26197. *
  26198. * @static
  26199. * @memberOf _
  26200. * @since 4.0.0
  26201. * @category Array
  26202. * @param {...Array} [arrays] The arrays to inspect.
  26203. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26204. * @returns {Array} Returns the new array of filtered values.
  26205. * @example
  26206. *
  26207. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26208. * // => [1.2, 3.4]
  26209. *
  26210. * // The `_.property` iteratee shorthand.
  26211. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26212. * // => [{ 'x': 2 }]
  26213. */
  26214. var xorBy = baseRest(function(arrays) {
  26215. var iteratee = last(arrays);
  26216. if (isArrayLikeObject(iteratee)) {
  26217. iteratee = undefined;
  26218. }
  26219. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26220. });
  26221. /**
  26222. * This method is like `_.xor` except that it accepts `comparator` which is
  26223. * invoked to compare elements of `arrays`. The order of result values is
  26224. * determined by the order they occur in the arrays. The comparator is invoked
  26225. * with two arguments: (arrVal, othVal).
  26226. *
  26227. * @static
  26228. * @memberOf _
  26229. * @since 4.0.0
  26230. * @category Array
  26231. * @param {...Array} [arrays] The arrays to inspect.
  26232. * @param {Function} [comparator] The comparator invoked per element.
  26233. * @returns {Array} Returns the new array of filtered values.
  26234. * @example
  26235. *
  26236. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26237. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26238. *
  26239. * _.xorWith(objects, others, _.isEqual);
  26240. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26241. */
  26242. var xorWith = baseRest(function(arrays) {
  26243. var comparator = last(arrays);
  26244. comparator = typeof comparator == 'function' ? comparator : undefined;
  26245. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26246. });
  26247. /**
  26248. * Creates an array of grouped elements, the first of which contains the
  26249. * first elements of the given arrays, the second of which contains the
  26250. * second elements of the given arrays, and so on.
  26251. *
  26252. * @static
  26253. * @memberOf _
  26254. * @since 0.1.0
  26255. * @category Array
  26256. * @param {...Array} [arrays] The arrays to process.
  26257. * @returns {Array} Returns the new array of grouped elements.
  26258. * @example
  26259. *
  26260. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26261. * // => [['a', 1, true], ['b', 2, false]]
  26262. */
  26263. var zip = baseRest(unzip);
  26264. /**
  26265. * This method is like `_.fromPairs` except that it accepts two arrays,
  26266. * one of property identifiers and one of corresponding values.
  26267. *
  26268. * @static
  26269. * @memberOf _
  26270. * @since 0.4.0
  26271. * @category Array
  26272. * @param {Array} [props=[]] The property identifiers.
  26273. * @param {Array} [values=[]] The property values.
  26274. * @returns {Object} Returns the new object.
  26275. * @example
  26276. *
  26277. * _.zipObject(['a', 'b'], [1, 2]);
  26278. * // => { 'a': 1, 'b': 2 }
  26279. */
  26280. function zipObject(props, values) {
  26281. return baseZipObject(props || [], values || [], assignValue);
  26282. }
  26283. /**
  26284. * This method is like `_.zipObject` except that it supports property paths.
  26285. *
  26286. * @static
  26287. * @memberOf _
  26288. * @since 4.1.0
  26289. * @category Array
  26290. * @param {Array} [props=[]] The property identifiers.
  26291. * @param {Array} [values=[]] The property values.
  26292. * @returns {Object} Returns the new object.
  26293. * @example
  26294. *
  26295. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26296. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26297. */
  26298. function zipObjectDeep(props, values) {
  26299. return baseZipObject(props || [], values || [], baseSet);
  26300. }
  26301. /**
  26302. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26303. * how grouped values should be combined. The iteratee is invoked with the
  26304. * elements of each group: (...group).
  26305. *
  26306. * @static
  26307. * @memberOf _
  26308. * @since 3.8.0
  26309. * @category Array
  26310. * @param {...Array} [arrays] The arrays to process.
  26311. * @param {Function} [iteratee=_.identity] The function to combine
  26312. * grouped values.
  26313. * @returns {Array} Returns the new array of grouped elements.
  26314. * @example
  26315. *
  26316. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26317. * return a + b + c;
  26318. * });
  26319. * // => [111, 222]
  26320. */
  26321. var zipWith = baseRest(function(arrays) {
  26322. var length = arrays.length,
  26323. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26324. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26325. return unzipWith(arrays, iteratee);
  26326. });
  26327. /*------------------------------------------------------------------------*/
  26328. /**
  26329. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26330. * chain sequences enabled. The result of such sequences must be unwrapped
  26331. * with `_#value`.
  26332. *
  26333. * @static
  26334. * @memberOf _
  26335. * @since 1.3.0
  26336. * @category Seq
  26337. * @param {*} value The value to wrap.
  26338. * @returns {Object} Returns the new `lodash` wrapper instance.
  26339. * @example
  26340. *
  26341. * var users = [
  26342. * { 'user': 'barney', 'age': 36 },
  26343. * { 'user': 'fred', 'age': 40 },
  26344. * { 'user': 'pebbles', 'age': 1 }
  26345. * ];
  26346. *
  26347. * var youngest = _
  26348. * .chain(users)
  26349. * .sortBy('age')
  26350. * .map(function(o) {
  26351. * return o.user + ' is ' + o.age;
  26352. * })
  26353. * .head()
  26354. * .value();
  26355. * // => 'pebbles is 1'
  26356. */
  26357. function chain(value) {
  26358. var result = lodash(value);
  26359. result.__chain__ = true;
  26360. return result;
  26361. }
  26362. /**
  26363. * This method invokes `interceptor` and returns `value`. The interceptor
  26364. * is invoked with one argument; (value). The purpose of this method is to
  26365. * "tap into" a method chain sequence in order to modify intermediate results.
  26366. *
  26367. * @static
  26368. * @memberOf _
  26369. * @since 0.1.0
  26370. * @category Seq
  26371. * @param {*} value The value to provide to `interceptor`.
  26372. * @param {Function} interceptor The function to invoke.
  26373. * @returns {*} Returns `value`.
  26374. * @example
  26375. *
  26376. * _([1, 2, 3])
  26377. * .tap(function(array) {
  26378. * // Mutate input array.
  26379. * array.pop();
  26380. * })
  26381. * .reverse()
  26382. * .value();
  26383. * // => [2, 1]
  26384. */
  26385. function tap(value, interceptor) {
  26386. interceptor(value);
  26387. return value;
  26388. }
  26389. /**
  26390. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26391. * The purpose of this method is to "pass thru" values replacing intermediate
  26392. * results in a method chain sequence.
  26393. *
  26394. * @static
  26395. * @memberOf _
  26396. * @since 3.0.0
  26397. * @category Seq
  26398. * @param {*} value The value to provide to `interceptor`.
  26399. * @param {Function} interceptor The function to invoke.
  26400. * @returns {*} Returns the result of `interceptor`.
  26401. * @example
  26402. *
  26403. * _(' abc ')
  26404. * .chain()
  26405. * .trim()
  26406. * .thru(function(value) {
  26407. * return [value];
  26408. * })
  26409. * .value();
  26410. * // => ['abc']
  26411. */
  26412. function thru(value, interceptor) {
  26413. return interceptor(value);
  26414. }
  26415. /**
  26416. * This method is the wrapper version of `_.at`.
  26417. *
  26418. * @name at
  26419. * @memberOf _
  26420. * @since 1.0.0
  26421. * @category Seq
  26422. * @param {...(string|string[])} [paths] The property paths to pick.
  26423. * @returns {Object} Returns the new `lodash` wrapper instance.
  26424. * @example
  26425. *
  26426. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26427. *
  26428. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26429. * // => [3, 4]
  26430. */
  26431. var wrapperAt = flatRest(function(paths) {
  26432. var length = paths.length,
  26433. start = length ? paths[0] : 0,
  26434. value = this.__wrapped__,
  26435. interceptor = function(object) { return baseAt(object, paths); };
  26436. if (length > 1 || this.__actions__.length ||
  26437. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26438. return this.thru(interceptor);
  26439. }
  26440. value = value.slice(start, +start + (length ? 1 : 0));
  26441. value.__actions__.push({
  26442. 'func': thru,
  26443. 'args': [interceptor],
  26444. 'thisArg': undefined
  26445. });
  26446. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26447. if (length && !array.length) {
  26448. array.push(undefined);
  26449. }
  26450. return array;
  26451. });
  26452. });
  26453. /**
  26454. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26455. *
  26456. * @name chain
  26457. * @memberOf _
  26458. * @since 0.1.0
  26459. * @category Seq
  26460. * @returns {Object} Returns the new `lodash` wrapper instance.
  26461. * @example
  26462. *
  26463. * var users = [
  26464. * { 'user': 'barney', 'age': 36 },
  26465. * { 'user': 'fred', 'age': 40 }
  26466. * ];
  26467. *
  26468. * // A sequence without explicit chaining.
  26469. * _(users).head();
  26470. * // => { 'user': 'barney', 'age': 36 }
  26471. *
  26472. * // A sequence with explicit chaining.
  26473. * _(users)
  26474. * .chain()
  26475. * .head()
  26476. * .pick('user')
  26477. * .value();
  26478. * // => { 'user': 'barney' }
  26479. */
  26480. function wrapperChain() {
  26481. return chain(this);
  26482. }
  26483. /**
  26484. * Executes the chain sequence and returns the wrapped result.
  26485. *
  26486. * @name commit
  26487. * @memberOf _
  26488. * @since 3.2.0
  26489. * @category Seq
  26490. * @returns {Object} Returns the new `lodash` wrapper instance.
  26491. * @example
  26492. *
  26493. * var array = [1, 2];
  26494. * var wrapped = _(array).push(3);
  26495. *
  26496. * console.log(array);
  26497. * // => [1, 2]
  26498. *
  26499. * wrapped = wrapped.commit();
  26500. * console.log(array);
  26501. * // => [1, 2, 3]
  26502. *
  26503. * wrapped.last();
  26504. * // => 3
  26505. *
  26506. * console.log(array);
  26507. * // => [1, 2, 3]
  26508. */
  26509. function wrapperCommit() {
  26510. return new LodashWrapper(this.value(), this.__chain__);
  26511. }
  26512. /**
  26513. * Gets the next value on a wrapped object following the
  26514. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26515. *
  26516. * @name next
  26517. * @memberOf _
  26518. * @since 4.0.0
  26519. * @category Seq
  26520. * @returns {Object} Returns the next iterator value.
  26521. * @example
  26522. *
  26523. * var wrapped = _([1, 2]);
  26524. *
  26525. * wrapped.next();
  26526. * // => { 'done': false, 'value': 1 }
  26527. *
  26528. * wrapped.next();
  26529. * // => { 'done': false, 'value': 2 }
  26530. *
  26531. * wrapped.next();
  26532. * // => { 'done': true, 'value': undefined }
  26533. */
  26534. function wrapperNext() {
  26535. if (this.__values__ === undefined) {
  26536. this.__values__ = toArray(this.value());
  26537. }
  26538. var done = this.__index__ >= this.__values__.length,
  26539. value = done ? undefined : this.__values__[this.__index__++];
  26540. return { 'done': done, 'value': value };
  26541. }
  26542. /**
  26543. * Enables the wrapper to be iterable.
  26544. *
  26545. * @name Symbol.iterator
  26546. * @memberOf _
  26547. * @since 4.0.0
  26548. * @category Seq
  26549. * @returns {Object} Returns the wrapper object.
  26550. * @example
  26551. *
  26552. * var wrapped = _([1, 2]);
  26553. *
  26554. * wrapped[Symbol.iterator]() === wrapped;
  26555. * // => true
  26556. *
  26557. * Array.from(wrapped);
  26558. * // => [1, 2]
  26559. */
  26560. function wrapperToIterator() {
  26561. return this;
  26562. }
  26563. /**
  26564. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26565. *
  26566. * @name plant
  26567. * @memberOf _
  26568. * @since 3.2.0
  26569. * @category Seq
  26570. * @param {*} value The value to plant.
  26571. * @returns {Object} Returns the new `lodash` wrapper instance.
  26572. * @example
  26573. *
  26574. * function square(n) {
  26575. * return n * n;
  26576. * }
  26577. *
  26578. * var wrapped = _([1, 2]).map(square);
  26579. * var other = wrapped.plant([3, 4]);
  26580. *
  26581. * other.value();
  26582. * // => [9, 16]
  26583. *
  26584. * wrapped.value();
  26585. * // => [1, 4]
  26586. */
  26587. function wrapperPlant(value) {
  26588. var result,
  26589. parent = this;
  26590. while (parent instanceof baseLodash) {
  26591. var clone = wrapperClone(parent);
  26592. clone.__index__ = 0;
  26593. clone.__values__ = undefined;
  26594. if (result) {
  26595. previous.__wrapped__ = clone;
  26596. } else {
  26597. result = clone;
  26598. }
  26599. var previous = clone;
  26600. parent = parent.__wrapped__;
  26601. }
  26602. previous.__wrapped__ = value;
  26603. return result;
  26604. }
  26605. /**
  26606. * This method is the wrapper version of `_.reverse`.
  26607. *
  26608. * **Note:** This method mutates the wrapped array.
  26609. *
  26610. * @name reverse
  26611. * @memberOf _
  26612. * @since 0.1.0
  26613. * @category Seq
  26614. * @returns {Object} Returns the new `lodash` wrapper instance.
  26615. * @example
  26616. *
  26617. * var array = [1, 2, 3];
  26618. *
  26619. * _(array).reverse().value()
  26620. * // => [3, 2, 1]
  26621. *
  26622. * console.log(array);
  26623. * // => [3, 2, 1]
  26624. */
  26625. function wrapperReverse() {
  26626. var value = this.__wrapped__;
  26627. if (value instanceof LazyWrapper) {
  26628. var wrapped = value;
  26629. if (this.__actions__.length) {
  26630. wrapped = new LazyWrapper(this);
  26631. }
  26632. wrapped = wrapped.reverse();
  26633. wrapped.__actions__.push({
  26634. 'func': thru,
  26635. 'args': [reverse],
  26636. 'thisArg': undefined
  26637. });
  26638. return new LodashWrapper(wrapped, this.__chain__);
  26639. }
  26640. return this.thru(reverse);
  26641. }
  26642. /**
  26643. * Executes the chain sequence to resolve the unwrapped value.
  26644. *
  26645. * @name value
  26646. * @memberOf _
  26647. * @since 0.1.0
  26648. * @alias toJSON, valueOf
  26649. * @category Seq
  26650. * @returns {*} Returns the resolved unwrapped value.
  26651. * @example
  26652. *
  26653. * _([1, 2, 3]).value();
  26654. * // => [1, 2, 3]
  26655. */
  26656. function wrapperValue() {
  26657. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26658. }
  26659. /*------------------------------------------------------------------------*/
  26660. /**
  26661. * Creates an object composed of keys generated from the results of running
  26662. * each element of `collection` thru `iteratee`. The corresponding value of
  26663. * each key is the number of times the key was returned by `iteratee`. The
  26664. * iteratee is invoked with one argument: (value).
  26665. *
  26666. * @static
  26667. * @memberOf _
  26668. * @since 0.5.0
  26669. * @category Collection
  26670. * @param {Array|Object} collection The collection to iterate over.
  26671. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26672. * @returns {Object} Returns the composed aggregate object.
  26673. * @example
  26674. *
  26675. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26676. * // => { '4': 1, '6': 2 }
  26677. *
  26678. * // The `_.property` iteratee shorthand.
  26679. * _.countBy(['one', 'two', 'three'], 'length');
  26680. * // => { '3': 2, '5': 1 }
  26681. */
  26682. var countBy = createAggregator(function(result, value, key) {
  26683. if (hasOwnProperty.call(result, key)) {
  26684. ++result[key];
  26685. } else {
  26686. baseAssignValue(result, key, 1);
  26687. }
  26688. });
  26689. /**
  26690. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26691. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26692. * invoked with three arguments: (value, index|key, collection).
  26693. *
  26694. * **Note:** This method returns `true` for
  26695. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26696. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26697. * elements of empty collections.
  26698. *
  26699. * @static
  26700. * @memberOf _
  26701. * @since 0.1.0
  26702. * @category Collection
  26703. * @param {Array|Object} collection The collection to iterate over.
  26704. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26705. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26706. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26707. * else `false`.
  26708. * @example
  26709. *
  26710. * _.every([true, 1, null, 'yes'], Boolean);
  26711. * // => false
  26712. *
  26713. * var users = [
  26714. * { 'user': 'barney', 'age': 36, 'active': false },
  26715. * { 'user': 'fred', 'age': 40, 'active': false }
  26716. * ];
  26717. *
  26718. * // The `_.matches` iteratee shorthand.
  26719. * _.every(users, { 'user': 'barney', 'active': false });
  26720. * // => false
  26721. *
  26722. * // The `_.matchesProperty` iteratee shorthand.
  26723. * _.every(users, ['active', false]);
  26724. * // => true
  26725. *
  26726. * // The `_.property` iteratee shorthand.
  26727. * _.every(users, 'active');
  26728. * // => false
  26729. */
  26730. function every(collection, predicate, guard) {
  26731. var func = isArray(collection) ? arrayEvery : baseEvery;
  26732. if (guard && isIterateeCall(collection, predicate, guard)) {
  26733. predicate = undefined;
  26734. }
  26735. return func(collection, getIteratee(predicate, 3));
  26736. }
  26737. /**
  26738. * Iterates over elements of `collection`, returning an array of all elements
  26739. * `predicate` returns truthy for. The predicate is invoked with three
  26740. * arguments: (value, index|key, collection).
  26741. *
  26742. * **Note:** Unlike `_.remove`, this method returns a new array.
  26743. *
  26744. * @static
  26745. * @memberOf _
  26746. * @since 0.1.0
  26747. * @category Collection
  26748. * @param {Array|Object} collection The collection to iterate over.
  26749. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26750. * @returns {Array} Returns the new filtered array.
  26751. * @see _.reject
  26752. * @example
  26753. *
  26754. * var users = [
  26755. * { 'user': 'barney', 'age': 36, 'active': true },
  26756. * { 'user': 'fred', 'age': 40, 'active': false }
  26757. * ];
  26758. *
  26759. * _.filter(users, function(o) { return !o.active; });
  26760. * // => objects for ['fred']
  26761. *
  26762. * // The `_.matches` iteratee shorthand.
  26763. * _.filter(users, { 'age': 36, 'active': true });
  26764. * // => objects for ['barney']
  26765. *
  26766. * // The `_.matchesProperty` iteratee shorthand.
  26767. * _.filter(users, ['active', false]);
  26768. * // => objects for ['fred']
  26769. *
  26770. * // The `_.property` iteratee shorthand.
  26771. * _.filter(users, 'active');
  26772. * // => objects for ['barney']
  26773. */
  26774. function filter(collection, predicate) {
  26775. var func = isArray(collection) ? arrayFilter : baseFilter;
  26776. return func(collection, getIteratee(predicate, 3));
  26777. }
  26778. /**
  26779. * Iterates over elements of `collection`, returning the first element
  26780. * `predicate` returns truthy for. The predicate is invoked with three
  26781. * arguments: (value, index|key, collection).
  26782. *
  26783. * @static
  26784. * @memberOf _
  26785. * @since 0.1.0
  26786. * @category Collection
  26787. * @param {Array|Object} collection The collection to inspect.
  26788. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26789. * @param {number} [fromIndex=0] The index to search from.
  26790. * @returns {*} Returns the matched element, else `undefined`.
  26791. * @example
  26792. *
  26793. * var users = [
  26794. * { 'user': 'barney', 'age': 36, 'active': true },
  26795. * { 'user': 'fred', 'age': 40, 'active': false },
  26796. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26797. * ];
  26798. *
  26799. * _.find(users, function(o) { return o.age < 40; });
  26800. * // => object for 'barney'
  26801. *
  26802. * // The `_.matches` iteratee shorthand.
  26803. * _.find(users, { 'age': 1, 'active': true });
  26804. * // => object for 'pebbles'
  26805. *
  26806. * // The `_.matchesProperty` iteratee shorthand.
  26807. * _.find(users, ['active', false]);
  26808. * // => object for 'fred'
  26809. *
  26810. * // The `_.property` iteratee shorthand.
  26811. * _.find(users, 'active');
  26812. * // => object for 'barney'
  26813. */
  26814. var find = createFind(findIndex);
  26815. /**
  26816. * This method is like `_.find` except that it iterates over elements of
  26817. * `collection` from right to left.
  26818. *
  26819. * @static
  26820. * @memberOf _
  26821. * @since 2.0.0
  26822. * @category Collection
  26823. * @param {Array|Object} collection The collection to inspect.
  26824. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26825. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26826. * @returns {*} Returns the matched element, else `undefined`.
  26827. * @example
  26828. *
  26829. * _.findLast([1, 2, 3, 4], function(n) {
  26830. * return n % 2 == 1;
  26831. * });
  26832. * // => 3
  26833. */
  26834. var findLast = createFind(findLastIndex);
  26835. /**
  26836. * Creates a flattened array of values by running each element in `collection`
  26837. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26838. * with three arguments: (value, index|key, collection).
  26839. *
  26840. * @static
  26841. * @memberOf _
  26842. * @since 4.0.0
  26843. * @category Collection
  26844. * @param {Array|Object} collection The collection to iterate over.
  26845. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26846. * @returns {Array} Returns the new flattened array.
  26847. * @example
  26848. *
  26849. * function duplicate(n) {
  26850. * return [n, n];
  26851. * }
  26852. *
  26853. * _.flatMap([1, 2], duplicate);
  26854. * // => [1, 1, 2, 2]
  26855. */
  26856. function flatMap(collection, iteratee) {
  26857. return baseFlatten(map(collection, iteratee), 1);
  26858. }
  26859. /**
  26860. * This method is like `_.flatMap` except that it recursively flattens the
  26861. * mapped results.
  26862. *
  26863. * @static
  26864. * @memberOf _
  26865. * @since 4.7.0
  26866. * @category Collection
  26867. * @param {Array|Object} collection The collection to iterate over.
  26868. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26869. * @returns {Array} Returns the new flattened array.
  26870. * @example
  26871. *
  26872. * function duplicate(n) {
  26873. * return [[[n, n]]];
  26874. * }
  26875. *
  26876. * _.flatMapDeep([1, 2], duplicate);
  26877. * // => [1, 1, 2, 2]
  26878. */
  26879. function flatMapDeep(collection, iteratee) {
  26880. return baseFlatten(map(collection, iteratee), INFINITY);
  26881. }
  26882. /**
  26883. * This method is like `_.flatMap` except that it recursively flattens the
  26884. * mapped results up to `depth` times.
  26885. *
  26886. * @static
  26887. * @memberOf _
  26888. * @since 4.7.0
  26889. * @category Collection
  26890. * @param {Array|Object} collection The collection to iterate over.
  26891. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26892. * @param {number} [depth=1] The maximum recursion depth.
  26893. * @returns {Array} Returns the new flattened array.
  26894. * @example
  26895. *
  26896. * function duplicate(n) {
  26897. * return [[[n, n]]];
  26898. * }
  26899. *
  26900. * _.flatMapDepth([1, 2], duplicate, 2);
  26901. * // => [[1, 1], [2, 2]]
  26902. */
  26903. function flatMapDepth(collection, iteratee, depth) {
  26904. depth = depth === undefined ? 1 : toInteger(depth);
  26905. return baseFlatten(map(collection, iteratee), depth);
  26906. }
  26907. /**
  26908. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26909. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26910. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26911. *
  26912. * **Note:** As with other "Collections" methods, objects with a "length"
  26913. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26914. * or `_.forOwn` for object iteration.
  26915. *
  26916. * @static
  26917. * @memberOf _
  26918. * @since 0.1.0
  26919. * @alias each
  26920. * @category Collection
  26921. * @param {Array|Object} collection The collection to iterate over.
  26922. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26923. * @returns {Array|Object} Returns `collection`.
  26924. * @see _.forEachRight
  26925. * @example
  26926. *
  26927. * _.forEach([1, 2], function(value) {
  26928. * console.log(value);
  26929. * });
  26930. * // => Logs `1` then `2`.
  26931. *
  26932. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26933. * console.log(key);
  26934. * });
  26935. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26936. */
  26937. function forEach(collection, iteratee) {
  26938. var func = isArray(collection) ? arrayEach : baseEach;
  26939. return func(collection, getIteratee(iteratee, 3));
  26940. }
  26941. /**
  26942. * This method is like `_.forEach` except that it iterates over elements of
  26943. * `collection` from right to left.
  26944. *
  26945. * @static
  26946. * @memberOf _
  26947. * @since 2.0.0
  26948. * @alias eachRight
  26949. * @category Collection
  26950. * @param {Array|Object} collection The collection to iterate over.
  26951. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26952. * @returns {Array|Object} Returns `collection`.
  26953. * @see _.forEach
  26954. * @example
  26955. *
  26956. * _.forEachRight([1, 2], function(value) {
  26957. * console.log(value);
  26958. * });
  26959. * // => Logs `2` then `1`.
  26960. */
  26961. function forEachRight(collection, iteratee) {
  26962. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26963. return func(collection, getIteratee(iteratee, 3));
  26964. }
  26965. /**
  26966. * Creates an object composed of keys generated from the results of running
  26967. * each element of `collection` thru `iteratee`. The order of grouped values
  26968. * is determined by the order they occur in `collection`. The corresponding
  26969. * value of each key is an array of elements responsible for generating the
  26970. * key. The iteratee is invoked with one argument: (value).
  26971. *
  26972. * @static
  26973. * @memberOf _
  26974. * @since 0.1.0
  26975. * @category Collection
  26976. * @param {Array|Object} collection The collection to iterate over.
  26977. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26978. * @returns {Object} Returns the composed aggregate object.
  26979. * @example
  26980. *
  26981. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26982. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26983. *
  26984. * // The `_.property` iteratee shorthand.
  26985. * _.groupBy(['one', 'two', 'three'], 'length');
  26986. * // => { '3': ['one', 'two'], '5': ['three'] }
  26987. */
  26988. var groupBy = createAggregator(function(result, value, key) {
  26989. if (hasOwnProperty.call(result, key)) {
  26990. result[key].push(value);
  26991. } else {
  26992. baseAssignValue(result, key, [value]);
  26993. }
  26994. });
  26995. /**
  26996. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26997. * checked for a substring of `value`, otherwise
  26998. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26999. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27000. * the offset from the end of `collection`.
  27001. *
  27002. * @static
  27003. * @memberOf _
  27004. * @since 0.1.0
  27005. * @category Collection
  27006. * @param {Array|Object|string} collection The collection to inspect.
  27007. * @param {*} value The value to search for.
  27008. * @param {number} [fromIndex=0] The index to search from.
  27009. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27010. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27011. * @example
  27012. *
  27013. * _.includes([1, 2, 3], 1);
  27014. * // => true
  27015. *
  27016. * _.includes([1, 2, 3], 1, 2);
  27017. * // => false
  27018. *
  27019. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27020. * // => true
  27021. *
  27022. * _.includes('abcd', 'bc');
  27023. * // => true
  27024. */
  27025. function includes(collection, value, fromIndex, guard) {
  27026. collection = isArrayLike(collection) ? collection : values(collection);
  27027. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27028. var length = collection.length;
  27029. if (fromIndex < 0) {
  27030. fromIndex = nativeMax(length + fromIndex, 0);
  27031. }
  27032. return isString(collection)
  27033. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27034. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27035. }
  27036. /**
  27037. * Invokes the method at `path` of each element in `collection`, returning
  27038. * an array of the results of each invoked method. Any additional arguments
  27039. * are provided to each invoked method. If `path` is a function, it's invoked
  27040. * for, and `this` bound to, each element in `collection`.
  27041. *
  27042. * @static
  27043. * @memberOf _
  27044. * @since 4.0.0
  27045. * @category Collection
  27046. * @param {Array|Object} collection The collection to iterate over.
  27047. * @param {Array|Function|string} path The path of the method to invoke or
  27048. * the function invoked per iteration.
  27049. * @param {...*} [args] The arguments to invoke each method with.
  27050. * @returns {Array} Returns the array of results.
  27051. * @example
  27052. *
  27053. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27054. * // => [[1, 5, 7], [1, 2, 3]]
  27055. *
  27056. * _.invokeMap([123, 456], String.prototype.split, '');
  27057. * // => [['1', '2', '3'], ['4', '5', '6']]
  27058. */
  27059. var invokeMap = baseRest(function(collection, path, args) {
  27060. var index = -1,
  27061. isFunc = typeof path == 'function',
  27062. result = isArrayLike(collection) ? Array(collection.length) : [];
  27063. baseEach(collection, function(value) {
  27064. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27065. });
  27066. return result;
  27067. });
  27068. /**
  27069. * Creates an object composed of keys generated from the results of running
  27070. * each element of `collection` thru `iteratee`. The corresponding value of
  27071. * each key is the last element responsible for generating the key. The
  27072. * iteratee is invoked with one argument: (value).
  27073. *
  27074. * @static
  27075. * @memberOf _
  27076. * @since 4.0.0
  27077. * @category Collection
  27078. * @param {Array|Object} collection The collection to iterate over.
  27079. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27080. * @returns {Object} Returns the composed aggregate object.
  27081. * @example
  27082. *
  27083. * var array = [
  27084. * { 'dir': 'left', 'code': 97 },
  27085. * { 'dir': 'right', 'code': 100 }
  27086. * ];
  27087. *
  27088. * _.keyBy(array, function(o) {
  27089. * return String.fromCharCode(o.code);
  27090. * });
  27091. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27092. *
  27093. * _.keyBy(array, 'dir');
  27094. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27095. */
  27096. var keyBy = createAggregator(function(result, value, key) {
  27097. baseAssignValue(result, key, value);
  27098. });
  27099. /**
  27100. * Creates an array of values by running each element in `collection` thru
  27101. * `iteratee`. The iteratee is invoked with three arguments:
  27102. * (value, index|key, collection).
  27103. *
  27104. * Many lodash methods are guarded to work as iteratees for methods like
  27105. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27106. *
  27107. * The guarded methods are:
  27108. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27109. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27110. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27111. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27112. *
  27113. * @static
  27114. * @memberOf _
  27115. * @since 0.1.0
  27116. * @category Collection
  27117. * @param {Array|Object} collection The collection to iterate over.
  27118. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27119. * @returns {Array} Returns the new mapped array.
  27120. * @example
  27121. *
  27122. * function square(n) {
  27123. * return n * n;
  27124. * }
  27125. *
  27126. * _.map([4, 8], square);
  27127. * // => [16, 64]
  27128. *
  27129. * _.map({ 'a': 4, 'b': 8 }, square);
  27130. * // => [16, 64] (iteration order is not guaranteed)
  27131. *
  27132. * var users = [
  27133. * { 'user': 'barney' },
  27134. * { 'user': 'fred' }
  27135. * ];
  27136. *
  27137. * // The `_.property` iteratee shorthand.
  27138. * _.map(users, 'user');
  27139. * // => ['barney', 'fred']
  27140. */
  27141. function map(collection, iteratee) {
  27142. var func = isArray(collection) ? arrayMap : baseMap;
  27143. return func(collection, getIteratee(iteratee, 3));
  27144. }
  27145. /**
  27146. * This method is like `_.sortBy` except that it allows specifying the sort
  27147. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27148. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27149. * descending or "asc" for ascending sort order of corresponding values.
  27150. *
  27151. * @static
  27152. * @memberOf _
  27153. * @since 4.0.0
  27154. * @category Collection
  27155. * @param {Array|Object} collection The collection to iterate over.
  27156. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27157. * The iteratees to sort by.
  27158. * @param {string[]} [orders] The sort orders of `iteratees`.
  27159. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27160. * @returns {Array} Returns the new sorted array.
  27161. * @example
  27162. *
  27163. * var users = [
  27164. * { 'user': 'fred', 'age': 48 },
  27165. * { 'user': 'barney', 'age': 34 },
  27166. * { 'user': 'fred', 'age': 40 },
  27167. * { 'user': 'barney', 'age': 36 }
  27168. * ];
  27169. *
  27170. * // Sort by `user` in ascending order and by `age` in descending order.
  27171. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27172. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27173. */
  27174. function orderBy(collection, iteratees, orders, guard) {
  27175. if (collection == null) {
  27176. return [];
  27177. }
  27178. if (!isArray(iteratees)) {
  27179. iteratees = iteratees == null ? [] : [iteratees];
  27180. }
  27181. orders = guard ? undefined : orders;
  27182. if (!isArray(orders)) {
  27183. orders = orders == null ? [] : [orders];
  27184. }
  27185. return baseOrderBy(collection, iteratees, orders);
  27186. }
  27187. /**
  27188. * Creates an array of elements split into two groups, the first of which
  27189. * contains elements `predicate` returns truthy for, the second of which
  27190. * contains elements `predicate` returns falsey for. The predicate is
  27191. * invoked with one argument: (value).
  27192. *
  27193. * @static
  27194. * @memberOf _
  27195. * @since 3.0.0
  27196. * @category Collection
  27197. * @param {Array|Object} collection The collection to iterate over.
  27198. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27199. * @returns {Array} Returns the array of grouped elements.
  27200. * @example
  27201. *
  27202. * var users = [
  27203. * { 'user': 'barney', 'age': 36, 'active': false },
  27204. * { 'user': 'fred', 'age': 40, 'active': true },
  27205. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27206. * ];
  27207. *
  27208. * _.partition(users, function(o) { return o.active; });
  27209. * // => objects for [['fred'], ['barney', 'pebbles']]
  27210. *
  27211. * // The `_.matches` iteratee shorthand.
  27212. * _.partition(users, { 'age': 1, 'active': false });
  27213. * // => objects for [['pebbles'], ['barney', 'fred']]
  27214. *
  27215. * // The `_.matchesProperty` iteratee shorthand.
  27216. * _.partition(users, ['active', false]);
  27217. * // => objects for [['barney', 'pebbles'], ['fred']]
  27218. *
  27219. * // The `_.property` iteratee shorthand.
  27220. * _.partition(users, 'active');
  27221. * // => objects for [['fred'], ['barney', 'pebbles']]
  27222. */
  27223. var partition = createAggregator(function(result, value, key) {
  27224. result[key ? 0 : 1].push(value);
  27225. }, function() { return [[], []]; });
  27226. /**
  27227. * Reduces `collection` to a value which is the accumulated result of running
  27228. * each element in `collection` thru `iteratee`, where each successive
  27229. * invocation is supplied the return value of the previous. If `accumulator`
  27230. * is not given, the first element of `collection` is used as the initial
  27231. * value. The iteratee is invoked with four arguments:
  27232. * (accumulator, value, index|key, collection).
  27233. *
  27234. * Many lodash methods are guarded to work as iteratees for methods like
  27235. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27236. *
  27237. * The guarded methods are:
  27238. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27239. * and `sortBy`
  27240. *
  27241. * @static
  27242. * @memberOf _
  27243. * @since 0.1.0
  27244. * @category Collection
  27245. * @param {Array|Object} collection The collection to iterate over.
  27246. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27247. * @param {*} [accumulator] The initial value.
  27248. * @returns {*} Returns the accumulated value.
  27249. * @see _.reduceRight
  27250. * @example
  27251. *
  27252. * _.reduce([1, 2], function(sum, n) {
  27253. * return sum + n;
  27254. * }, 0);
  27255. * // => 3
  27256. *
  27257. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27258. * (result[value] || (result[value] = [])).push(key);
  27259. * return result;
  27260. * }, {});
  27261. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27262. */
  27263. function reduce(collection, iteratee, accumulator) {
  27264. var func = isArray(collection) ? arrayReduce : baseReduce,
  27265. initAccum = arguments.length < 3;
  27266. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27267. }
  27268. /**
  27269. * This method is like `_.reduce` except that it iterates over elements of
  27270. * `collection` from right to left.
  27271. *
  27272. * @static
  27273. * @memberOf _
  27274. * @since 0.1.0
  27275. * @category Collection
  27276. * @param {Array|Object} collection The collection to iterate over.
  27277. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27278. * @param {*} [accumulator] The initial value.
  27279. * @returns {*} Returns the accumulated value.
  27280. * @see _.reduce
  27281. * @example
  27282. *
  27283. * var array = [[0, 1], [2, 3], [4, 5]];
  27284. *
  27285. * _.reduceRight(array, function(flattened, other) {
  27286. * return flattened.concat(other);
  27287. * }, []);
  27288. * // => [4, 5, 2, 3, 0, 1]
  27289. */
  27290. function reduceRight(collection, iteratee, accumulator) {
  27291. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27292. initAccum = arguments.length < 3;
  27293. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27294. }
  27295. /**
  27296. * The opposite of `_.filter`; this method returns the elements of `collection`
  27297. * that `predicate` does **not** return truthy for.
  27298. *
  27299. * @static
  27300. * @memberOf _
  27301. * @since 0.1.0
  27302. * @category Collection
  27303. * @param {Array|Object} collection The collection to iterate over.
  27304. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27305. * @returns {Array} Returns the new filtered array.
  27306. * @see _.filter
  27307. * @example
  27308. *
  27309. * var users = [
  27310. * { 'user': 'barney', 'age': 36, 'active': false },
  27311. * { 'user': 'fred', 'age': 40, 'active': true }
  27312. * ];
  27313. *
  27314. * _.reject(users, function(o) { return !o.active; });
  27315. * // => objects for ['fred']
  27316. *
  27317. * // The `_.matches` iteratee shorthand.
  27318. * _.reject(users, { 'age': 40, 'active': true });
  27319. * // => objects for ['barney']
  27320. *
  27321. * // The `_.matchesProperty` iteratee shorthand.
  27322. * _.reject(users, ['active', false]);
  27323. * // => objects for ['fred']
  27324. *
  27325. * // The `_.property` iteratee shorthand.
  27326. * _.reject(users, 'active');
  27327. * // => objects for ['barney']
  27328. */
  27329. function reject(collection, predicate) {
  27330. var func = isArray(collection) ? arrayFilter : baseFilter;
  27331. return func(collection, negate(getIteratee(predicate, 3)));
  27332. }
  27333. /**
  27334. * Gets a random element from `collection`.
  27335. *
  27336. * @static
  27337. * @memberOf _
  27338. * @since 2.0.0
  27339. * @category Collection
  27340. * @param {Array|Object} collection The collection to sample.
  27341. * @returns {*} Returns the random element.
  27342. * @example
  27343. *
  27344. * _.sample([1, 2, 3, 4]);
  27345. * // => 2
  27346. */
  27347. function sample(collection) {
  27348. var func = isArray(collection) ? arraySample : baseSample;
  27349. return func(collection);
  27350. }
  27351. /**
  27352. * Gets `n` random elements at unique keys from `collection` up to the
  27353. * size of `collection`.
  27354. *
  27355. * @static
  27356. * @memberOf _
  27357. * @since 4.0.0
  27358. * @category Collection
  27359. * @param {Array|Object} collection The collection to sample.
  27360. * @param {number} [n=1] The number of elements to sample.
  27361. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27362. * @returns {Array} Returns the random elements.
  27363. * @example
  27364. *
  27365. * _.sampleSize([1, 2, 3], 2);
  27366. * // => [3, 1]
  27367. *
  27368. * _.sampleSize([1, 2, 3], 4);
  27369. * // => [2, 3, 1]
  27370. */
  27371. function sampleSize(collection, n, guard) {
  27372. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27373. n = 1;
  27374. } else {
  27375. n = toInteger(n);
  27376. }
  27377. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27378. return func(collection, n);
  27379. }
  27380. /**
  27381. * Creates an array of shuffled values, using a version of the
  27382. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27383. *
  27384. * @static
  27385. * @memberOf _
  27386. * @since 0.1.0
  27387. * @category Collection
  27388. * @param {Array|Object} collection The collection to shuffle.
  27389. * @returns {Array} Returns the new shuffled array.
  27390. * @example
  27391. *
  27392. * _.shuffle([1, 2, 3, 4]);
  27393. * // => [4, 1, 3, 2]
  27394. */
  27395. function shuffle(collection) {
  27396. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27397. return func(collection);
  27398. }
  27399. /**
  27400. * Gets the size of `collection` by returning its length for array-like
  27401. * values or the number of own enumerable string keyed properties for objects.
  27402. *
  27403. * @static
  27404. * @memberOf _
  27405. * @since 0.1.0
  27406. * @category Collection
  27407. * @param {Array|Object|string} collection The collection to inspect.
  27408. * @returns {number} Returns the collection size.
  27409. * @example
  27410. *
  27411. * _.size([1, 2, 3]);
  27412. * // => 3
  27413. *
  27414. * _.size({ 'a': 1, 'b': 2 });
  27415. * // => 2
  27416. *
  27417. * _.size('pebbles');
  27418. * // => 7
  27419. */
  27420. function size(collection) {
  27421. if (collection == null) {
  27422. return 0;
  27423. }
  27424. if (isArrayLike(collection)) {
  27425. return isString(collection) ? stringSize(collection) : collection.length;
  27426. }
  27427. var tag = getTag(collection);
  27428. if (tag == mapTag || tag == setTag) {
  27429. return collection.size;
  27430. }
  27431. return baseKeys(collection).length;
  27432. }
  27433. /**
  27434. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27435. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27436. * invoked with three arguments: (value, index|key, collection).
  27437. *
  27438. * @static
  27439. * @memberOf _
  27440. * @since 0.1.0
  27441. * @category Collection
  27442. * @param {Array|Object} collection The collection to iterate over.
  27443. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27444. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27445. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27446. * else `false`.
  27447. * @example
  27448. *
  27449. * _.some([null, 0, 'yes', false], Boolean);
  27450. * // => true
  27451. *
  27452. * var users = [
  27453. * { 'user': 'barney', 'active': true },
  27454. * { 'user': 'fred', 'active': false }
  27455. * ];
  27456. *
  27457. * // The `_.matches` iteratee shorthand.
  27458. * _.some(users, { 'user': 'barney', 'active': false });
  27459. * // => false
  27460. *
  27461. * // The `_.matchesProperty` iteratee shorthand.
  27462. * _.some(users, ['active', false]);
  27463. * // => true
  27464. *
  27465. * // The `_.property` iteratee shorthand.
  27466. * _.some(users, 'active');
  27467. * // => true
  27468. */
  27469. function some(collection, predicate, guard) {
  27470. var func = isArray(collection) ? arraySome : baseSome;
  27471. if (guard && isIterateeCall(collection, predicate, guard)) {
  27472. predicate = undefined;
  27473. }
  27474. return func(collection, getIteratee(predicate, 3));
  27475. }
  27476. /**
  27477. * Creates an array of elements, sorted in ascending order by the results of
  27478. * running each element in a collection thru each iteratee. This method
  27479. * performs a stable sort, that is, it preserves the original sort order of
  27480. * equal elements. The iteratees are invoked with one argument: (value).
  27481. *
  27482. * @static
  27483. * @memberOf _
  27484. * @since 0.1.0
  27485. * @category Collection
  27486. * @param {Array|Object} collection The collection to iterate over.
  27487. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27488. * The iteratees to sort by.
  27489. * @returns {Array} Returns the new sorted array.
  27490. * @example
  27491. *
  27492. * var users = [
  27493. * { 'user': 'fred', 'age': 48 },
  27494. * { 'user': 'barney', 'age': 36 },
  27495. * { 'user': 'fred', 'age': 40 },
  27496. * { 'user': 'barney', 'age': 34 }
  27497. * ];
  27498. *
  27499. * _.sortBy(users, [function(o) { return o.user; }]);
  27500. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27501. *
  27502. * _.sortBy(users, ['user', 'age']);
  27503. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27504. */
  27505. var sortBy = baseRest(function(collection, iteratees) {
  27506. if (collection == null) {
  27507. return [];
  27508. }
  27509. var length = iteratees.length;
  27510. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27511. iteratees = [];
  27512. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27513. iteratees = [iteratees[0]];
  27514. }
  27515. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27516. });
  27517. /*------------------------------------------------------------------------*/
  27518. /**
  27519. * Gets the timestamp of the number of milliseconds that have elapsed since
  27520. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27521. *
  27522. * @static
  27523. * @memberOf _
  27524. * @since 2.4.0
  27525. * @category Date
  27526. * @returns {number} Returns the timestamp.
  27527. * @example
  27528. *
  27529. * _.defer(function(stamp) {
  27530. * console.log(_.now() - stamp);
  27531. * }, _.now());
  27532. * // => Logs the number of milliseconds it took for the deferred invocation.
  27533. */
  27534. var now = ctxNow || function() {
  27535. return root.Date.now();
  27536. };
  27537. /*------------------------------------------------------------------------*/
  27538. /**
  27539. * The opposite of `_.before`; this method creates a function that invokes
  27540. * `func` once it's called `n` or more times.
  27541. *
  27542. * @static
  27543. * @memberOf _
  27544. * @since 0.1.0
  27545. * @category Function
  27546. * @param {number} n The number of calls before `func` is invoked.
  27547. * @param {Function} func The function to restrict.
  27548. * @returns {Function} Returns the new restricted function.
  27549. * @example
  27550. *
  27551. * var saves = ['profile', 'settings'];
  27552. *
  27553. * var done = _.after(saves.length, function() {
  27554. * console.log('done saving!');
  27555. * });
  27556. *
  27557. * _.forEach(saves, function(type) {
  27558. * asyncSave({ 'type': type, 'complete': done });
  27559. * });
  27560. * // => Logs 'done saving!' after the two async saves have completed.
  27561. */
  27562. function after(n, func) {
  27563. if (typeof func != 'function') {
  27564. throw new TypeError(FUNC_ERROR_TEXT);
  27565. }
  27566. n = toInteger(n);
  27567. return function() {
  27568. if (--n < 1) {
  27569. return func.apply(this, arguments);
  27570. }
  27571. };
  27572. }
  27573. /**
  27574. * Creates a function that invokes `func`, with up to `n` arguments,
  27575. * ignoring any additional arguments.
  27576. *
  27577. * @static
  27578. * @memberOf _
  27579. * @since 3.0.0
  27580. * @category Function
  27581. * @param {Function} func The function to cap arguments for.
  27582. * @param {number} [n=func.length] The arity cap.
  27583. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27584. * @returns {Function} Returns the new capped function.
  27585. * @example
  27586. *
  27587. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27588. * // => [6, 8, 10]
  27589. */
  27590. function ary(func, n, guard) {
  27591. n = guard ? undefined : n;
  27592. n = (func && n == null) ? func.length : n;
  27593. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27594. }
  27595. /**
  27596. * Creates a function that invokes `func`, with the `this` binding and arguments
  27597. * of the created function, while it's called less than `n` times. Subsequent
  27598. * calls to the created function return the result of the last `func` invocation.
  27599. *
  27600. * @static
  27601. * @memberOf _
  27602. * @since 3.0.0
  27603. * @category Function
  27604. * @param {number} n The number of calls at which `func` is no longer invoked.
  27605. * @param {Function} func The function to restrict.
  27606. * @returns {Function} Returns the new restricted function.
  27607. * @example
  27608. *
  27609. * jQuery(element).on('click', _.before(5, addContactToList));
  27610. * // => Allows adding up to 4 contacts to the list.
  27611. */
  27612. function before(n, func) {
  27613. var result;
  27614. if (typeof func != 'function') {
  27615. throw new TypeError(FUNC_ERROR_TEXT);
  27616. }
  27617. n = toInteger(n);
  27618. return function() {
  27619. if (--n > 0) {
  27620. result = func.apply(this, arguments);
  27621. }
  27622. if (n <= 1) {
  27623. func = undefined;
  27624. }
  27625. return result;
  27626. };
  27627. }
  27628. /**
  27629. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27630. * and `partials` prepended to the arguments it receives.
  27631. *
  27632. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27633. * may be used as a placeholder for partially applied arguments.
  27634. *
  27635. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27636. * property of bound functions.
  27637. *
  27638. * @static
  27639. * @memberOf _
  27640. * @since 0.1.0
  27641. * @category Function
  27642. * @param {Function} func The function to bind.
  27643. * @param {*} thisArg The `this` binding of `func`.
  27644. * @param {...*} [partials] The arguments to be partially applied.
  27645. * @returns {Function} Returns the new bound function.
  27646. * @example
  27647. *
  27648. * function greet(greeting, punctuation) {
  27649. * return greeting + ' ' + this.user + punctuation;
  27650. * }
  27651. *
  27652. * var object = { 'user': 'fred' };
  27653. *
  27654. * var bound = _.bind(greet, object, 'hi');
  27655. * bound('!');
  27656. * // => 'hi fred!'
  27657. *
  27658. * // Bound with placeholders.
  27659. * var bound = _.bind(greet, object, _, '!');
  27660. * bound('hi');
  27661. * // => 'hi fred!'
  27662. */
  27663. var bind = baseRest(function(func, thisArg, partials) {
  27664. var bitmask = WRAP_BIND_FLAG;
  27665. if (partials.length) {
  27666. var holders = replaceHolders(partials, getHolder(bind));
  27667. bitmask |= WRAP_PARTIAL_FLAG;
  27668. }
  27669. return createWrap(func, bitmask, thisArg, partials, holders);
  27670. });
  27671. /**
  27672. * Creates a function that invokes the method at `object[key]` with `partials`
  27673. * prepended to the arguments it receives.
  27674. *
  27675. * This method differs from `_.bind` by allowing bound functions to reference
  27676. * methods that may be redefined or don't yet exist. See
  27677. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27678. * for more details.
  27679. *
  27680. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27681. * builds, may be used as a placeholder for partially applied arguments.
  27682. *
  27683. * @static
  27684. * @memberOf _
  27685. * @since 0.10.0
  27686. * @category Function
  27687. * @param {Object} object The object to invoke the method on.
  27688. * @param {string} key The key of the method.
  27689. * @param {...*} [partials] The arguments to be partially applied.
  27690. * @returns {Function} Returns the new bound function.
  27691. * @example
  27692. *
  27693. * var object = {
  27694. * 'user': 'fred',
  27695. * 'greet': function(greeting, punctuation) {
  27696. * return greeting + ' ' + this.user + punctuation;
  27697. * }
  27698. * };
  27699. *
  27700. * var bound = _.bindKey(object, 'greet', 'hi');
  27701. * bound('!');
  27702. * // => 'hi fred!'
  27703. *
  27704. * object.greet = function(greeting, punctuation) {
  27705. * return greeting + 'ya ' + this.user + punctuation;
  27706. * };
  27707. *
  27708. * bound('!');
  27709. * // => 'hiya fred!'
  27710. *
  27711. * // Bound with placeholders.
  27712. * var bound = _.bindKey(object, 'greet', _, '!');
  27713. * bound('hi');
  27714. * // => 'hiya fred!'
  27715. */
  27716. var bindKey = baseRest(function(object, key, partials) {
  27717. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27718. if (partials.length) {
  27719. var holders = replaceHolders(partials, getHolder(bindKey));
  27720. bitmask |= WRAP_PARTIAL_FLAG;
  27721. }
  27722. return createWrap(key, bitmask, object, partials, holders);
  27723. });
  27724. /**
  27725. * Creates a function that accepts arguments of `func` and either invokes
  27726. * `func` returning its result, if at least `arity` number of arguments have
  27727. * been provided, or returns a function that accepts the remaining `func`
  27728. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27729. * is not sufficient.
  27730. *
  27731. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27732. * may be used as a placeholder for provided arguments.
  27733. *
  27734. * **Note:** This method doesn't set the "length" property of curried functions.
  27735. *
  27736. * @static
  27737. * @memberOf _
  27738. * @since 2.0.0
  27739. * @category Function
  27740. * @param {Function} func The function to curry.
  27741. * @param {number} [arity=func.length] The arity of `func`.
  27742. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27743. * @returns {Function} Returns the new curried function.
  27744. * @example
  27745. *
  27746. * var abc = function(a, b, c) {
  27747. * return [a, b, c];
  27748. * };
  27749. *
  27750. * var curried = _.curry(abc);
  27751. *
  27752. * curried(1)(2)(3);
  27753. * // => [1, 2, 3]
  27754. *
  27755. * curried(1, 2)(3);
  27756. * // => [1, 2, 3]
  27757. *
  27758. * curried(1, 2, 3);
  27759. * // => [1, 2, 3]
  27760. *
  27761. * // Curried with placeholders.
  27762. * curried(1)(_, 3)(2);
  27763. * // => [1, 2, 3]
  27764. */
  27765. function curry(func, arity, guard) {
  27766. arity = guard ? undefined : arity;
  27767. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27768. result.placeholder = curry.placeholder;
  27769. return result;
  27770. }
  27771. /**
  27772. * This method is like `_.curry` except that arguments are applied to `func`
  27773. * in the manner of `_.partialRight` instead of `_.partial`.
  27774. *
  27775. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27776. * builds, may be used as a placeholder for provided arguments.
  27777. *
  27778. * **Note:** This method doesn't set the "length" property of curried functions.
  27779. *
  27780. * @static
  27781. * @memberOf _
  27782. * @since 3.0.0
  27783. * @category Function
  27784. * @param {Function} func The function to curry.
  27785. * @param {number} [arity=func.length] The arity of `func`.
  27786. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27787. * @returns {Function} Returns the new curried function.
  27788. * @example
  27789. *
  27790. * var abc = function(a, b, c) {
  27791. * return [a, b, c];
  27792. * };
  27793. *
  27794. * var curried = _.curryRight(abc);
  27795. *
  27796. * curried(3)(2)(1);
  27797. * // => [1, 2, 3]
  27798. *
  27799. * curried(2, 3)(1);
  27800. * // => [1, 2, 3]
  27801. *
  27802. * curried(1, 2, 3);
  27803. * // => [1, 2, 3]
  27804. *
  27805. * // Curried with placeholders.
  27806. * curried(3)(1, _)(2);
  27807. * // => [1, 2, 3]
  27808. */
  27809. function curryRight(func, arity, guard) {
  27810. arity = guard ? undefined : arity;
  27811. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27812. result.placeholder = curryRight.placeholder;
  27813. return result;
  27814. }
  27815. /**
  27816. * Creates a debounced function that delays invoking `func` until after `wait`
  27817. * milliseconds have elapsed since the last time the debounced function was
  27818. * invoked. The debounced function comes with a `cancel` method to cancel
  27819. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27820. * Provide `options` to indicate whether `func` should be invoked on the
  27821. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27822. * with the last arguments provided to the debounced function. Subsequent
  27823. * calls to the debounced function return the result of the last `func`
  27824. * invocation.
  27825. *
  27826. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27827. * invoked on the trailing edge of the timeout only if the debounced function
  27828. * is invoked more than once during the `wait` timeout.
  27829. *
  27830. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27831. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27832. *
  27833. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27834. * for details over the differences between `_.debounce` and `_.throttle`.
  27835. *
  27836. * @static
  27837. * @memberOf _
  27838. * @since 0.1.0
  27839. * @category Function
  27840. * @param {Function} func The function to debounce.
  27841. * @param {number} [wait=0] The number of milliseconds to delay.
  27842. * @param {Object} [options={}] The options object.
  27843. * @param {boolean} [options.leading=false]
  27844. * Specify invoking on the leading edge of the timeout.
  27845. * @param {number} [options.maxWait]
  27846. * The maximum time `func` is allowed to be delayed before it's invoked.
  27847. * @param {boolean} [options.trailing=true]
  27848. * Specify invoking on the trailing edge of the timeout.
  27849. * @returns {Function} Returns the new debounced function.
  27850. * @example
  27851. *
  27852. * // Avoid costly calculations while the window size is in flux.
  27853. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27854. *
  27855. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27856. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27857. * 'leading': true,
  27858. * 'trailing': false
  27859. * }));
  27860. *
  27861. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27862. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27863. * var source = new EventSource('/stream');
  27864. * jQuery(source).on('message', debounced);
  27865. *
  27866. * // Cancel the trailing debounced invocation.
  27867. * jQuery(window).on('popstate', debounced.cancel);
  27868. */
  27869. function debounce(func, wait, options) {
  27870. var lastArgs,
  27871. lastThis,
  27872. maxWait,
  27873. result,
  27874. timerId,
  27875. lastCallTime,
  27876. lastInvokeTime = 0,
  27877. leading = false,
  27878. maxing = false,
  27879. trailing = true;
  27880. if (typeof func != 'function') {
  27881. throw new TypeError(FUNC_ERROR_TEXT);
  27882. }
  27883. wait = toNumber(wait) || 0;
  27884. if (isObject(options)) {
  27885. leading = !!options.leading;
  27886. maxing = 'maxWait' in options;
  27887. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27888. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27889. }
  27890. function invokeFunc(time) {
  27891. var args = lastArgs,
  27892. thisArg = lastThis;
  27893. lastArgs = lastThis = undefined;
  27894. lastInvokeTime = time;
  27895. result = func.apply(thisArg, args);
  27896. return result;
  27897. }
  27898. function leadingEdge(time) {
  27899. // Reset any `maxWait` timer.
  27900. lastInvokeTime = time;
  27901. // Start the timer for the trailing edge.
  27902. timerId = setTimeout(timerExpired, wait);
  27903. // Invoke the leading edge.
  27904. return leading ? invokeFunc(time) : result;
  27905. }
  27906. function remainingWait(time) {
  27907. var timeSinceLastCall = time - lastCallTime,
  27908. timeSinceLastInvoke = time - lastInvokeTime,
  27909. timeWaiting = wait - timeSinceLastCall;
  27910. return maxing
  27911. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27912. : timeWaiting;
  27913. }
  27914. function shouldInvoke(time) {
  27915. var timeSinceLastCall = time - lastCallTime,
  27916. timeSinceLastInvoke = time - lastInvokeTime;
  27917. // Either this is the first call, activity has stopped and we're at the
  27918. // trailing edge, the system time has gone backwards and we're treating
  27919. // it as the trailing edge, or we've hit the `maxWait` limit.
  27920. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27921. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27922. }
  27923. function timerExpired() {
  27924. var time = now();
  27925. if (shouldInvoke(time)) {
  27926. return trailingEdge(time);
  27927. }
  27928. // Restart the timer.
  27929. timerId = setTimeout(timerExpired, remainingWait(time));
  27930. }
  27931. function trailingEdge(time) {
  27932. timerId = undefined;
  27933. // Only invoke if we have `lastArgs` which means `func` has been
  27934. // debounced at least once.
  27935. if (trailing && lastArgs) {
  27936. return invokeFunc(time);
  27937. }
  27938. lastArgs = lastThis = undefined;
  27939. return result;
  27940. }
  27941. function cancel() {
  27942. if (timerId !== undefined) {
  27943. clearTimeout(timerId);
  27944. }
  27945. lastInvokeTime = 0;
  27946. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27947. }
  27948. function flush() {
  27949. return timerId === undefined ? result : trailingEdge(now());
  27950. }
  27951. function debounced() {
  27952. var time = now(),
  27953. isInvoking = shouldInvoke(time);
  27954. lastArgs = arguments;
  27955. lastThis = this;
  27956. lastCallTime = time;
  27957. if (isInvoking) {
  27958. if (timerId === undefined) {
  27959. return leadingEdge(lastCallTime);
  27960. }
  27961. if (maxing) {
  27962. // Handle invocations in a tight loop.
  27963. clearTimeout(timerId);
  27964. timerId = setTimeout(timerExpired, wait);
  27965. return invokeFunc(lastCallTime);
  27966. }
  27967. }
  27968. if (timerId === undefined) {
  27969. timerId = setTimeout(timerExpired, wait);
  27970. }
  27971. return result;
  27972. }
  27973. debounced.cancel = cancel;
  27974. debounced.flush = flush;
  27975. return debounced;
  27976. }
  27977. /**
  27978. * Defers invoking the `func` until the current call stack has cleared. Any
  27979. * additional arguments are provided to `func` when it's invoked.
  27980. *
  27981. * @static
  27982. * @memberOf _
  27983. * @since 0.1.0
  27984. * @category Function
  27985. * @param {Function} func The function to defer.
  27986. * @param {...*} [args] The arguments to invoke `func` with.
  27987. * @returns {number} Returns the timer id.
  27988. * @example
  27989. *
  27990. * _.defer(function(text) {
  27991. * console.log(text);
  27992. * }, 'deferred');
  27993. * // => Logs 'deferred' after one millisecond.
  27994. */
  27995. var defer = baseRest(function(func, args) {
  27996. return baseDelay(func, 1, args);
  27997. });
  27998. /**
  27999. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28000. * provided to `func` when it's invoked.
  28001. *
  28002. * @static
  28003. * @memberOf _
  28004. * @since 0.1.0
  28005. * @category Function
  28006. * @param {Function} func The function to delay.
  28007. * @param {number} wait The number of milliseconds to delay invocation.
  28008. * @param {...*} [args] The arguments to invoke `func` with.
  28009. * @returns {number} Returns the timer id.
  28010. * @example
  28011. *
  28012. * _.delay(function(text) {
  28013. * console.log(text);
  28014. * }, 1000, 'later');
  28015. * // => Logs 'later' after one second.
  28016. */
  28017. var delay = baseRest(function(func, wait, args) {
  28018. return baseDelay(func, toNumber(wait) || 0, args);
  28019. });
  28020. /**
  28021. * Creates a function that invokes `func` with arguments reversed.
  28022. *
  28023. * @static
  28024. * @memberOf _
  28025. * @since 4.0.0
  28026. * @category Function
  28027. * @param {Function} func The function to flip arguments for.
  28028. * @returns {Function} Returns the new flipped function.
  28029. * @example
  28030. *
  28031. * var flipped = _.flip(function() {
  28032. * return _.toArray(arguments);
  28033. * });
  28034. *
  28035. * flipped('a', 'b', 'c', 'd');
  28036. * // => ['d', 'c', 'b', 'a']
  28037. */
  28038. function flip(func) {
  28039. return createWrap(func, WRAP_FLIP_FLAG);
  28040. }
  28041. /**
  28042. * Creates a function that memoizes the result of `func`. If `resolver` is
  28043. * provided, it determines the cache key for storing the result based on the
  28044. * arguments provided to the memoized function. By default, the first argument
  28045. * provided to the memoized function is used as the map cache key. The `func`
  28046. * is invoked with the `this` binding of the memoized function.
  28047. *
  28048. * **Note:** The cache is exposed as the `cache` property on the memoized
  28049. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28050. * constructor with one whose instances implement the
  28051. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28052. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28053. *
  28054. * @static
  28055. * @memberOf _
  28056. * @since 0.1.0
  28057. * @category Function
  28058. * @param {Function} func The function to have its output memoized.
  28059. * @param {Function} [resolver] The function to resolve the cache key.
  28060. * @returns {Function} Returns the new memoized function.
  28061. * @example
  28062. *
  28063. * var object = { 'a': 1, 'b': 2 };
  28064. * var other = { 'c': 3, 'd': 4 };
  28065. *
  28066. * var values = _.memoize(_.values);
  28067. * values(object);
  28068. * // => [1, 2]
  28069. *
  28070. * values(other);
  28071. * // => [3, 4]
  28072. *
  28073. * object.a = 2;
  28074. * values(object);
  28075. * // => [1, 2]
  28076. *
  28077. * // Modify the result cache.
  28078. * values.cache.set(object, ['a', 'b']);
  28079. * values(object);
  28080. * // => ['a', 'b']
  28081. *
  28082. * // Replace `_.memoize.Cache`.
  28083. * _.memoize.Cache = WeakMap;
  28084. */
  28085. function memoize(func, resolver) {
  28086. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28087. throw new TypeError(FUNC_ERROR_TEXT);
  28088. }
  28089. var memoized = function() {
  28090. var args = arguments,
  28091. key = resolver ? resolver.apply(this, args) : args[0],
  28092. cache = memoized.cache;
  28093. if (cache.has(key)) {
  28094. return cache.get(key);
  28095. }
  28096. var result = func.apply(this, args);
  28097. memoized.cache = cache.set(key, result) || cache;
  28098. return result;
  28099. };
  28100. memoized.cache = new (memoize.Cache || MapCache);
  28101. return memoized;
  28102. }
  28103. // Expose `MapCache`.
  28104. memoize.Cache = MapCache;
  28105. /**
  28106. * Creates a function that negates the result of the predicate `func`. The
  28107. * `func` predicate is invoked with the `this` binding and arguments of the
  28108. * created function.
  28109. *
  28110. * @static
  28111. * @memberOf _
  28112. * @since 3.0.0
  28113. * @category Function
  28114. * @param {Function} predicate The predicate to negate.
  28115. * @returns {Function} Returns the new negated function.
  28116. * @example
  28117. *
  28118. * function isEven(n) {
  28119. * return n % 2 == 0;
  28120. * }
  28121. *
  28122. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28123. * // => [1, 3, 5]
  28124. */
  28125. function negate(predicate) {
  28126. if (typeof predicate != 'function') {
  28127. throw new TypeError(FUNC_ERROR_TEXT);
  28128. }
  28129. return function() {
  28130. var args = arguments;
  28131. switch (args.length) {
  28132. case 0: return !predicate.call(this);
  28133. case 1: return !predicate.call(this, args[0]);
  28134. case 2: return !predicate.call(this, args[0], args[1]);
  28135. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28136. }
  28137. return !predicate.apply(this, args);
  28138. };
  28139. }
  28140. /**
  28141. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28142. * to the function return the value of the first invocation. The `func` is
  28143. * invoked with the `this` binding and arguments of the created function.
  28144. *
  28145. * @static
  28146. * @memberOf _
  28147. * @since 0.1.0
  28148. * @category Function
  28149. * @param {Function} func The function to restrict.
  28150. * @returns {Function} Returns the new restricted function.
  28151. * @example
  28152. *
  28153. * var initialize = _.once(createApplication);
  28154. * initialize();
  28155. * initialize();
  28156. * // => `createApplication` is invoked once
  28157. */
  28158. function once(func) {
  28159. return before(2, func);
  28160. }
  28161. /**
  28162. * Creates a function that invokes `func` with its arguments transformed.
  28163. *
  28164. * @static
  28165. * @since 4.0.0
  28166. * @memberOf _
  28167. * @category Function
  28168. * @param {Function} func The function to wrap.
  28169. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28170. * The argument transforms.
  28171. * @returns {Function} Returns the new function.
  28172. * @example
  28173. *
  28174. * function doubled(n) {
  28175. * return n * 2;
  28176. * }
  28177. *
  28178. * function square(n) {
  28179. * return n * n;
  28180. * }
  28181. *
  28182. * var func = _.overArgs(function(x, y) {
  28183. * return [x, y];
  28184. * }, [square, doubled]);
  28185. *
  28186. * func(9, 3);
  28187. * // => [81, 6]
  28188. *
  28189. * func(10, 5);
  28190. * // => [100, 10]
  28191. */
  28192. var overArgs = castRest(function(func, transforms) {
  28193. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28194. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28195. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28196. var funcsLength = transforms.length;
  28197. return baseRest(function(args) {
  28198. var index = -1,
  28199. length = nativeMin(args.length, funcsLength);
  28200. while (++index < length) {
  28201. args[index] = transforms[index].call(this, args[index]);
  28202. }
  28203. return apply(func, this, args);
  28204. });
  28205. });
  28206. /**
  28207. * Creates a function that invokes `func` with `partials` prepended to the
  28208. * arguments it receives. This method is like `_.bind` except it does **not**
  28209. * alter the `this` binding.
  28210. *
  28211. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28212. * builds, may be used as a placeholder for partially applied arguments.
  28213. *
  28214. * **Note:** This method doesn't set the "length" property of partially
  28215. * applied functions.
  28216. *
  28217. * @static
  28218. * @memberOf _
  28219. * @since 0.2.0
  28220. * @category Function
  28221. * @param {Function} func The function to partially apply arguments to.
  28222. * @param {...*} [partials] The arguments to be partially applied.
  28223. * @returns {Function} Returns the new partially applied function.
  28224. * @example
  28225. *
  28226. * function greet(greeting, name) {
  28227. * return greeting + ' ' + name;
  28228. * }
  28229. *
  28230. * var sayHelloTo = _.partial(greet, 'hello');
  28231. * sayHelloTo('fred');
  28232. * // => 'hello fred'
  28233. *
  28234. * // Partially applied with placeholders.
  28235. * var greetFred = _.partial(greet, _, 'fred');
  28236. * greetFred('hi');
  28237. * // => 'hi fred'
  28238. */
  28239. var partial = baseRest(function(func, partials) {
  28240. var holders = replaceHolders(partials, getHolder(partial));
  28241. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28242. });
  28243. /**
  28244. * This method is like `_.partial` except that partially applied arguments
  28245. * are appended to the arguments it receives.
  28246. *
  28247. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28248. * builds, may be used as a placeholder for partially applied arguments.
  28249. *
  28250. * **Note:** This method doesn't set the "length" property of partially
  28251. * applied functions.
  28252. *
  28253. * @static
  28254. * @memberOf _
  28255. * @since 1.0.0
  28256. * @category Function
  28257. * @param {Function} func The function to partially apply arguments to.
  28258. * @param {...*} [partials] The arguments to be partially applied.
  28259. * @returns {Function} Returns the new partially applied function.
  28260. * @example
  28261. *
  28262. * function greet(greeting, name) {
  28263. * return greeting + ' ' + name;
  28264. * }
  28265. *
  28266. * var greetFred = _.partialRight(greet, 'fred');
  28267. * greetFred('hi');
  28268. * // => 'hi fred'
  28269. *
  28270. * // Partially applied with placeholders.
  28271. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28272. * sayHelloTo('fred');
  28273. * // => 'hello fred'
  28274. */
  28275. var partialRight = baseRest(function(func, partials) {
  28276. var holders = replaceHolders(partials, getHolder(partialRight));
  28277. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28278. });
  28279. /**
  28280. * Creates a function that invokes `func` with arguments arranged according
  28281. * to the specified `indexes` where the argument value at the first index is
  28282. * provided as the first argument, the argument value at the second index is
  28283. * provided as the second argument, and so on.
  28284. *
  28285. * @static
  28286. * @memberOf _
  28287. * @since 3.0.0
  28288. * @category Function
  28289. * @param {Function} func The function to rearrange arguments for.
  28290. * @param {...(number|number[])} indexes The arranged argument indexes.
  28291. * @returns {Function} Returns the new function.
  28292. * @example
  28293. *
  28294. * var rearged = _.rearg(function(a, b, c) {
  28295. * return [a, b, c];
  28296. * }, [2, 0, 1]);
  28297. *
  28298. * rearged('b', 'c', 'a')
  28299. * // => ['a', 'b', 'c']
  28300. */
  28301. var rearg = flatRest(function(func, indexes) {
  28302. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28303. });
  28304. /**
  28305. * Creates a function that invokes `func` with the `this` binding of the
  28306. * created function and arguments from `start` and beyond provided as
  28307. * an array.
  28308. *
  28309. * **Note:** This method is based on the
  28310. * [rest parameter](https://mdn.io/rest_parameters).
  28311. *
  28312. * @static
  28313. * @memberOf _
  28314. * @since 4.0.0
  28315. * @category Function
  28316. * @param {Function} func The function to apply a rest parameter to.
  28317. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28318. * @returns {Function} Returns the new function.
  28319. * @example
  28320. *
  28321. * var say = _.rest(function(what, names) {
  28322. * return what + ' ' + _.initial(names).join(', ') +
  28323. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28324. * });
  28325. *
  28326. * say('hello', 'fred', 'barney', 'pebbles');
  28327. * // => 'hello fred, barney, & pebbles'
  28328. */
  28329. function rest(func, start) {
  28330. if (typeof func != 'function') {
  28331. throw new TypeError(FUNC_ERROR_TEXT);
  28332. }
  28333. start = start === undefined ? start : toInteger(start);
  28334. return baseRest(func, start);
  28335. }
  28336. /**
  28337. * Creates a function that invokes `func` with the `this` binding of the
  28338. * create function and an array of arguments much like
  28339. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28340. *
  28341. * **Note:** This method is based on the
  28342. * [spread operator](https://mdn.io/spread_operator).
  28343. *
  28344. * @static
  28345. * @memberOf _
  28346. * @since 3.2.0
  28347. * @category Function
  28348. * @param {Function} func The function to spread arguments over.
  28349. * @param {number} [start=0] The start position of the spread.
  28350. * @returns {Function} Returns the new function.
  28351. * @example
  28352. *
  28353. * var say = _.spread(function(who, what) {
  28354. * return who + ' says ' + what;
  28355. * });
  28356. *
  28357. * say(['fred', 'hello']);
  28358. * // => 'fred says hello'
  28359. *
  28360. * var numbers = Promise.all([
  28361. * Promise.resolve(40),
  28362. * Promise.resolve(36)
  28363. * ]);
  28364. *
  28365. * numbers.then(_.spread(function(x, y) {
  28366. * return x + y;
  28367. * }));
  28368. * // => a Promise of 76
  28369. */
  28370. function spread(func, start) {
  28371. if (typeof func != 'function') {
  28372. throw new TypeError(FUNC_ERROR_TEXT);
  28373. }
  28374. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28375. return baseRest(function(args) {
  28376. var array = args[start],
  28377. otherArgs = castSlice(args, 0, start);
  28378. if (array) {
  28379. arrayPush(otherArgs, array);
  28380. }
  28381. return apply(func, this, otherArgs);
  28382. });
  28383. }
  28384. /**
  28385. * Creates a throttled function that only invokes `func` at most once per
  28386. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28387. * method to cancel delayed `func` invocations and a `flush` method to
  28388. * immediately invoke them. Provide `options` to indicate whether `func`
  28389. * should be invoked on the leading and/or trailing edge of the `wait`
  28390. * timeout. The `func` is invoked with the last arguments provided to the
  28391. * throttled function. Subsequent calls to the throttled function return the
  28392. * result of the last `func` invocation.
  28393. *
  28394. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28395. * invoked on the trailing edge of the timeout only if the throttled function
  28396. * is invoked more than once during the `wait` timeout.
  28397. *
  28398. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28399. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28400. *
  28401. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28402. * for details over the differences between `_.throttle` and `_.debounce`.
  28403. *
  28404. * @static
  28405. * @memberOf _
  28406. * @since 0.1.0
  28407. * @category Function
  28408. * @param {Function} func The function to throttle.
  28409. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28410. * @param {Object} [options={}] The options object.
  28411. * @param {boolean} [options.leading=true]
  28412. * Specify invoking on the leading edge of the timeout.
  28413. * @param {boolean} [options.trailing=true]
  28414. * Specify invoking on the trailing edge of the timeout.
  28415. * @returns {Function} Returns the new throttled function.
  28416. * @example
  28417. *
  28418. * // Avoid excessively updating the position while scrolling.
  28419. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28420. *
  28421. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28422. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28423. * jQuery(element).on('click', throttled);
  28424. *
  28425. * // Cancel the trailing throttled invocation.
  28426. * jQuery(window).on('popstate', throttled.cancel);
  28427. */
  28428. function throttle(func, wait, options) {
  28429. var leading = true,
  28430. trailing = true;
  28431. if (typeof func != 'function') {
  28432. throw new TypeError(FUNC_ERROR_TEXT);
  28433. }
  28434. if (isObject(options)) {
  28435. leading = 'leading' in options ? !!options.leading : leading;
  28436. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28437. }
  28438. return debounce(func, wait, {
  28439. 'leading': leading,
  28440. 'maxWait': wait,
  28441. 'trailing': trailing
  28442. });
  28443. }
  28444. /**
  28445. * Creates a function that accepts up to one argument, ignoring any
  28446. * additional arguments.
  28447. *
  28448. * @static
  28449. * @memberOf _
  28450. * @since 4.0.0
  28451. * @category Function
  28452. * @param {Function} func The function to cap arguments for.
  28453. * @returns {Function} Returns the new capped function.
  28454. * @example
  28455. *
  28456. * _.map(['6', '8', '10'], _.unary(parseInt));
  28457. * // => [6, 8, 10]
  28458. */
  28459. function unary(func) {
  28460. return ary(func, 1);
  28461. }
  28462. /**
  28463. * Creates a function that provides `value` to `wrapper` as its first
  28464. * argument. Any additional arguments provided to the function are appended
  28465. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28466. * binding of the created function.
  28467. *
  28468. * @static
  28469. * @memberOf _
  28470. * @since 0.1.0
  28471. * @category Function
  28472. * @param {*} value The value to wrap.
  28473. * @param {Function} [wrapper=identity] The wrapper function.
  28474. * @returns {Function} Returns the new function.
  28475. * @example
  28476. *
  28477. * var p = _.wrap(_.escape, function(func, text) {
  28478. * return '<p>' + func(text) + '</p>';
  28479. * });
  28480. *
  28481. * p('fred, barney, & pebbles');
  28482. * // => '<p>fred, barney, &amp; pebbles</p>'
  28483. */
  28484. function wrap(value, wrapper) {
  28485. return partial(castFunction(wrapper), value);
  28486. }
  28487. /*------------------------------------------------------------------------*/
  28488. /**
  28489. * Casts `value` as an array if it's not one.
  28490. *
  28491. * @static
  28492. * @memberOf _
  28493. * @since 4.4.0
  28494. * @category Lang
  28495. * @param {*} value The value to inspect.
  28496. * @returns {Array} Returns the cast array.
  28497. * @example
  28498. *
  28499. * _.castArray(1);
  28500. * // => [1]
  28501. *
  28502. * _.castArray({ 'a': 1 });
  28503. * // => [{ 'a': 1 }]
  28504. *
  28505. * _.castArray('abc');
  28506. * // => ['abc']
  28507. *
  28508. * _.castArray(null);
  28509. * // => [null]
  28510. *
  28511. * _.castArray(undefined);
  28512. * // => [undefined]
  28513. *
  28514. * _.castArray();
  28515. * // => []
  28516. *
  28517. * var array = [1, 2, 3];
  28518. * console.log(_.castArray(array) === array);
  28519. * // => true
  28520. */
  28521. function castArray() {
  28522. if (!arguments.length) {
  28523. return [];
  28524. }
  28525. var value = arguments[0];
  28526. return isArray(value) ? value : [value];
  28527. }
  28528. /**
  28529. * Creates a shallow clone of `value`.
  28530. *
  28531. * **Note:** This method is loosely based on the
  28532. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28533. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28534. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28535. * arrays. The own enumerable properties of `arguments` objects are cloned
  28536. * as plain objects. An empty object is returned for uncloneable values such
  28537. * as error objects, functions, DOM nodes, and WeakMaps.
  28538. *
  28539. * @static
  28540. * @memberOf _
  28541. * @since 0.1.0
  28542. * @category Lang
  28543. * @param {*} value The value to clone.
  28544. * @returns {*} Returns the cloned value.
  28545. * @see _.cloneDeep
  28546. * @example
  28547. *
  28548. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28549. *
  28550. * var shallow = _.clone(objects);
  28551. * console.log(shallow[0] === objects[0]);
  28552. * // => true
  28553. */
  28554. function clone(value) {
  28555. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28556. }
  28557. /**
  28558. * This method is like `_.clone` except that it accepts `customizer` which
  28559. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28560. * cloning is handled by the method instead. The `customizer` is invoked with
  28561. * up to four arguments; (value [, index|key, object, stack]).
  28562. *
  28563. * @static
  28564. * @memberOf _
  28565. * @since 4.0.0
  28566. * @category Lang
  28567. * @param {*} value The value to clone.
  28568. * @param {Function} [customizer] The function to customize cloning.
  28569. * @returns {*} Returns the cloned value.
  28570. * @see _.cloneDeepWith
  28571. * @example
  28572. *
  28573. * function customizer(value) {
  28574. * if (_.isElement(value)) {
  28575. * return value.cloneNode(false);
  28576. * }
  28577. * }
  28578. *
  28579. * var el = _.cloneWith(document.body, customizer);
  28580. *
  28581. * console.log(el === document.body);
  28582. * // => false
  28583. * console.log(el.nodeName);
  28584. * // => 'BODY'
  28585. * console.log(el.childNodes.length);
  28586. * // => 0
  28587. */
  28588. function cloneWith(value, customizer) {
  28589. customizer = typeof customizer == 'function' ? customizer : undefined;
  28590. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28591. }
  28592. /**
  28593. * This method is like `_.clone` except that it recursively clones `value`.
  28594. *
  28595. * @static
  28596. * @memberOf _
  28597. * @since 1.0.0
  28598. * @category Lang
  28599. * @param {*} value The value to recursively clone.
  28600. * @returns {*} Returns the deep cloned value.
  28601. * @see _.clone
  28602. * @example
  28603. *
  28604. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28605. *
  28606. * var deep = _.cloneDeep(objects);
  28607. * console.log(deep[0] === objects[0]);
  28608. * // => false
  28609. */
  28610. function cloneDeep(value) {
  28611. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28612. }
  28613. /**
  28614. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28615. *
  28616. * @static
  28617. * @memberOf _
  28618. * @since 4.0.0
  28619. * @category Lang
  28620. * @param {*} value The value to recursively clone.
  28621. * @param {Function} [customizer] The function to customize cloning.
  28622. * @returns {*} Returns the deep cloned value.
  28623. * @see _.cloneWith
  28624. * @example
  28625. *
  28626. * function customizer(value) {
  28627. * if (_.isElement(value)) {
  28628. * return value.cloneNode(true);
  28629. * }
  28630. * }
  28631. *
  28632. * var el = _.cloneDeepWith(document.body, customizer);
  28633. *
  28634. * console.log(el === document.body);
  28635. * // => false
  28636. * console.log(el.nodeName);
  28637. * // => 'BODY'
  28638. * console.log(el.childNodes.length);
  28639. * // => 20
  28640. */
  28641. function cloneDeepWith(value, customizer) {
  28642. customizer = typeof customizer == 'function' ? customizer : undefined;
  28643. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28644. }
  28645. /**
  28646. * Checks if `object` conforms to `source` by invoking the predicate
  28647. * properties of `source` with the corresponding property values of `object`.
  28648. *
  28649. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28650. * partially applied.
  28651. *
  28652. * @static
  28653. * @memberOf _
  28654. * @since 4.14.0
  28655. * @category Lang
  28656. * @param {Object} object The object to inspect.
  28657. * @param {Object} source The object of property predicates to conform to.
  28658. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28659. * @example
  28660. *
  28661. * var object = { 'a': 1, 'b': 2 };
  28662. *
  28663. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28664. * // => true
  28665. *
  28666. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28667. * // => false
  28668. */
  28669. function conformsTo(object, source) {
  28670. return source == null || baseConformsTo(object, source, keys(source));
  28671. }
  28672. /**
  28673. * Performs a
  28674. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28675. * comparison between two values to determine if they are equivalent.
  28676. *
  28677. * @static
  28678. * @memberOf _
  28679. * @since 4.0.0
  28680. * @category Lang
  28681. * @param {*} value The value to compare.
  28682. * @param {*} other The other value to compare.
  28683. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28684. * @example
  28685. *
  28686. * var object = { 'a': 1 };
  28687. * var other = { 'a': 1 };
  28688. *
  28689. * _.eq(object, object);
  28690. * // => true
  28691. *
  28692. * _.eq(object, other);
  28693. * // => false
  28694. *
  28695. * _.eq('a', 'a');
  28696. * // => true
  28697. *
  28698. * _.eq('a', Object('a'));
  28699. * // => false
  28700. *
  28701. * _.eq(NaN, NaN);
  28702. * // => true
  28703. */
  28704. function eq(value, other) {
  28705. return value === other || (value !== value && other !== other);
  28706. }
  28707. /**
  28708. * Checks if `value` is greater than `other`.
  28709. *
  28710. * @static
  28711. * @memberOf _
  28712. * @since 3.9.0
  28713. * @category Lang
  28714. * @param {*} value The value to compare.
  28715. * @param {*} other The other value to compare.
  28716. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28717. * else `false`.
  28718. * @see _.lt
  28719. * @example
  28720. *
  28721. * _.gt(3, 1);
  28722. * // => true
  28723. *
  28724. * _.gt(3, 3);
  28725. * // => false
  28726. *
  28727. * _.gt(1, 3);
  28728. * // => false
  28729. */
  28730. var gt = createRelationalOperation(baseGt);
  28731. /**
  28732. * Checks if `value` is greater than or equal to `other`.
  28733. *
  28734. * @static
  28735. * @memberOf _
  28736. * @since 3.9.0
  28737. * @category Lang
  28738. * @param {*} value The value to compare.
  28739. * @param {*} other The other value to compare.
  28740. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28741. * `other`, else `false`.
  28742. * @see _.lte
  28743. * @example
  28744. *
  28745. * _.gte(3, 1);
  28746. * // => true
  28747. *
  28748. * _.gte(3, 3);
  28749. * // => true
  28750. *
  28751. * _.gte(1, 3);
  28752. * // => false
  28753. */
  28754. var gte = createRelationalOperation(function(value, other) {
  28755. return value >= other;
  28756. });
  28757. /**
  28758. * Checks if `value` is likely an `arguments` object.
  28759. *
  28760. * @static
  28761. * @memberOf _
  28762. * @since 0.1.0
  28763. * @category Lang
  28764. * @param {*} value The value to check.
  28765. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28766. * else `false`.
  28767. * @example
  28768. *
  28769. * _.isArguments(function() { return arguments; }());
  28770. * // => true
  28771. *
  28772. * _.isArguments([1, 2, 3]);
  28773. * // => false
  28774. */
  28775. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28776. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28777. !propertyIsEnumerable.call(value, 'callee');
  28778. };
  28779. /**
  28780. * Checks if `value` is classified as an `Array` object.
  28781. *
  28782. * @static
  28783. * @memberOf _
  28784. * @since 0.1.0
  28785. * @category Lang
  28786. * @param {*} value The value to check.
  28787. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28788. * @example
  28789. *
  28790. * _.isArray([1, 2, 3]);
  28791. * // => true
  28792. *
  28793. * _.isArray(document.body.children);
  28794. * // => false
  28795. *
  28796. * _.isArray('abc');
  28797. * // => false
  28798. *
  28799. * _.isArray(_.noop);
  28800. * // => false
  28801. */
  28802. var isArray = Array.isArray;
  28803. /**
  28804. * Checks if `value` is classified as an `ArrayBuffer` object.
  28805. *
  28806. * @static
  28807. * @memberOf _
  28808. * @since 4.3.0
  28809. * @category Lang
  28810. * @param {*} value The value to check.
  28811. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28812. * @example
  28813. *
  28814. * _.isArrayBuffer(new ArrayBuffer(2));
  28815. * // => true
  28816. *
  28817. * _.isArrayBuffer(new Array(2));
  28818. * // => false
  28819. */
  28820. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28821. /**
  28822. * Checks if `value` is array-like. A value is considered array-like if it's
  28823. * not a function and has a `value.length` that's an integer greater than or
  28824. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28825. *
  28826. * @static
  28827. * @memberOf _
  28828. * @since 4.0.0
  28829. * @category Lang
  28830. * @param {*} value The value to check.
  28831. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28832. * @example
  28833. *
  28834. * _.isArrayLike([1, 2, 3]);
  28835. * // => true
  28836. *
  28837. * _.isArrayLike(document.body.children);
  28838. * // => true
  28839. *
  28840. * _.isArrayLike('abc');
  28841. * // => true
  28842. *
  28843. * _.isArrayLike(_.noop);
  28844. * // => false
  28845. */
  28846. function isArrayLike(value) {
  28847. return value != null && isLength(value.length) && !isFunction(value);
  28848. }
  28849. /**
  28850. * This method is like `_.isArrayLike` except that it also checks if `value`
  28851. * is an object.
  28852. *
  28853. * @static
  28854. * @memberOf _
  28855. * @since 4.0.0
  28856. * @category Lang
  28857. * @param {*} value The value to check.
  28858. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28859. * else `false`.
  28860. * @example
  28861. *
  28862. * _.isArrayLikeObject([1, 2, 3]);
  28863. * // => true
  28864. *
  28865. * _.isArrayLikeObject(document.body.children);
  28866. * // => true
  28867. *
  28868. * _.isArrayLikeObject('abc');
  28869. * // => false
  28870. *
  28871. * _.isArrayLikeObject(_.noop);
  28872. * // => false
  28873. */
  28874. function isArrayLikeObject(value) {
  28875. return isObjectLike(value) && isArrayLike(value);
  28876. }
  28877. /**
  28878. * Checks if `value` is classified as a boolean primitive or object.
  28879. *
  28880. * @static
  28881. * @memberOf _
  28882. * @since 0.1.0
  28883. * @category Lang
  28884. * @param {*} value The value to check.
  28885. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28886. * @example
  28887. *
  28888. * _.isBoolean(false);
  28889. * // => true
  28890. *
  28891. * _.isBoolean(null);
  28892. * // => false
  28893. */
  28894. function isBoolean(value) {
  28895. return value === true || value === false ||
  28896. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28897. }
  28898. /**
  28899. * Checks if `value` is a buffer.
  28900. *
  28901. * @static
  28902. * @memberOf _
  28903. * @since 4.3.0
  28904. * @category Lang
  28905. * @param {*} value The value to check.
  28906. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28907. * @example
  28908. *
  28909. * _.isBuffer(new Buffer(2));
  28910. * // => true
  28911. *
  28912. * _.isBuffer(new Uint8Array(2));
  28913. * // => false
  28914. */
  28915. var isBuffer = nativeIsBuffer || stubFalse;
  28916. /**
  28917. * Checks if `value` is classified as a `Date` object.
  28918. *
  28919. * @static
  28920. * @memberOf _
  28921. * @since 0.1.0
  28922. * @category Lang
  28923. * @param {*} value The value to check.
  28924. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28925. * @example
  28926. *
  28927. * _.isDate(new Date);
  28928. * // => true
  28929. *
  28930. * _.isDate('Mon April 23 2012');
  28931. * // => false
  28932. */
  28933. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28934. /**
  28935. * Checks if `value` is likely a DOM element.
  28936. *
  28937. * @static
  28938. * @memberOf _
  28939. * @since 0.1.0
  28940. * @category Lang
  28941. * @param {*} value The value to check.
  28942. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28943. * @example
  28944. *
  28945. * _.isElement(document.body);
  28946. * // => true
  28947. *
  28948. * _.isElement('<body>');
  28949. * // => false
  28950. */
  28951. function isElement(value) {
  28952. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28953. }
  28954. /**
  28955. * Checks if `value` is an empty object, collection, map, or set.
  28956. *
  28957. * Objects are considered empty if they have no own enumerable string keyed
  28958. * properties.
  28959. *
  28960. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28961. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28962. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28963. *
  28964. * @static
  28965. * @memberOf _
  28966. * @since 0.1.0
  28967. * @category Lang
  28968. * @param {*} value The value to check.
  28969. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28970. * @example
  28971. *
  28972. * _.isEmpty(null);
  28973. * // => true
  28974. *
  28975. * _.isEmpty(true);
  28976. * // => true
  28977. *
  28978. * _.isEmpty(1);
  28979. * // => true
  28980. *
  28981. * _.isEmpty([1, 2, 3]);
  28982. * // => false
  28983. *
  28984. * _.isEmpty({ 'a': 1 });
  28985. * // => false
  28986. */
  28987. function isEmpty(value) {
  28988. if (value == null) {
  28989. return true;
  28990. }
  28991. if (isArrayLike(value) &&
  28992. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28993. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28994. return !value.length;
  28995. }
  28996. var tag = getTag(value);
  28997. if (tag == mapTag || tag == setTag) {
  28998. return !value.size;
  28999. }
  29000. if (isPrototype(value)) {
  29001. return !baseKeys(value).length;
  29002. }
  29003. for (var key in value) {
  29004. if (hasOwnProperty.call(value, key)) {
  29005. return false;
  29006. }
  29007. }
  29008. return true;
  29009. }
  29010. /**
  29011. * Performs a deep comparison between two values to determine if they are
  29012. * equivalent.
  29013. *
  29014. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29015. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29016. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29017. * by their own, not inherited, enumerable properties. Functions and DOM
  29018. * nodes are compared by strict equality, i.e. `===`.
  29019. *
  29020. * @static
  29021. * @memberOf _
  29022. * @since 0.1.0
  29023. * @category Lang
  29024. * @param {*} value The value to compare.
  29025. * @param {*} other The other value to compare.
  29026. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29027. * @example
  29028. *
  29029. * var object = { 'a': 1 };
  29030. * var other = { 'a': 1 };
  29031. *
  29032. * _.isEqual(object, other);
  29033. * // => true
  29034. *
  29035. * object === other;
  29036. * // => false
  29037. */
  29038. function isEqual(value, other) {
  29039. return baseIsEqual(value, other);
  29040. }
  29041. /**
  29042. * This method is like `_.isEqual` except that it accepts `customizer` which
  29043. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29044. * are handled by the method instead. The `customizer` is invoked with up to
  29045. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29046. *
  29047. * @static
  29048. * @memberOf _
  29049. * @since 4.0.0
  29050. * @category Lang
  29051. * @param {*} value The value to compare.
  29052. * @param {*} other The other value to compare.
  29053. * @param {Function} [customizer] The function to customize comparisons.
  29054. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29055. * @example
  29056. *
  29057. * function isGreeting(value) {
  29058. * return /^h(?:i|ello)$/.test(value);
  29059. * }
  29060. *
  29061. * function customizer(objValue, othValue) {
  29062. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29063. * return true;
  29064. * }
  29065. * }
  29066. *
  29067. * var array = ['hello', 'goodbye'];
  29068. * var other = ['hi', 'goodbye'];
  29069. *
  29070. * _.isEqualWith(array, other, customizer);
  29071. * // => true
  29072. */
  29073. function isEqualWith(value, other, customizer) {
  29074. customizer = typeof customizer == 'function' ? customizer : undefined;
  29075. var result = customizer ? customizer(value, other) : undefined;
  29076. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29077. }
  29078. /**
  29079. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29080. * `SyntaxError`, `TypeError`, or `URIError` object.
  29081. *
  29082. * @static
  29083. * @memberOf _
  29084. * @since 3.0.0
  29085. * @category Lang
  29086. * @param {*} value The value to check.
  29087. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29088. * @example
  29089. *
  29090. * _.isError(new Error);
  29091. * // => true
  29092. *
  29093. * _.isError(Error);
  29094. * // => false
  29095. */
  29096. function isError(value) {
  29097. if (!isObjectLike(value)) {
  29098. return false;
  29099. }
  29100. var tag = baseGetTag(value);
  29101. return tag == errorTag || tag == domExcTag ||
  29102. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29103. }
  29104. /**
  29105. * Checks if `value` is a finite primitive number.
  29106. *
  29107. * **Note:** This method is based on
  29108. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29109. *
  29110. * @static
  29111. * @memberOf _
  29112. * @since 0.1.0
  29113. * @category Lang
  29114. * @param {*} value The value to check.
  29115. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29116. * @example
  29117. *
  29118. * _.isFinite(3);
  29119. * // => true
  29120. *
  29121. * _.isFinite(Number.MIN_VALUE);
  29122. * // => true
  29123. *
  29124. * _.isFinite(Infinity);
  29125. * // => false
  29126. *
  29127. * _.isFinite('3');
  29128. * // => false
  29129. */
  29130. function isFinite(value) {
  29131. return typeof value == 'number' && nativeIsFinite(value);
  29132. }
  29133. /**
  29134. * Checks if `value` is classified as a `Function` object.
  29135. *
  29136. * @static
  29137. * @memberOf _
  29138. * @since 0.1.0
  29139. * @category Lang
  29140. * @param {*} value The value to check.
  29141. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29142. * @example
  29143. *
  29144. * _.isFunction(_);
  29145. * // => true
  29146. *
  29147. * _.isFunction(/abc/);
  29148. * // => false
  29149. */
  29150. function isFunction(value) {
  29151. if (!isObject(value)) {
  29152. return false;
  29153. }
  29154. // The use of `Object#toString` avoids issues with the `typeof` operator
  29155. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29156. var tag = baseGetTag(value);
  29157. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29158. }
  29159. /**
  29160. * Checks if `value` is an integer.
  29161. *
  29162. * **Note:** This method is based on
  29163. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29164. *
  29165. * @static
  29166. * @memberOf _
  29167. * @since 4.0.0
  29168. * @category Lang
  29169. * @param {*} value The value to check.
  29170. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29171. * @example
  29172. *
  29173. * _.isInteger(3);
  29174. * // => true
  29175. *
  29176. * _.isInteger(Number.MIN_VALUE);
  29177. * // => false
  29178. *
  29179. * _.isInteger(Infinity);
  29180. * // => false
  29181. *
  29182. * _.isInteger('3');
  29183. * // => false
  29184. */
  29185. function isInteger(value) {
  29186. return typeof value == 'number' && value == toInteger(value);
  29187. }
  29188. /**
  29189. * Checks if `value` is a valid array-like length.
  29190. *
  29191. * **Note:** This method is loosely based on
  29192. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29193. *
  29194. * @static
  29195. * @memberOf _
  29196. * @since 4.0.0
  29197. * @category Lang
  29198. * @param {*} value The value to check.
  29199. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29200. * @example
  29201. *
  29202. * _.isLength(3);
  29203. * // => true
  29204. *
  29205. * _.isLength(Number.MIN_VALUE);
  29206. * // => false
  29207. *
  29208. * _.isLength(Infinity);
  29209. * // => false
  29210. *
  29211. * _.isLength('3');
  29212. * // => false
  29213. */
  29214. function isLength(value) {
  29215. return typeof value == 'number' &&
  29216. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29217. }
  29218. /**
  29219. * Checks if `value` is the
  29220. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29221. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29222. *
  29223. * @static
  29224. * @memberOf _
  29225. * @since 0.1.0
  29226. * @category Lang
  29227. * @param {*} value The value to check.
  29228. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29229. * @example
  29230. *
  29231. * _.isObject({});
  29232. * // => true
  29233. *
  29234. * _.isObject([1, 2, 3]);
  29235. * // => true
  29236. *
  29237. * _.isObject(_.noop);
  29238. * // => true
  29239. *
  29240. * _.isObject(null);
  29241. * // => false
  29242. */
  29243. function isObject(value) {
  29244. var type = typeof value;
  29245. return value != null && (type == 'object' || type == 'function');
  29246. }
  29247. /**
  29248. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29249. * and has a `typeof` result of "object".
  29250. *
  29251. * @static
  29252. * @memberOf _
  29253. * @since 4.0.0
  29254. * @category Lang
  29255. * @param {*} value The value to check.
  29256. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29257. * @example
  29258. *
  29259. * _.isObjectLike({});
  29260. * // => true
  29261. *
  29262. * _.isObjectLike([1, 2, 3]);
  29263. * // => true
  29264. *
  29265. * _.isObjectLike(_.noop);
  29266. * // => false
  29267. *
  29268. * _.isObjectLike(null);
  29269. * // => false
  29270. */
  29271. function isObjectLike(value) {
  29272. return value != null && typeof value == 'object';
  29273. }
  29274. /**
  29275. * Checks if `value` is classified as a `Map` object.
  29276. *
  29277. * @static
  29278. * @memberOf _
  29279. * @since 4.3.0
  29280. * @category Lang
  29281. * @param {*} value The value to check.
  29282. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29283. * @example
  29284. *
  29285. * _.isMap(new Map);
  29286. * // => true
  29287. *
  29288. * _.isMap(new WeakMap);
  29289. * // => false
  29290. */
  29291. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29292. /**
  29293. * Performs a partial deep comparison between `object` and `source` to
  29294. * determine if `object` contains equivalent property values.
  29295. *
  29296. * **Note:** This method is equivalent to `_.matches` when `source` is
  29297. * partially applied.
  29298. *
  29299. * Partial comparisons will match empty array and empty object `source`
  29300. * values against any array or object value, respectively. See `_.isEqual`
  29301. * for a list of supported value comparisons.
  29302. *
  29303. * @static
  29304. * @memberOf _
  29305. * @since 3.0.0
  29306. * @category Lang
  29307. * @param {Object} object The object to inspect.
  29308. * @param {Object} source The object of property values to match.
  29309. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29310. * @example
  29311. *
  29312. * var object = { 'a': 1, 'b': 2 };
  29313. *
  29314. * _.isMatch(object, { 'b': 2 });
  29315. * // => true
  29316. *
  29317. * _.isMatch(object, { 'b': 1 });
  29318. * // => false
  29319. */
  29320. function isMatch(object, source) {
  29321. return object === source || baseIsMatch(object, source, getMatchData(source));
  29322. }
  29323. /**
  29324. * This method is like `_.isMatch` except that it accepts `customizer` which
  29325. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29326. * are handled by the method instead. The `customizer` is invoked with five
  29327. * arguments: (objValue, srcValue, index|key, object, source).
  29328. *
  29329. * @static
  29330. * @memberOf _
  29331. * @since 4.0.0
  29332. * @category Lang
  29333. * @param {Object} object The object to inspect.
  29334. * @param {Object} source The object of property values to match.
  29335. * @param {Function} [customizer] The function to customize comparisons.
  29336. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29337. * @example
  29338. *
  29339. * function isGreeting(value) {
  29340. * return /^h(?:i|ello)$/.test(value);
  29341. * }
  29342. *
  29343. * function customizer(objValue, srcValue) {
  29344. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29345. * return true;
  29346. * }
  29347. * }
  29348. *
  29349. * var object = { 'greeting': 'hello' };
  29350. * var source = { 'greeting': 'hi' };
  29351. *
  29352. * _.isMatchWith(object, source, customizer);
  29353. * // => true
  29354. */
  29355. function isMatchWith(object, source, customizer) {
  29356. customizer = typeof customizer == 'function' ? customizer : undefined;
  29357. return baseIsMatch(object, source, getMatchData(source), customizer);
  29358. }
  29359. /**
  29360. * Checks if `value` is `NaN`.
  29361. *
  29362. * **Note:** This method is based on
  29363. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29364. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29365. * `undefined` and other non-number values.
  29366. *
  29367. * @static
  29368. * @memberOf _
  29369. * @since 0.1.0
  29370. * @category Lang
  29371. * @param {*} value The value to check.
  29372. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29373. * @example
  29374. *
  29375. * _.isNaN(NaN);
  29376. * // => true
  29377. *
  29378. * _.isNaN(new Number(NaN));
  29379. * // => true
  29380. *
  29381. * isNaN(undefined);
  29382. * // => true
  29383. *
  29384. * _.isNaN(undefined);
  29385. * // => false
  29386. */
  29387. function isNaN(value) {
  29388. // An `NaN` primitive is the only value that is not equal to itself.
  29389. // Perform the `toStringTag` check first to avoid errors with some
  29390. // ActiveX objects in IE.
  29391. return isNumber(value) && value != +value;
  29392. }
  29393. /**
  29394. * Checks if `value` is a pristine native function.
  29395. *
  29396. * **Note:** This method can't reliably detect native functions in the presence
  29397. * of the core-js package because core-js circumvents this kind of detection.
  29398. * Despite multiple requests, the core-js maintainer has made it clear: any
  29399. * attempt to fix the detection will be obstructed. As a result, we're left
  29400. * with little choice but to throw an error. Unfortunately, this also affects
  29401. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29402. * which rely on core-js.
  29403. *
  29404. * @static
  29405. * @memberOf _
  29406. * @since 3.0.0
  29407. * @category Lang
  29408. * @param {*} value The value to check.
  29409. * @returns {boolean} Returns `true` if `value` is a native function,
  29410. * else `false`.
  29411. * @example
  29412. *
  29413. * _.isNative(Array.prototype.push);
  29414. * // => true
  29415. *
  29416. * _.isNative(_);
  29417. * // => false
  29418. */
  29419. function isNative(value) {
  29420. if (isMaskable(value)) {
  29421. throw new Error(CORE_ERROR_TEXT);
  29422. }
  29423. return baseIsNative(value);
  29424. }
  29425. /**
  29426. * Checks if `value` is `null`.
  29427. *
  29428. * @static
  29429. * @memberOf _
  29430. * @since 0.1.0
  29431. * @category Lang
  29432. * @param {*} value The value to check.
  29433. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29434. * @example
  29435. *
  29436. * _.isNull(null);
  29437. * // => true
  29438. *
  29439. * _.isNull(void 0);
  29440. * // => false
  29441. */
  29442. function isNull(value) {
  29443. return value === null;
  29444. }
  29445. /**
  29446. * Checks if `value` is `null` or `undefined`.
  29447. *
  29448. * @static
  29449. * @memberOf _
  29450. * @since 4.0.0
  29451. * @category Lang
  29452. * @param {*} value The value to check.
  29453. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29454. * @example
  29455. *
  29456. * _.isNil(null);
  29457. * // => true
  29458. *
  29459. * _.isNil(void 0);
  29460. * // => true
  29461. *
  29462. * _.isNil(NaN);
  29463. * // => false
  29464. */
  29465. function isNil(value) {
  29466. return value == null;
  29467. }
  29468. /**
  29469. * Checks if `value` is classified as a `Number` primitive or object.
  29470. *
  29471. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29472. * classified as numbers, use the `_.isFinite` method.
  29473. *
  29474. * @static
  29475. * @memberOf _
  29476. * @since 0.1.0
  29477. * @category Lang
  29478. * @param {*} value The value to check.
  29479. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29480. * @example
  29481. *
  29482. * _.isNumber(3);
  29483. * // => true
  29484. *
  29485. * _.isNumber(Number.MIN_VALUE);
  29486. * // => true
  29487. *
  29488. * _.isNumber(Infinity);
  29489. * // => true
  29490. *
  29491. * _.isNumber('3');
  29492. * // => false
  29493. */
  29494. function isNumber(value) {
  29495. return typeof value == 'number' ||
  29496. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29497. }
  29498. /**
  29499. * Checks if `value` is a plain object, that is, an object created by the
  29500. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29501. *
  29502. * @static
  29503. * @memberOf _
  29504. * @since 0.8.0
  29505. * @category Lang
  29506. * @param {*} value The value to check.
  29507. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29508. * @example
  29509. *
  29510. * function Foo() {
  29511. * this.a = 1;
  29512. * }
  29513. *
  29514. * _.isPlainObject(new Foo);
  29515. * // => false
  29516. *
  29517. * _.isPlainObject([1, 2, 3]);
  29518. * // => false
  29519. *
  29520. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29521. * // => true
  29522. *
  29523. * _.isPlainObject(Object.create(null));
  29524. * // => true
  29525. */
  29526. function isPlainObject(value) {
  29527. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29528. return false;
  29529. }
  29530. var proto = getPrototype(value);
  29531. if (proto === null) {
  29532. return true;
  29533. }
  29534. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29535. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29536. funcToString.call(Ctor) == objectCtorString;
  29537. }
  29538. /**
  29539. * Checks if `value` is classified as a `RegExp` object.
  29540. *
  29541. * @static
  29542. * @memberOf _
  29543. * @since 0.1.0
  29544. * @category Lang
  29545. * @param {*} value The value to check.
  29546. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29547. * @example
  29548. *
  29549. * _.isRegExp(/abc/);
  29550. * // => true
  29551. *
  29552. * _.isRegExp('/abc/');
  29553. * // => false
  29554. */
  29555. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29556. /**
  29557. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29558. * double precision number which isn't the result of a rounded unsafe integer.
  29559. *
  29560. * **Note:** This method is based on
  29561. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29562. *
  29563. * @static
  29564. * @memberOf _
  29565. * @since 4.0.0
  29566. * @category Lang
  29567. * @param {*} value The value to check.
  29568. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29569. * @example
  29570. *
  29571. * _.isSafeInteger(3);
  29572. * // => true
  29573. *
  29574. * _.isSafeInteger(Number.MIN_VALUE);
  29575. * // => false
  29576. *
  29577. * _.isSafeInteger(Infinity);
  29578. * // => false
  29579. *
  29580. * _.isSafeInteger('3');
  29581. * // => false
  29582. */
  29583. function isSafeInteger(value) {
  29584. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29585. }
  29586. /**
  29587. * Checks if `value` is classified as a `Set` object.
  29588. *
  29589. * @static
  29590. * @memberOf _
  29591. * @since 4.3.0
  29592. * @category Lang
  29593. * @param {*} value The value to check.
  29594. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29595. * @example
  29596. *
  29597. * _.isSet(new Set);
  29598. * // => true
  29599. *
  29600. * _.isSet(new WeakSet);
  29601. * // => false
  29602. */
  29603. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29604. /**
  29605. * Checks if `value` is classified as a `String` primitive or object.
  29606. *
  29607. * @static
  29608. * @since 0.1.0
  29609. * @memberOf _
  29610. * @category Lang
  29611. * @param {*} value The value to check.
  29612. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29613. * @example
  29614. *
  29615. * _.isString('abc');
  29616. * // => true
  29617. *
  29618. * _.isString(1);
  29619. * // => false
  29620. */
  29621. function isString(value) {
  29622. return typeof value == 'string' ||
  29623. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29624. }
  29625. /**
  29626. * Checks if `value` is classified as a `Symbol` primitive or object.
  29627. *
  29628. * @static
  29629. * @memberOf _
  29630. * @since 4.0.0
  29631. * @category Lang
  29632. * @param {*} value The value to check.
  29633. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29634. * @example
  29635. *
  29636. * _.isSymbol(Symbol.iterator);
  29637. * // => true
  29638. *
  29639. * _.isSymbol('abc');
  29640. * // => false
  29641. */
  29642. function isSymbol(value) {
  29643. return typeof value == 'symbol' ||
  29644. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29645. }
  29646. /**
  29647. * Checks if `value` is classified as a typed array.
  29648. *
  29649. * @static
  29650. * @memberOf _
  29651. * @since 3.0.0
  29652. * @category Lang
  29653. * @param {*} value The value to check.
  29654. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29655. * @example
  29656. *
  29657. * _.isTypedArray(new Uint8Array);
  29658. * // => true
  29659. *
  29660. * _.isTypedArray([]);
  29661. * // => false
  29662. */
  29663. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29664. /**
  29665. * Checks if `value` is `undefined`.
  29666. *
  29667. * @static
  29668. * @since 0.1.0
  29669. * @memberOf _
  29670. * @category Lang
  29671. * @param {*} value The value to check.
  29672. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29673. * @example
  29674. *
  29675. * _.isUndefined(void 0);
  29676. * // => true
  29677. *
  29678. * _.isUndefined(null);
  29679. * // => false
  29680. */
  29681. function isUndefined(value) {
  29682. return value === undefined;
  29683. }
  29684. /**
  29685. * Checks if `value` is classified as a `WeakMap` object.
  29686. *
  29687. * @static
  29688. * @memberOf _
  29689. * @since 4.3.0
  29690. * @category Lang
  29691. * @param {*} value The value to check.
  29692. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29693. * @example
  29694. *
  29695. * _.isWeakMap(new WeakMap);
  29696. * // => true
  29697. *
  29698. * _.isWeakMap(new Map);
  29699. * // => false
  29700. */
  29701. function isWeakMap(value) {
  29702. return isObjectLike(value) && getTag(value) == weakMapTag;
  29703. }
  29704. /**
  29705. * Checks if `value` is classified as a `WeakSet` object.
  29706. *
  29707. * @static
  29708. * @memberOf _
  29709. * @since 4.3.0
  29710. * @category Lang
  29711. * @param {*} value The value to check.
  29712. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29713. * @example
  29714. *
  29715. * _.isWeakSet(new WeakSet);
  29716. * // => true
  29717. *
  29718. * _.isWeakSet(new Set);
  29719. * // => false
  29720. */
  29721. function isWeakSet(value) {
  29722. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29723. }
  29724. /**
  29725. * Checks if `value` is less than `other`.
  29726. *
  29727. * @static
  29728. * @memberOf _
  29729. * @since 3.9.0
  29730. * @category Lang
  29731. * @param {*} value The value to compare.
  29732. * @param {*} other The other value to compare.
  29733. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29734. * else `false`.
  29735. * @see _.gt
  29736. * @example
  29737. *
  29738. * _.lt(1, 3);
  29739. * // => true
  29740. *
  29741. * _.lt(3, 3);
  29742. * // => false
  29743. *
  29744. * _.lt(3, 1);
  29745. * // => false
  29746. */
  29747. var lt = createRelationalOperation(baseLt);
  29748. /**
  29749. * Checks if `value` is less than or equal to `other`.
  29750. *
  29751. * @static
  29752. * @memberOf _
  29753. * @since 3.9.0
  29754. * @category Lang
  29755. * @param {*} value The value to compare.
  29756. * @param {*} other The other value to compare.
  29757. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29758. * `other`, else `false`.
  29759. * @see _.gte
  29760. * @example
  29761. *
  29762. * _.lte(1, 3);
  29763. * // => true
  29764. *
  29765. * _.lte(3, 3);
  29766. * // => true
  29767. *
  29768. * _.lte(3, 1);
  29769. * // => false
  29770. */
  29771. var lte = createRelationalOperation(function(value, other) {
  29772. return value <= other;
  29773. });
  29774. /**
  29775. * Converts `value` to an array.
  29776. *
  29777. * @static
  29778. * @since 0.1.0
  29779. * @memberOf _
  29780. * @category Lang
  29781. * @param {*} value The value to convert.
  29782. * @returns {Array} Returns the converted array.
  29783. * @example
  29784. *
  29785. * _.toArray({ 'a': 1, 'b': 2 });
  29786. * // => [1, 2]
  29787. *
  29788. * _.toArray('abc');
  29789. * // => ['a', 'b', 'c']
  29790. *
  29791. * _.toArray(1);
  29792. * // => []
  29793. *
  29794. * _.toArray(null);
  29795. * // => []
  29796. */
  29797. function toArray(value) {
  29798. if (!value) {
  29799. return [];
  29800. }
  29801. if (isArrayLike(value)) {
  29802. return isString(value) ? stringToArray(value) : copyArray(value);
  29803. }
  29804. if (symIterator && value[symIterator]) {
  29805. return iteratorToArray(value[symIterator]());
  29806. }
  29807. var tag = getTag(value),
  29808. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29809. return func(value);
  29810. }
  29811. /**
  29812. * Converts `value` to a finite number.
  29813. *
  29814. * @static
  29815. * @memberOf _
  29816. * @since 4.12.0
  29817. * @category Lang
  29818. * @param {*} value The value to convert.
  29819. * @returns {number} Returns the converted number.
  29820. * @example
  29821. *
  29822. * _.toFinite(3.2);
  29823. * // => 3.2
  29824. *
  29825. * _.toFinite(Number.MIN_VALUE);
  29826. * // => 5e-324
  29827. *
  29828. * _.toFinite(Infinity);
  29829. * // => 1.7976931348623157e+308
  29830. *
  29831. * _.toFinite('3.2');
  29832. * // => 3.2
  29833. */
  29834. function toFinite(value) {
  29835. if (!value) {
  29836. return value === 0 ? value : 0;
  29837. }
  29838. value = toNumber(value);
  29839. if (value === INFINITY || value === -INFINITY) {
  29840. var sign = (value < 0 ? -1 : 1);
  29841. return sign * MAX_INTEGER;
  29842. }
  29843. return value === value ? value : 0;
  29844. }
  29845. /**
  29846. * Converts `value` to an integer.
  29847. *
  29848. * **Note:** This method is loosely based on
  29849. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29850. *
  29851. * @static
  29852. * @memberOf _
  29853. * @since 4.0.0
  29854. * @category Lang
  29855. * @param {*} value The value to convert.
  29856. * @returns {number} Returns the converted integer.
  29857. * @example
  29858. *
  29859. * _.toInteger(3.2);
  29860. * // => 3
  29861. *
  29862. * _.toInteger(Number.MIN_VALUE);
  29863. * // => 0
  29864. *
  29865. * _.toInteger(Infinity);
  29866. * // => 1.7976931348623157e+308
  29867. *
  29868. * _.toInteger('3.2');
  29869. * // => 3
  29870. */
  29871. function toInteger(value) {
  29872. var result = toFinite(value),
  29873. remainder = result % 1;
  29874. return result === result ? (remainder ? result - remainder : result) : 0;
  29875. }
  29876. /**
  29877. * Converts `value` to an integer suitable for use as the length of an
  29878. * array-like object.
  29879. *
  29880. * **Note:** This method is based on
  29881. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29882. *
  29883. * @static
  29884. * @memberOf _
  29885. * @since 4.0.0
  29886. * @category Lang
  29887. * @param {*} value The value to convert.
  29888. * @returns {number} Returns the converted integer.
  29889. * @example
  29890. *
  29891. * _.toLength(3.2);
  29892. * // => 3
  29893. *
  29894. * _.toLength(Number.MIN_VALUE);
  29895. * // => 0
  29896. *
  29897. * _.toLength(Infinity);
  29898. * // => 4294967295
  29899. *
  29900. * _.toLength('3.2');
  29901. * // => 3
  29902. */
  29903. function toLength(value) {
  29904. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29905. }
  29906. /**
  29907. * Converts `value` to a number.
  29908. *
  29909. * @static
  29910. * @memberOf _
  29911. * @since 4.0.0
  29912. * @category Lang
  29913. * @param {*} value The value to process.
  29914. * @returns {number} Returns the number.
  29915. * @example
  29916. *
  29917. * _.toNumber(3.2);
  29918. * // => 3.2
  29919. *
  29920. * _.toNumber(Number.MIN_VALUE);
  29921. * // => 5e-324
  29922. *
  29923. * _.toNumber(Infinity);
  29924. * // => Infinity
  29925. *
  29926. * _.toNumber('3.2');
  29927. * // => 3.2
  29928. */
  29929. function toNumber(value) {
  29930. if (typeof value == 'number') {
  29931. return value;
  29932. }
  29933. if (isSymbol(value)) {
  29934. return NAN;
  29935. }
  29936. if (isObject(value)) {
  29937. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29938. value = isObject(other) ? (other + '') : other;
  29939. }
  29940. if (typeof value != 'string') {
  29941. return value === 0 ? value : +value;
  29942. }
  29943. value = value.replace(reTrim, '');
  29944. var isBinary = reIsBinary.test(value);
  29945. return (isBinary || reIsOctal.test(value))
  29946. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29947. : (reIsBadHex.test(value) ? NAN : +value);
  29948. }
  29949. /**
  29950. * Converts `value` to a plain object flattening inherited enumerable string
  29951. * keyed properties of `value` to own properties of the plain object.
  29952. *
  29953. * @static
  29954. * @memberOf _
  29955. * @since 3.0.0
  29956. * @category Lang
  29957. * @param {*} value The value to convert.
  29958. * @returns {Object} Returns the converted plain object.
  29959. * @example
  29960. *
  29961. * function Foo() {
  29962. * this.b = 2;
  29963. * }
  29964. *
  29965. * Foo.prototype.c = 3;
  29966. *
  29967. * _.assign({ 'a': 1 }, new Foo);
  29968. * // => { 'a': 1, 'b': 2 }
  29969. *
  29970. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29971. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29972. */
  29973. function toPlainObject(value) {
  29974. return copyObject(value, keysIn(value));
  29975. }
  29976. /**
  29977. * Converts `value` to a safe integer. A safe integer can be compared and
  29978. * represented correctly.
  29979. *
  29980. * @static
  29981. * @memberOf _
  29982. * @since 4.0.0
  29983. * @category Lang
  29984. * @param {*} value The value to convert.
  29985. * @returns {number} Returns the converted integer.
  29986. * @example
  29987. *
  29988. * _.toSafeInteger(3.2);
  29989. * // => 3
  29990. *
  29991. * _.toSafeInteger(Number.MIN_VALUE);
  29992. * // => 0
  29993. *
  29994. * _.toSafeInteger(Infinity);
  29995. * // => 9007199254740991
  29996. *
  29997. * _.toSafeInteger('3.2');
  29998. * // => 3
  29999. */
  30000. function toSafeInteger(value) {
  30001. return value
  30002. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30003. : (value === 0 ? value : 0);
  30004. }
  30005. /**
  30006. * Converts `value` to a string. An empty string is returned for `null`
  30007. * and `undefined` values. The sign of `-0` is preserved.
  30008. *
  30009. * @static
  30010. * @memberOf _
  30011. * @since 4.0.0
  30012. * @category Lang
  30013. * @param {*} value The value to convert.
  30014. * @returns {string} Returns the converted string.
  30015. * @example
  30016. *
  30017. * _.toString(null);
  30018. * // => ''
  30019. *
  30020. * _.toString(-0);
  30021. * // => '-0'
  30022. *
  30023. * _.toString([1, 2, 3]);
  30024. * // => '1,2,3'
  30025. */
  30026. function toString(value) {
  30027. return value == null ? '' : baseToString(value);
  30028. }
  30029. /*------------------------------------------------------------------------*/
  30030. /**
  30031. * Assigns own enumerable string keyed properties of source objects to the
  30032. * destination object. Source objects are applied from left to right.
  30033. * Subsequent sources overwrite property assignments of previous sources.
  30034. *
  30035. * **Note:** This method mutates `object` and is loosely based on
  30036. * [`Object.assign`](https://mdn.io/Object/assign).
  30037. *
  30038. * @static
  30039. * @memberOf _
  30040. * @since 0.10.0
  30041. * @category Object
  30042. * @param {Object} object The destination object.
  30043. * @param {...Object} [sources] The source objects.
  30044. * @returns {Object} Returns `object`.
  30045. * @see _.assignIn
  30046. * @example
  30047. *
  30048. * function Foo() {
  30049. * this.a = 1;
  30050. * }
  30051. *
  30052. * function Bar() {
  30053. * this.c = 3;
  30054. * }
  30055. *
  30056. * Foo.prototype.b = 2;
  30057. * Bar.prototype.d = 4;
  30058. *
  30059. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30060. * // => { 'a': 1, 'c': 3 }
  30061. */
  30062. var assign = createAssigner(function(object, source) {
  30063. if (isPrototype(source) || isArrayLike(source)) {
  30064. copyObject(source, keys(source), object);
  30065. return;
  30066. }
  30067. for (var key in source) {
  30068. if (hasOwnProperty.call(source, key)) {
  30069. assignValue(object, key, source[key]);
  30070. }
  30071. }
  30072. });
  30073. /**
  30074. * This method is like `_.assign` except that it iterates over own and
  30075. * inherited source properties.
  30076. *
  30077. * **Note:** This method mutates `object`.
  30078. *
  30079. * @static
  30080. * @memberOf _
  30081. * @since 4.0.0
  30082. * @alias extend
  30083. * @category Object
  30084. * @param {Object} object The destination object.
  30085. * @param {...Object} [sources] The source objects.
  30086. * @returns {Object} Returns `object`.
  30087. * @see _.assign
  30088. * @example
  30089. *
  30090. * function Foo() {
  30091. * this.a = 1;
  30092. * }
  30093. *
  30094. * function Bar() {
  30095. * this.c = 3;
  30096. * }
  30097. *
  30098. * Foo.prototype.b = 2;
  30099. * Bar.prototype.d = 4;
  30100. *
  30101. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30102. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30103. */
  30104. var assignIn = createAssigner(function(object, source) {
  30105. copyObject(source, keysIn(source), object);
  30106. });
  30107. /**
  30108. * This method is like `_.assignIn` except that it accepts `customizer`
  30109. * which is invoked to produce the assigned values. If `customizer` returns
  30110. * `undefined`, assignment is handled by the method instead. The `customizer`
  30111. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30112. *
  30113. * **Note:** This method mutates `object`.
  30114. *
  30115. * @static
  30116. * @memberOf _
  30117. * @since 4.0.0
  30118. * @alias extendWith
  30119. * @category Object
  30120. * @param {Object} object The destination object.
  30121. * @param {...Object} sources The source objects.
  30122. * @param {Function} [customizer] The function to customize assigned values.
  30123. * @returns {Object} Returns `object`.
  30124. * @see _.assignWith
  30125. * @example
  30126. *
  30127. * function customizer(objValue, srcValue) {
  30128. * return _.isUndefined(objValue) ? srcValue : objValue;
  30129. * }
  30130. *
  30131. * var defaults = _.partialRight(_.assignInWith, customizer);
  30132. *
  30133. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30134. * // => { 'a': 1, 'b': 2 }
  30135. */
  30136. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30137. copyObject(source, keysIn(source), object, customizer);
  30138. });
  30139. /**
  30140. * This method is like `_.assign` except that it accepts `customizer`
  30141. * which is invoked to produce the assigned values. If `customizer` returns
  30142. * `undefined`, assignment is handled by the method instead. The `customizer`
  30143. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30144. *
  30145. * **Note:** This method mutates `object`.
  30146. *
  30147. * @static
  30148. * @memberOf _
  30149. * @since 4.0.0
  30150. * @category Object
  30151. * @param {Object} object The destination object.
  30152. * @param {...Object} sources The source objects.
  30153. * @param {Function} [customizer] The function to customize assigned values.
  30154. * @returns {Object} Returns `object`.
  30155. * @see _.assignInWith
  30156. * @example
  30157. *
  30158. * function customizer(objValue, srcValue) {
  30159. * return _.isUndefined(objValue) ? srcValue : objValue;
  30160. * }
  30161. *
  30162. * var defaults = _.partialRight(_.assignWith, customizer);
  30163. *
  30164. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30165. * // => { 'a': 1, 'b': 2 }
  30166. */
  30167. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30168. copyObject(source, keys(source), object, customizer);
  30169. });
  30170. /**
  30171. * Creates an array of values corresponding to `paths` of `object`.
  30172. *
  30173. * @static
  30174. * @memberOf _
  30175. * @since 1.0.0
  30176. * @category Object
  30177. * @param {Object} object The object to iterate over.
  30178. * @param {...(string|string[])} [paths] The property paths to pick.
  30179. * @returns {Array} Returns the picked values.
  30180. * @example
  30181. *
  30182. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30183. *
  30184. * _.at(object, ['a[0].b.c', 'a[1]']);
  30185. * // => [3, 4]
  30186. */
  30187. var at = flatRest(baseAt);
  30188. /**
  30189. * Creates an object that inherits from the `prototype` object. If a
  30190. * `properties` object is given, its own enumerable string keyed properties
  30191. * are assigned to the created object.
  30192. *
  30193. * @static
  30194. * @memberOf _
  30195. * @since 2.3.0
  30196. * @category Object
  30197. * @param {Object} prototype The object to inherit from.
  30198. * @param {Object} [properties] The properties to assign to the object.
  30199. * @returns {Object} Returns the new object.
  30200. * @example
  30201. *
  30202. * function Shape() {
  30203. * this.x = 0;
  30204. * this.y = 0;
  30205. * }
  30206. *
  30207. * function Circle() {
  30208. * Shape.call(this);
  30209. * }
  30210. *
  30211. * Circle.prototype = _.create(Shape.prototype, {
  30212. * 'constructor': Circle
  30213. * });
  30214. *
  30215. * var circle = new Circle;
  30216. * circle instanceof Circle;
  30217. * // => true
  30218. *
  30219. * circle instanceof Shape;
  30220. * // => true
  30221. */
  30222. function create(prototype, properties) {
  30223. var result = baseCreate(prototype);
  30224. return properties == null ? result : baseAssign(result, properties);
  30225. }
  30226. /**
  30227. * Assigns own and inherited enumerable string keyed properties of source
  30228. * objects to the destination object for all destination properties that
  30229. * resolve to `undefined`. Source objects are applied from left to right.
  30230. * Once a property is set, additional values of the same property are ignored.
  30231. *
  30232. * **Note:** This method mutates `object`.
  30233. *
  30234. * @static
  30235. * @since 0.1.0
  30236. * @memberOf _
  30237. * @category Object
  30238. * @param {Object} object The destination object.
  30239. * @param {...Object} [sources] The source objects.
  30240. * @returns {Object} Returns `object`.
  30241. * @see _.defaultsDeep
  30242. * @example
  30243. *
  30244. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30245. * // => { 'a': 1, 'b': 2 }
  30246. */
  30247. var defaults = baseRest(function(object, sources) {
  30248. object = Object(object);
  30249. var index = -1;
  30250. var length = sources.length;
  30251. var guard = length > 2 ? sources[2] : undefined;
  30252. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30253. length = 1;
  30254. }
  30255. while (++index < length) {
  30256. var source = sources[index];
  30257. var props = keysIn(source);
  30258. var propsIndex = -1;
  30259. var propsLength = props.length;
  30260. while (++propsIndex < propsLength) {
  30261. var key = props[propsIndex];
  30262. var value = object[key];
  30263. if (value === undefined ||
  30264. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30265. object[key] = source[key];
  30266. }
  30267. }
  30268. }
  30269. return object;
  30270. });
  30271. /**
  30272. * This method is like `_.defaults` except that it recursively assigns
  30273. * default properties.
  30274. *
  30275. * **Note:** This method mutates `object`.
  30276. *
  30277. * @static
  30278. * @memberOf _
  30279. * @since 3.10.0
  30280. * @category Object
  30281. * @param {Object} object The destination object.
  30282. * @param {...Object} [sources] The source objects.
  30283. * @returns {Object} Returns `object`.
  30284. * @see _.defaults
  30285. * @example
  30286. *
  30287. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30288. * // => { 'a': { 'b': 2, 'c': 3 } }
  30289. */
  30290. var defaultsDeep = baseRest(function(args) {
  30291. args.push(undefined, customDefaultsMerge);
  30292. return apply(mergeWith, undefined, args);
  30293. });
  30294. /**
  30295. * This method is like `_.find` except that it returns the key of the first
  30296. * element `predicate` returns truthy for instead of the element itself.
  30297. *
  30298. * @static
  30299. * @memberOf _
  30300. * @since 1.1.0
  30301. * @category Object
  30302. * @param {Object} object The object to inspect.
  30303. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30304. * @returns {string|undefined} Returns the key of the matched element,
  30305. * else `undefined`.
  30306. * @example
  30307. *
  30308. * var users = {
  30309. * 'barney': { 'age': 36, 'active': true },
  30310. * 'fred': { 'age': 40, 'active': false },
  30311. * 'pebbles': { 'age': 1, 'active': true }
  30312. * };
  30313. *
  30314. * _.findKey(users, function(o) { return o.age < 40; });
  30315. * // => 'barney' (iteration order is not guaranteed)
  30316. *
  30317. * // The `_.matches` iteratee shorthand.
  30318. * _.findKey(users, { 'age': 1, 'active': true });
  30319. * // => 'pebbles'
  30320. *
  30321. * // The `_.matchesProperty` iteratee shorthand.
  30322. * _.findKey(users, ['active', false]);
  30323. * // => 'fred'
  30324. *
  30325. * // The `_.property` iteratee shorthand.
  30326. * _.findKey(users, 'active');
  30327. * // => 'barney'
  30328. */
  30329. function findKey(object, predicate) {
  30330. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30331. }
  30332. /**
  30333. * This method is like `_.findKey` except that it iterates over elements of
  30334. * a collection in the opposite order.
  30335. *
  30336. * @static
  30337. * @memberOf _
  30338. * @since 2.0.0
  30339. * @category Object
  30340. * @param {Object} object The object to inspect.
  30341. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30342. * @returns {string|undefined} Returns the key of the matched element,
  30343. * else `undefined`.
  30344. * @example
  30345. *
  30346. * var users = {
  30347. * 'barney': { 'age': 36, 'active': true },
  30348. * 'fred': { 'age': 40, 'active': false },
  30349. * 'pebbles': { 'age': 1, 'active': true }
  30350. * };
  30351. *
  30352. * _.findLastKey(users, function(o) { return o.age < 40; });
  30353. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30354. *
  30355. * // The `_.matches` iteratee shorthand.
  30356. * _.findLastKey(users, { 'age': 36, 'active': true });
  30357. * // => 'barney'
  30358. *
  30359. * // The `_.matchesProperty` iteratee shorthand.
  30360. * _.findLastKey(users, ['active', false]);
  30361. * // => 'fred'
  30362. *
  30363. * // The `_.property` iteratee shorthand.
  30364. * _.findLastKey(users, 'active');
  30365. * // => 'pebbles'
  30366. */
  30367. function findLastKey(object, predicate) {
  30368. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30369. }
  30370. /**
  30371. * Iterates over own and inherited enumerable string keyed properties of an
  30372. * object and invokes `iteratee` for each property. The iteratee is invoked
  30373. * with three arguments: (value, key, object). Iteratee functions may exit
  30374. * iteration early by explicitly returning `false`.
  30375. *
  30376. * @static
  30377. * @memberOf _
  30378. * @since 0.3.0
  30379. * @category Object
  30380. * @param {Object} object The object to iterate over.
  30381. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30382. * @returns {Object} Returns `object`.
  30383. * @see _.forInRight
  30384. * @example
  30385. *
  30386. * function Foo() {
  30387. * this.a = 1;
  30388. * this.b = 2;
  30389. * }
  30390. *
  30391. * Foo.prototype.c = 3;
  30392. *
  30393. * _.forIn(new Foo, function(value, key) {
  30394. * console.log(key);
  30395. * });
  30396. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30397. */
  30398. function forIn(object, iteratee) {
  30399. return object == null
  30400. ? object
  30401. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30402. }
  30403. /**
  30404. * This method is like `_.forIn` except that it iterates over properties of
  30405. * `object` in the opposite order.
  30406. *
  30407. * @static
  30408. * @memberOf _
  30409. * @since 2.0.0
  30410. * @category Object
  30411. * @param {Object} object The object to iterate over.
  30412. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30413. * @returns {Object} Returns `object`.
  30414. * @see _.forIn
  30415. * @example
  30416. *
  30417. * function Foo() {
  30418. * this.a = 1;
  30419. * this.b = 2;
  30420. * }
  30421. *
  30422. * Foo.prototype.c = 3;
  30423. *
  30424. * _.forInRight(new Foo, function(value, key) {
  30425. * console.log(key);
  30426. * });
  30427. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30428. */
  30429. function forInRight(object, iteratee) {
  30430. return object == null
  30431. ? object
  30432. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30433. }
  30434. /**
  30435. * Iterates over own enumerable string keyed properties of an object and
  30436. * invokes `iteratee` for each property. The iteratee is invoked with three
  30437. * arguments: (value, key, object). Iteratee functions may exit iteration
  30438. * early by explicitly returning `false`.
  30439. *
  30440. * @static
  30441. * @memberOf _
  30442. * @since 0.3.0
  30443. * @category Object
  30444. * @param {Object} object The object to iterate over.
  30445. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30446. * @returns {Object} Returns `object`.
  30447. * @see _.forOwnRight
  30448. * @example
  30449. *
  30450. * function Foo() {
  30451. * this.a = 1;
  30452. * this.b = 2;
  30453. * }
  30454. *
  30455. * Foo.prototype.c = 3;
  30456. *
  30457. * _.forOwn(new Foo, function(value, key) {
  30458. * console.log(key);
  30459. * });
  30460. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30461. */
  30462. function forOwn(object, iteratee) {
  30463. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30464. }
  30465. /**
  30466. * This method is like `_.forOwn` except that it iterates over properties of
  30467. * `object` in the opposite order.
  30468. *
  30469. * @static
  30470. * @memberOf _
  30471. * @since 2.0.0
  30472. * @category Object
  30473. * @param {Object} object The object to iterate over.
  30474. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30475. * @returns {Object} Returns `object`.
  30476. * @see _.forOwn
  30477. * @example
  30478. *
  30479. * function Foo() {
  30480. * this.a = 1;
  30481. * this.b = 2;
  30482. * }
  30483. *
  30484. * Foo.prototype.c = 3;
  30485. *
  30486. * _.forOwnRight(new Foo, function(value, key) {
  30487. * console.log(key);
  30488. * });
  30489. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30490. */
  30491. function forOwnRight(object, iteratee) {
  30492. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30493. }
  30494. /**
  30495. * Creates an array of function property names from own enumerable properties
  30496. * of `object`.
  30497. *
  30498. * @static
  30499. * @since 0.1.0
  30500. * @memberOf _
  30501. * @category Object
  30502. * @param {Object} object The object to inspect.
  30503. * @returns {Array} Returns the function names.
  30504. * @see _.functionsIn
  30505. * @example
  30506. *
  30507. * function Foo() {
  30508. * this.a = _.constant('a');
  30509. * this.b = _.constant('b');
  30510. * }
  30511. *
  30512. * Foo.prototype.c = _.constant('c');
  30513. *
  30514. * _.functions(new Foo);
  30515. * // => ['a', 'b']
  30516. */
  30517. function functions(object) {
  30518. return object == null ? [] : baseFunctions(object, keys(object));
  30519. }
  30520. /**
  30521. * Creates an array of function property names from own and inherited
  30522. * enumerable properties of `object`.
  30523. *
  30524. * @static
  30525. * @memberOf _
  30526. * @since 4.0.0
  30527. * @category Object
  30528. * @param {Object} object The object to inspect.
  30529. * @returns {Array} Returns the function names.
  30530. * @see _.functions
  30531. * @example
  30532. *
  30533. * function Foo() {
  30534. * this.a = _.constant('a');
  30535. * this.b = _.constant('b');
  30536. * }
  30537. *
  30538. * Foo.prototype.c = _.constant('c');
  30539. *
  30540. * _.functionsIn(new Foo);
  30541. * // => ['a', 'b', 'c']
  30542. */
  30543. function functionsIn(object) {
  30544. return object == null ? [] : baseFunctions(object, keysIn(object));
  30545. }
  30546. /**
  30547. * Gets the value at `path` of `object`. If the resolved value is
  30548. * `undefined`, the `defaultValue` is returned in its place.
  30549. *
  30550. * @static
  30551. * @memberOf _
  30552. * @since 3.7.0
  30553. * @category Object
  30554. * @param {Object} object The object to query.
  30555. * @param {Array|string} path The path of the property to get.
  30556. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30557. * @returns {*} Returns the resolved value.
  30558. * @example
  30559. *
  30560. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30561. *
  30562. * _.get(object, 'a[0].b.c');
  30563. * // => 3
  30564. *
  30565. * _.get(object, ['a', '0', 'b', 'c']);
  30566. * // => 3
  30567. *
  30568. * _.get(object, 'a.b.c', 'default');
  30569. * // => 'default'
  30570. */
  30571. function get(object, path, defaultValue) {
  30572. var result = object == null ? undefined : baseGet(object, path);
  30573. return result === undefined ? defaultValue : result;
  30574. }
  30575. /**
  30576. * Checks if `path` is a direct property of `object`.
  30577. *
  30578. * @static
  30579. * @since 0.1.0
  30580. * @memberOf _
  30581. * @category Object
  30582. * @param {Object} object The object to query.
  30583. * @param {Array|string} path The path to check.
  30584. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30585. * @example
  30586. *
  30587. * var object = { 'a': { 'b': 2 } };
  30588. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30589. *
  30590. * _.has(object, 'a');
  30591. * // => true
  30592. *
  30593. * _.has(object, 'a.b');
  30594. * // => true
  30595. *
  30596. * _.has(object, ['a', 'b']);
  30597. * // => true
  30598. *
  30599. * _.has(other, 'a');
  30600. * // => false
  30601. */
  30602. function has(object, path) {
  30603. return object != null && hasPath(object, path, baseHas);
  30604. }
  30605. /**
  30606. * Checks if `path` is a direct or inherited property of `object`.
  30607. *
  30608. * @static
  30609. * @memberOf _
  30610. * @since 4.0.0
  30611. * @category Object
  30612. * @param {Object} object The object to query.
  30613. * @param {Array|string} path The path to check.
  30614. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30615. * @example
  30616. *
  30617. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30618. *
  30619. * _.hasIn(object, 'a');
  30620. * // => true
  30621. *
  30622. * _.hasIn(object, 'a.b');
  30623. * // => true
  30624. *
  30625. * _.hasIn(object, ['a', 'b']);
  30626. * // => true
  30627. *
  30628. * _.hasIn(object, 'b');
  30629. * // => false
  30630. */
  30631. function hasIn(object, path) {
  30632. return object != null && hasPath(object, path, baseHasIn);
  30633. }
  30634. /**
  30635. * Creates an object composed of the inverted keys and values of `object`.
  30636. * If `object` contains duplicate values, subsequent values overwrite
  30637. * property assignments of previous values.
  30638. *
  30639. * @static
  30640. * @memberOf _
  30641. * @since 0.7.0
  30642. * @category Object
  30643. * @param {Object} object The object to invert.
  30644. * @returns {Object} Returns the new inverted object.
  30645. * @example
  30646. *
  30647. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30648. *
  30649. * _.invert(object);
  30650. * // => { '1': 'c', '2': 'b' }
  30651. */
  30652. var invert = createInverter(function(result, value, key) {
  30653. if (value != null &&
  30654. typeof value.toString != 'function') {
  30655. value = nativeObjectToString.call(value);
  30656. }
  30657. result[value] = key;
  30658. }, constant(identity));
  30659. /**
  30660. * This method is like `_.invert` except that the inverted object is generated
  30661. * from the results of running each element of `object` thru `iteratee`. The
  30662. * corresponding inverted value of each inverted key is an array of keys
  30663. * responsible for generating the inverted value. The iteratee is invoked
  30664. * with one argument: (value).
  30665. *
  30666. * @static
  30667. * @memberOf _
  30668. * @since 4.1.0
  30669. * @category Object
  30670. * @param {Object} object The object to invert.
  30671. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30672. * @returns {Object} Returns the new inverted object.
  30673. * @example
  30674. *
  30675. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30676. *
  30677. * _.invertBy(object);
  30678. * // => { '1': ['a', 'c'], '2': ['b'] }
  30679. *
  30680. * _.invertBy(object, function(value) {
  30681. * return 'group' + value;
  30682. * });
  30683. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30684. */
  30685. var invertBy = createInverter(function(result, value, key) {
  30686. if (value != null &&
  30687. typeof value.toString != 'function') {
  30688. value = nativeObjectToString.call(value);
  30689. }
  30690. if (hasOwnProperty.call(result, value)) {
  30691. result[value].push(key);
  30692. } else {
  30693. result[value] = [key];
  30694. }
  30695. }, getIteratee);
  30696. /**
  30697. * Invokes the method at `path` of `object`.
  30698. *
  30699. * @static
  30700. * @memberOf _
  30701. * @since 4.0.0
  30702. * @category Object
  30703. * @param {Object} object The object to query.
  30704. * @param {Array|string} path The path of the method to invoke.
  30705. * @param {...*} [args] The arguments to invoke the method with.
  30706. * @returns {*} Returns the result of the invoked method.
  30707. * @example
  30708. *
  30709. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30710. *
  30711. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30712. * // => [2, 3]
  30713. */
  30714. var invoke = baseRest(baseInvoke);
  30715. /**
  30716. * Creates an array of the own enumerable property names of `object`.
  30717. *
  30718. * **Note:** Non-object values are coerced to objects. See the
  30719. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30720. * for more details.
  30721. *
  30722. * @static
  30723. * @since 0.1.0
  30724. * @memberOf _
  30725. * @category Object
  30726. * @param {Object} object The object to query.
  30727. * @returns {Array} Returns the array of property names.
  30728. * @example
  30729. *
  30730. * function Foo() {
  30731. * this.a = 1;
  30732. * this.b = 2;
  30733. * }
  30734. *
  30735. * Foo.prototype.c = 3;
  30736. *
  30737. * _.keys(new Foo);
  30738. * // => ['a', 'b'] (iteration order is not guaranteed)
  30739. *
  30740. * _.keys('hi');
  30741. * // => ['0', '1']
  30742. */
  30743. function keys(object) {
  30744. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30745. }
  30746. /**
  30747. * Creates an array of the own and inherited enumerable property names of `object`.
  30748. *
  30749. * **Note:** Non-object values are coerced to objects.
  30750. *
  30751. * @static
  30752. * @memberOf _
  30753. * @since 3.0.0
  30754. * @category Object
  30755. * @param {Object} object The object to query.
  30756. * @returns {Array} Returns the array of property names.
  30757. * @example
  30758. *
  30759. * function Foo() {
  30760. * this.a = 1;
  30761. * this.b = 2;
  30762. * }
  30763. *
  30764. * Foo.prototype.c = 3;
  30765. *
  30766. * _.keysIn(new Foo);
  30767. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30768. */
  30769. function keysIn(object) {
  30770. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30771. }
  30772. /**
  30773. * The opposite of `_.mapValues`; this method creates an object with the
  30774. * same values as `object` and keys generated by running each own enumerable
  30775. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30776. * with three arguments: (value, key, object).
  30777. *
  30778. * @static
  30779. * @memberOf _
  30780. * @since 3.8.0
  30781. * @category Object
  30782. * @param {Object} object The object to iterate over.
  30783. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30784. * @returns {Object} Returns the new mapped object.
  30785. * @see _.mapValues
  30786. * @example
  30787. *
  30788. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30789. * return key + value;
  30790. * });
  30791. * // => { 'a1': 1, 'b2': 2 }
  30792. */
  30793. function mapKeys(object, iteratee) {
  30794. var result = {};
  30795. iteratee = getIteratee(iteratee, 3);
  30796. baseForOwn(object, function(value, key, object) {
  30797. baseAssignValue(result, iteratee(value, key, object), value);
  30798. });
  30799. return result;
  30800. }
  30801. /**
  30802. * Creates an object with the same keys as `object` and values generated
  30803. * by running each own enumerable string keyed property of `object` thru
  30804. * `iteratee`. The iteratee is invoked with three arguments:
  30805. * (value, key, object).
  30806. *
  30807. * @static
  30808. * @memberOf _
  30809. * @since 2.4.0
  30810. * @category Object
  30811. * @param {Object} object The object to iterate over.
  30812. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30813. * @returns {Object} Returns the new mapped object.
  30814. * @see _.mapKeys
  30815. * @example
  30816. *
  30817. * var users = {
  30818. * 'fred': { 'user': 'fred', 'age': 40 },
  30819. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30820. * };
  30821. *
  30822. * _.mapValues(users, function(o) { return o.age; });
  30823. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30824. *
  30825. * // The `_.property` iteratee shorthand.
  30826. * _.mapValues(users, 'age');
  30827. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30828. */
  30829. function mapValues(object, iteratee) {
  30830. var result = {};
  30831. iteratee = getIteratee(iteratee, 3);
  30832. baseForOwn(object, function(value, key, object) {
  30833. baseAssignValue(result, key, iteratee(value, key, object));
  30834. });
  30835. return result;
  30836. }
  30837. /**
  30838. * This method is like `_.assign` except that it recursively merges own and
  30839. * inherited enumerable string keyed properties of source objects into the
  30840. * destination object. Source properties that resolve to `undefined` are
  30841. * skipped if a destination value exists. Array and plain object properties
  30842. * are merged recursively. Other objects and value types are overridden by
  30843. * assignment. Source objects are applied from left to right. Subsequent
  30844. * sources overwrite property assignments of previous sources.
  30845. *
  30846. * **Note:** This method mutates `object`.
  30847. *
  30848. * @static
  30849. * @memberOf _
  30850. * @since 0.5.0
  30851. * @category Object
  30852. * @param {Object} object The destination object.
  30853. * @param {...Object} [sources] The source objects.
  30854. * @returns {Object} Returns `object`.
  30855. * @example
  30856. *
  30857. * var object = {
  30858. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30859. * };
  30860. *
  30861. * var other = {
  30862. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30863. * };
  30864. *
  30865. * _.merge(object, other);
  30866. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30867. */
  30868. var merge = createAssigner(function(object, source, srcIndex) {
  30869. baseMerge(object, source, srcIndex);
  30870. });
  30871. /**
  30872. * This method is like `_.merge` except that it accepts `customizer` which
  30873. * is invoked to produce the merged values of the destination and source
  30874. * properties. If `customizer` returns `undefined`, merging is handled by the
  30875. * method instead. The `customizer` is invoked with six arguments:
  30876. * (objValue, srcValue, key, object, source, stack).
  30877. *
  30878. * **Note:** This method mutates `object`.
  30879. *
  30880. * @static
  30881. * @memberOf _
  30882. * @since 4.0.0
  30883. * @category Object
  30884. * @param {Object} object The destination object.
  30885. * @param {...Object} sources The source objects.
  30886. * @param {Function} customizer The function to customize assigned values.
  30887. * @returns {Object} Returns `object`.
  30888. * @example
  30889. *
  30890. * function customizer(objValue, srcValue) {
  30891. * if (_.isArray(objValue)) {
  30892. * return objValue.concat(srcValue);
  30893. * }
  30894. * }
  30895. *
  30896. * var object = { 'a': [1], 'b': [2] };
  30897. * var other = { 'a': [3], 'b': [4] };
  30898. *
  30899. * _.mergeWith(object, other, customizer);
  30900. * // => { 'a': [1, 3], 'b': [2, 4] }
  30901. */
  30902. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30903. baseMerge(object, source, srcIndex, customizer);
  30904. });
  30905. /**
  30906. * The opposite of `_.pick`; this method creates an object composed of the
  30907. * own and inherited enumerable property paths of `object` that are not omitted.
  30908. *
  30909. * **Note:** This method is considerably slower than `_.pick`.
  30910. *
  30911. * @static
  30912. * @since 0.1.0
  30913. * @memberOf _
  30914. * @category Object
  30915. * @param {Object} object The source object.
  30916. * @param {...(string|string[])} [paths] The property paths to omit.
  30917. * @returns {Object} Returns the new object.
  30918. * @example
  30919. *
  30920. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30921. *
  30922. * _.omit(object, ['a', 'c']);
  30923. * // => { 'b': '2' }
  30924. */
  30925. var omit = flatRest(function(object, paths) {
  30926. var result = {};
  30927. if (object == null) {
  30928. return result;
  30929. }
  30930. var isDeep = false;
  30931. paths = arrayMap(paths, function(path) {
  30932. path = castPath(path, object);
  30933. isDeep || (isDeep = path.length > 1);
  30934. return path;
  30935. });
  30936. copyObject(object, getAllKeysIn(object), result);
  30937. if (isDeep) {
  30938. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30939. }
  30940. var length = paths.length;
  30941. while (length--) {
  30942. baseUnset(result, paths[length]);
  30943. }
  30944. return result;
  30945. });
  30946. /**
  30947. * The opposite of `_.pickBy`; this method creates an object composed of
  30948. * the own and inherited enumerable string keyed properties of `object` that
  30949. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30950. * arguments: (value, key).
  30951. *
  30952. * @static
  30953. * @memberOf _
  30954. * @since 4.0.0
  30955. * @category Object
  30956. * @param {Object} object The source object.
  30957. * @param {Function} [predicate=_.identity] The function invoked per property.
  30958. * @returns {Object} Returns the new object.
  30959. * @example
  30960. *
  30961. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30962. *
  30963. * _.omitBy(object, _.isNumber);
  30964. * // => { 'b': '2' }
  30965. */
  30966. function omitBy(object, predicate) {
  30967. return pickBy(object, negate(getIteratee(predicate)));
  30968. }
  30969. /**
  30970. * Creates an object composed of the picked `object` properties.
  30971. *
  30972. * @static
  30973. * @since 0.1.0
  30974. * @memberOf _
  30975. * @category Object
  30976. * @param {Object} object The source object.
  30977. * @param {...(string|string[])} [paths] The property paths to pick.
  30978. * @returns {Object} Returns the new object.
  30979. * @example
  30980. *
  30981. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30982. *
  30983. * _.pick(object, ['a', 'c']);
  30984. * // => { 'a': 1, 'c': 3 }
  30985. */
  30986. var pick = flatRest(function(object, paths) {
  30987. return object == null ? {} : basePick(object, paths);
  30988. });
  30989. /**
  30990. * Creates an object composed of the `object` properties `predicate` returns
  30991. * truthy for. The predicate is invoked with two arguments: (value, key).
  30992. *
  30993. * @static
  30994. * @memberOf _
  30995. * @since 4.0.0
  30996. * @category Object
  30997. * @param {Object} object The source object.
  30998. * @param {Function} [predicate=_.identity] The function invoked per property.
  30999. * @returns {Object} Returns the new object.
  31000. * @example
  31001. *
  31002. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31003. *
  31004. * _.pickBy(object, _.isNumber);
  31005. * // => { 'a': 1, 'c': 3 }
  31006. */
  31007. function pickBy(object, predicate) {
  31008. if (object == null) {
  31009. return {};
  31010. }
  31011. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31012. return [prop];
  31013. });
  31014. predicate = getIteratee(predicate);
  31015. return basePickBy(object, props, function(value, path) {
  31016. return predicate(value, path[0]);
  31017. });
  31018. }
  31019. /**
  31020. * This method is like `_.get` except that if the resolved value is a
  31021. * function it's invoked with the `this` binding of its parent object and
  31022. * its result is returned.
  31023. *
  31024. * @static
  31025. * @since 0.1.0
  31026. * @memberOf _
  31027. * @category Object
  31028. * @param {Object} object The object to query.
  31029. * @param {Array|string} path The path of the property to resolve.
  31030. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31031. * @returns {*} Returns the resolved value.
  31032. * @example
  31033. *
  31034. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31035. *
  31036. * _.result(object, 'a[0].b.c1');
  31037. * // => 3
  31038. *
  31039. * _.result(object, 'a[0].b.c2');
  31040. * // => 4
  31041. *
  31042. * _.result(object, 'a[0].b.c3', 'default');
  31043. * // => 'default'
  31044. *
  31045. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31046. * // => 'default'
  31047. */
  31048. function result(object, path, defaultValue) {
  31049. path = castPath(path, object);
  31050. var index = -1,
  31051. length = path.length;
  31052. // Ensure the loop is entered when path is empty.
  31053. if (!length) {
  31054. length = 1;
  31055. object = undefined;
  31056. }
  31057. while (++index < length) {
  31058. var value = object == null ? undefined : object[toKey(path[index])];
  31059. if (value === undefined) {
  31060. index = length;
  31061. value = defaultValue;
  31062. }
  31063. object = isFunction(value) ? value.call(object) : value;
  31064. }
  31065. return object;
  31066. }
  31067. /**
  31068. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31069. * it's created. Arrays are created for missing index properties while objects
  31070. * are created for all other missing properties. Use `_.setWith` to customize
  31071. * `path` creation.
  31072. *
  31073. * **Note:** This method mutates `object`.
  31074. *
  31075. * @static
  31076. * @memberOf _
  31077. * @since 3.7.0
  31078. * @category Object
  31079. * @param {Object} object The object to modify.
  31080. * @param {Array|string} path The path of the property to set.
  31081. * @param {*} value The value to set.
  31082. * @returns {Object} Returns `object`.
  31083. * @example
  31084. *
  31085. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31086. *
  31087. * _.set(object, 'a[0].b.c', 4);
  31088. * console.log(object.a[0].b.c);
  31089. * // => 4
  31090. *
  31091. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31092. * console.log(object.x[0].y.z);
  31093. * // => 5
  31094. */
  31095. function set(object, path, value) {
  31096. return object == null ? object : baseSet(object, path, value);
  31097. }
  31098. /**
  31099. * This method is like `_.set` except that it accepts `customizer` which is
  31100. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31101. * path creation is handled by the method instead. The `customizer` is invoked
  31102. * with three arguments: (nsValue, key, nsObject).
  31103. *
  31104. * **Note:** This method mutates `object`.
  31105. *
  31106. * @static
  31107. * @memberOf _
  31108. * @since 4.0.0
  31109. * @category Object
  31110. * @param {Object} object The object to modify.
  31111. * @param {Array|string} path The path of the property to set.
  31112. * @param {*} value The value to set.
  31113. * @param {Function} [customizer] The function to customize assigned values.
  31114. * @returns {Object} Returns `object`.
  31115. * @example
  31116. *
  31117. * var object = {};
  31118. *
  31119. * _.setWith(object, '[0][1]', 'a', Object);
  31120. * // => { '0': { '1': 'a' } }
  31121. */
  31122. function setWith(object, path, value, customizer) {
  31123. customizer = typeof customizer == 'function' ? customizer : undefined;
  31124. return object == null ? object : baseSet(object, path, value, customizer);
  31125. }
  31126. /**
  31127. * Creates an array of own enumerable string keyed-value pairs for `object`
  31128. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31129. * entries are returned.
  31130. *
  31131. * @static
  31132. * @memberOf _
  31133. * @since 4.0.0
  31134. * @alias entries
  31135. * @category Object
  31136. * @param {Object} object The object to query.
  31137. * @returns {Array} Returns the key-value pairs.
  31138. * @example
  31139. *
  31140. * function Foo() {
  31141. * this.a = 1;
  31142. * this.b = 2;
  31143. * }
  31144. *
  31145. * Foo.prototype.c = 3;
  31146. *
  31147. * _.toPairs(new Foo);
  31148. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31149. */
  31150. var toPairs = createToPairs(keys);
  31151. /**
  31152. * Creates an array of own and inherited enumerable string keyed-value pairs
  31153. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31154. * or set, its entries are returned.
  31155. *
  31156. * @static
  31157. * @memberOf _
  31158. * @since 4.0.0
  31159. * @alias entriesIn
  31160. * @category Object
  31161. * @param {Object} object The object to query.
  31162. * @returns {Array} Returns the key-value pairs.
  31163. * @example
  31164. *
  31165. * function Foo() {
  31166. * this.a = 1;
  31167. * this.b = 2;
  31168. * }
  31169. *
  31170. * Foo.prototype.c = 3;
  31171. *
  31172. * _.toPairsIn(new Foo);
  31173. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31174. */
  31175. var toPairsIn = createToPairs(keysIn);
  31176. /**
  31177. * An alternative to `_.reduce`; this method transforms `object` to a new
  31178. * `accumulator` object which is the result of running each of its own
  31179. * enumerable string keyed properties thru `iteratee`, with each invocation
  31180. * potentially mutating the `accumulator` object. If `accumulator` is not
  31181. * provided, a new object with the same `[[Prototype]]` will be used. The
  31182. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31183. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31184. *
  31185. * @static
  31186. * @memberOf _
  31187. * @since 1.3.0
  31188. * @category Object
  31189. * @param {Object} object The object to iterate over.
  31190. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31191. * @param {*} [accumulator] The custom accumulator value.
  31192. * @returns {*} Returns the accumulated value.
  31193. * @example
  31194. *
  31195. * _.transform([2, 3, 4], function(result, n) {
  31196. * result.push(n *= n);
  31197. * return n % 2 == 0;
  31198. * }, []);
  31199. * // => [4, 9]
  31200. *
  31201. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31202. * (result[value] || (result[value] = [])).push(key);
  31203. * }, {});
  31204. * // => { '1': ['a', 'c'], '2': ['b'] }
  31205. */
  31206. function transform(object, iteratee, accumulator) {
  31207. var isArr = isArray(object),
  31208. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31209. iteratee = getIteratee(iteratee, 4);
  31210. if (accumulator == null) {
  31211. var Ctor = object && object.constructor;
  31212. if (isArrLike) {
  31213. accumulator = isArr ? new Ctor : [];
  31214. }
  31215. else if (isObject(object)) {
  31216. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31217. }
  31218. else {
  31219. accumulator = {};
  31220. }
  31221. }
  31222. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31223. return iteratee(accumulator, value, index, object);
  31224. });
  31225. return accumulator;
  31226. }
  31227. /**
  31228. * Removes the property at `path` of `object`.
  31229. *
  31230. * **Note:** This method mutates `object`.
  31231. *
  31232. * @static
  31233. * @memberOf _
  31234. * @since 4.0.0
  31235. * @category Object
  31236. * @param {Object} object The object to modify.
  31237. * @param {Array|string} path The path of the property to unset.
  31238. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31239. * @example
  31240. *
  31241. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31242. * _.unset(object, 'a[0].b.c');
  31243. * // => true
  31244. *
  31245. * console.log(object);
  31246. * // => { 'a': [{ 'b': {} }] };
  31247. *
  31248. * _.unset(object, ['a', '0', 'b', 'c']);
  31249. * // => true
  31250. *
  31251. * console.log(object);
  31252. * // => { 'a': [{ 'b': {} }] };
  31253. */
  31254. function unset(object, path) {
  31255. return object == null ? true : baseUnset(object, path);
  31256. }
  31257. /**
  31258. * This method is like `_.set` except that accepts `updater` to produce the
  31259. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31260. * is invoked with one argument: (value).
  31261. *
  31262. * **Note:** This method mutates `object`.
  31263. *
  31264. * @static
  31265. * @memberOf _
  31266. * @since 4.6.0
  31267. * @category Object
  31268. * @param {Object} object The object to modify.
  31269. * @param {Array|string} path The path of the property to set.
  31270. * @param {Function} updater The function to produce the updated value.
  31271. * @returns {Object} Returns `object`.
  31272. * @example
  31273. *
  31274. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31275. *
  31276. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31277. * console.log(object.a[0].b.c);
  31278. * // => 9
  31279. *
  31280. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31281. * console.log(object.x[0].y.z);
  31282. * // => 0
  31283. */
  31284. function update(object, path, updater) {
  31285. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31286. }
  31287. /**
  31288. * This method is like `_.update` except that it accepts `customizer` which is
  31289. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31290. * path creation is handled by the method instead. The `customizer` is invoked
  31291. * with three arguments: (nsValue, key, nsObject).
  31292. *
  31293. * **Note:** This method mutates `object`.
  31294. *
  31295. * @static
  31296. * @memberOf _
  31297. * @since 4.6.0
  31298. * @category Object
  31299. * @param {Object} object The object to modify.
  31300. * @param {Array|string} path The path of the property to set.
  31301. * @param {Function} updater The function to produce the updated value.
  31302. * @param {Function} [customizer] The function to customize assigned values.
  31303. * @returns {Object} Returns `object`.
  31304. * @example
  31305. *
  31306. * var object = {};
  31307. *
  31308. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31309. * // => { '0': { '1': 'a' } }
  31310. */
  31311. function updateWith(object, path, updater, customizer) {
  31312. customizer = typeof customizer == 'function' ? customizer : undefined;
  31313. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31314. }
  31315. /**
  31316. * Creates an array of the own enumerable string keyed property values of `object`.
  31317. *
  31318. * **Note:** Non-object values are coerced to objects.
  31319. *
  31320. * @static
  31321. * @since 0.1.0
  31322. * @memberOf _
  31323. * @category Object
  31324. * @param {Object} object The object to query.
  31325. * @returns {Array} Returns the array of property values.
  31326. * @example
  31327. *
  31328. * function Foo() {
  31329. * this.a = 1;
  31330. * this.b = 2;
  31331. * }
  31332. *
  31333. * Foo.prototype.c = 3;
  31334. *
  31335. * _.values(new Foo);
  31336. * // => [1, 2] (iteration order is not guaranteed)
  31337. *
  31338. * _.values('hi');
  31339. * // => ['h', 'i']
  31340. */
  31341. function values(object) {
  31342. return object == null ? [] : baseValues(object, keys(object));
  31343. }
  31344. /**
  31345. * Creates an array of the own and inherited enumerable string keyed property
  31346. * values of `object`.
  31347. *
  31348. * **Note:** Non-object values are coerced to objects.
  31349. *
  31350. * @static
  31351. * @memberOf _
  31352. * @since 3.0.0
  31353. * @category Object
  31354. * @param {Object} object The object to query.
  31355. * @returns {Array} Returns the array of property values.
  31356. * @example
  31357. *
  31358. * function Foo() {
  31359. * this.a = 1;
  31360. * this.b = 2;
  31361. * }
  31362. *
  31363. * Foo.prototype.c = 3;
  31364. *
  31365. * _.valuesIn(new Foo);
  31366. * // => [1, 2, 3] (iteration order is not guaranteed)
  31367. */
  31368. function valuesIn(object) {
  31369. return object == null ? [] : baseValues(object, keysIn(object));
  31370. }
  31371. /*------------------------------------------------------------------------*/
  31372. /**
  31373. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31374. *
  31375. * @static
  31376. * @memberOf _
  31377. * @since 4.0.0
  31378. * @category Number
  31379. * @param {number} number The number to clamp.
  31380. * @param {number} [lower] The lower bound.
  31381. * @param {number} upper The upper bound.
  31382. * @returns {number} Returns the clamped number.
  31383. * @example
  31384. *
  31385. * _.clamp(-10, -5, 5);
  31386. * // => -5
  31387. *
  31388. * _.clamp(10, -5, 5);
  31389. * // => 5
  31390. */
  31391. function clamp(number, lower, upper) {
  31392. if (upper === undefined) {
  31393. upper = lower;
  31394. lower = undefined;
  31395. }
  31396. if (upper !== undefined) {
  31397. upper = toNumber(upper);
  31398. upper = upper === upper ? upper : 0;
  31399. }
  31400. if (lower !== undefined) {
  31401. lower = toNumber(lower);
  31402. lower = lower === lower ? lower : 0;
  31403. }
  31404. return baseClamp(toNumber(number), lower, upper);
  31405. }
  31406. /**
  31407. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31408. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31409. * If `start` is greater than `end` the params are swapped to support
  31410. * negative ranges.
  31411. *
  31412. * @static
  31413. * @memberOf _
  31414. * @since 3.3.0
  31415. * @category Number
  31416. * @param {number} number The number to check.
  31417. * @param {number} [start=0] The start of the range.
  31418. * @param {number} end The end of the range.
  31419. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31420. * @see _.range, _.rangeRight
  31421. * @example
  31422. *
  31423. * _.inRange(3, 2, 4);
  31424. * // => true
  31425. *
  31426. * _.inRange(4, 8);
  31427. * // => true
  31428. *
  31429. * _.inRange(4, 2);
  31430. * // => false
  31431. *
  31432. * _.inRange(2, 2);
  31433. * // => false
  31434. *
  31435. * _.inRange(1.2, 2);
  31436. * // => true
  31437. *
  31438. * _.inRange(5.2, 4);
  31439. * // => false
  31440. *
  31441. * _.inRange(-3, -2, -6);
  31442. * // => true
  31443. */
  31444. function inRange(number, start, end) {
  31445. start = toFinite(start);
  31446. if (end === undefined) {
  31447. end = start;
  31448. start = 0;
  31449. } else {
  31450. end = toFinite(end);
  31451. }
  31452. number = toNumber(number);
  31453. return baseInRange(number, start, end);
  31454. }
  31455. /**
  31456. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31457. * If only one argument is provided a number between `0` and the given number
  31458. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31459. * floats, a floating-point number is returned instead of an integer.
  31460. *
  31461. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31462. * floating-point values which can produce unexpected results.
  31463. *
  31464. * @static
  31465. * @memberOf _
  31466. * @since 0.7.0
  31467. * @category Number
  31468. * @param {number} [lower=0] The lower bound.
  31469. * @param {number} [upper=1] The upper bound.
  31470. * @param {boolean} [floating] Specify returning a floating-point number.
  31471. * @returns {number} Returns the random number.
  31472. * @example
  31473. *
  31474. * _.random(0, 5);
  31475. * // => an integer between 0 and 5
  31476. *
  31477. * _.random(5);
  31478. * // => also an integer between 0 and 5
  31479. *
  31480. * _.random(5, true);
  31481. * // => a floating-point number between 0 and 5
  31482. *
  31483. * _.random(1.2, 5.2);
  31484. * // => a floating-point number between 1.2 and 5.2
  31485. */
  31486. function random(lower, upper, floating) {
  31487. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31488. upper = floating = undefined;
  31489. }
  31490. if (floating === undefined) {
  31491. if (typeof upper == 'boolean') {
  31492. floating = upper;
  31493. upper = undefined;
  31494. }
  31495. else if (typeof lower == 'boolean') {
  31496. floating = lower;
  31497. lower = undefined;
  31498. }
  31499. }
  31500. if (lower === undefined && upper === undefined) {
  31501. lower = 0;
  31502. upper = 1;
  31503. }
  31504. else {
  31505. lower = toFinite(lower);
  31506. if (upper === undefined) {
  31507. upper = lower;
  31508. lower = 0;
  31509. } else {
  31510. upper = toFinite(upper);
  31511. }
  31512. }
  31513. if (lower > upper) {
  31514. var temp = lower;
  31515. lower = upper;
  31516. upper = temp;
  31517. }
  31518. if (floating || lower % 1 || upper % 1) {
  31519. var rand = nativeRandom();
  31520. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31521. }
  31522. return baseRandom(lower, upper);
  31523. }
  31524. /*------------------------------------------------------------------------*/
  31525. /**
  31526. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31527. *
  31528. * @static
  31529. * @memberOf _
  31530. * @since 3.0.0
  31531. * @category String
  31532. * @param {string} [string=''] The string to convert.
  31533. * @returns {string} Returns the camel cased string.
  31534. * @example
  31535. *
  31536. * _.camelCase('Foo Bar');
  31537. * // => 'fooBar'
  31538. *
  31539. * _.camelCase('--foo-bar--');
  31540. * // => 'fooBar'
  31541. *
  31542. * _.camelCase('__FOO_BAR__');
  31543. * // => 'fooBar'
  31544. */
  31545. var camelCase = createCompounder(function(result, word, index) {
  31546. word = word.toLowerCase();
  31547. return result + (index ? capitalize(word) : word);
  31548. });
  31549. /**
  31550. * Converts the first character of `string` to upper case and the remaining
  31551. * to lower case.
  31552. *
  31553. * @static
  31554. * @memberOf _
  31555. * @since 3.0.0
  31556. * @category String
  31557. * @param {string} [string=''] The string to capitalize.
  31558. * @returns {string} Returns the capitalized string.
  31559. * @example
  31560. *
  31561. * _.capitalize('FRED');
  31562. * // => 'Fred'
  31563. */
  31564. function capitalize(string) {
  31565. return upperFirst(toString(string).toLowerCase());
  31566. }
  31567. /**
  31568. * Deburrs `string` by converting
  31569. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31570. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31571. * letters to basic Latin letters and removing
  31572. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31573. *
  31574. * @static
  31575. * @memberOf _
  31576. * @since 3.0.0
  31577. * @category String
  31578. * @param {string} [string=''] The string to deburr.
  31579. * @returns {string} Returns the deburred string.
  31580. * @example
  31581. *
  31582. * _.deburr('déjà vu');
  31583. * // => 'deja vu'
  31584. */
  31585. function deburr(string) {
  31586. string = toString(string);
  31587. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31588. }
  31589. /**
  31590. * Checks if `string` ends with the given target string.
  31591. *
  31592. * @static
  31593. * @memberOf _
  31594. * @since 3.0.0
  31595. * @category String
  31596. * @param {string} [string=''] The string to inspect.
  31597. * @param {string} [target] The string to search for.
  31598. * @param {number} [position=string.length] The position to search up to.
  31599. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31600. * else `false`.
  31601. * @example
  31602. *
  31603. * _.endsWith('abc', 'c');
  31604. * // => true
  31605. *
  31606. * _.endsWith('abc', 'b');
  31607. * // => false
  31608. *
  31609. * _.endsWith('abc', 'b', 2);
  31610. * // => true
  31611. */
  31612. function endsWith(string, target, position) {
  31613. string = toString(string);
  31614. target = baseToString(target);
  31615. var length = string.length;
  31616. position = position === undefined
  31617. ? length
  31618. : baseClamp(toInteger(position), 0, length);
  31619. var end = position;
  31620. position -= target.length;
  31621. return position >= 0 && string.slice(position, end) == target;
  31622. }
  31623. /**
  31624. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31625. * corresponding HTML entities.
  31626. *
  31627. * **Note:** No other characters are escaped. To escape additional
  31628. * characters use a third-party library like [_he_](https://mths.be/he).
  31629. *
  31630. * Though the ">" character is escaped for symmetry, characters like
  31631. * ">" and "/" don't need escaping in HTML and have no special meaning
  31632. * unless they're part of a tag or unquoted attribute value. See
  31633. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31634. * (under "semi-related fun fact") for more details.
  31635. *
  31636. * When working with HTML you should always
  31637. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31638. * XSS vectors.
  31639. *
  31640. * @static
  31641. * @since 0.1.0
  31642. * @memberOf _
  31643. * @category String
  31644. * @param {string} [string=''] The string to escape.
  31645. * @returns {string} Returns the escaped string.
  31646. * @example
  31647. *
  31648. * _.escape('fred, barney, & pebbles');
  31649. * // => 'fred, barney, &amp; pebbles'
  31650. */
  31651. function escape(string) {
  31652. string = toString(string);
  31653. return (string && reHasUnescapedHtml.test(string))
  31654. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31655. : string;
  31656. }
  31657. /**
  31658. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31659. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31660. *
  31661. * @static
  31662. * @memberOf _
  31663. * @since 3.0.0
  31664. * @category String
  31665. * @param {string} [string=''] The string to escape.
  31666. * @returns {string} Returns the escaped string.
  31667. * @example
  31668. *
  31669. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31670. * // => '\[lodash\]\(https://lodash\.com/\)'
  31671. */
  31672. function escapeRegExp(string) {
  31673. string = toString(string);
  31674. return (string && reHasRegExpChar.test(string))
  31675. ? string.replace(reRegExpChar, '\\$&')
  31676. : string;
  31677. }
  31678. /**
  31679. * Converts `string` to
  31680. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31681. *
  31682. * @static
  31683. * @memberOf _
  31684. * @since 3.0.0
  31685. * @category String
  31686. * @param {string} [string=''] The string to convert.
  31687. * @returns {string} Returns the kebab cased string.
  31688. * @example
  31689. *
  31690. * _.kebabCase('Foo Bar');
  31691. * // => 'foo-bar'
  31692. *
  31693. * _.kebabCase('fooBar');
  31694. * // => 'foo-bar'
  31695. *
  31696. * _.kebabCase('__FOO_BAR__');
  31697. * // => 'foo-bar'
  31698. */
  31699. var kebabCase = createCompounder(function(result, word, index) {
  31700. return result + (index ? '-' : '') + word.toLowerCase();
  31701. });
  31702. /**
  31703. * Converts `string`, as space separated words, to lower case.
  31704. *
  31705. * @static
  31706. * @memberOf _
  31707. * @since 4.0.0
  31708. * @category String
  31709. * @param {string} [string=''] The string to convert.
  31710. * @returns {string} Returns the lower cased string.
  31711. * @example
  31712. *
  31713. * _.lowerCase('--Foo-Bar--');
  31714. * // => 'foo bar'
  31715. *
  31716. * _.lowerCase('fooBar');
  31717. * // => 'foo bar'
  31718. *
  31719. * _.lowerCase('__FOO_BAR__');
  31720. * // => 'foo bar'
  31721. */
  31722. var lowerCase = createCompounder(function(result, word, index) {
  31723. return result + (index ? ' ' : '') + word.toLowerCase();
  31724. });
  31725. /**
  31726. * Converts the first character of `string` to lower case.
  31727. *
  31728. * @static
  31729. * @memberOf _
  31730. * @since 4.0.0
  31731. * @category String
  31732. * @param {string} [string=''] The string to convert.
  31733. * @returns {string} Returns the converted string.
  31734. * @example
  31735. *
  31736. * _.lowerFirst('Fred');
  31737. * // => 'fred'
  31738. *
  31739. * _.lowerFirst('FRED');
  31740. * // => 'fRED'
  31741. */
  31742. var lowerFirst = createCaseFirst('toLowerCase');
  31743. /**
  31744. * Pads `string` on the left and right sides if it's shorter than `length`.
  31745. * Padding characters are truncated if they can't be evenly divided by `length`.
  31746. *
  31747. * @static
  31748. * @memberOf _
  31749. * @since 3.0.0
  31750. * @category String
  31751. * @param {string} [string=''] The string to pad.
  31752. * @param {number} [length=0] The padding length.
  31753. * @param {string} [chars=' '] The string used as padding.
  31754. * @returns {string} Returns the padded string.
  31755. * @example
  31756. *
  31757. * _.pad('abc', 8);
  31758. * // => ' abc '
  31759. *
  31760. * _.pad('abc', 8, '_-');
  31761. * // => '_-abc_-_'
  31762. *
  31763. * _.pad('abc', 3);
  31764. * // => 'abc'
  31765. */
  31766. function pad(string, length, chars) {
  31767. string = toString(string);
  31768. length = toInteger(length);
  31769. var strLength = length ? stringSize(string) : 0;
  31770. if (!length || strLength >= length) {
  31771. return string;
  31772. }
  31773. var mid = (length - strLength) / 2;
  31774. return (
  31775. createPadding(nativeFloor(mid), chars) +
  31776. string +
  31777. createPadding(nativeCeil(mid), chars)
  31778. );
  31779. }
  31780. /**
  31781. * Pads `string` on the right side if it's shorter than `length`. Padding
  31782. * characters are truncated if they exceed `length`.
  31783. *
  31784. * @static
  31785. * @memberOf _
  31786. * @since 4.0.0
  31787. * @category String
  31788. * @param {string} [string=''] The string to pad.
  31789. * @param {number} [length=0] The padding length.
  31790. * @param {string} [chars=' '] The string used as padding.
  31791. * @returns {string} Returns the padded string.
  31792. * @example
  31793. *
  31794. * _.padEnd('abc', 6);
  31795. * // => 'abc '
  31796. *
  31797. * _.padEnd('abc', 6, '_-');
  31798. * // => 'abc_-_'
  31799. *
  31800. * _.padEnd('abc', 3);
  31801. * // => 'abc'
  31802. */
  31803. function padEnd(string, length, chars) {
  31804. string = toString(string);
  31805. length = toInteger(length);
  31806. var strLength = length ? stringSize(string) : 0;
  31807. return (length && strLength < length)
  31808. ? (string + createPadding(length - strLength, chars))
  31809. : string;
  31810. }
  31811. /**
  31812. * Pads `string` on the left side if it's shorter than `length`. Padding
  31813. * characters are truncated if they exceed `length`.
  31814. *
  31815. * @static
  31816. * @memberOf _
  31817. * @since 4.0.0
  31818. * @category String
  31819. * @param {string} [string=''] The string to pad.
  31820. * @param {number} [length=0] The padding length.
  31821. * @param {string} [chars=' '] The string used as padding.
  31822. * @returns {string} Returns the padded string.
  31823. * @example
  31824. *
  31825. * _.padStart('abc', 6);
  31826. * // => ' abc'
  31827. *
  31828. * _.padStart('abc', 6, '_-');
  31829. * // => '_-_abc'
  31830. *
  31831. * _.padStart('abc', 3);
  31832. * // => 'abc'
  31833. */
  31834. function padStart(string, length, chars) {
  31835. string = toString(string);
  31836. length = toInteger(length);
  31837. var strLength = length ? stringSize(string) : 0;
  31838. return (length && strLength < length)
  31839. ? (createPadding(length - strLength, chars) + string)
  31840. : string;
  31841. }
  31842. /**
  31843. * Converts `string` to an integer of the specified radix. If `radix` is
  31844. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31845. * hexadecimal, in which case a `radix` of `16` is used.
  31846. *
  31847. * **Note:** This method aligns with the
  31848. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31849. *
  31850. * @static
  31851. * @memberOf _
  31852. * @since 1.1.0
  31853. * @category String
  31854. * @param {string} string The string to convert.
  31855. * @param {number} [radix=10] The radix to interpret `value` by.
  31856. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31857. * @returns {number} Returns the converted integer.
  31858. * @example
  31859. *
  31860. * _.parseInt('08');
  31861. * // => 8
  31862. *
  31863. * _.map(['6', '08', '10'], _.parseInt);
  31864. * // => [6, 8, 10]
  31865. */
  31866. function parseInt(string, radix, guard) {
  31867. if (guard || radix == null) {
  31868. radix = 0;
  31869. } else if (radix) {
  31870. radix = +radix;
  31871. }
  31872. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31873. }
  31874. /**
  31875. * Repeats the given string `n` times.
  31876. *
  31877. * @static
  31878. * @memberOf _
  31879. * @since 3.0.0
  31880. * @category String
  31881. * @param {string} [string=''] The string to repeat.
  31882. * @param {number} [n=1] The number of times to repeat the string.
  31883. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31884. * @returns {string} Returns the repeated string.
  31885. * @example
  31886. *
  31887. * _.repeat('*', 3);
  31888. * // => '***'
  31889. *
  31890. * _.repeat('abc', 2);
  31891. * // => 'abcabc'
  31892. *
  31893. * _.repeat('abc', 0);
  31894. * // => ''
  31895. */
  31896. function repeat(string, n, guard) {
  31897. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31898. n = 1;
  31899. } else {
  31900. n = toInteger(n);
  31901. }
  31902. return baseRepeat(toString(string), n);
  31903. }
  31904. /**
  31905. * Replaces matches for `pattern` in `string` with `replacement`.
  31906. *
  31907. * **Note:** This method is based on
  31908. * [`String#replace`](https://mdn.io/String/replace).
  31909. *
  31910. * @static
  31911. * @memberOf _
  31912. * @since 4.0.0
  31913. * @category String
  31914. * @param {string} [string=''] The string to modify.
  31915. * @param {RegExp|string} pattern The pattern to replace.
  31916. * @param {Function|string} replacement The match replacement.
  31917. * @returns {string} Returns the modified string.
  31918. * @example
  31919. *
  31920. * _.replace('Hi Fred', 'Fred', 'Barney');
  31921. * // => 'Hi Barney'
  31922. */
  31923. function replace() {
  31924. var args = arguments,
  31925. string = toString(args[0]);
  31926. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31927. }
  31928. /**
  31929. * Converts `string` to
  31930. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31931. *
  31932. * @static
  31933. * @memberOf _
  31934. * @since 3.0.0
  31935. * @category String
  31936. * @param {string} [string=''] The string to convert.
  31937. * @returns {string} Returns the snake cased string.
  31938. * @example
  31939. *
  31940. * _.snakeCase('Foo Bar');
  31941. * // => 'foo_bar'
  31942. *
  31943. * _.snakeCase('fooBar');
  31944. * // => 'foo_bar'
  31945. *
  31946. * _.snakeCase('--FOO-BAR--');
  31947. * // => 'foo_bar'
  31948. */
  31949. var snakeCase = createCompounder(function(result, word, index) {
  31950. return result + (index ? '_' : '') + word.toLowerCase();
  31951. });
  31952. /**
  31953. * Splits `string` by `separator`.
  31954. *
  31955. * **Note:** This method is based on
  31956. * [`String#split`](https://mdn.io/String/split).
  31957. *
  31958. * @static
  31959. * @memberOf _
  31960. * @since 4.0.0
  31961. * @category String
  31962. * @param {string} [string=''] The string to split.
  31963. * @param {RegExp|string} separator The separator pattern to split by.
  31964. * @param {number} [limit] The length to truncate results to.
  31965. * @returns {Array} Returns the string segments.
  31966. * @example
  31967. *
  31968. * _.split('a-b-c', '-', 2);
  31969. * // => ['a', 'b']
  31970. */
  31971. function split(string, separator, limit) {
  31972. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31973. separator = limit = undefined;
  31974. }
  31975. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31976. if (!limit) {
  31977. return [];
  31978. }
  31979. string = toString(string);
  31980. if (string && (
  31981. typeof separator == 'string' ||
  31982. (separator != null && !isRegExp(separator))
  31983. )) {
  31984. separator = baseToString(separator);
  31985. if (!separator && hasUnicode(string)) {
  31986. return castSlice(stringToArray(string), 0, limit);
  31987. }
  31988. }
  31989. return string.split(separator, limit);
  31990. }
  31991. /**
  31992. * Converts `string` to
  31993. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31994. *
  31995. * @static
  31996. * @memberOf _
  31997. * @since 3.1.0
  31998. * @category String
  31999. * @param {string} [string=''] The string to convert.
  32000. * @returns {string} Returns the start cased string.
  32001. * @example
  32002. *
  32003. * _.startCase('--foo-bar--');
  32004. * // => 'Foo Bar'
  32005. *
  32006. * _.startCase('fooBar');
  32007. * // => 'Foo Bar'
  32008. *
  32009. * _.startCase('__FOO_BAR__');
  32010. * // => 'FOO BAR'
  32011. */
  32012. var startCase = createCompounder(function(result, word, index) {
  32013. return result + (index ? ' ' : '') + upperFirst(word);
  32014. });
  32015. /**
  32016. * Checks if `string` starts with the given target string.
  32017. *
  32018. * @static
  32019. * @memberOf _
  32020. * @since 3.0.0
  32021. * @category String
  32022. * @param {string} [string=''] The string to inspect.
  32023. * @param {string} [target] The string to search for.
  32024. * @param {number} [position=0] The position to search from.
  32025. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32026. * else `false`.
  32027. * @example
  32028. *
  32029. * _.startsWith('abc', 'a');
  32030. * // => true
  32031. *
  32032. * _.startsWith('abc', 'b');
  32033. * // => false
  32034. *
  32035. * _.startsWith('abc', 'b', 1);
  32036. * // => true
  32037. */
  32038. function startsWith(string, target, position) {
  32039. string = toString(string);
  32040. position = position == null
  32041. ? 0
  32042. : baseClamp(toInteger(position), 0, string.length);
  32043. target = baseToString(target);
  32044. return string.slice(position, position + target.length) == target;
  32045. }
  32046. /**
  32047. * Creates a compiled template function that can interpolate data properties
  32048. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32049. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32050. * properties may be accessed as free variables in the template. If a setting
  32051. * object is given, it takes precedence over `_.templateSettings` values.
  32052. *
  32053. * **Note:** In the development build `_.template` utilizes
  32054. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32055. * for easier debugging.
  32056. *
  32057. * For more information on precompiling templates see
  32058. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32059. *
  32060. * For more information on Chrome extension sandboxes see
  32061. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32062. *
  32063. * @static
  32064. * @since 0.1.0
  32065. * @memberOf _
  32066. * @category String
  32067. * @param {string} [string=''] The template string.
  32068. * @param {Object} [options={}] The options object.
  32069. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32070. * The HTML "escape" delimiter.
  32071. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32072. * The "evaluate" delimiter.
  32073. * @param {Object} [options.imports=_.templateSettings.imports]
  32074. * An object to import into the template as free variables.
  32075. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32076. * The "interpolate" delimiter.
  32077. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32078. * The sourceURL of the compiled template.
  32079. * @param {string} [options.variable='obj']
  32080. * The data object variable name.
  32081. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32082. * @returns {Function} Returns the compiled template function.
  32083. * @example
  32084. *
  32085. * // Use the "interpolate" delimiter to create a compiled template.
  32086. * var compiled = _.template('hello <%= user %>!');
  32087. * compiled({ 'user': 'fred' });
  32088. * // => 'hello fred!'
  32089. *
  32090. * // Use the HTML "escape" delimiter to escape data property values.
  32091. * var compiled = _.template('<b><%- value %></b>');
  32092. * compiled({ 'value': '<script>' });
  32093. * // => '<b>&lt;script&gt;</b>'
  32094. *
  32095. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32096. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32097. * compiled({ 'users': ['fred', 'barney'] });
  32098. * // => '<li>fred</li><li>barney</li>'
  32099. *
  32100. * // Use the internal `print` function in "evaluate" delimiters.
  32101. * var compiled = _.template('<% print("hello " + user); %>!');
  32102. * compiled({ 'user': 'barney' });
  32103. * // => 'hello barney!'
  32104. *
  32105. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32106. * // Disable support by replacing the "interpolate" delimiter.
  32107. * var compiled = _.template('hello ${ user }!');
  32108. * compiled({ 'user': 'pebbles' });
  32109. * // => 'hello pebbles!'
  32110. *
  32111. * // Use backslashes to treat delimiters as plain text.
  32112. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32113. * compiled({ 'value': 'ignored' });
  32114. * // => '<%- value %>'
  32115. *
  32116. * // Use the `imports` option to import `jQuery` as `jq`.
  32117. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32118. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32119. * compiled({ 'users': ['fred', 'barney'] });
  32120. * // => '<li>fred</li><li>barney</li>'
  32121. *
  32122. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32123. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32124. * compiled(data);
  32125. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32126. *
  32127. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32128. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32129. * compiled.source;
  32130. * // => function(data) {
  32131. * // var __t, __p = '';
  32132. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32133. * // return __p;
  32134. * // }
  32135. *
  32136. * // Use custom template delimiters.
  32137. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32138. * var compiled = _.template('hello {{ user }}!');
  32139. * compiled({ 'user': 'mustache' });
  32140. * // => 'hello mustache!'
  32141. *
  32142. * // Use the `source` property to inline compiled templates for meaningful
  32143. * // line numbers in error messages and stack traces.
  32144. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32145. * var JST = {\
  32146. * "main": ' + _.template(mainText).source + '\
  32147. * };\
  32148. * ');
  32149. */
  32150. function template(string, options, guard) {
  32151. // Based on John Resig's `tmpl` implementation
  32152. // (http://ejohn.org/blog/javascript-micro-templating/)
  32153. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32154. var settings = lodash.templateSettings;
  32155. if (guard && isIterateeCall(string, options, guard)) {
  32156. options = undefined;
  32157. }
  32158. string = toString(string);
  32159. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32160. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32161. importsKeys = keys(imports),
  32162. importsValues = baseValues(imports, importsKeys);
  32163. var isEscaping,
  32164. isEvaluating,
  32165. index = 0,
  32166. interpolate = options.interpolate || reNoMatch,
  32167. source = "__p += '";
  32168. // Compile the regexp to match each delimiter.
  32169. var reDelimiters = RegExp(
  32170. (options.escape || reNoMatch).source + '|' +
  32171. interpolate.source + '|' +
  32172. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32173. (options.evaluate || reNoMatch).source + '|$'
  32174. , 'g');
  32175. // Use a sourceURL for easier debugging.
  32176. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32177. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32178. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32179. var sourceURL = '//# sourceURL=' +
  32180. (hasOwnProperty.call(options, 'sourceURL')
  32181. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32182. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32183. ) + '\n';
  32184. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32185. interpolateValue || (interpolateValue = esTemplateValue);
  32186. // Escape characters that can't be included in string literals.
  32187. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32188. // Replace delimiters with snippets.
  32189. if (escapeValue) {
  32190. isEscaping = true;
  32191. source += "' +\n__e(" + escapeValue + ") +\n'";
  32192. }
  32193. if (evaluateValue) {
  32194. isEvaluating = true;
  32195. source += "';\n" + evaluateValue + ";\n__p += '";
  32196. }
  32197. if (interpolateValue) {
  32198. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32199. }
  32200. index = offset + match.length;
  32201. // The JS engine embedded in Adobe products needs `match` returned in
  32202. // order to produce the correct `offset` value.
  32203. return match;
  32204. });
  32205. source += "';\n";
  32206. // If `variable` is not specified wrap a with-statement around the generated
  32207. // code to add the data object to the top of the scope chain.
  32208. // Like with sourceURL, we take care to not check the option's prototype,
  32209. // as this configuration is a code injection vector.
  32210. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32211. if (!variable) {
  32212. source = 'with (obj) {\n' + source + '\n}\n';
  32213. }
  32214. // Cleanup code by stripping empty strings.
  32215. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32216. .replace(reEmptyStringMiddle, '$1')
  32217. .replace(reEmptyStringTrailing, '$1;');
  32218. // Frame code as the function body.
  32219. source = 'function(' + (variable || 'obj') + ') {\n' +
  32220. (variable
  32221. ? ''
  32222. : 'obj || (obj = {});\n'
  32223. ) +
  32224. "var __t, __p = ''" +
  32225. (isEscaping
  32226. ? ', __e = _.escape'
  32227. : ''
  32228. ) +
  32229. (isEvaluating
  32230. ? ', __j = Array.prototype.join;\n' +
  32231. "function print() { __p += __j.call(arguments, '') }\n"
  32232. : ';\n'
  32233. ) +
  32234. source +
  32235. 'return __p\n}';
  32236. var result = attempt(function() {
  32237. return Function(importsKeys, sourceURL + 'return ' + source)
  32238. .apply(undefined, importsValues);
  32239. });
  32240. // Provide the compiled function's source by its `toString` method or
  32241. // the `source` property as a convenience for inlining compiled templates.
  32242. result.source = source;
  32243. if (isError(result)) {
  32244. throw result;
  32245. }
  32246. return result;
  32247. }
  32248. /**
  32249. * Converts `string`, as a whole, to lower case just like
  32250. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32251. *
  32252. * @static
  32253. * @memberOf _
  32254. * @since 4.0.0
  32255. * @category String
  32256. * @param {string} [string=''] The string to convert.
  32257. * @returns {string} Returns the lower cased string.
  32258. * @example
  32259. *
  32260. * _.toLower('--Foo-Bar--');
  32261. * // => '--foo-bar--'
  32262. *
  32263. * _.toLower('fooBar');
  32264. * // => 'foobar'
  32265. *
  32266. * _.toLower('__FOO_BAR__');
  32267. * // => '__foo_bar__'
  32268. */
  32269. function toLower(value) {
  32270. return toString(value).toLowerCase();
  32271. }
  32272. /**
  32273. * Converts `string`, as a whole, to upper case just like
  32274. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32275. *
  32276. * @static
  32277. * @memberOf _
  32278. * @since 4.0.0
  32279. * @category String
  32280. * @param {string} [string=''] The string to convert.
  32281. * @returns {string} Returns the upper cased string.
  32282. * @example
  32283. *
  32284. * _.toUpper('--foo-bar--');
  32285. * // => '--FOO-BAR--'
  32286. *
  32287. * _.toUpper('fooBar');
  32288. * // => 'FOOBAR'
  32289. *
  32290. * _.toUpper('__foo_bar__');
  32291. * // => '__FOO_BAR__'
  32292. */
  32293. function toUpper(value) {
  32294. return toString(value).toUpperCase();
  32295. }
  32296. /**
  32297. * Removes leading and trailing whitespace or specified characters from `string`.
  32298. *
  32299. * @static
  32300. * @memberOf _
  32301. * @since 3.0.0
  32302. * @category String
  32303. * @param {string} [string=''] The string to trim.
  32304. * @param {string} [chars=whitespace] The characters to trim.
  32305. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32306. * @returns {string} Returns the trimmed string.
  32307. * @example
  32308. *
  32309. * _.trim(' abc ');
  32310. * // => 'abc'
  32311. *
  32312. * _.trim('-_-abc-_-', '_-');
  32313. * // => 'abc'
  32314. *
  32315. * _.map([' foo ', ' bar '], _.trim);
  32316. * // => ['foo', 'bar']
  32317. */
  32318. function trim(string, chars, guard) {
  32319. string = toString(string);
  32320. if (string && (guard || chars === undefined)) {
  32321. return string.replace(reTrim, '');
  32322. }
  32323. if (!string || !(chars = baseToString(chars))) {
  32324. return string;
  32325. }
  32326. var strSymbols = stringToArray(string),
  32327. chrSymbols = stringToArray(chars),
  32328. start = charsStartIndex(strSymbols, chrSymbols),
  32329. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32330. return castSlice(strSymbols, start, end).join('');
  32331. }
  32332. /**
  32333. * Removes trailing whitespace or specified characters from `string`.
  32334. *
  32335. * @static
  32336. * @memberOf _
  32337. * @since 4.0.0
  32338. * @category String
  32339. * @param {string} [string=''] The string to trim.
  32340. * @param {string} [chars=whitespace] The characters to trim.
  32341. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32342. * @returns {string} Returns the trimmed string.
  32343. * @example
  32344. *
  32345. * _.trimEnd(' abc ');
  32346. * // => ' abc'
  32347. *
  32348. * _.trimEnd('-_-abc-_-', '_-');
  32349. * // => '-_-abc'
  32350. */
  32351. function trimEnd(string, chars, guard) {
  32352. string = toString(string);
  32353. if (string && (guard || chars === undefined)) {
  32354. return string.replace(reTrimEnd, '');
  32355. }
  32356. if (!string || !(chars = baseToString(chars))) {
  32357. return string;
  32358. }
  32359. var strSymbols = stringToArray(string),
  32360. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32361. return castSlice(strSymbols, 0, end).join('');
  32362. }
  32363. /**
  32364. * Removes leading whitespace or specified characters from `string`.
  32365. *
  32366. * @static
  32367. * @memberOf _
  32368. * @since 4.0.0
  32369. * @category String
  32370. * @param {string} [string=''] The string to trim.
  32371. * @param {string} [chars=whitespace] The characters to trim.
  32372. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32373. * @returns {string} Returns the trimmed string.
  32374. * @example
  32375. *
  32376. * _.trimStart(' abc ');
  32377. * // => 'abc '
  32378. *
  32379. * _.trimStart('-_-abc-_-', '_-');
  32380. * // => 'abc-_-'
  32381. */
  32382. function trimStart(string, chars, guard) {
  32383. string = toString(string);
  32384. if (string && (guard || chars === undefined)) {
  32385. return string.replace(reTrimStart, '');
  32386. }
  32387. if (!string || !(chars = baseToString(chars))) {
  32388. return string;
  32389. }
  32390. var strSymbols = stringToArray(string),
  32391. start = charsStartIndex(strSymbols, stringToArray(chars));
  32392. return castSlice(strSymbols, start).join('');
  32393. }
  32394. /**
  32395. * Truncates `string` if it's longer than the given maximum string length.
  32396. * The last characters of the truncated string are replaced with the omission
  32397. * string which defaults to "...".
  32398. *
  32399. * @static
  32400. * @memberOf _
  32401. * @since 4.0.0
  32402. * @category String
  32403. * @param {string} [string=''] The string to truncate.
  32404. * @param {Object} [options={}] The options object.
  32405. * @param {number} [options.length=30] The maximum string length.
  32406. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32407. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32408. * @returns {string} Returns the truncated string.
  32409. * @example
  32410. *
  32411. * _.truncate('hi-diddly-ho there, neighborino');
  32412. * // => 'hi-diddly-ho there, neighbo...'
  32413. *
  32414. * _.truncate('hi-diddly-ho there, neighborino', {
  32415. * 'length': 24,
  32416. * 'separator': ' '
  32417. * });
  32418. * // => 'hi-diddly-ho there,...'
  32419. *
  32420. * _.truncate('hi-diddly-ho there, neighborino', {
  32421. * 'length': 24,
  32422. * 'separator': /,? +/
  32423. * });
  32424. * // => 'hi-diddly-ho there...'
  32425. *
  32426. * _.truncate('hi-diddly-ho there, neighborino', {
  32427. * 'omission': ' [...]'
  32428. * });
  32429. * // => 'hi-diddly-ho there, neig [...]'
  32430. */
  32431. function truncate(string, options) {
  32432. var length = DEFAULT_TRUNC_LENGTH,
  32433. omission = DEFAULT_TRUNC_OMISSION;
  32434. if (isObject(options)) {
  32435. var separator = 'separator' in options ? options.separator : separator;
  32436. length = 'length' in options ? toInteger(options.length) : length;
  32437. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32438. }
  32439. string = toString(string);
  32440. var strLength = string.length;
  32441. if (hasUnicode(string)) {
  32442. var strSymbols = stringToArray(string);
  32443. strLength = strSymbols.length;
  32444. }
  32445. if (length >= strLength) {
  32446. return string;
  32447. }
  32448. var end = length - stringSize(omission);
  32449. if (end < 1) {
  32450. return omission;
  32451. }
  32452. var result = strSymbols
  32453. ? castSlice(strSymbols, 0, end).join('')
  32454. : string.slice(0, end);
  32455. if (separator === undefined) {
  32456. return result + omission;
  32457. }
  32458. if (strSymbols) {
  32459. end += (result.length - end);
  32460. }
  32461. if (isRegExp(separator)) {
  32462. if (string.slice(end).search(separator)) {
  32463. var match,
  32464. substring = result;
  32465. if (!separator.global) {
  32466. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32467. }
  32468. separator.lastIndex = 0;
  32469. while ((match = separator.exec(substring))) {
  32470. var newEnd = match.index;
  32471. }
  32472. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32473. }
  32474. } else if (string.indexOf(baseToString(separator), end) != end) {
  32475. var index = result.lastIndexOf(separator);
  32476. if (index > -1) {
  32477. result = result.slice(0, index);
  32478. }
  32479. }
  32480. return result + omission;
  32481. }
  32482. /**
  32483. * The inverse of `_.escape`; this method converts the HTML entities
  32484. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32485. * their corresponding characters.
  32486. *
  32487. * **Note:** No other HTML entities are unescaped. To unescape additional
  32488. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32489. *
  32490. * @static
  32491. * @memberOf _
  32492. * @since 0.6.0
  32493. * @category String
  32494. * @param {string} [string=''] The string to unescape.
  32495. * @returns {string} Returns the unescaped string.
  32496. * @example
  32497. *
  32498. * _.unescape('fred, barney, &amp; pebbles');
  32499. * // => 'fred, barney, & pebbles'
  32500. */
  32501. function unescape(string) {
  32502. string = toString(string);
  32503. return (string && reHasEscapedHtml.test(string))
  32504. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32505. : string;
  32506. }
  32507. /**
  32508. * Converts `string`, as space separated words, to upper case.
  32509. *
  32510. * @static
  32511. * @memberOf _
  32512. * @since 4.0.0
  32513. * @category String
  32514. * @param {string} [string=''] The string to convert.
  32515. * @returns {string} Returns the upper cased string.
  32516. * @example
  32517. *
  32518. * _.upperCase('--foo-bar');
  32519. * // => 'FOO BAR'
  32520. *
  32521. * _.upperCase('fooBar');
  32522. * // => 'FOO BAR'
  32523. *
  32524. * _.upperCase('__foo_bar__');
  32525. * // => 'FOO BAR'
  32526. */
  32527. var upperCase = createCompounder(function(result, word, index) {
  32528. return result + (index ? ' ' : '') + word.toUpperCase();
  32529. });
  32530. /**
  32531. * Converts the first character of `string` to upper case.
  32532. *
  32533. * @static
  32534. * @memberOf _
  32535. * @since 4.0.0
  32536. * @category String
  32537. * @param {string} [string=''] The string to convert.
  32538. * @returns {string} Returns the converted string.
  32539. * @example
  32540. *
  32541. * _.upperFirst('fred');
  32542. * // => 'Fred'
  32543. *
  32544. * _.upperFirst('FRED');
  32545. * // => 'FRED'
  32546. */
  32547. var upperFirst = createCaseFirst('toUpperCase');
  32548. /**
  32549. * Splits `string` into an array of its words.
  32550. *
  32551. * @static
  32552. * @memberOf _
  32553. * @since 3.0.0
  32554. * @category String
  32555. * @param {string} [string=''] The string to inspect.
  32556. * @param {RegExp|string} [pattern] The pattern to match words.
  32557. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32558. * @returns {Array} Returns the words of `string`.
  32559. * @example
  32560. *
  32561. * _.words('fred, barney, & pebbles');
  32562. * // => ['fred', 'barney', 'pebbles']
  32563. *
  32564. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32565. * // => ['fred', 'barney', '&', 'pebbles']
  32566. */
  32567. function words(string, pattern, guard) {
  32568. string = toString(string);
  32569. pattern = guard ? undefined : pattern;
  32570. if (pattern === undefined) {
  32571. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32572. }
  32573. return string.match(pattern) || [];
  32574. }
  32575. /*------------------------------------------------------------------------*/
  32576. /**
  32577. * Attempts to invoke `func`, returning either the result or the caught error
  32578. * object. Any additional arguments are provided to `func` when it's invoked.
  32579. *
  32580. * @static
  32581. * @memberOf _
  32582. * @since 3.0.0
  32583. * @category Util
  32584. * @param {Function} func The function to attempt.
  32585. * @param {...*} [args] The arguments to invoke `func` with.
  32586. * @returns {*} Returns the `func` result or error object.
  32587. * @example
  32588. *
  32589. * // Avoid throwing errors for invalid selectors.
  32590. * var elements = _.attempt(function(selector) {
  32591. * return document.querySelectorAll(selector);
  32592. * }, '>_>');
  32593. *
  32594. * if (_.isError(elements)) {
  32595. * elements = [];
  32596. * }
  32597. */
  32598. var attempt = baseRest(function(func, args) {
  32599. try {
  32600. return apply(func, undefined, args);
  32601. } catch (e) {
  32602. return isError(e) ? e : new Error(e);
  32603. }
  32604. });
  32605. /**
  32606. * Binds methods of an object to the object itself, overwriting the existing
  32607. * method.
  32608. *
  32609. * **Note:** This method doesn't set the "length" property of bound functions.
  32610. *
  32611. * @static
  32612. * @since 0.1.0
  32613. * @memberOf _
  32614. * @category Util
  32615. * @param {Object} object The object to bind and assign the bound methods to.
  32616. * @param {...(string|string[])} methodNames The object method names to bind.
  32617. * @returns {Object} Returns `object`.
  32618. * @example
  32619. *
  32620. * var view = {
  32621. * 'label': 'docs',
  32622. * 'click': function() {
  32623. * console.log('clicked ' + this.label);
  32624. * }
  32625. * };
  32626. *
  32627. * _.bindAll(view, ['click']);
  32628. * jQuery(element).on('click', view.click);
  32629. * // => Logs 'clicked docs' when clicked.
  32630. */
  32631. var bindAll = flatRest(function(object, methodNames) {
  32632. arrayEach(methodNames, function(key) {
  32633. key = toKey(key);
  32634. baseAssignValue(object, key, bind(object[key], object));
  32635. });
  32636. return object;
  32637. });
  32638. /**
  32639. * Creates a function that iterates over `pairs` and invokes the corresponding
  32640. * function of the first predicate to return truthy. The predicate-function
  32641. * pairs are invoked with the `this` binding and arguments of the created
  32642. * function.
  32643. *
  32644. * @static
  32645. * @memberOf _
  32646. * @since 4.0.0
  32647. * @category Util
  32648. * @param {Array} pairs The predicate-function pairs.
  32649. * @returns {Function} Returns the new composite function.
  32650. * @example
  32651. *
  32652. * var func = _.cond([
  32653. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32654. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32655. * [_.stubTrue, _.constant('no match')]
  32656. * ]);
  32657. *
  32658. * func({ 'a': 1, 'b': 2 });
  32659. * // => 'matches A'
  32660. *
  32661. * func({ 'a': 0, 'b': 1 });
  32662. * // => 'matches B'
  32663. *
  32664. * func({ 'a': '1', 'b': '2' });
  32665. * // => 'no match'
  32666. */
  32667. function cond(pairs) {
  32668. var length = pairs == null ? 0 : pairs.length,
  32669. toIteratee = getIteratee();
  32670. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32671. if (typeof pair[1] != 'function') {
  32672. throw new TypeError(FUNC_ERROR_TEXT);
  32673. }
  32674. return [toIteratee(pair[0]), pair[1]];
  32675. });
  32676. return baseRest(function(args) {
  32677. var index = -1;
  32678. while (++index < length) {
  32679. var pair = pairs[index];
  32680. if (apply(pair[0], this, args)) {
  32681. return apply(pair[1], this, args);
  32682. }
  32683. }
  32684. });
  32685. }
  32686. /**
  32687. * Creates a function that invokes the predicate properties of `source` with
  32688. * the corresponding property values of a given object, returning `true` if
  32689. * all predicates return truthy, else `false`.
  32690. *
  32691. * **Note:** The created function is equivalent to `_.conformsTo` with
  32692. * `source` partially applied.
  32693. *
  32694. * @static
  32695. * @memberOf _
  32696. * @since 4.0.0
  32697. * @category Util
  32698. * @param {Object} source The object of property predicates to conform to.
  32699. * @returns {Function} Returns the new spec function.
  32700. * @example
  32701. *
  32702. * var objects = [
  32703. * { 'a': 2, 'b': 1 },
  32704. * { 'a': 1, 'b': 2 }
  32705. * ];
  32706. *
  32707. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32708. * // => [{ 'a': 1, 'b': 2 }]
  32709. */
  32710. function conforms(source) {
  32711. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32712. }
  32713. /**
  32714. * Creates a function that returns `value`.
  32715. *
  32716. * @static
  32717. * @memberOf _
  32718. * @since 2.4.0
  32719. * @category Util
  32720. * @param {*} value The value to return from the new function.
  32721. * @returns {Function} Returns the new constant function.
  32722. * @example
  32723. *
  32724. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32725. *
  32726. * console.log(objects);
  32727. * // => [{ 'a': 1 }, { 'a': 1 }]
  32728. *
  32729. * console.log(objects[0] === objects[1]);
  32730. * // => true
  32731. */
  32732. function constant(value) {
  32733. return function() {
  32734. return value;
  32735. };
  32736. }
  32737. /**
  32738. * Checks `value` to determine whether a default value should be returned in
  32739. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32740. * or `undefined`.
  32741. *
  32742. * @static
  32743. * @memberOf _
  32744. * @since 4.14.0
  32745. * @category Util
  32746. * @param {*} value The value to check.
  32747. * @param {*} defaultValue The default value.
  32748. * @returns {*} Returns the resolved value.
  32749. * @example
  32750. *
  32751. * _.defaultTo(1, 10);
  32752. * // => 1
  32753. *
  32754. * _.defaultTo(undefined, 10);
  32755. * // => 10
  32756. */
  32757. function defaultTo(value, defaultValue) {
  32758. return (value == null || value !== value) ? defaultValue : value;
  32759. }
  32760. /**
  32761. * Creates a function that returns the result of invoking the given functions
  32762. * with the `this` binding of the created function, where each successive
  32763. * invocation is supplied the return value of the previous.
  32764. *
  32765. * @static
  32766. * @memberOf _
  32767. * @since 3.0.0
  32768. * @category Util
  32769. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32770. * @returns {Function} Returns the new composite function.
  32771. * @see _.flowRight
  32772. * @example
  32773. *
  32774. * function square(n) {
  32775. * return n * n;
  32776. * }
  32777. *
  32778. * var addSquare = _.flow([_.add, square]);
  32779. * addSquare(1, 2);
  32780. * // => 9
  32781. */
  32782. var flow = createFlow();
  32783. /**
  32784. * This method is like `_.flow` except that it creates a function that
  32785. * invokes the given functions from right to left.
  32786. *
  32787. * @static
  32788. * @since 3.0.0
  32789. * @memberOf _
  32790. * @category Util
  32791. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32792. * @returns {Function} Returns the new composite function.
  32793. * @see _.flow
  32794. * @example
  32795. *
  32796. * function square(n) {
  32797. * return n * n;
  32798. * }
  32799. *
  32800. * var addSquare = _.flowRight([square, _.add]);
  32801. * addSquare(1, 2);
  32802. * // => 9
  32803. */
  32804. var flowRight = createFlow(true);
  32805. /**
  32806. * This method returns the first argument it receives.
  32807. *
  32808. * @static
  32809. * @since 0.1.0
  32810. * @memberOf _
  32811. * @category Util
  32812. * @param {*} value Any value.
  32813. * @returns {*} Returns `value`.
  32814. * @example
  32815. *
  32816. * var object = { 'a': 1 };
  32817. *
  32818. * console.log(_.identity(object) === object);
  32819. * // => true
  32820. */
  32821. function identity(value) {
  32822. return value;
  32823. }
  32824. /**
  32825. * Creates a function that invokes `func` with the arguments of the created
  32826. * function. If `func` is a property name, the created function returns the
  32827. * property value for a given element. If `func` is an array or object, the
  32828. * created function returns `true` for elements that contain the equivalent
  32829. * source properties, otherwise it returns `false`.
  32830. *
  32831. * @static
  32832. * @since 4.0.0
  32833. * @memberOf _
  32834. * @category Util
  32835. * @param {*} [func=_.identity] The value to convert to a callback.
  32836. * @returns {Function} Returns the callback.
  32837. * @example
  32838. *
  32839. * var users = [
  32840. * { 'user': 'barney', 'age': 36, 'active': true },
  32841. * { 'user': 'fred', 'age': 40, 'active': false }
  32842. * ];
  32843. *
  32844. * // The `_.matches` iteratee shorthand.
  32845. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32846. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32847. *
  32848. * // The `_.matchesProperty` iteratee shorthand.
  32849. * _.filter(users, _.iteratee(['user', 'fred']));
  32850. * // => [{ 'user': 'fred', 'age': 40 }]
  32851. *
  32852. * // The `_.property` iteratee shorthand.
  32853. * _.map(users, _.iteratee('user'));
  32854. * // => ['barney', 'fred']
  32855. *
  32856. * // Create custom iteratee shorthands.
  32857. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32858. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32859. * return func.test(string);
  32860. * };
  32861. * });
  32862. *
  32863. * _.filter(['abc', 'def'], /ef/);
  32864. * // => ['def']
  32865. */
  32866. function iteratee(func) {
  32867. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32868. }
  32869. /**
  32870. * Creates a function that performs a partial deep comparison between a given
  32871. * object and `source`, returning `true` if the given object has equivalent
  32872. * property values, else `false`.
  32873. *
  32874. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32875. * partially applied.
  32876. *
  32877. * Partial comparisons will match empty array and empty object `source`
  32878. * values against any array or object value, respectively. See `_.isEqual`
  32879. * for a list of supported value comparisons.
  32880. *
  32881. * @static
  32882. * @memberOf _
  32883. * @since 3.0.0
  32884. * @category Util
  32885. * @param {Object} source The object of property values to match.
  32886. * @returns {Function} Returns the new spec function.
  32887. * @example
  32888. *
  32889. * var objects = [
  32890. * { 'a': 1, 'b': 2, 'c': 3 },
  32891. * { 'a': 4, 'b': 5, 'c': 6 }
  32892. * ];
  32893. *
  32894. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32895. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32896. */
  32897. function matches(source) {
  32898. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32899. }
  32900. /**
  32901. * Creates a function that performs a partial deep comparison between the
  32902. * value at `path` of a given object to `srcValue`, returning `true` if the
  32903. * object value is equivalent, else `false`.
  32904. *
  32905. * **Note:** Partial comparisons will match empty array and empty object
  32906. * `srcValue` values against any array or object value, respectively. See
  32907. * `_.isEqual` for a list of supported value comparisons.
  32908. *
  32909. * @static
  32910. * @memberOf _
  32911. * @since 3.2.0
  32912. * @category Util
  32913. * @param {Array|string} path The path of the property to get.
  32914. * @param {*} srcValue The value to match.
  32915. * @returns {Function} Returns the new spec function.
  32916. * @example
  32917. *
  32918. * var objects = [
  32919. * { 'a': 1, 'b': 2, 'c': 3 },
  32920. * { 'a': 4, 'b': 5, 'c': 6 }
  32921. * ];
  32922. *
  32923. * _.find(objects, _.matchesProperty('a', 4));
  32924. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32925. */
  32926. function matchesProperty(path, srcValue) {
  32927. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32928. }
  32929. /**
  32930. * Creates a function that invokes the method at `path` of a given object.
  32931. * Any additional arguments are provided to the invoked method.
  32932. *
  32933. * @static
  32934. * @memberOf _
  32935. * @since 3.7.0
  32936. * @category Util
  32937. * @param {Array|string} path The path of the method to invoke.
  32938. * @param {...*} [args] The arguments to invoke the method with.
  32939. * @returns {Function} Returns the new invoker function.
  32940. * @example
  32941. *
  32942. * var objects = [
  32943. * { 'a': { 'b': _.constant(2) } },
  32944. * { 'a': { 'b': _.constant(1) } }
  32945. * ];
  32946. *
  32947. * _.map(objects, _.method('a.b'));
  32948. * // => [2, 1]
  32949. *
  32950. * _.map(objects, _.method(['a', 'b']));
  32951. * // => [2, 1]
  32952. */
  32953. var method = baseRest(function(path, args) {
  32954. return function(object) {
  32955. return baseInvoke(object, path, args);
  32956. };
  32957. });
  32958. /**
  32959. * The opposite of `_.method`; this method creates a function that invokes
  32960. * the method at a given path of `object`. Any additional arguments are
  32961. * provided to the invoked method.
  32962. *
  32963. * @static
  32964. * @memberOf _
  32965. * @since 3.7.0
  32966. * @category Util
  32967. * @param {Object} object The object to query.
  32968. * @param {...*} [args] The arguments to invoke the method with.
  32969. * @returns {Function} Returns the new invoker function.
  32970. * @example
  32971. *
  32972. * var array = _.times(3, _.constant),
  32973. * object = { 'a': array, 'b': array, 'c': array };
  32974. *
  32975. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32976. * // => [2, 0]
  32977. *
  32978. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32979. * // => [2, 0]
  32980. */
  32981. var methodOf = baseRest(function(object, args) {
  32982. return function(path) {
  32983. return baseInvoke(object, path, args);
  32984. };
  32985. });
  32986. /**
  32987. * Adds all own enumerable string keyed function properties of a source
  32988. * object to the destination object. If `object` is a function, then methods
  32989. * are added to its prototype as well.
  32990. *
  32991. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32992. * avoid conflicts caused by modifying the original.
  32993. *
  32994. * @static
  32995. * @since 0.1.0
  32996. * @memberOf _
  32997. * @category Util
  32998. * @param {Function|Object} [object=lodash] The destination object.
  32999. * @param {Object} source The object of functions to add.
  33000. * @param {Object} [options={}] The options object.
  33001. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33002. * @returns {Function|Object} Returns `object`.
  33003. * @example
  33004. *
  33005. * function vowels(string) {
  33006. * return _.filter(string, function(v) {
  33007. * return /[aeiou]/i.test(v);
  33008. * });
  33009. * }
  33010. *
  33011. * _.mixin({ 'vowels': vowels });
  33012. * _.vowels('fred');
  33013. * // => ['e']
  33014. *
  33015. * _('fred').vowels().value();
  33016. * // => ['e']
  33017. *
  33018. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33019. * _('fred').vowels();
  33020. * // => ['e']
  33021. */
  33022. function mixin(object, source, options) {
  33023. var props = keys(source),
  33024. methodNames = baseFunctions(source, props);
  33025. if (options == null &&
  33026. !(isObject(source) && (methodNames.length || !props.length))) {
  33027. options = source;
  33028. source = object;
  33029. object = this;
  33030. methodNames = baseFunctions(source, keys(source));
  33031. }
  33032. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33033. isFunc = isFunction(object);
  33034. arrayEach(methodNames, function(methodName) {
  33035. var func = source[methodName];
  33036. object[methodName] = func;
  33037. if (isFunc) {
  33038. object.prototype[methodName] = function() {
  33039. var chainAll = this.__chain__;
  33040. if (chain || chainAll) {
  33041. var result = object(this.__wrapped__),
  33042. actions = result.__actions__ = copyArray(this.__actions__);
  33043. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33044. result.__chain__ = chainAll;
  33045. return result;
  33046. }
  33047. return func.apply(object, arrayPush([this.value()], arguments));
  33048. };
  33049. }
  33050. });
  33051. return object;
  33052. }
  33053. /**
  33054. * Reverts the `_` variable to its previous value and returns a reference to
  33055. * the `lodash` function.
  33056. *
  33057. * @static
  33058. * @since 0.1.0
  33059. * @memberOf _
  33060. * @category Util
  33061. * @returns {Function} Returns the `lodash` function.
  33062. * @example
  33063. *
  33064. * var lodash = _.noConflict();
  33065. */
  33066. function noConflict() {
  33067. if (root._ === this) {
  33068. root._ = oldDash;
  33069. }
  33070. return this;
  33071. }
  33072. /**
  33073. * This method returns `undefined`.
  33074. *
  33075. * @static
  33076. * @memberOf _
  33077. * @since 2.3.0
  33078. * @category Util
  33079. * @example
  33080. *
  33081. * _.times(2, _.noop);
  33082. * // => [undefined, undefined]
  33083. */
  33084. function noop() {
  33085. // No operation performed.
  33086. }
  33087. /**
  33088. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33089. * the nth argument from the end is returned.
  33090. *
  33091. * @static
  33092. * @memberOf _
  33093. * @since 4.0.0
  33094. * @category Util
  33095. * @param {number} [n=0] The index of the argument to return.
  33096. * @returns {Function} Returns the new pass-thru function.
  33097. * @example
  33098. *
  33099. * var func = _.nthArg(1);
  33100. * func('a', 'b', 'c', 'd');
  33101. * // => 'b'
  33102. *
  33103. * var func = _.nthArg(-2);
  33104. * func('a', 'b', 'c', 'd');
  33105. * // => 'c'
  33106. */
  33107. function nthArg(n) {
  33108. n = toInteger(n);
  33109. return baseRest(function(args) {
  33110. return baseNth(args, n);
  33111. });
  33112. }
  33113. /**
  33114. * Creates a function that invokes `iteratees` with the arguments it receives
  33115. * and returns their results.
  33116. *
  33117. * @static
  33118. * @memberOf _
  33119. * @since 4.0.0
  33120. * @category Util
  33121. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33122. * The iteratees to invoke.
  33123. * @returns {Function} Returns the new function.
  33124. * @example
  33125. *
  33126. * var func = _.over([Math.max, Math.min]);
  33127. *
  33128. * func(1, 2, 3, 4);
  33129. * // => [4, 1]
  33130. */
  33131. var over = createOver(arrayMap);
  33132. /**
  33133. * Creates a function that checks if **all** of the `predicates` return
  33134. * truthy when invoked with the arguments it receives.
  33135. *
  33136. * @static
  33137. * @memberOf _
  33138. * @since 4.0.0
  33139. * @category Util
  33140. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33141. * The predicates to check.
  33142. * @returns {Function} Returns the new function.
  33143. * @example
  33144. *
  33145. * var func = _.overEvery([Boolean, isFinite]);
  33146. *
  33147. * func('1');
  33148. * // => true
  33149. *
  33150. * func(null);
  33151. * // => false
  33152. *
  33153. * func(NaN);
  33154. * // => false
  33155. */
  33156. var overEvery = createOver(arrayEvery);
  33157. /**
  33158. * Creates a function that checks if **any** of the `predicates` return
  33159. * truthy when invoked with the arguments it receives.
  33160. *
  33161. * @static
  33162. * @memberOf _
  33163. * @since 4.0.0
  33164. * @category Util
  33165. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33166. * The predicates to check.
  33167. * @returns {Function} Returns the new function.
  33168. * @example
  33169. *
  33170. * var func = _.overSome([Boolean, isFinite]);
  33171. *
  33172. * func('1');
  33173. * // => true
  33174. *
  33175. * func(null);
  33176. * // => true
  33177. *
  33178. * func(NaN);
  33179. * // => false
  33180. */
  33181. var overSome = createOver(arraySome);
  33182. /**
  33183. * Creates a function that returns the value at `path` of a given object.
  33184. *
  33185. * @static
  33186. * @memberOf _
  33187. * @since 2.4.0
  33188. * @category Util
  33189. * @param {Array|string} path The path of the property to get.
  33190. * @returns {Function} Returns the new accessor function.
  33191. * @example
  33192. *
  33193. * var objects = [
  33194. * { 'a': { 'b': 2 } },
  33195. * { 'a': { 'b': 1 } }
  33196. * ];
  33197. *
  33198. * _.map(objects, _.property('a.b'));
  33199. * // => [2, 1]
  33200. *
  33201. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33202. * // => [1, 2]
  33203. */
  33204. function property(path) {
  33205. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33206. }
  33207. /**
  33208. * The opposite of `_.property`; this method creates a function that returns
  33209. * the value at a given path of `object`.
  33210. *
  33211. * @static
  33212. * @memberOf _
  33213. * @since 3.0.0
  33214. * @category Util
  33215. * @param {Object} object The object to query.
  33216. * @returns {Function} Returns the new accessor function.
  33217. * @example
  33218. *
  33219. * var array = [0, 1, 2],
  33220. * object = { 'a': array, 'b': array, 'c': array };
  33221. *
  33222. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33223. * // => [2, 0]
  33224. *
  33225. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33226. * // => [2, 0]
  33227. */
  33228. function propertyOf(object) {
  33229. return function(path) {
  33230. return object == null ? undefined : baseGet(object, path);
  33231. };
  33232. }
  33233. /**
  33234. * Creates an array of numbers (positive and/or negative) progressing from
  33235. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33236. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33237. * it's set to `start` with `start` then set to `0`.
  33238. *
  33239. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33240. * floating-point values which can produce unexpected results.
  33241. *
  33242. * @static
  33243. * @since 0.1.0
  33244. * @memberOf _
  33245. * @category Util
  33246. * @param {number} [start=0] The start of the range.
  33247. * @param {number} end The end of the range.
  33248. * @param {number} [step=1] The value to increment or decrement by.
  33249. * @returns {Array} Returns the range of numbers.
  33250. * @see _.inRange, _.rangeRight
  33251. * @example
  33252. *
  33253. * _.range(4);
  33254. * // => [0, 1, 2, 3]
  33255. *
  33256. * _.range(-4);
  33257. * // => [0, -1, -2, -3]
  33258. *
  33259. * _.range(1, 5);
  33260. * // => [1, 2, 3, 4]
  33261. *
  33262. * _.range(0, 20, 5);
  33263. * // => [0, 5, 10, 15]
  33264. *
  33265. * _.range(0, -4, -1);
  33266. * // => [0, -1, -2, -3]
  33267. *
  33268. * _.range(1, 4, 0);
  33269. * // => [1, 1, 1]
  33270. *
  33271. * _.range(0);
  33272. * // => []
  33273. */
  33274. var range = createRange();
  33275. /**
  33276. * This method is like `_.range` except that it populates values in
  33277. * descending order.
  33278. *
  33279. * @static
  33280. * @memberOf _
  33281. * @since 4.0.0
  33282. * @category Util
  33283. * @param {number} [start=0] The start of the range.
  33284. * @param {number} end The end of the range.
  33285. * @param {number} [step=1] The value to increment or decrement by.
  33286. * @returns {Array} Returns the range of numbers.
  33287. * @see _.inRange, _.range
  33288. * @example
  33289. *
  33290. * _.rangeRight(4);
  33291. * // => [3, 2, 1, 0]
  33292. *
  33293. * _.rangeRight(-4);
  33294. * // => [-3, -2, -1, 0]
  33295. *
  33296. * _.rangeRight(1, 5);
  33297. * // => [4, 3, 2, 1]
  33298. *
  33299. * _.rangeRight(0, 20, 5);
  33300. * // => [15, 10, 5, 0]
  33301. *
  33302. * _.rangeRight(0, -4, -1);
  33303. * // => [-3, -2, -1, 0]
  33304. *
  33305. * _.rangeRight(1, 4, 0);
  33306. * // => [1, 1, 1]
  33307. *
  33308. * _.rangeRight(0);
  33309. * // => []
  33310. */
  33311. var rangeRight = createRange(true);
  33312. /**
  33313. * This method returns a new empty array.
  33314. *
  33315. * @static
  33316. * @memberOf _
  33317. * @since 4.13.0
  33318. * @category Util
  33319. * @returns {Array} Returns the new empty array.
  33320. * @example
  33321. *
  33322. * var arrays = _.times(2, _.stubArray);
  33323. *
  33324. * console.log(arrays);
  33325. * // => [[], []]
  33326. *
  33327. * console.log(arrays[0] === arrays[1]);
  33328. * // => false
  33329. */
  33330. function stubArray() {
  33331. return [];
  33332. }
  33333. /**
  33334. * This method returns `false`.
  33335. *
  33336. * @static
  33337. * @memberOf _
  33338. * @since 4.13.0
  33339. * @category Util
  33340. * @returns {boolean} Returns `false`.
  33341. * @example
  33342. *
  33343. * _.times(2, _.stubFalse);
  33344. * // => [false, false]
  33345. */
  33346. function stubFalse() {
  33347. return false;
  33348. }
  33349. /**
  33350. * This method returns a new empty object.
  33351. *
  33352. * @static
  33353. * @memberOf _
  33354. * @since 4.13.0
  33355. * @category Util
  33356. * @returns {Object} Returns the new empty object.
  33357. * @example
  33358. *
  33359. * var objects = _.times(2, _.stubObject);
  33360. *
  33361. * console.log(objects);
  33362. * // => [{}, {}]
  33363. *
  33364. * console.log(objects[0] === objects[1]);
  33365. * // => false
  33366. */
  33367. function stubObject() {
  33368. return {};
  33369. }
  33370. /**
  33371. * This method returns an empty string.
  33372. *
  33373. * @static
  33374. * @memberOf _
  33375. * @since 4.13.0
  33376. * @category Util
  33377. * @returns {string} Returns the empty string.
  33378. * @example
  33379. *
  33380. * _.times(2, _.stubString);
  33381. * // => ['', '']
  33382. */
  33383. function stubString() {
  33384. return '';
  33385. }
  33386. /**
  33387. * This method returns `true`.
  33388. *
  33389. * @static
  33390. * @memberOf _
  33391. * @since 4.13.0
  33392. * @category Util
  33393. * @returns {boolean} Returns `true`.
  33394. * @example
  33395. *
  33396. * _.times(2, _.stubTrue);
  33397. * // => [true, true]
  33398. */
  33399. function stubTrue() {
  33400. return true;
  33401. }
  33402. /**
  33403. * Invokes the iteratee `n` times, returning an array of the results of
  33404. * each invocation. The iteratee is invoked with one argument; (index).
  33405. *
  33406. * @static
  33407. * @since 0.1.0
  33408. * @memberOf _
  33409. * @category Util
  33410. * @param {number} n The number of times to invoke `iteratee`.
  33411. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33412. * @returns {Array} Returns the array of results.
  33413. * @example
  33414. *
  33415. * _.times(3, String);
  33416. * // => ['0', '1', '2']
  33417. *
  33418. * _.times(4, _.constant(0));
  33419. * // => [0, 0, 0, 0]
  33420. */
  33421. function times(n, iteratee) {
  33422. n = toInteger(n);
  33423. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33424. return [];
  33425. }
  33426. var index = MAX_ARRAY_LENGTH,
  33427. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33428. iteratee = getIteratee(iteratee);
  33429. n -= MAX_ARRAY_LENGTH;
  33430. var result = baseTimes(length, iteratee);
  33431. while (++index < n) {
  33432. iteratee(index);
  33433. }
  33434. return result;
  33435. }
  33436. /**
  33437. * Converts `value` to a property path array.
  33438. *
  33439. * @static
  33440. * @memberOf _
  33441. * @since 4.0.0
  33442. * @category Util
  33443. * @param {*} value The value to convert.
  33444. * @returns {Array} Returns the new property path array.
  33445. * @example
  33446. *
  33447. * _.toPath('a.b.c');
  33448. * // => ['a', 'b', 'c']
  33449. *
  33450. * _.toPath('a[0].b.c');
  33451. * // => ['a', '0', 'b', 'c']
  33452. */
  33453. function toPath(value) {
  33454. if (isArray(value)) {
  33455. return arrayMap(value, toKey);
  33456. }
  33457. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33458. }
  33459. /**
  33460. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33461. *
  33462. * @static
  33463. * @since 0.1.0
  33464. * @memberOf _
  33465. * @category Util
  33466. * @param {string} [prefix=''] The value to prefix the ID with.
  33467. * @returns {string} Returns the unique ID.
  33468. * @example
  33469. *
  33470. * _.uniqueId('contact_');
  33471. * // => 'contact_104'
  33472. *
  33473. * _.uniqueId();
  33474. * // => '105'
  33475. */
  33476. function uniqueId(prefix) {
  33477. var id = ++idCounter;
  33478. return toString(prefix) + id;
  33479. }
  33480. /*------------------------------------------------------------------------*/
  33481. /**
  33482. * Adds two numbers.
  33483. *
  33484. * @static
  33485. * @memberOf _
  33486. * @since 3.4.0
  33487. * @category Math
  33488. * @param {number} augend The first number in an addition.
  33489. * @param {number} addend The second number in an addition.
  33490. * @returns {number} Returns the total.
  33491. * @example
  33492. *
  33493. * _.add(6, 4);
  33494. * // => 10
  33495. */
  33496. var add = createMathOperation(function(augend, addend) {
  33497. return augend + addend;
  33498. }, 0);
  33499. /**
  33500. * Computes `number` rounded up to `precision`.
  33501. *
  33502. * @static
  33503. * @memberOf _
  33504. * @since 3.10.0
  33505. * @category Math
  33506. * @param {number} number The number to round up.
  33507. * @param {number} [precision=0] The precision to round up to.
  33508. * @returns {number} Returns the rounded up number.
  33509. * @example
  33510. *
  33511. * _.ceil(4.006);
  33512. * // => 5
  33513. *
  33514. * _.ceil(6.004, 2);
  33515. * // => 6.01
  33516. *
  33517. * _.ceil(6040, -2);
  33518. * // => 6100
  33519. */
  33520. var ceil = createRound('ceil');
  33521. /**
  33522. * Divide two numbers.
  33523. *
  33524. * @static
  33525. * @memberOf _
  33526. * @since 4.7.0
  33527. * @category Math
  33528. * @param {number} dividend The first number in a division.
  33529. * @param {number} divisor The second number in a division.
  33530. * @returns {number} Returns the quotient.
  33531. * @example
  33532. *
  33533. * _.divide(6, 4);
  33534. * // => 1.5
  33535. */
  33536. var divide = createMathOperation(function(dividend, divisor) {
  33537. return dividend / divisor;
  33538. }, 1);
  33539. /**
  33540. * Computes `number` rounded down to `precision`.
  33541. *
  33542. * @static
  33543. * @memberOf _
  33544. * @since 3.10.0
  33545. * @category Math
  33546. * @param {number} number The number to round down.
  33547. * @param {number} [precision=0] The precision to round down to.
  33548. * @returns {number} Returns the rounded down number.
  33549. * @example
  33550. *
  33551. * _.floor(4.006);
  33552. * // => 4
  33553. *
  33554. * _.floor(0.046, 2);
  33555. * // => 0.04
  33556. *
  33557. * _.floor(4060, -2);
  33558. * // => 4000
  33559. */
  33560. var floor = createRound('floor');
  33561. /**
  33562. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33563. * `undefined` is returned.
  33564. *
  33565. * @static
  33566. * @since 0.1.0
  33567. * @memberOf _
  33568. * @category Math
  33569. * @param {Array} array The array to iterate over.
  33570. * @returns {*} Returns the maximum value.
  33571. * @example
  33572. *
  33573. * _.max([4, 2, 8, 6]);
  33574. * // => 8
  33575. *
  33576. * _.max([]);
  33577. * // => undefined
  33578. */
  33579. function max(array) {
  33580. return (array && array.length)
  33581. ? baseExtremum(array, identity, baseGt)
  33582. : undefined;
  33583. }
  33584. /**
  33585. * This method is like `_.max` except that it accepts `iteratee` which is
  33586. * invoked for each element in `array` to generate the criterion by which
  33587. * the value is ranked. The iteratee is invoked with one argument: (value).
  33588. *
  33589. * @static
  33590. * @memberOf _
  33591. * @since 4.0.0
  33592. * @category Math
  33593. * @param {Array} array The array to iterate over.
  33594. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33595. * @returns {*} Returns the maximum value.
  33596. * @example
  33597. *
  33598. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33599. *
  33600. * _.maxBy(objects, function(o) { return o.n; });
  33601. * // => { 'n': 2 }
  33602. *
  33603. * // The `_.property` iteratee shorthand.
  33604. * _.maxBy(objects, 'n');
  33605. * // => { 'n': 2 }
  33606. */
  33607. function maxBy(array, iteratee) {
  33608. return (array && array.length)
  33609. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33610. : undefined;
  33611. }
  33612. /**
  33613. * Computes the mean of the values in `array`.
  33614. *
  33615. * @static
  33616. * @memberOf _
  33617. * @since 4.0.0
  33618. * @category Math
  33619. * @param {Array} array The array to iterate over.
  33620. * @returns {number} Returns the mean.
  33621. * @example
  33622. *
  33623. * _.mean([4, 2, 8, 6]);
  33624. * // => 5
  33625. */
  33626. function mean(array) {
  33627. return baseMean(array, identity);
  33628. }
  33629. /**
  33630. * This method is like `_.mean` except that it accepts `iteratee` which is
  33631. * invoked for each element in `array` to generate the value to be averaged.
  33632. * The iteratee is invoked with one argument: (value).
  33633. *
  33634. * @static
  33635. * @memberOf _
  33636. * @since 4.7.0
  33637. * @category Math
  33638. * @param {Array} array The array to iterate over.
  33639. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33640. * @returns {number} Returns the mean.
  33641. * @example
  33642. *
  33643. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33644. *
  33645. * _.meanBy(objects, function(o) { return o.n; });
  33646. * // => 5
  33647. *
  33648. * // The `_.property` iteratee shorthand.
  33649. * _.meanBy(objects, 'n');
  33650. * // => 5
  33651. */
  33652. function meanBy(array, iteratee) {
  33653. return baseMean(array, getIteratee(iteratee, 2));
  33654. }
  33655. /**
  33656. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33657. * `undefined` is returned.
  33658. *
  33659. * @static
  33660. * @since 0.1.0
  33661. * @memberOf _
  33662. * @category Math
  33663. * @param {Array} array The array to iterate over.
  33664. * @returns {*} Returns the minimum value.
  33665. * @example
  33666. *
  33667. * _.min([4, 2, 8, 6]);
  33668. * // => 2
  33669. *
  33670. * _.min([]);
  33671. * // => undefined
  33672. */
  33673. function min(array) {
  33674. return (array && array.length)
  33675. ? baseExtremum(array, identity, baseLt)
  33676. : undefined;
  33677. }
  33678. /**
  33679. * This method is like `_.min` except that it accepts `iteratee` which is
  33680. * invoked for each element in `array` to generate the criterion by which
  33681. * the value is ranked. The iteratee is invoked with one argument: (value).
  33682. *
  33683. * @static
  33684. * @memberOf _
  33685. * @since 4.0.0
  33686. * @category Math
  33687. * @param {Array} array The array to iterate over.
  33688. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33689. * @returns {*} Returns the minimum value.
  33690. * @example
  33691. *
  33692. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33693. *
  33694. * _.minBy(objects, function(o) { return o.n; });
  33695. * // => { 'n': 1 }
  33696. *
  33697. * // The `_.property` iteratee shorthand.
  33698. * _.minBy(objects, 'n');
  33699. * // => { 'n': 1 }
  33700. */
  33701. function minBy(array, iteratee) {
  33702. return (array && array.length)
  33703. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33704. : undefined;
  33705. }
  33706. /**
  33707. * Multiply two numbers.
  33708. *
  33709. * @static
  33710. * @memberOf _
  33711. * @since 4.7.0
  33712. * @category Math
  33713. * @param {number} multiplier The first number in a multiplication.
  33714. * @param {number} multiplicand The second number in a multiplication.
  33715. * @returns {number} Returns the product.
  33716. * @example
  33717. *
  33718. * _.multiply(6, 4);
  33719. * // => 24
  33720. */
  33721. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33722. return multiplier * multiplicand;
  33723. }, 1);
  33724. /**
  33725. * Computes `number` rounded to `precision`.
  33726. *
  33727. * @static
  33728. * @memberOf _
  33729. * @since 3.10.0
  33730. * @category Math
  33731. * @param {number} number The number to round.
  33732. * @param {number} [precision=0] The precision to round to.
  33733. * @returns {number} Returns the rounded number.
  33734. * @example
  33735. *
  33736. * _.round(4.006);
  33737. * // => 4
  33738. *
  33739. * _.round(4.006, 2);
  33740. * // => 4.01
  33741. *
  33742. * _.round(4060, -2);
  33743. * // => 4100
  33744. */
  33745. var round = createRound('round');
  33746. /**
  33747. * Subtract two numbers.
  33748. *
  33749. * @static
  33750. * @memberOf _
  33751. * @since 4.0.0
  33752. * @category Math
  33753. * @param {number} minuend The first number in a subtraction.
  33754. * @param {number} subtrahend The second number in a subtraction.
  33755. * @returns {number} Returns the difference.
  33756. * @example
  33757. *
  33758. * _.subtract(6, 4);
  33759. * // => 2
  33760. */
  33761. var subtract = createMathOperation(function(minuend, subtrahend) {
  33762. return minuend - subtrahend;
  33763. }, 0);
  33764. /**
  33765. * Computes the sum of the values in `array`.
  33766. *
  33767. * @static
  33768. * @memberOf _
  33769. * @since 3.4.0
  33770. * @category Math
  33771. * @param {Array} array The array to iterate over.
  33772. * @returns {number} Returns the sum.
  33773. * @example
  33774. *
  33775. * _.sum([4, 2, 8, 6]);
  33776. * // => 20
  33777. */
  33778. function sum(array) {
  33779. return (array && array.length)
  33780. ? baseSum(array, identity)
  33781. : 0;
  33782. }
  33783. /**
  33784. * This method is like `_.sum` except that it accepts `iteratee` which is
  33785. * invoked for each element in `array` to generate the value to be summed.
  33786. * The iteratee is invoked with one argument: (value).
  33787. *
  33788. * @static
  33789. * @memberOf _
  33790. * @since 4.0.0
  33791. * @category Math
  33792. * @param {Array} array The array to iterate over.
  33793. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33794. * @returns {number} Returns the sum.
  33795. * @example
  33796. *
  33797. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33798. *
  33799. * _.sumBy(objects, function(o) { return o.n; });
  33800. * // => 20
  33801. *
  33802. * // The `_.property` iteratee shorthand.
  33803. * _.sumBy(objects, 'n');
  33804. * // => 20
  33805. */
  33806. function sumBy(array, iteratee) {
  33807. return (array && array.length)
  33808. ? baseSum(array, getIteratee(iteratee, 2))
  33809. : 0;
  33810. }
  33811. /*------------------------------------------------------------------------*/
  33812. // Add methods that return wrapped values in chain sequences.
  33813. lodash.after = after;
  33814. lodash.ary = ary;
  33815. lodash.assign = assign;
  33816. lodash.assignIn = assignIn;
  33817. lodash.assignInWith = assignInWith;
  33818. lodash.assignWith = assignWith;
  33819. lodash.at = at;
  33820. lodash.before = before;
  33821. lodash.bind = bind;
  33822. lodash.bindAll = bindAll;
  33823. lodash.bindKey = bindKey;
  33824. lodash.castArray = castArray;
  33825. lodash.chain = chain;
  33826. lodash.chunk = chunk;
  33827. lodash.compact = compact;
  33828. lodash.concat = concat;
  33829. lodash.cond = cond;
  33830. lodash.conforms = conforms;
  33831. lodash.constant = constant;
  33832. lodash.countBy = countBy;
  33833. lodash.create = create;
  33834. lodash.curry = curry;
  33835. lodash.curryRight = curryRight;
  33836. lodash.debounce = debounce;
  33837. lodash.defaults = defaults;
  33838. lodash.defaultsDeep = defaultsDeep;
  33839. lodash.defer = defer;
  33840. lodash.delay = delay;
  33841. lodash.difference = difference;
  33842. lodash.differenceBy = differenceBy;
  33843. lodash.differenceWith = differenceWith;
  33844. lodash.drop = drop;
  33845. lodash.dropRight = dropRight;
  33846. lodash.dropRightWhile = dropRightWhile;
  33847. lodash.dropWhile = dropWhile;
  33848. lodash.fill = fill;
  33849. lodash.filter = filter;
  33850. lodash.flatMap = flatMap;
  33851. lodash.flatMapDeep = flatMapDeep;
  33852. lodash.flatMapDepth = flatMapDepth;
  33853. lodash.flatten = flatten;
  33854. lodash.flattenDeep = flattenDeep;
  33855. lodash.flattenDepth = flattenDepth;
  33856. lodash.flip = flip;
  33857. lodash.flow = flow;
  33858. lodash.flowRight = flowRight;
  33859. lodash.fromPairs = fromPairs;
  33860. lodash.functions = functions;
  33861. lodash.functionsIn = functionsIn;
  33862. lodash.groupBy = groupBy;
  33863. lodash.initial = initial;
  33864. lodash.intersection = intersection;
  33865. lodash.intersectionBy = intersectionBy;
  33866. lodash.intersectionWith = intersectionWith;
  33867. lodash.invert = invert;
  33868. lodash.invertBy = invertBy;
  33869. lodash.invokeMap = invokeMap;
  33870. lodash.iteratee = iteratee;
  33871. lodash.keyBy = keyBy;
  33872. lodash.keys = keys;
  33873. lodash.keysIn = keysIn;
  33874. lodash.map = map;
  33875. lodash.mapKeys = mapKeys;
  33876. lodash.mapValues = mapValues;
  33877. lodash.matches = matches;
  33878. lodash.matchesProperty = matchesProperty;
  33879. lodash.memoize = memoize;
  33880. lodash.merge = merge;
  33881. lodash.mergeWith = mergeWith;
  33882. lodash.method = method;
  33883. lodash.methodOf = methodOf;
  33884. lodash.mixin = mixin;
  33885. lodash.negate = negate;
  33886. lodash.nthArg = nthArg;
  33887. lodash.omit = omit;
  33888. lodash.omitBy = omitBy;
  33889. lodash.once = once;
  33890. lodash.orderBy = orderBy;
  33891. lodash.over = over;
  33892. lodash.overArgs = overArgs;
  33893. lodash.overEvery = overEvery;
  33894. lodash.overSome = overSome;
  33895. lodash.partial = partial;
  33896. lodash.partialRight = partialRight;
  33897. lodash.partition = partition;
  33898. lodash.pick = pick;
  33899. lodash.pickBy = pickBy;
  33900. lodash.property = property;
  33901. lodash.propertyOf = propertyOf;
  33902. lodash.pull = pull;
  33903. lodash.pullAll = pullAll;
  33904. lodash.pullAllBy = pullAllBy;
  33905. lodash.pullAllWith = pullAllWith;
  33906. lodash.pullAt = pullAt;
  33907. lodash.range = range;
  33908. lodash.rangeRight = rangeRight;
  33909. lodash.rearg = rearg;
  33910. lodash.reject = reject;
  33911. lodash.remove = remove;
  33912. lodash.rest = rest;
  33913. lodash.reverse = reverse;
  33914. lodash.sampleSize = sampleSize;
  33915. lodash.set = set;
  33916. lodash.setWith = setWith;
  33917. lodash.shuffle = shuffle;
  33918. lodash.slice = slice;
  33919. lodash.sortBy = sortBy;
  33920. lodash.sortedUniq = sortedUniq;
  33921. lodash.sortedUniqBy = sortedUniqBy;
  33922. lodash.split = split;
  33923. lodash.spread = spread;
  33924. lodash.tail = tail;
  33925. lodash.take = take;
  33926. lodash.takeRight = takeRight;
  33927. lodash.takeRightWhile = takeRightWhile;
  33928. lodash.takeWhile = takeWhile;
  33929. lodash.tap = tap;
  33930. lodash.throttle = throttle;
  33931. lodash.thru = thru;
  33932. lodash.toArray = toArray;
  33933. lodash.toPairs = toPairs;
  33934. lodash.toPairsIn = toPairsIn;
  33935. lodash.toPath = toPath;
  33936. lodash.toPlainObject = toPlainObject;
  33937. lodash.transform = transform;
  33938. lodash.unary = unary;
  33939. lodash.union = union;
  33940. lodash.unionBy = unionBy;
  33941. lodash.unionWith = unionWith;
  33942. lodash.uniq = uniq;
  33943. lodash.uniqBy = uniqBy;
  33944. lodash.uniqWith = uniqWith;
  33945. lodash.unset = unset;
  33946. lodash.unzip = unzip;
  33947. lodash.unzipWith = unzipWith;
  33948. lodash.update = update;
  33949. lodash.updateWith = updateWith;
  33950. lodash.values = values;
  33951. lodash.valuesIn = valuesIn;
  33952. lodash.without = without;
  33953. lodash.words = words;
  33954. lodash.wrap = wrap;
  33955. lodash.xor = xor;
  33956. lodash.xorBy = xorBy;
  33957. lodash.xorWith = xorWith;
  33958. lodash.zip = zip;
  33959. lodash.zipObject = zipObject;
  33960. lodash.zipObjectDeep = zipObjectDeep;
  33961. lodash.zipWith = zipWith;
  33962. // Add aliases.
  33963. lodash.entries = toPairs;
  33964. lodash.entriesIn = toPairsIn;
  33965. lodash.extend = assignIn;
  33966. lodash.extendWith = assignInWith;
  33967. // Add methods to `lodash.prototype`.
  33968. mixin(lodash, lodash);
  33969. /*------------------------------------------------------------------------*/
  33970. // Add methods that return unwrapped values in chain sequences.
  33971. lodash.add = add;
  33972. lodash.attempt = attempt;
  33973. lodash.camelCase = camelCase;
  33974. lodash.capitalize = capitalize;
  33975. lodash.ceil = ceil;
  33976. lodash.clamp = clamp;
  33977. lodash.clone = clone;
  33978. lodash.cloneDeep = cloneDeep;
  33979. lodash.cloneDeepWith = cloneDeepWith;
  33980. lodash.cloneWith = cloneWith;
  33981. lodash.conformsTo = conformsTo;
  33982. lodash.deburr = deburr;
  33983. lodash.defaultTo = defaultTo;
  33984. lodash.divide = divide;
  33985. lodash.endsWith = endsWith;
  33986. lodash.eq = eq;
  33987. lodash.escape = escape;
  33988. lodash.escapeRegExp = escapeRegExp;
  33989. lodash.every = every;
  33990. lodash.find = find;
  33991. lodash.findIndex = findIndex;
  33992. lodash.findKey = findKey;
  33993. lodash.findLast = findLast;
  33994. lodash.findLastIndex = findLastIndex;
  33995. lodash.findLastKey = findLastKey;
  33996. lodash.floor = floor;
  33997. lodash.forEach = forEach;
  33998. lodash.forEachRight = forEachRight;
  33999. lodash.forIn = forIn;
  34000. lodash.forInRight = forInRight;
  34001. lodash.forOwn = forOwn;
  34002. lodash.forOwnRight = forOwnRight;
  34003. lodash.get = get;
  34004. lodash.gt = gt;
  34005. lodash.gte = gte;
  34006. lodash.has = has;
  34007. lodash.hasIn = hasIn;
  34008. lodash.head = head;
  34009. lodash.identity = identity;
  34010. lodash.includes = includes;
  34011. lodash.indexOf = indexOf;
  34012. lodash.inRange = inRange;
  34013. lodash.invoke = invoke;
  34014. lodash.isArguments = isArguments;
  34015. lodash.isArray = isArray;
  34016. lodash.isArrayBuffer = isArrayBuffer;
  34017. lodash.isArrayLike = isArrayLike;
  34018. lodash.isArrayLikeObject = isArrayLikeObject;
  34019. lodash.isBoolean = isBoolean;
  34020. lodash.isBuffer = isBuffer;
  34021. lodash.isDate = isDate;
  34022. lodash.isElement = isElement;
  34023. lodash.isEmpty = isEmpty;
  34024. lodash.isEqual = isEqual;
  34025. lodash.isEqualWith = isEqualWith;
  34026. lodash.isError = isError;
  34027. lodash.isFinite = isFinite;
  34028. lodash.isFunction = isFunction;
  34029. lodash.isInteger = isInteger;
  34030. lodash.isLength = isLength;
  34031. lodash.isMap = isMap;
  34032. lodash.isMatch = isMatch;
  34033. lodash.isMatchWith = isMatchWith;
  34034. lodash.isNaN = isNaN;
  34035. lodash.isNative = isNative;
  34036. lodash.isNil = isNil;
  34037. lodash.isNull = isNull;
  34038. lodash.isNumber = isNumber;
  34039. lodash.isObject = isObject;
  34040. lodash.isObjectLike = isObjectLike;
  34041. lodash.isPlainObject = isPlainObject;
  34042. lodash.isRegExp = isRegExp;
  34043. lodash.isSafeInteger = isSafeInteger;
  34044. lodash.isSet = isSet;
  34045. lodash.isString = isString;
  34046. lodash.isSymbol = isSymbol;
  34047. lodash.isTypedArray = isTypedArray;
  34048. lodash.isUndefined = isUndefined;
  34049. lodash.isWeakMap = isWeakMap;
  34050. lodash.isWeakSet = isWeakSet;
  34051. lodash.join = join;
  34052. lodash.kebabCase = kebabCase;
  34053. lodash.last = last;
  34054. lodash.lastIndexOf = lastIndexOf;
  34055. lodash.lowerCase = lowerCase;
  34056. lodash.lowerFirst = lowerFirst;
  34057. lodash.lt = lt;
  34058. lodash.lte = lte;
  34059. lodash.max = max;
  34060. lodash.maxBy = maxBy;
  34061. lodash.mean = mean;
  34062. lodash.meanBy = meanBy;
  34063. lodash.min = min;
  34064. lodash.minBy = minBy;
  34065. lodash.stubArray = stubArray;
  34066. lodash.stubFalse = stubFalse;
  34067. lodash.stubObject = stubObject;
  34068. lodash.stubString = stubString;
  34069. lodash.stubTrue = stubTrue;
  34070. lodash.multiply = multiply;
  34071. lodash.nth = nth;
  34072. lodash.noConflict = noConflict;
  34073. lodash.noop = noop;
  34074. lodash.now = now;
  34075. lodash.pad = pad;
  34076. lodash.padEnd = padEnd;
  34077. lodash.padStart = padStart;
  34078. lodash.parseInt = parseInt;
  34079. lodash.random = random;
  34080. lodash.reduce = reduce;
  34081. lodash.reduceRight = reduceRight;
  34082. lodash.repeat = repeat;
  34083. lodash.replace = replace;
  34084. lodash.result = result;
  34085. lodash.round = round;
  34086. lodash.runInContext = runInContext;
  34087. lodash.sample = sample;
  34088. lodash.size = size;
  34089. lodash.snakeCase = snakeCase;
  34090. lodash.some = some;
  34091. lodash.sortedIndex = sortedIndex;
  34092. lodash.sortedIndexBy = sortedIndexBy;
  34093. lodash.sortedIndexOf = sortedIndexOf;
  34094. lodash.sortedLastIndex = sortedLastIndex;
  34095. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34096. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34097. lodash.startCase = startCase;
  34098. lodash.startsWith = startsWith;
  34099. lodash.subtract = subtract;
  34100. lodash.sum = sum;
  34101. lodash.sumBy = sumBy;
  34102. lodash.template = template;
  34103. lodash.times = times;
  34104. lodash.toFinite = toFinite;
  34105. lodash.toInteger = toInteger;
  34106. lodash.toLength = toLength;
  34107. lodash.toLower = toLower;
  34108. lodash.toNumber = toNumber;
  34109. lodash.toSafeInteger = toSafeInteger;
  34110. lodash.toString = toString;
  34111. lodash.toUpper = toUpper;
  34112. lodash.trim = trim;
  34113. lodash.trimEnd = trimEnd;
  34114. lodash.trimStart = trimStart;
  34115. lodash.truncate = truncate;
  34116. lodash.unescape = unescape;
  34117. lodash.uniqueId = uniqueId;
  34118. lodash.upperCase = upperCase;
  34119. lodash.upperFirst = upperFirst;
  34120. // Add aliases.
  34121. lodash.each = forEach;
  34122. lodash.eachRight = forEachRight;
  34123. lodash.first = head;
  34124. mixin(lodash, (function() {
  34125. var source = {};
  34126. baseForOwn(lodash, function(func, methodName) {
  34127. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34128. source[methodName] = func;
  34129. }
  34130. });
  34131. return source;
  34132. }()), { 'chain': false });
  34133. /*------------------------------------------------------------------------*/
  34134. /**
  34135. * The semantic version number.
  34136. *
  34137. * @static
  34138. * @memberOf _
  34139. * @type {string}
  34140. */
  34141. lodash.VERSION = VERSION;
  34142. // Assign default placeholders.
  34143. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34144. lodash[methodName].placeholder = lodash;
  34145. });
  34146. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34147. arrayEach(['drop', 'take'], function(methodName, index) {
  34148. LazyWrapper.prototype[methodName] = function(n) {
  34149. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34150. var result = (this.__filtered__ && !index)
  34151. ? new LazyWrapper(this)
  34152. : this.clone();
  34153. if (result.__filtered__) {
  34154. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34155. } else {
  34156. result.__views__.push({
  34157. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34158. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34159. });
  34160. }
  34161. return result;
  34162. };
  34163. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34164. return this.reverse()[methodName](n).reverse();
  34165. };
  34166. });
  34167. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34168. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34169. var type = index + 1,
  34170. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34171. LazyWrapper.prototype[methodName] = function(iteratee) {
  34172. var result = this.clone();
  34173. result.__iteratees__.push({
  34174. 'iteratee': getIteratee(iteratee, 3),
  34175. 'type': type
  34176. });
  34177. result.__filtered__ = result.__filtered__ || isFilter;
  34178. return result;
  34179. };
  34180. });
  34181. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34182. arrayEach(['head', 'last'], function(methodName, index) {
  34183. var takeName = 'take' + (index ? 'Right' : '');
  34184. LazyWrapper.prototype[methodName] = function() {
  34185. return this[takeName](1).value()[0];
  34186. };
  34187. });
  34188. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34189. arrayEach(['initial', 'tail'], function(methodName, index) {
  34190. var dropName = 'drop' + (index ? '' : 'Right');
  34191. LazyWrapper.prototype[methodName] = function() {
  34192. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34193. };
  34194. });
  34195. LazyWrapper.prototype.compact = function() {
  34196. return this.filter(identity);
  34197. };
  34198. LazyWrapper.prototype.find = function(predicate) {
  34199. return this.filter(predicate).head();
  34200. };
  34201. LazyWrapper.prototype.findLast = function(predicate) {
  34202. return this.reverse().find(predicate);
  34203. };
  34204. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34205. if (typeof path == 'function') {
  34206. return new LazyWrapper(this);
  34207. }
  34208. return this.map(function(value) {
  34209. return baseInvoke(value, path, args);
  34210. });
  34211. });
  34212. LazyWrapper.prototype.reject = function(predicate) {
  34213. return this.filter(negate(getIteratee(predicate)));
  34214. };
  34215. LazyWrapper.prototype.slice = function(start, end) {
  34216. start = toInteger(start);
  34217. var result = this;
  34218. if (result.__filtered__ && (start > 0 || end < 0)) {
  34219. return new LazyWrapper(result);
  34220. }
  34221. if (start < 0) {
  34222. result = result.takeRight(-start);
  34223. } else if (start) {
  34224. result = result.drop(start);
  34225. }
  34226. if (end !== undefined) {
  34227. end = toInteger(end);
  34228. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34229. }
  34230. return result;
  34231. };
  34232. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34233. return this.reverse().takeWhile(predicate).reverse();
  34234. };
  34235. LazyWrapper.prototype.toArray = function() {
  34236. return this.take(MAX_ARRAY_LENGTH);
  34237. };
  34238. // Add `LazyWrapper` methods to `lodash.prototype`.
  34239. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34240. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34241. isTaker = /^(?:head|last)$/.test(methodName),
  34242. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34243. retUnwrapped = isTaker || /^find/.test(methodName);
  34244. if (!lodashFunc) {
  34245. return;
  34246. }
  34247. lodash.prototype[methodName] = function() {
  34248. var value = this.__wrapped__,
  34249. args = isTaker ? [1] : arguments,
  34250. isLazy = value instanceof LazyWrapper,
  34251. iteratee = args[0],
  34252. useLazy = isLazy || isArray(value);
  34253. var interceptor = function(value) {
  34254. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34255. return (isTaker && chainAll) ? result[0] : result;
  34256. };
  34257. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34258. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34259. isLazy = useLazy = false;
  34260. }
  34261. var chainAll = this.__chain__,
  34262. isHybrid = !!this.__actions__.length,
  34263. isUnwrapped = retUnwrapped && !chainAll,
  34264. onlyLazy = isLazy && !isHybrid;
  34265. if (!retUnwrapped && useLazy) {
  34266. value = onlyLazy ? value : new LazyWrapper(this);
  34267. var result = func.apply(value, args);
  34268. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34269. return new LodashWrapper(result, chainAll);
  34270. }
  34271. if (isUnwrapped && onlyLazy) {
  34272. return func.apply(this, args);
  34273. }
  34274. result = this.thru(interceptor);
  34275. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34276. };
  34277. });
  34278. // Add `Array` methods to `lodash.prototype`.
  34279. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34280. var func = arrayProto[methodName],
  34281. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34282. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34283. lodash.prototype[methodName] = function() {
  34284. var args = arguments;
  34285. if (retUnwrapped && !this.__chain__) {
  34286. var value = this.value();
  34287. return func.apply(isArray(value) ? value : [], args);
  34288. }
  34289. return this[chainName](function(value) {
  34290. return func.apply(isArray(value) ? value : [], args);
  34291. });
  34292. };
  34293. });
  34294. // Map minified method names to their real names.
  34295. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34296. var lodashFunc = lodash[methodName];
  34297. if (lodashFunc) {
  34298. var key = lodashFunc.name + '';
  34299. if (!hasOwnProperty.call(realNames, key)) {
  34300. realNames[key] = [];
  34301. }
  34302. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34303. }
  34304. });
  34305. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34306. 'name': 'wrapper',
  34307. 'func': undefined
  34308. }];
  34309. // Add methods to `LazyWrapper`.
  34310. LazyWrapper.prototype.clone = lazyClone;
  34311. LazyWrapper.prototype.reverse = lazyReverse;
  34312. LazyWrapper.prototype.value = lazyValue;
  34313. // Add chain sequence methods to the `lodash` wrapper.
  34314. lodash.prototype.at = wrapperAt;
  34315. lodash.prototype.chain = wrapperChain;
  34316. lodash.prototype.commit = wrapperCommit;
  34317. lodash.prototype.next = wrapperNext;
  34318. lodash.prototype.plant = wrapperPlant;
  34319. lodash.prototype.reverse = wrapperReverse;
  34320. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34321. // Add lazy aliases.
  34322. lodash.prototype.first = lodash.prototype.head;
  34323. if (symIterator) {
  34324. lodash.prototype[symIterator] = wrapperToIterator;
  34325. }
  34326. return lodash;
  34327. });
  34328. /*--------------------------------------------------------------------------*/
  34329. // Export lodash.
  34330. var _ = runInContext();
  34331. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34332. if (true) {
  34333. // Expose Lodash on the global object to prevent errors when Lodash is
  34334. // loaded by a script tag in the presence of an AMD loader.
  34335. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34336. // Use `_.noConflict` to remove Lodash from the global object.
  34337. root._ = _;
  34338. // Define as an anonymous module so, through path mapping, it can be
  34339. // referenced as the "underscore" module.
  34340. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34341. return _;
  34342. }).call(exports, __webpack_require__, exports, module),
  34343. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34344. }
  34345. // Check for `exports` after `define` in case a build optimizer adds it.
  34346. else {}
  34347. }.call(this));
  34348. /* 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)))
  34349. /***/ }),
  34350. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34351. /*!***************************************************!*\
  34352. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34353. \***************************************************/
  34354. /*! exports provided: default */
  34355. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34356. "use strict";
  34357. __webpack_require__.r(__webpack_exports__);
  34358. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34359. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34360. * @version 1.16.1
  34361. * @license
  34362. * Copyright (c) 2016 Federico Zivolo and contributors
  34363. *
  34364. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34365. * of this software and associated documentation files (the "Software"), to deal
  34366. * in the Software without restriction, including without limitation the rights
  34367. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34368. * copies of the Software, and to permit persons to whom the Software is
  34369. * furnished to do so, subject to the following conditions:
  34370. *
  34371. * The above copyright notice and this permission notice shall be included in all
  34372. * copies or substantial portions of the Software.
  34373. *
  34374. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34375. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34376. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34377. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34378. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34379. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34380. * SOFTWARE.
  34381. */
  34382. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34383. var timeoutDuration = function () {
  34384. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34385. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34386. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34387. return 1;
  34388. }
  34389. }
  34390. return 0;
  34391. }();
  34392. function microtaskDebounce(fn) {
  34393. var called = false;
  34394. return function () {
  34395. if (called) {
  34396. return;
  34397. }
  34398. called = true;
  34399. window.Promise.resolve().then(function () {
  34400. called = false;
  34401. fn();
  34402. });
  34403. };
  34404. }
  34405. function taskDebounce(fn) {
  34406. var scheduled = false;
  34407. return function () {
  34408. if (!scheduled) {
  34409. scheduled = true;
  34410. setTimeout(function () {
  34411. scheduled = false;
  34412. fn();
  34413. }, timeoutDuration);
  34414. }
  34415. };
  34416. }
  34417. var supportsMicroTasks = isBrowser && window.Promise;
  34418. /**
  34419. * Create a debounced version of a method, that's asynchronously deferred
  34420. * but called in the minimum time possible.
  34421. *
  34422. * @method
  34423. * @memberof Popper.Utils
  34424. * @argument {Function} fn
  34425. * @returns {Function}
  34426. */
  34427. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34428. /**
  34429. * Check if the given variable is a function
  34430. * @method
  34431. * @memberof Popper.Utils
  34432. * @argument {Any} functionToCheck - variable to check
  34433. * @returns {Boolean} answer to: is a function?
  34434. */
  34435. function isFunction(functionToCheck) {
  34436. var getType = {};
  34437. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34438. }
  34439. /**
  34440. * Get CSS computed property of the given element
  34441. * @method
  34442. * @memberof Popper.Utils
  34443. * @argument {Eement} element
  34444. * @argument {String} property
  34445. */
  34446. function getStyleComputedProperty(element, property) {
  34447. if (element.nodeType !== 1) {
  34448. return [];
  34449. }
  34450. // NOTE: 1 DOM access here
  34451. var window = element.ownerDocument.defaultView;
  34452. var css = window.getComputedStyle(element, null);
  34453. return property ? css[property] : css;
  34454. }
  34455. /**
  34456. * Returns the parentNode or the host of the element
  34457. * @method
  34458. * @memberof Popper.Utils
  34459. * @argument {Element} element
  34460. * @returns {Element} parent
  34461. */
  34462. function getParentNode(element) {
  34463. if (element.nodeName === 'HTML') {
  34464. return element;
  34465. }
  34466. return element.parentNode || element.host;
  34467. }
  34468. /**
  34469. * Returns the scrolling parent of the given element
  34470. * @method
  34471. * @memberof Popper.Utils
  34472. * @argument {Element} element
  34473. * @returns {Element} scroll parent
  34474. */
  34475. function getScrollParent(element) {
  34476. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34477. if (!element) {
  34478. return document.body;
  34479. }
  34480. switch (element.nodeName) {
  34481. case 'HTML':
  34482. case 'BODY':
  34483. return element.ownerDocument.body;
  34484. case '#document':
  34485. return element.body;
  34486. }
  34487. // Firefox want us to check `-x` and `-y` variations as well
  34488. var _getStyleComputedProp = getStyleComputedProperty(element),
  34489. overflow = _getStyleComputedProp.overflow,
  34490. overflowX = _getStyleComputedProp.overflowX,
  34491. overflowY = _getStyleComputedProp.overflowY;
  34492. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34493. return element;
  34494. }
  34495. return getScrollParent(getParentNode(element));
  34496. }
  34497. /**
  34498. * Returns the reference node of the reference object, or the reference object itself.
  34499. * @method
  34500. * @memberof Popper.Utils
  34501. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34502. * @returns {Element} parent
  34503. */
  34504. function getReferenceNode(reference) {
  34505. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34506. }
  34507. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34508. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34509. /**
  34510. * Determines if the browser is Internet Explorer
  34511. * @method
  34512. * @memberof Popper.Utils
  34513. * @param {Number} version to check
  34514. * @returns {Boolean} isIE
  34515. */
  34516. function isIE(version) {
  34517. if (version === 11) {
  34518. return isIE11;
  34519. }
  34520. if (version === 10) {
  34521. return isIE10;
  34522. }
  34523. return isIE11 || isIE10;
  34524. }
  34525. /**
  34526. * Returns the offset parent of the given element
  34527. * @method
  34528. * @memberof Popper.Utils
  34529. * @argument {Element} element
  34530. * @returns {Element} offset parent
  34531. */
  34532. function getOffsetParent(element) {
  34533. if (!element) {
  34534. return document.documentElement;
  34535. }
  34536. var noOffsetParent = isIE(10) ? document.body : null;
  34537. // NOTE: 1 DOM access here
  34538. var offsetParent = element.offsetParent || null;
  34539. // Skip hidden elements which don't have an offsetParent
  34540. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34541. offsetParent = (element = element.nextElementSibling).offsetParent;
  34542. }
  34543. var nodeName = offsetParent && offsetParent.nodeName;
  34544. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34545. return element ? element.ownerDocument.documentElement : document.documentElement;
  34546. }
  34547. // .offsetParent will return the closest TH, TD or TABLE in case
  34548. // no offsetParent is present, I hate this job...
  34549. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34550. return getOffsetParent(offsetParent);
  34551. }
  34552. return offsetParent;
  34553. }
  34554. function isOffsetContainer(element) {
  34555. var nodeName = element.nodeName;
  34556. if (nodeName === 'BODY') {
  34557. return false;
  34558. }
  34559. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34560. }
  34561. /**
  34562. * Finds the root node (document, shadowDOM root) of the given element
  34563. * @method
  34564. * @memberof Popper.Utils
  34565. * @argument {Element} node
  34566. * @returns {Element} root node
  34567. */
  34568. function getRoot(node) {
  34569. if (node.parentNode !== null) {
  34570. return getRoot(node.parentNode);
  34571. }
  34572. return node;
  34573. }
  34574. /**
  34575. * Finds the offset parent common to the two provided nodes
  34576. * @method
  34577. * @memberof Popper.Utils
  34578. * @argument {Element} element1
  34579. * @argument {Element} element2
  34580. * @returns {Element} common offset parent
  34581. */
  34582. function findCommonOffsetParent(element1, element2) {
  34583. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34584. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34585. return document.documentElement;
  34586. }
  34587. // Here we make sure to give as "start" the element that comes first in the DOM
  34588. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34589. var start = order ? element1 : element2;
  34590. var end = order ? element2 : element1;
  34591. // Get common ancestor container
  34592. var range = document.createRange();
  34593. range.setStart(start, 0);
  34594. range.setEnd(end, 0);
  34595. var commonAncestorContainer = range.commonAncestorContainer;
  34596. // Both nodes are inside #document
  34597. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34598. if (isOffsetContainer(commonAncestorContainer)) {
  34599. return commonAncestorContainer;
  34600. }
  34601. return getOffsetParent(commonAncestorContainer);
  34602. }
  34603. // one of the nodes is inside shadowDOM, find which one
  34604. var element1root = getRoot(element1);
  34605. if (element1root.host) {
  34606. return findCommonOffsetParent(element1root.host, element2);
  34607. } else {
  34608. return findCommonOffsetParent(element1, getRoot(element2).host);
  34609. }
  34610. }
  34611. /**
  34612. * Gets the scroll value of the given element in the given side (top and left)
  34613. * @method
  34614. * @memberof Popper.Utils
  34615. * @argument {Element} element
  34616. * @argument {String} side `top` or `left`
  34617. * @returns {number} amount of scrolled pixels
  34618. */
  34619. function getScroll(element) {
  34620. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34621. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34622. var nodeName = element.nodeName;
  34623. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34624. var html = element.ownerDocument.documentElement;
  34625. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34626. return scrollingElement[upperSide];
  34627. }
  34628. return element[upperSide];
  34629. }
  34630. /*
  34631. * Sum or subtract the element scroll values (left and top) from a given rect object
  34632. * @method
  34633. * @memberof Popper.Utils
  34634. * @param {Object} rect - Rect object you want to change
  34635. * @param {HTMLElement} element - The element from the function reads the scroll values
  34636. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34637. * @return {Object} rect - The modifier rect object
  34638. */
  34639. function includeScroll(rect, element) {
  34640. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34641. var scrollTop = getScroll(element, 'top');
  34642. var scrollLeft = getScroll(element, 'left');
  34643. var modifier = subtract ? -1 : 1;
  34644. rect.top += scrollTop * modifier;
  34645. rect.bottom += scrollTop * modifier;
  34646. rect.left += scrollLeft * modifier;
  34647. rect.right += scrollLeft * modifier;
  34648. return rect;
  34649. }
  34650. /*
  34651. * Helper to detect borders of a given element
  34652. * @method
  34653. * @memberof Popper.Utils
  34654. * @param {CSSStyleDeclaration} styles
  34655. * Result of `getStyleComputedProperty` on the given element
  34656. * @param {String} axis - `x` or `y`
  34657. * @return {number} borders - The borders size of the given axis
  34658. */
  34659. function getBordersSize(styles, axis) {
  34660. var sideA = axis === 'x' ? 'Left' : 'Top';
  34661. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34662. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34663. }
  34664. function getSize(axis, body, html, computedStyle) {
  34665. 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);
  34666. }
  34667. function getWindowSizes(document) {
  34668. var body = document.body;
  34669. var html = document.documentElement;
  34670. var computedStyle = isIE(10) && getComputedStyle(html);
  34671. return {
  34672. height: getSize('Height', body, html, computedStyle),
  34673. width: getSize('Width', body, html, computedStyle)
  34674. };
  34675. }
  34676. var classCallCheck = function (instance, Constructor) {
  34677. if (!(instance instanceof Constructor)) {
  34678. throw new TypeError("Cannot call a class as a function");
  34679. }
  34680. };
  34681. var createClass = function () {
  34682. function defineProperties(target, props) {
  34683. for (var i = 0; i < props.length; i++) {
  34684. var descriptor = props[i];
  34685. descriptor.enumerable = descriptor.enumerable || false;
  34686. descriptor.configurable = true;
  34687. if ("value" in descriptor) descriptor.writable = true;
  34688. Object.defineProperty(target, descriptor.key, descriptor);
  34689. }
  34690. }
  34691. return function (Constructor, protoProps, staticProps) {
  34692. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34693. if (staticProps) defineProperties(Constructor, staticProps);
  34694. return Constructor;
  34695. };
  34696. }();
  34697. var defineProperty = function (obj, key, value) {
  34698. if (key in obj) {
  34699. Object.defineProperty(obj, key, {
  34700. value: value,
  34701. enumerable: true,
  34702. configurable: true,
  34703. writable: true
  34704. });
  34705. } else {
  34706. obj[key] = value;
  34707. }
  34708. return obj;
  34709. };
  34710. var _extends = Object.assign || function (target) {
  34711. for (var i = 1; i < arguments.length; i++) {
  34712. var source = arguments[i];
  34713. for (var key in source) {
  34714. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34715. target[key] = source[key];
  34716. }
  34717. }
  34718. }
  34719. return target;
  34720. };
  34721. /**
  34722. * Given element offsets, generate an output similar to getBoundingClientRect
  34723. * @method
  34724. * @memberof Popper.Utils
  34725. * @argument {Object} offsets
  34726. * @returns {Object} ClientRect like output
  34727. */
  34728. function getClientRect(offsets) {
  34729. return _extends({}, offsets, {
  34730. right: offsets.left + offsets.width,
  34731. bottom: offsets.top + offsets.height
  34732. });
  34733. }
  34734. /**
  34735. * Get bounding client rect of given element
  34736. * @method
  34737. * @memberof Popper.Utils
  34738. * @param {HTMLElement} element
  34739. * @return {Object} client rect
  34740. */
  34741. function getBoundingClientRect(element) {
  34742. var rect = {};
  34743. // IE10 10 FIX: Please, don't ask, the element isn't
  34744. // considered in DOM in some circumstances...
  34745. // This isn't reproducible in IE10 compatibility mode of IE11
  34746. try {
  34747. if (isIE(10)) {
  34748. rect = element.getBoundingClientRect();
  34749. var scrollTop = getScroll(element, 'top');
  34750. var scrollLeft = getScroll(element, 'left');
  34751. rect.top += scrollTop;
  34752. rect.left += scrollLeft;
  34753. rect.bottom += scrollTop;
  34754. rect.right += scrollLeft;
  34755. } else {
  34756. rect = element.getBoundingClientRect();
  34757. }
  34758. } catch (e) {}
  34759. var result = {
  34760. left: rect.left,
  34761. top: rect.top,
  34762. width: rect.right - rect.left,
  34763. height: rect.bottom - rect.top
  34764. };
  34765. // subtract scrollbar size from sizes
  34766. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34767. var width = sizes.width || element.clientWidth || result.width;
  34768. var height = sizes.height || element.clientHeight || result.height;
  34769. var horizScrollbar = element.offsetWidth - width;
  34770. var vertScrollbar = element.offsetHeight - height;
  34771. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34772. // we make this check conditional for performance reasons
  34773. if (horizScrollbar || vertScrollbar) {
  34774. var styles = getStyleComputedProperty(element);
  34775. horizScrollbar -= getBordersSize(styles, 'x');
  34776. vertScrollbar -= getBordersSize(styles, 'y');
  34777. result.width -= horizScrollbar;
  34778. result.height -= vertScrollbar;
  34779. }
  34780. return getClientRect(result);
  34781. }
  34782. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34783. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34784. var isIE10 = isIE(10);
  34785. var isHTML = parent.nodeName === 'HTML';
  34786. var childrenRect = getBoundingClientRect(children);
  34787. var parentRect = getBoundingClientRect(parent);
  34788. var scrollParent = getScrollParent(children);
  34789. var styles = getStyleComputedProperty(parent);
  34790. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34791. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34792. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34793. if (fixedPosition && isHTML) {
  34794. parentRect.top = Math.max(parentRect.top, 0);
  34795. parentRect.left = Math.max(parentRect.left, 0);
  34796. }
  34797. var offsets = getClientRect({
  34798. top: childrenRect.top - parentRect.top - borderTopWidth,
  34799. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34800. width: childrenRect.width,
  34801. height: childrenRect.height
  34802. });
  34803. offsets.marginTop = 0;
  34804. offsets.marginLeft = 0;
  34805. // Subtract margins of documentElement in case it's being used as parent
  34806. // we do this only on HTML because it's the only element that behaves
  34807. // differently when margins are applied to it. The margins are included in
  34808. // the box of the documentElement, in the other cases not.
  34809. if (!isIE10 && isHTML) {
  34810. var marginTop = parseFloat(styles.marginTop);
  34811. var marginLeft = parseFloat(styles.marginLeft);
  34812. offsets.top -= borderTopWidth - marginTop;
  34813. offsets.bottom -= borderTopWidth - marginTop;
  34814. offsets.left -= borderLeftWidth - marginLeft;
  34815. offsets.right -= borderLeftWidth - marginLeft;
  34816. // Attach marginTop and marginLeft because in some circumstances we may need them
  34817. offsets.marginTop = marginTop;
  34818. offsets.marginLeft = marginLeft;
  34819. }
  34820. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34821. offsets = includeScroll(offsets, parent);
  34822. }
  34823. return offsets;
  34824. }
  34825. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34826. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34827. var html = element.ownerDocument.documentElement;
  34828. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34829. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34830. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34831. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34832. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34833. var offset = {
  34834. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34835. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34836. width: width,
  34837. height: height
  34838. };
  34839. return getClientRect(offset);
  34840. }
  34841. /**
  34842. * Check if the given element is fixed or is inside a fixed parent
  34843. * @method
  34844. * @memberof Popper.Utils
  34845. * @argument {Element} element
  34846. * @argument {Element} customContainer
  34847. * @returns {Boolean} answer to "isFixed?"
  34848. */
  34849. function isFixed(element) {
  34850. var nodeName = element.nodeName;
  34851. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34852. return false;
  34853. }
  34854. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34855. return true;
  34856. }
  34857. var parentNode = getParentNode(element);
  34858. if (!parentNode) {
  34859. return false;
  34860. }
  34861. return isFixed(parentNode);
  34862. }
  34863. /**
  34864. * Finds the first parent of an element that has a transformed property defined
  34865. * @method
  34866. * @memberof Popper.Utils
  34867. * @argument {Element} element
  34868. * @returns {Element} first transformed parent or documentElement
  34869. */
  34870. function getFixedPositionOffsetParent(element) {
  34871. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34872. if (!element || !element.parentElement || isIE()) {
  34873. return document.documentElement;
  34874. }
  34875. var el = element.parentElement;
  34876. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34877. el = el.parentElement;
  34878. }
  34879. return el || document.documentElement;
  34880. }
  34881. /**
  34882. * Computed the boundaries limits and return them
  34883. * @method
  34884. * @memberof Popper.Utils
  34885. * @param {HTMLElement} popper
  34886. * @param {HTMLElement} reference
  34887. * @param {number} padding
  34888. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34889. * @param {Boolean} fixedPosition - Is in fixed position mode
  34890. * @returns {Object} Coordinates of the boundaries
  34891. */
  34892. function getBoundaries(popper, reference, padding, boundariesElement) {
  34893. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34894. // NOTE: 1 DOM access here
  34895. var boundaries = { top: 0, left: 0 };
  34896. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34897. // Handle viewport case
  34898. if (boundariesElement === 'viewport') {
  34899. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34900. } else {
  34901. // Handle other cases based on DOM element used as boundaries
  34902. var boundariesNode = void 0;
  34903. if (boundariesElement === 'scrollParent') {
  34904. boundariesNode = getScrollParent(getParentNode(reference));
  34905. if (boundariesNode.nodeName === 'BODY') {
  34906. boundariesNode = popper.ownerDocument.documentElement;
  34907. }
  34908. } else if (boundariesElement === 'window') {
  34909. boundariesNode = popper.ownerDocument.documentElement;
  34910. } else {
  34911. boundariesNode = boundariesElement;
  34912. }
  34913. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34914. // In case of HTML, we need a different computation
  34915. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34916. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34917. height = _getWindowSizes.height,
  34918. width = _getWindowSizes.width;
  34919. boundaries.top += offsets.top - offsets.marginTop;
  34920. boundaries.bottom = height + offsets.top;
  34921. boundaries.left += offsets.left - offsets.marginLeft;
  34922. boundaries.right = width + offsets.left;
  34923. } else {
  34924. // for all the other DOM elements, this one is good
  34925. boundaries = offsets;
  34926. }
  34927. }
  34928. // Add paddings
  34929. padding = padding || 0;
  34930. var isPaddingNumber = typeof padding === 'number';
  34931. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34932. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34933. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34934. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34935. return boundaries;
  34936. }
  34937. function getArea(_ref) {
  34938. var width = _ref.width,
  34939. height = _ref.height;
  34940. return width * height;
  34941. }
  34942. /**
  34943. * Utility used to transform the `auto` placement to the placement with more
  34944. * available space.
  34945. * @method
  34946. * @memberof Popper.Utils
  34947. * @argument {Object} data - The data object generated by update method
  34948. * @argument {Object} options - Modifiers configuration and options
  34949. * @returns {Object} The data object, properly modified
  34950. */
  34951. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34952. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34953. if (placement.indexOf('auto') === -1) {
  34954. return placement;
  34955. }
  34956. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34957. var rects = {
  34958. top: {
  34959. width: boundaries.width,
  34960. height: refRect.top - boundaries.top
  34961. },
  34962. right: {
  34963. width: boundaries.right - refRect.right,
  34964. height: boundaries.height
  34965. },
  34966. bottom: {
  34967. width: boundaries.width,
  34968. height: boundaries.bottom - refRect.bottom
  34969. },
  34970. left: {
  34971. width: refRect.left - boundaries.left,
  34972. height: boundaries.height
  34973. }
  34974. };
  34975. var sortedAreas = Object.keys(rects).map(function (key) {
  34976. return _extends({
  34977. key: key
  34978. }, rects[key], {
  34979. area: getArea(rects[key])
  34980. });
  34981. }).sort(function (a, b) {
  34982. return b.area - a.area;
  34983. });
  34984. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34985. var width = _ref2.width,
  34986. height = _ref2.height;
  34987. return width >= popper.clientWidth && height >= popper.clientHeight;
  34988. });
  34989. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34990. var variation = placement.split('-')[1];
  34991. return computedPlacement + (variation ? '-' + variation : '');
  34992. }
  34993. /**
  34994. * Get offsets to the reference element
  34995. * @method
  34996. * @memberof Popper.Utils
  34997. * @param {Object} state
  34998. * @param {Element} popper - the popper element
  34999. * @param {Element} reference - the reference element (the popper will be relative to this)
  35000. * @param {Element} fixedPosition - is in fixed position mode
  35001. * @returns {Object} An object containing the offsets which will be applied to the popper
  35002. */
  35003. function getReferenceOffsets(state, popper, reference) {
  35004. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35005. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35006. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35007. }
  35008. /**
  35009. * Get the outer sizes of the given element (offset size + margins)
  35010. * @method
  35011. * @memberof Popper.Utils
  35012. * @argument {Element} element
  35013. * @returns {Object} object containing width and height properties
  35014. */
  35015. function getOuterSizes(element) {
  35016. var window = element.ownerDocument.defaultView;
  35017. var styles = window.getComputedStyle(element);
  35018. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35019. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35020. var result = {
  35021. width: element.offsetWidth + y,
  35022. height: element.offsetHeight + x
  35023. };
  35024. return result;
  35025. }
  35026. /**
  35027. * Get the opposite placement of the given one
  35028. * @method
  35029. * @memberof Popper.Utils
  35030. * @argument {String} placement
  35031. * @returns {String} flipped placement
  35032. */
  35033. function getOppositePlacement(placement) {
  35034. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35035. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35036. return hash[matched];
  35037. });
  35038. }
  35039. /**
  35040. * Get offsets to the popper
  35041. * @method
  35042. * @memberof Popper.Utils
  35043. * @param {Object} position - CSS position the Popper will get applied
  35044. * @param {HTMLElement} popper - the popper element
  35045. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35046. * @param {String} placement - one of the valid placement options
  35047. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35048. */
  35049. function getPopperOffsets(popper, referenceOffsets, placement) {
  35050. placement = placement.split('-')[0];
  35051. // Get popper node sizes
  35052. var popperRect = getOuterSizes(popper);
  35053. // Add position, width and height to our offsets object
  35054. var popperOffsets = {
  35055. width: popperRect.width,
  35056. height: popperRect.height
  35057. };
  35058. // depending by the popper placement we have to compute its offsets slightly differently
  35059. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35060. var mainSide = isHoriz ? 'top' : 'left';
  35061. var secondarySide = isHoriz ? 'left' : 'top';
  35062. var measurement = isHoriz ? 'height' : 'width';
  35063. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35064. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35065. if (placement === secondarySide) {
  35066. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35067. } else {
  35068. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35069. }
  35070. return popperOffsets;
  35071. }
  35072. /**
  35073. * Mimics the `find` method of Array
  35074. * @method
  35075. * @memberof Popper.Utils
  35076. * @argument {Array} arr
  35077. * @argument prop
  35078. * @argument value
  35079. * @returns index or -1
  35080. */
  35081. function find(arr, check) {
  35082. // use native find if supported
  35083. if (Array.prototype.find) {
  35084. return arr.find(check);
  35085. }
  35086. // use `filter` to obtain the same behavior of `find`
  35087. return arr.filter(check)[0];
  35088. }
  35089. /**
  35090. * Return the index of the matching object
  35091. * @method
  35092. * @memberof Popper.Utils
  35093. * @argument {Array} arr
  35094. * @argument prop
  35095. * @argument value
  35096. * @returns index or -1
  35097. */
  35098. function findIndex(arr, prop, value) {
  35099. // use native findIndex if supported
  35100. if (Array.prototype.findIndex) {
  35101. return arr.findIndex(function (cur) {
  35102. return cur[prop] === value;
  35103. });
  35104. }
  35105. // use `find` + `indexOf` if `findIndex` isn't supported
  35106. var match = find(arr, function (obj) {
  35107. return obj[prop] === value;
  35108. });
  35109. return arr.indexOf(match);
  35110. }
  35111. /**
  35112. * Loop trough the list of modifiers and run them in order,
  35113. * each of them will then edit the data object.
  35114. * @method
  35115. * @memberof Popper.Utils
  35116. * @param {dataObject} data
  35117. * @param {Array} modifiers
  35118. * @param {String} ends - Optional modifier name used as stopper
  35119. * @returns {dataObject}
  35120. */
  35121. function runModifiers(modifiers, data, ends) {
  35122. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35123. modifiersToRun.forEach(function (modifier) {
  35124. if (modifier['function']) {
  35125. // eslint-disable-line dot-notation
  35126. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35127. }
  35128. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35129. if (modifier.enabled && isFunction(fn)) {
  35130. // Add properties to offsets to make them a complete clientRect object
  35131. // we do this before each modifier to make sure the previous one doesn't
  35132. // mess with these values
  35133. data.offsets.popper = getClientRect(data.offsets.popper);
  35134. data.offsets.reference = getClientRect(data.offsets.reference);
  35135. data = fn(data, modifier);
  35136. }
  35137. });
  35138. return data;
  35139. }
  35140. /**
  35141. * Updates the position of the popper, computing the new offsets and applying
  35142. * the new style.<br />
  35143. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35144. * @method
  35145. * @memberof Popper
  35146. */
  35147. function update() {
  35148. // if popper is destroyed, don't perform any further update
  35149. if (this.state.isDestroyed) {
  35150. return;
  35151. }
  35152. var data = {
  35153. instance: this,
  35154. styles: {},
  35155. arrowStyles: {},
  35156. attributes: {},
  35157. flipped: false,
  35158. offsets: {}
  35159. };
  35160. // compute reference element offsets
  35161. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35162. // compute auto placement, store placement inside the data object,
  35163. // modifiers will be able to edit `placement` if needed
  35164. // and refer to originalPlacement to know the original value
  35165. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35166. // store the computed placement inside `originalPlacement`
  35167. data.originalPlacement = data.placement;
  35168. data.positionFixed = this.options.positionFixed;
  35169. // compute the popper offsets
  35170. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35171. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35172. // run the modifiers
  35173. data = runModifiers(this.modifiers, data);
  35174. // the first `update` will call `onCreate` callback
  35175. // the other ones will call `onUpdate` callback
  35176. if (!this.state.isCreated) {
  35177. this.state.isCreated = true;
  35178. this.options.onCreate(data);
  35179. } else {
  35180. this.options.onUpdate(data);
  35181. }
  35182. }
  35183. /**
  35184. * Helper used to know if the given modifier is enabled.
  35185. * @method
  35186. * @memberof Popper.Utils
  35187. * @returns {Boolean}
  35188. */
  35189. function isModifierEnabled(modifiers, modifierName) {
  35190. return modifiers.some(function (_ref) {
  35191. var name = _ref.name,
  35192. enabled = _ref.enabled;
  35193. return enabled && name === modifierName;
  35194. });
  35195. }
  35196. /**
  35197. * Get the prefixed supported property name
  35198. * @method
  35199. * @memberof Popper.Utils
  35200. * @argument {String} property (camelCase)
  35201. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35202. */
  35203. function getSupportedPropertyName(property) {
  35204. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35205. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35206. for (var i = 0; i < prefixes.length; i++) {
  35207. var prefix = prefixes[i];
  35208. var toCheck = prefix ? '' + prefix + upperProp : property;
  35209. if (typeof document.body.style[toCheck] !== 'undefined') {
  35210. return toCheck;
  35211. }
  35212. }
  35213. return null;
  35214. }
  35215. /**
  35216. * Destroys the popper.
  35217. * @method
  35218. * @memberof Popper
  35219. */
  35220. function destroy() {
  35221. this.state.isDestroyed = true;
  35222. // touch DOM only if `applyStyle` modifier is enabled
  35223. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35224. this.popper.removeAttribute('x-placement');
  35225. this.popper.style.position = '';
  35226. this.popper.style.top = '';
  35227. this.popper.style.left = '';
  35228. this.popper.style.right = '';
  35229. this.popper.style.bottom = '';
  35230. this.popper.style.willChange = '';
  35231. this.popper.style[getSupportedPropertyName('transform')] = '';
  35232. }
  35233. this.disableEventListeners();
  35234. // remove the popper if user explicitly asked for the deletion on destroy
  35235. // do not use `remove` because IE11 doesn't support it
  35236. if (this.options.removeOnDestroy) {
  35237. this.popper.parentNode.removeChild(this.popper);
  35238. }
  35239. return this;
  35240. }
  35241. /**
  35242. * Get the window associated with the element
  35243. * @argument {Element} element
  35244. * @returns {Window}
  35245. */
  35246. function getWindow(element) {
  35247. var ownerDocument = element.ownerDocument;
  35248. return ownerDocument ? ownerDocument.defaultView : window;
  35249. }
  35250. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35251. var isBody = scrollParent.nodeName === 'BODY';
  35252. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35253. target.addEventListener(event, callback, { passive: true });
  35254. if (!isBody) {
  35255. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35256. }
  35257. scrollParents.push(target);
  35258. }
  35259. /**
  35260. * Setup needed event listeners used to update the popper position
  35261. * @method
  35262. * @memberof Popper.Utils
  35263. * @private
  35264. */
  35265. function setupEventListeners(reference, options, state, updateBound) {
  35266. // Resize event listener on window
  35267. state.updateBound = updateBound;
  35268. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35269. // Scroll event listener on scroll parents
  35270. var scrollElement = getScrollParent(reference);
  35271. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35272. state.scrollElement = scrollElement;
  35273. state.eventsEnabled = true;
  35274. return state;
  35275. }
  35276. /**
  35277. * It will add resize/scroll events and start recalculating
  35278. * position of the popper element when they are triggered.
  35279. * @method
  35280. * @memberof Popper
  35281. */
  35282. function enableEventListeners() {
  35283. if (!this.state.eventsEnabled) {
  35284. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35285. }
  35286. }
  35287. /**
  35288. * Remove event listeners used to update the popper position
  35289. * @method
  35290. * @memberof Popper.Utils
  35291. * @private
  35292. */
  35293. function removeEventListeners(reference, state) {
  35294. // Remove resize event listener on window
  35295. getWindow(reference).removeEventListener('resize', state.updateBound);
  35296. // Remove scroll event listener on scroll parents
  35297. state.scrollParents.forEach(function (target) {
  35298. target.removeEventListener('scroll', state.updateBound);
  35299. });
  35300. // Reset state
  35301. state.updateBound = null;
  35302. state.scrollParents = [];
  35303. state.scrollElement = null;
  35304. state.eventsEnabled = false;
  35305. return state;
  35306. }
  35307. /**
  35308. * It will remove resize/scroll events and won't recalculate popper position
  35309. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35310. * unless you call `update` method manually.
  35311. * @method
  35312. * @memberof Popper
  35313. */
  35314. function disableEventListeners() {
  35315. if (this.state.eventsEnabled) {
  35316. cancelAnimationFrame(this.scheduleUpdate);
  35317. this.state = removeEventListeners(this.reference, this.state);
  35318. }
  35319. }
  35320. /**
  35321. * Tells if a given input is a number
  35322. * @method
  35323. * @memberof Popper.Utils
  35324. * @param {*} input to check
  35325. * @return {Boolean}
  35326. */
  35327. function isNumeric(n) {
  35328. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35329. }
  35330. /**
  35331. * Set the style to the given popper
  35332. * @method
  35333. * @memberof Popper.Utils
  35334. * @argument {Element} element - Element to apply the style to
  35335. * @argument {Object} styles
  35336. * Object with a list of properties and values which will be applied to the element
  35337. */
  35338. function setStyles(element, styles) {
  35339. Object.keys(styles).forEach(function (prop) {
  35340. var unit = '';
  35341. // add unit if the value is numeric and is one of the following
  35342. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35343. unit = 'px';
  35344. }
  35345. element.style[prop] = styles[prop] + unit;
  35346. });
  35347. }
  35348. /**
  35349. * Set the attributes to the given popper
  35350. * @method
  35351. * @memberof Popper.Utils
  35352. * @argument {Element} element - Element to apply the attributes to
  35353. * @argument {Object} styles
  35354. * Object with a list of properties and values which will be applied to the element
  35355. */
  35356. function setAttributes(element, attributes) {
  35357. Object.keys(attributes).forEach(function (prop) {
  35358. var value = attributes[prop];
  35359. if (value !== false) {
  35360. element.setAttribute(prop, attributes[prop]);
  35361. } else {
  35362. element.removeAttribute(prop);
  35363. }
  35364. });
  35365. }
  35366. /**
  35367. * @function
  35368. * @memberof Modifiers
  35369. * @argument {Object} data - The data object generated by `update` method
  35370. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35371. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35372. * @argument {Object} options - Modifiers configuration and options
  35373. * @returns {Object} The same data object
  35374. */
  35375. function applyStyle(data) {
  35376. // any property present in `data.styles` will be applied to the popper,
  35377. // in this way we can make the 3rd party modifiers add custom styles to it
  35378. // Be aware, modifiers could override the properties defined in the previous
  35379. // lines of this modifier!
  35380. setStyles(data.instance.popper, data.styles);
  35381. // any property present in `data.attributes` will be applied to the popper,
  35382. // they will be set as HTML attributes of the element
  35383. setAttributes(data.instance.popper, data.attributes);
  35384. // if arrowElement is defined and arrowStyles has some properties
  35385. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35386. setStyles(data.arrowElement, data.arrowStyles);
  35387. }
  35388. return data;
  35389. }
  35390. /**
  35391. * Set the x-placement attribute before everything else because it could be used
  35392. * to add margins to the popper margins needs to be calculated to get the
  35393. * correct popper offsets.
  35394. * @method
  35395. * @memberof Popper.modifiers
  35396. * @param {HTMLElement} reference - The reference element used to position the popper
  35397. * @param {HTMLElement} popper - The HTML element used as popper
  35398. * @param {Object} options - Popper.js options
  35399. */
  35400. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35401. // compute reference element offsets
  35402. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35403. // compute auto placement, store placement inside the data object,
  35404. // modifiers will be able to edit `placement` if needed
  35405. // and refer to originalPlacement to know the original value
  35406. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35407. popper.setAttribute('x-placement', placement);
  35408. // Apply `position` to popper before anything else because
  35409. // without the position applied we can't guarantee correct computations
  35410. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35411. return options;
  35412. }
  35413. /**
  35414. * @function
  35415. * @memberof Popper.Utils
  35416. * @argument {Object} data - The data object generated by `update` method
  35417. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35418. * @returns {Object} The popper's position offsets rounded
  35419. *
  35420. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35421. * good as it can be within reason.
  35422. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35423. *
  35424. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35425. * as well on High DPI screens).
  35426. *
  35427. * Firefox prefers no rounding for positioning and does not have blurriness on
  35428. * high DPI screens.
  35429. *
  35430. * Only horizontal placement and left/right values need to be considered.
  35431. */
  35432. function getRoundedOffsets(data, shouldRound) {
  35433. var _data$offsets = data.offsets,
  35434. popper = _data$offsets.popper,
  35435. reference = _data$offsets.reference;
  35436. var round = Math.round,
  35437. floor = Math.floor;
  35438. var noRound = function noRound(v) {
  35439. return v;
  35440. };
  35441. var referenceWidth = round(reference.width);
  35442. var popperWidth = round(popper.width);
  35443. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35444. var isVariation = data.placement.indexOf('-') !== -1;
  35445. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35446. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35447. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35448. var verticalToInteger = !shouldRound ? noRound : round;
  35449. return {
  35450. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35451. top: verticalToInteger(popper.top),
  35452. bottom: verticalToInteger(popper.bottom),
  35453. right: horizontalToInteger(popper.right)
  35454. };
  35455. }
  35456. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35457. /**
  35458. * @function
  35459. * @memberof Modifiers
  35460. * @argument {Object} data - The data object generated by `update` method
  35461. * @argument {Object} options - Modifiers configuration and options
  35462. * @returns {Object} The data object, properly modified
  35463. */
  35464. function computeStyle(data, options) {
  35465. var x = options.x,
  35466. y = options.y;
  35467. var popper = data.offsets.popper;
  35468. // Remove this legacy support in Popper.js v2
  35469. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35470. return modifier.name === 'applyStyle';
  35471. }).gpuAcceleration;
  35472. if (legacyGpuAccelerationOption !== undefined) {
  35473. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35474. }
  35475. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35476. var offsetParent = getOffsetParent(data.instance.popper);
  35477. var offsetParentRect = getBoundingClientRect(offsetParent);
  35478. // Styles
  35479. var styles = {
  35480. position: popper.position
  35481. };
  35482. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35483. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35484. var sideB = y === 'right' ? 'left' : 'right';
  35485. // if gpuAcceleration is set to `true` and transform is supported,
  35486. // we use `translate3d` to apply the position to the popper we
  35487. // automatically use the supported prefixed version if needed
  35488. var prefixedProperty = getSupportedPropertyName('transform');
  35489. // now, let's make a step back and look at this code closely (wtf?)
  35490. // If the content of the popper grows once it's been positioned, it
  35491. // may happen that the popper gets misplaced because of the new content
  35492. // overflowing its reference element
  35493. // To avoid this problem, we provide two options (x and y), which allow
  35494. // the consumer to define the offset origin.
  35495. // If we position a popper on top of a reference element, we can set
  35496. // `x` to `top` to make the popper grow towards its top instead of
  35497. // its bottom.
  35498. var left = void 0,
  35499. top = void 0;
  35500. if (sideA === 'bottom') {
  35501. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35502. // and not the bottom of the html element
  35503. if (offsetParent.nodeName === 'HTML') {
  35504. top = -offsetParent.clientHeight + offsets.bottom;
  35505. } else {
  35506. top = -offsetParentRect.height + offsets.bottom;
  35507. }
  35508. } else {
  35509. top = offsets.top;
  35510. }
  35511. if (sideB === 'right') {
  35512. if (offsetParent.nodeName === 'HTML') {
  35513. left = -offsetParent.clientWidth + offsets.right;
  35514. } else {
  35515. left = -offsetParentRect.width + offsets.right;
  35516. }
  35517. } else {
  35518. left = offsets.left;
  35519. }
  35520. if (gpuAcceleration && prefixedProperty) {
  35521. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35522. styles[sideA] = 0;
  35523. styles[sideB] = 0;
  35524. styles.willChange = 'transform';
  35525. } else {
  35526. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35527. var invertTop = sideA === 'bottom' ? -1 : 1;
  35528. var invertLeft = sideB === 'right' ? -1 : 1;
  35529. styles[sideA] = top * invertTop;
  35530. styles[sideB] = left * invertLeft;
  35531. styles.willChange = sideA + ', ' + sideB;
  35532. }
  35533. // Attributes
  35534. var attributes = {
  35535. 'x-placement': data.placement
  35536. };
  35537. // Update `data` attributes, styles and arrowStyles
  35538. data.attributes = _extends({}, attributes, data.attributes);
  35539. data.styles = _extends({}, styles, data.styles);
  35540. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35541. return data;
  35542. }
  35543. /**
  35544. * Helper used to know if the given modifier depends from another one.<br />
  35545. * It checks if the needed modifier is listed and enabled.
  35546. * @method
  35547. * @memberof Popper.Utils
  35548. * @param {Array} modifiers - list of modifiers
  35549. * @param {String} requestingName - name of requesting modifier
  35550. * @param {String} requestedName - name of requested modifier
  35551. * @returns {Boolean}
  35552. */
  35553. function isModifierRequired(modifiers, requestingName, requestedName) {
  35554. var requesting = find(modifiers, function (_ref) {
  35555. var name = _ref.name;
  35556. return name === requestingName;
  35557. });
  35558. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35559. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35560. });
  35561. if (!isRequired) {
  35562. var _requesting = '`' + requestingName + '`';
  35563. var requested = '`' + requestedName + '`';
  35564. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35565. }
  35566. return isRequired;
  35567. }
  35568. /**
  35569. * @function
  35570. * @memberof Modifiers
  35571. * @argument {Object} data - The data object generated by update method
  35572. * @argument {Object} options - Modifiers configuration and options
  35573. * @returns {Object} The data object, properly modified
  35574. */
  35575. function arrow(data, options) {
  35576. var _data$offsets$arrow;
  35577. // arrow depends on keepTogether in order to work
  35578. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35579. return data;
  35580. }
  35581. var arrowElement = options.element;
  35582. // if arrowElement is a string, suppose it's a CSS selector
  35583. if (typeof arrowElement === 'string') {
  35584. arrowElement = data.instance.popper.querySelector(arrowElement);
  35585. // if arrowElement is not found, don't run the modifier
  35586. if (!arrowElement) {
  35587. return data;
  35588. }
  35589. } else {
  35590. // if the arrowElement isn't a query selector we must check that the
  35591. // provided DOM node is child of its popper node
  35592. if (!data.instance.popper.contains(arrowElement)) {
  35593. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35594. return data;
  35595. }
  35596. }
  35597. var placement = data.placement.split('-')[0];
  35598. var _data$offsets = data.offsets,
  35599. popper = _data$offsets.popper,
  35600. reference = _data$offsets.reference;
  35601. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35602. var len = isVertical ? 'height' : 'width';
  35603. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35604. var side = sideCapitalized.toLowerCase();
  35605. var altSide = isVertical ? 'left' : 'top';
  35606. var opSide = isVertical ? 'bottom' : 'right';
  35607. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35608. //
  35609. // extends keepTogether behavior making sure the popper and its
  35610. // reference have enough pixels in conjunction
  35611. //
  35612. // top/left side
  35613. if (reference[opSide] - arrowElementSize < popper[side]) {
  35614. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35615. }
  35616. // bottom/right side
  35617. if (reference[side] + arrowElementSize > popper[opSide]) {
  35618. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35619. }
  35620. data.offsets.popper = getClientRect(data.offsets.popper);
  35621. // compute center of the popper
  35622. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35623. // Compute the sideValue using the updated popper offsets
  35624. // take popper margin in account because we don't have this info available
  35625. var css = getStyleComputedProperty(data.instance.popper);
  35626. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35627. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35628. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35629. // prevent arrowElement from being placed not contiguously to its popper
  35630. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35631. data.arrowElement = arrowElement;
  35632. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35633. return data;
  35634. }
  35635. /**
  35636. * Get the opposite placement variation of the given one
  35637. * @method
  35638. * @memberof Popper.Utils
  35639. * @argument {String} placement variation
  35640. * @returns {String} flipped placement variation
  35641. */
  35642. function getOppositeVariation(variation) {
  35643. if (variation === 'end') {
  35644. return 'start';
  35645. } else if (variation === 'start') {
  35646. return 'end';
  35647. }
  35648. return variation;
  35649. }
  35650. /**
  35651. * List of accepted placements to use as values of the `placement` option.<br />
  35652. * Valid placements are:
  35653. * - `auto`
  35654. * - `top`
  35655. * - `right`
  35656. * - `bottom`
  35657. * - `left`
  35658. *
  35659. * Each placement can have a variation from this list:
  35660. * - `-start`
  35661. * - `-end`
  35662. *
  35663. * Variations are interpreted easily if you think of them as the left to right
  35664. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35665. * is right.<br />
  35666. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35667. *
  35668. * Some valid examples are:
  35669. * - `top-end` (on top of reference, right aligned)
  35670. * - `right-start` (on right of reference, top aligned)
  35671. * - `bottom` (on bottom, centered)
  35672. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35673. *
  35674. * @static
  35675. * @type {Array}
  35676. * @enum {String}
  35677. * @readonly
  35678. * @method placements
  35679. * @memberof Popper
  35680. */
  35681. 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'];
  35682. // Get rid of `auto` `auto-start` and `auto-end`
  35683. var validPlacements = placements.slice(3);
  35684. /**
  35685. * Given an initial placement, returns all the subsequent placements
  35686. * clockwise (or counter-clockwise).
  35687. *
  35688. * @method
  35689. * @memberof Popper.Utils
  35690. * @argument {String} placement - A valid placement (it accepts variations)
  35691. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35692. * @returns {Array} placements including their variations
  35693. */
  35694. function clockwise(placement) {
  35695. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35696. var index = validPlacements.indexOf(placement);
  35697. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35698. return counter ? arr.reverse() : arr;
  35699. }
  35700. var BEHAVIORS = {
  35701. FLIP: 'flip',
  35702. CLOCKWISE: 'clockwise',
  35703. COUNTERCLOCKWISE: 'counterclockwise'
  35704. };
  35705. /**
  35706. * @function
  35707. * @memberof Modifiers
  35708. * @argument {Object} data - The data object generated by update method
  35709. * @argument {Object} options - Modifiers configuration and options
  35710. * @returns {Object} The data object, properly modified
  35711. */
  35712. function flip(data, options) {
  35713. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35714. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35715. return data;
  35716. }
  35717. if (data.flipped && data.placement === data.originalPlacement) {
  35718. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35719. return data;
  35720. }
  35721. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35722. var placement = data.placement.split('-')[0];
  35723. var placementOpposite = getOppositePlacement(placement);
  35724. var variation = data.placement.split('-')[1] || '';
  35725. var flipOrder = [];
  35726. switch (options.behavior) {
  35727. case BEHAVIORS.FLIP:
  35728. flipOrder = [placement, placementOpposite];
  35729. break;
  35730. case BEHAVIORS.CLOCKWISE:
  35731. flipOrder = clockwise(placement);
  35732. break;
  35733. case BEHAVIORS.COUNTERCLOCKWISE:
  35734. flipOrder = clockwise(placement, true);
  35735. break;
  35736. default:
  35737. flipOrder = options.behavior;
  35738. }
  35739. flipOrder.forEach(function (step, index) {
  35740. if (placement !== step || flipOrder.length === index + 1) {
  35741. return data;
  35742. }
  35743. placement = data.placement.split('-')[0];
  35744. placementOpposite = getOppositePlacement(placement);
  35745. var popperOffsets = data.offsets.popper;
  35746. var refOffsets = data.offsets.reference;
  35747. // using floor because the reference offsets may contain decimals we are not going to consider here
  35748. var floor = Math.floor;
  35749. 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);
  35750. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35751. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35752. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35753. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35754. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35755. // flip the variation if required
  35756. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35757. // flips variation if reference element overflows boundaries
  35758. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35759. // flips variation if popper content overflows boundaries
  35760. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35761. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35762. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35763. // this boolean to detect any flip loop
  35764. data.flipped = true;
  35765. if (overlapsRef || overflowsBoundaries) {
  35766. placement = flipOrder[index + 1];
  35767. }
  35768. if (flippedVariation) {
  35769. variation = getOppositeVariation(variation);
  35770. }
  35771. data.placement = placement + (variation ? '-' + variation : '');
  35772. // this object contains `position`, we want to preserve it along with
  35773. // any additional property we may add in the future
  35774. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35775. data = runModifiers(data.instance.modifiers, data, 'flip');
  35776. }
  35777. });
  35778. return data;
  35779. }
  35780. /**
  35781. * @function
  35782. * @memberof Modifiers
  35783. * @argument {Object} data - The data object generated by update method
  35784. * @argument {Object} options - Modifiers configuration and options
  35785. * @returns {Object} The data object, properly modified
  35786. */
  35787. function keepTogether(data) {
  35788. var _data$offsets = data.offsets,
  35789. popper = _data$offsets.popper,
  35790. reference = _data$offsets.reference;
  35791. var placement = data.placement.split('-')[0];
  35792. var floor = Math.floor;
  35793. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35794. var side = isVertical ? 'right' : 'bottom';
  35795. var opSide = isVertical ? 'left' : 'top';
  35796. var measurement = isVertical ? 'width' : 'height';
  35797. if (popper[side] < floor(reference[opSide])) {
  35798. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35799. }
  35800. if (popper[opSide] > floor(reference[side])) {
  35801. data.offsets.popper[opSide] = floor(reference[side]);
  35802. }
  35803. return data;
  35804. }
  35805. /**
  35806. * Converts a string containing value + unit into a px value number
  35807. * @function
  35808. * @memberof {modifiers~offset}
  35809. * @private
  35810. * @argument {String} str - Value + unit string
  35811. * @argument {String} measurement - `height` or `width`
  35812. * @argument {Object} popperOffsets
  35813. * @argument {Object} referenceOffsets
  35814. * @returns {Number|String}
  35815. * Value in pixels, or original string if no values were extracted
  35816. */
  35817. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35818. // separate value from unit
  35819. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35820. var value = +split[1];
  35821. var unit = split[2];
  35822. // If it's not a number it's an operator, I guess
  35823. if (!value) {
  35824. return str;
  35825. }
  35826. if (unit.indexOf('%') === 0) {
  35827. var element = void 0;
  35828. switch (unit) {
  35829. case '%p':
  35830. element = popperOffsets;
  35831. break;
  35832. case '%':
  35833. case '%r':
  35834. default:
  35835. element = referenceOffsets;
  35836. }
  35837. var rect = getClientRect(element);
  35838. return rect[measurement] / 100 * value;
  35839. } else if (unit === 'vh' || unit === 'vw') {
  35840. // if is a vh or vw, we calculate the size based on the viewport
  35841. var size = void 0;
  35842. if (unit === 'vh') {
  35843. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35844. } else {
  35845. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35846. }
  35847. return size / 100 * value;
  35848. } else {
  35849. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35850. // if is an implicit unit, it's px, and we return just the value
  35851. return value;
  35852. }
  35853. }
  35854. /**
  35855. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35856. * @function
  35857. * @memberof {modifiers~offset}
  35858. * @private
  35859. * @argument {String} offset
  35860. * @argument {Object} popperOffsets
  35861. * @argument {Object} referenceOffsets
  35862. * @argument {String} basePlacement
  35863. * @returns {Array} a two cells array with x and y offsets in numbers
  35864. */
  35865. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35866. var offsets = [0, 0];
  35867. // Use height if placement is left or right and index is 0 otherwise use width
  35868. // in this way the first offset will use an axis and the second one
  35869. // will use the other one
  35870. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35871. // Split the offset string to obtain a list of values and operands
  35872. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35873. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35874. return frag.trim();
  35875. });
  35876. // Detect if the offset string contains a pair of values or a single one
  35877. // they could be separated by comma or space
  35878. var divider = fragments.indexOf(find(fragments, function (frag) {
  35879. return frag.search(/,|\s/) !== -1;
  35880. }));
  35881. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35882. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35883. }
  35884. // If divider is found, we divide the list of values and operands to divide
  35885. // them by ofset X and Y.
  35886. var splitRegex = /\s*,\s*|\s+/;
  35887. 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];
  35888. // Convert the values with units to absolute pixels to allow our computations
  35889. ops = ops.map(function (op, index) {
  35890. // Most of the units rely on the orientation of the popper
  35891. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35892. var mergeWithPrevious = false;
  35893. return op
  35894. // This aggregates any `+` or `-` sign that aren't considered operators
  35895. // e.g.: 10 + +5 => [10, +, +5]
  35896. .reduce(function (a, b) {
  35897. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35898. a[a.length - 1] = b;
  35899. mergeWithPrevious = true;
  35900. return a;
  35901. } else if (mergeWithPrevious) {
  35902. a[a.length - 1] += b;
  35903. mergeWithPrevious = false;
  35904. return a;
  35905. } else {
  35906. return a.concat(b);
  35907. }
  35908. }, [])
  35909. // Here we convert the string values into number values (in px)
  35910. .map(function (str) {
  35911. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35912. });
  35913. });
  35914. // Loop trough the offsets arrays and execute the operations
  35915. ops.forEach(function (op, index) {
  35916. op.forEach(function (frag, index2) {
  35917. if (isNumeric(frag)) {
  35918. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35919. }
  35920. });
  35921. });
  35922. return offsets;
  35923. }
  35924. /**
  35925. * @function
  35926. * @memberof Modifiers
  35927. * @argument {Object} data - The data object generated by update method
  35928. * @argument {Object} options - Modifiers configuration and options
  35929. * @argument {Number|String} options.offset=0
  35930. * The offset value as described in the modifier description
  35931. * @returns {Object} The data object, properly modified
  35932. */
  35933. function offset(data, _ref) {
  35934. var offset = _ref.offset;
  35935. var placement = data.placement,
  35936. _data$offsets = data.offsets,
  35937. popper = _data$offsets.popper,
  35938. reference = _data$offsets.reference;
  35939. var basePlacement = placement.split('-')[0];
  35940. var offsets = void 0;
  35941. if (isNumeric(+offset)) {
  35942. offsets = [+offset, 0];
  35943. } else {
  35944. offsets = parseOffset(offset, popper, reference, basePlacement);
  35945. }
  35946. if (basePlacement === 'left') {
  35947. popper.top += offsets[0];
  35948. popper.left -= offsets[1];
  35949. } else if (basePlacement === 'right') {
  35950. popper.top += offsets[0];
  35951. popper.left += offsets[1];
  35952. } else if (basePlacement === 'top') {
  35953. popper.left += offsets[0];
  35954. popper.top -= offsets[1];
  35955. } else if (basePlacement === 'bottom') {
  35956. popper.left += offsets[0];
  35957. popper.top += offsets[1];
  35958. }
  35959. data.popper = popper;
  35960. return data;
  35961. }
  35962. /**
  35963. * @function
  35964. * @memberof Modifiers
  35965. * @argument {Object} data - The data object generated by `update` method
  35966. * @argument {Object} options - Modifiers configuration and options
  35967. * @returns {Object} The data object, properly modified
  35968. */
  35969. function preventOverflow(data, options) {
  35970. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35971. // If offsetParent is the reference element, we really want to
  35972. // go one step up and use the next offsetParent as reference to
  35973. // avoid to make this modifier completely useless and look like broken
  35974. if (data.instance.reference === boundariesElement) {
  35975. boundariesElement = getOffsetParent(boundariesElement);
  35976. }
  35977. // NOTE: DOM access here
  35978. // resets the popper's position so that the document size can be calculated excluding
  35979. // the size of the popper element itself
  35980. var transformProp = getSupportedPropertyName('transform');
  35981. var popperStyles = data.instance.popper.style; // assignment to help minification
  35982. var top = popperStyles.top,
  35983. left = popperStyles.left,
  35984. transform = popperStyles[transformProp];
  35985. popperStyles.top = '';
  35986. popperStyles.left = '';
  35987. popperStyles[transformProp] = '';
  35988. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35989. // NOTE: DOM access here
  35990. // restores the original style properties after the offsets have been computed
  35991. popperStyles.top = top;
  35992. popperStyles.left = left;
  35993. popperStyles[transformProp] = transform;
  35994. options.boundaries = boundaries;
  35995. var order = options.priority;
  35996. var popper = data.offsets.popper;
  35997. var check = {
  35998. primary: function primary(placement) {
  35999. var value = popper[placement];
  36000. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36001. value = Math.max(popper[placement], boundaries[placement]);
  36002. }
  36003. return defineProperty({}, placement, value);
  36004. },
  36005. secondary: function secondary(placement) {
  36006. var mainSide = placement === 'right' ? 'left' : 'top';
  36007. var value = popper[mainSide];
  36008. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36009. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36010. }
  36011. return defineProperty({}, mainSide, value);
  36012. }
  36013. };
  36014. order.forEach(function (placement) {
  36015. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36016. popper = _extends({}, popper, check[side](placement));
  36017. });
  36018. data.offsets.popper = popper;
  36019. return data;
  36020. }
  36021. /**
  36022. * @function
  36023. * @memberof Modifiers
  36024. * @argument {Object} data - The data object generated by `update` method
  36025. * @argument {Object} options - Modifiers configuration and options
  36026. * @returns {Object} The data object, properly modified
  36027. */
  36028. function shift(data) {
  36029. var placement = data.placement;
  36030. var basePlacement = placement.split('-')[0];
  36031. var shiftvariation = placement.split('-')[1];
  36032. // if shift shiftvariation is specified, run the modifier
  36033. if (shiftvariation) {
  36034. var _data$offsets = data.offsets,
  36035. reference = _data$offsets.reference,
  36036. popper = _data$offsets.popper;
  36037. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36038. var side = isVertical ? 'left' : 'top';
  36039. var measurement = isVertical ? 'width' : 'height';
  36040. var shiftOffsets = {
  36041. start: defineProperty({}, side, reference[side]),
  36042. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36043. };
  36044. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36045. }
  36046. return data;
  36047. }
  36048. /**
  36049. * @function
  36050. * @memberof Modifiers
  36051. * @argument {Object} data - The data object generated by update method
  36052. * @argument {Object} options - Modifiers configuration and options
  36053. * @returns {Object} The data object, properly modified
  36054. */
  36055. function hide(data) {
  36056. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36057. return data;
  36058. }
  36059. var refRect = data.offsets.reference;
  36060. var bound = find(data.instance.modifiers, function (modifier) {
  36061. return modifier.name === 'preventOverflow';
  36062. }).boundaries;
  36063. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36064. // Avoid unnecessary DOM access if visibility hasn't changed
  36065. if (data.hide === true) {
  36066. return data;
  36067. }
  36068. data.hide = true;
  36069. data.attributes['x-out-of-boundaries'] = '';
  36070. } else {
  36071. // Avoid unnecessary DOM access if visibility hasn't changed
  36072. if (data.hide === false) {
  36073. return data;
  36074. }
  36075. data.hide = false;
  36076. data.attributes['x-out-of-boundaries'] = false;
  36077. }
  36078. return data;
  36079. }
  36080. /**
  36081. * @function
  36082. * @memberof Modifiers
  36083. * @argument {Object} data - The data object generated by `update` method
  36084. * @argument {Object} options - Modifiers configuration and options
  36085. * @returns {Object} The data object, properly modified
  36086. */
  36087. function inner(data) {
  36088. var placement = data.placement;
  36089. var basePlacement = placement.split('-')[0];
  36090. var _data$offsets = data.offsets,
  36091. popper = _data$offsets.popper,
  36092. reference = _data$offsets.reference;
  36093. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36094. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36095. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36096. data.placement = getOppositePlacement(placement);
  36097. data.offsets.popper = getClientRect(popper);
  36098. return data;
  36099. }
  36100. /**
  36101. * Modifier function, each modifier can have a function of this type assigned
  36102. * to its `fn` property.<br />
  36103. * These functions will be called on each update, this means that you must
  36104. * make sure they are performant enough to avoid performance bottlenecks.
  36105. *
  36106. * @function ModifierFn
  36107. * @argument {dataObject} data - The data object generated by `update` method
  36108. * @argument {Object} options - Modifiers configuration and options
  36109. * @returns {dataObject} The data object, properly modified
  36110. */
  36111. /**
  36112. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36113. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36114. * needed by the library.
  36115. *
  36116. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36117. * All the other properties are configurations that could be tweaked.
  36118. * @namespace modifiers
  36119. */
  36120. var modifiers = {
  36121. /**
  36122. * Modifier used to shift the popper on the start or end of its reference
  36123. * element.<br />
  36124. * It will read the variation of the `placement` property.<br />
  36125. * It can be one either `-end` or `-start`.
  36126. * @memberof modifiers
  36127. * @inner
  36128. */
  36129. shift: {
  36130. /** @prop {number} order=100 - Index used to define the order of execution */
  36131. order: 100,
  36132. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36133. enabled: true,
  36134. /** @prop {ModifierFn} */
  36135. fn: shift
  36136. },
  36137. /**
  36138. * The `offset` modifier can shift your popper on both its axis.
  36139. *
  36140. * It accepts the following units:
  36141. * - `px` or unit-less, interpreted as pixels
  36142. * - `%` or `%r`, percentage relative to the length of the reference element
  36143. * - `%p`, percentage relative to the length of the popper element
  36144. * - `vw`, CSS viewport width unit
  36145. * - `vh`, CSS viewport height unit
  36146. *
  36147. * For length is intended the main axis relative to the placement of the popper.<br />
  36148. * This means that if the placement is `top` or `bottom`, the length will be the
  36149. * `width`. In case of `left` or `right`, it will be the `height`.
  36150. *
  36151. * You can provide a single value (as `Number` or `String`), or a pair of values
  36152. * as `String` divided by a comma or one (or more) white spaces.<br />
  36153. * The latter is a deprecated method because it leads to confusion and will be
  36154. * removed in v2.<br />
  36155. * Additionally, it accepts additions and subtractions between different units.
  36156. * Note that multiplications and divisions aren't supported.
  36157. *
  36158. * Valid examples are:
  36159. * ```
  36160. * 10
  36161. * '10%'
  36162. * '10, 10'
  36163. * '10%, 10'
  36164. * '10 + 10%'
  36165. * '10 - 5vh + 3%'
  36166. * '-10px + 5vh, 5px - 6%'
  36167. * ```
  36168. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36169. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36170. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36171. *
  36172. * @memberof modifiers
  36173. * @inner
  36174. */
  36175. offset: {
  36176. /** @prop {number} order=200 - Index used to define the order of execution */
  36177. order: 200,
  36178. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36179. enabled: true,
  36180. /** @prop {ModifierFn} */
  36181. fn: offset,
  36182. /** @prop {Number|String} offset=0
  36183. * The offset value as described in the modifier description
  36184. */
  36185. offset: 0
  36186. },
  36187. /**
  36188. * Modifier used to prevent the popper from being positioned outside the boundary.
  36189. *
  36190. * A scenario exists where the reference itself is not within the boundaries.<br />
  36191. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36192. * In this case we need to decide whether the popper should either:
  36193. *
  36194. * - detach from the reference and remain "trapped" in the boundaries, or
  36195. * - if it should ignore the boundary and "escape with its reference"
  36196. *
  36197. * When `escapeWithReference` is set to`true` and reference is completely
  36198. * outside its boundaries, the popper will overflow (or completely leave)
  36199. * the boundaries in order to remain attached to the edge of the reference.
  36200. *
  36201. * @memberof modifiers
  36202. * @inner
  36203. */
  36204. preventOverflow: {
  36205. /** @prop {number} order=300 - Index used to define the order of execution */
  36206. order: 300,
  36207. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36208. enabled: true,
  36209. /** @prop {ModifierFn} */
  36210. fn: preventOverflow,
  36211. /**
  36212. * @prop {Array} [priority=['left','right','top','bottom']]
  36213. * Popper will try to prevent overflow following these priorities by default,
  36214. * then, it could overflow on the left and on top of the `boundariesElement`
  36215. */
  36216. priority: ['left', 'right', 'top', 'bottom'],
  36217. /**
  36218. * @prop {number} padding=5
  36219. * Amount of pixel used to define a minimum distance between the boundaries
  36220. * and the popper. This makes sure the popper always has a little padding
  36221. * between the edges of its container
  36222. */
  36223. padding: 5,
  36224. /**
  36225. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36226. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36227. * `viewport` or any DOM element.
  36228. */
  36229. boundariesElement: 'scrollParent'
  36230. },
  36231. /**
  36232. * Modifier used to make sure the reference and its popper stay near each other
  36233. * without leaving any gap between the two. Especially useful when the arrow is
  36234. * enabled and you want to ensure that it points to its reference element.
  36235. * It cares only about the first axis. You can still have poppers with margin
  36236. * between the popper and its reference element.
  36237. * @memberof modifiers
  36238. * @inner
  36239. */
  36240. keepTogether: {
  36241. /** @prop {number} order=400 - Index used to define the order of execution */
  36242. order: 400,
  36243. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36244. enabled: true,
  36245. /** @prop {ModifierFn} */
  36246. fn: keepTogether
  36247. },
  36248. /**
  36249. * This modifier is used to move the `arrowElement` of the popper to make
  36250. * sure it is positioned between the reference element and its popper element.
  36251. * It will read the outer size of the `arrowElement` node to detect how many
  36252. * pixels of conjunction are needed.
  36253. *
  36254. * It has no effect if no `arrowElement` is provided.
  36255. * @memberof modifiers
  36256. * @inner
  36257. */
  36258. arrow: {
  36259. /** @prop {number} order=500 - Index used to define the order of execution */
  36260. order: 500,
  36261. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36262. enabled: true,
  36263. /** @prop {ModifierFn} */
  36264. fn: arrow,
  36265. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36266. element: '[x-arrow]'
  36267. },
  36268. /**
  36269. * Modifier used to flip the popper's placement when it starts to overlap its
  36270. * reference element.
  36271. *
  36272. * Requires the `preventOverflow` modifier before it in order to work.
  36273. *
  36274. * **NOTE:** this modifier will interrupt the current update cycle and will
  36275. * restart it if it detects the need to flip the placement.
  36276. * @memberof modifiers
  36277. * @inner
  36278. */
  36279. flip: {
  36280. /** @prop {number} order=600 - Index used to define the order of execution */
  36281. order: 600,
  36282. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36283. enabled: true,
  36284. /** @prop {ModifierFn} */
  36285. fn: flip,
  36286. /**
  36287. * @prop {String|Array} behavior='flip'
  36288. * The behavior used to change the popper's placement. It can be one of
  36289. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36290. * placements (with optional variations)
  36291. */
  36292. behavior: 'flip',
  36293. /**
  36294. * @prop {number} padding=5
  36295. * The popper will flip if it hits the edges of the `boundariesElement`
  36296. */
  36297. padding: 5,
  36298. /**
  36299. * @prop {String|HTMLElement} boundariesElement='viewport'
  36300. * The element which will define the boundaries of the popper position.
  36301. * The popper will never be placed outside of the defined boundaries
  36302. * (except if `keepTogether` is enabled)
  36303. */
  36304. boundariesElement: 'viewport',
  36305. /**
  36306. * @prop {Boolean} flipVariations=false
  36307. * The popper will switch placement variation between `-start` and `-end` when
  36308. * the reference element overlaps its boundaries.
  36309. *
  36310. * The original placement should have a set variation.
  36311. */
  36312. flipVariations: false,
  36313. /**
  36314. * @prop {Boolean} flipVariationsByContent=false
  36315. * The popper will switch placement variation between `-start` and `-end` when
  36316. * the popper element overlaps its reference boundaries.
  36317. *
  36318. * The original placement should have a set variation.
  36319. */
  36320. flipVariationsByContent: false
  36321. },
  36322. /**
  36323. * Modifier used to make the popper flow toward the inner of the reference element.
  36324. * By default, when this modifier is disabled, the popper will be placed outside
  36325. * the reference element.
  36326. * @memberof modifiers
  36327. * @inner
  36328. */
  36329. inner: {
  36330. /** @prop {number} order=700 - Index used to define the order of execution */
  36331. order: 700,
  36332. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36333. enabled: false,
  36334. /** @prop {ModifierFn} */
  36335. fn: inner
  36336. },
  36337. /**
  36338. * Modifier used to hide the popper when its reference element is outside of the
  36339. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36340. * be used to hide with a CSS selector the popper when its reference is
  36341. * out of boundaries.
  36342. *
  36343. * Requires the `preventOverflow` modifier before it in order to work.
  36344. * @memberof modifiers
  36345. * @inner
  36346. */
  36347. hide: {
  36348. /** @prop {number} order=800 - Index used to define the order of execution */
  36349. order: 800,
  36350. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36351. enabled: true,
  36352. /** @prop {ModifierFn} */
  36353. fn: hide
  36354. },
  36355. /**
  36356. * Computes the style that will be applied to the popper element to gets
  36357. * properly positioned.
  36358. *
  36359. * Note that this modifier will not touch the DOM, it just prepares the styles
  36360. * so that `applyStyle` modifier can apply it. This separation is useful
  36361. * in case you need to replace `applyStyle` with a custom implementation.
  36362. *
  36363. * This modifier has `850` as `order` value to maintain backward compatibility
  36364. * with previous versions of Popper.js. Expect the modifiers ordering method
  36365. * to change in future major versions of the library.
  36366. *
  36367. * @memberof modifiers
  36368. * @inner
  36369. */
  36370. computeStyle: {
  36371. /** @prop {number} order=850 - Index used to define the order of execution */
  36372. order: 850,
  36373. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36374. enabled: true,
  36375. /** @prop {ModifierFn} */
  36376. fn: computeStyle,
  36377. /**
  36378. * @prop {Boolean} gpuAcceleration=true
  36379. * If true, it uses the CSS 3D transformation to position the popper.
  36380. * Otherwise, it will use the `top` and `left` properties
  36381. */
  36382. gpuAcceleration: true,
  36383. /**
  36384. * @prop {string} [x='bottom']
  36385. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36386. * Change this if your popper should grow in a direction different from `bottom`
  36387. */
  36388. x: 'bottom',
  36389. /**
  36390. * @prop {string} [x='left']
  36391. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36392. * Change this if your popper should grow in a direction different from `right`
  36393. */
  36394. y: 'right'
  36395. },
  36396. /**
  36397. * Applies the computed styles to the popper element.
  36398. *
  36399. * All the DOM manipulations are limited to this modifier. This is useful in case
  36400. * you want to integrate Popper.js inside a framework or view library and you
  36401. * want to delegate all the DOM manipulations to it.
  36402. *
  36403. * Note that if you disable this modifier, you must make sure the popper element
  36404. * has its position set to `absolute` before Popper.js can do its work!
  36405. *
  36406. * Just disable this modifier and define your own to achieve the desired effect.
  36407. *
  36408. * @memberof modifiers
  36409. * @inner
  36410. */
  36411. applyStyle: {
  36412. /** @prop {number} order=900 - Index used to define the order of execution */
  36413. order: 900,
  36414. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36415. enabled: true,
  36416. /** @prop {ModifierFn} */
  36417. fn: applyStyle,
  36418. /** @prop {Function} */
  36419. onLoad: applyStyleOnLoad,
  36420. /**
  36421. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36422. * @prop {Boolean} gpuAcceleration=true
  36423. * If true, it uses the CSS 3D transformation to position the popper.
  36424. * Otherwise, it will use the `top` and `left` properties
  36425. */
  36426. gpuAcceleration: undefined
  36427. }
  36428. };
  36429. /**
  36430. * The `dataObject` is an object containing all the information used by Popper.js.
  36431. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36432. * @name dataObject
  36433. * @property {Object} data.instance The Popper.js instance
  36434. * @property {String} data.placement Placement applied to popper
  36435. * @property {String} data.originalPlacement Placement originally defined on init
  36436. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36437. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36438. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36439. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36440. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36441. * @property {Object} data.boundaries Offsets of the popper boundaries
  36442. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36443. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36444. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36445. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36446. */
  36447. /**
  36448. * Default options provided to Popper.js constructor.<br />
  36449. * These can be overridden using the `options` argument of Popper.js.<br />
  36450. * To override an option, simply pass an object with the same
  36451. * structure of the `options` object, as the 3rd argument. For example:
  36452. * ```
  36453. * new Popper(ref, pop, {
  36454. * modifiers: {
  36455. * preventOverflow: { enabled: false }
  36456. * }
  36457. * })
  36458. * ```
  36459. * @type {Object}
  36460. * @static
  36461. * @memberof Popper
  36462. */
  36463. var Defaults = {
  36464. /**
  36465. * Popper's placement.
  36466. * @prop {Popper.placements} placement='bottom'
  36467. */
  36468. placement: 'bottom',
  36469. /**
  36470. * Set this to true if you want popper to position it self in 'fixed' mode
  36471. * @prop {Boolean} positionFixed=false
  36472. */
  36473. positionFixed: false,
  36474. /**
  36475. * Whether events (resize, scroll) are initially enabled.
  36476. * @prop {Boolean} eventsEnabled=true
  36477. */
  36478. eventsEnabled: true,
  36479. /**
  36480. * Set to true if you want to automatically remove the popper when
  36481. * you call the `destroy` method.
  36482. * @prop {Boolean} removeOnDestroy=false
  36483. */
  36484. removeOnDestroy: false,
  36485. /**
  36486. * Callback called when the popper is created.<br />
  36487. * By default, it is set to no-op.<br />
  36488. * Access Popper.js instance with `data.instance`.
  36489. * @prop {onCreate}
  36490. */
  36491. onCreate: function onCreate() {},
  36492. /**
  36493. * Callback called when the popper is updated. This callback is not called
  36494. * on the initialization/creation of the popper, but only on subsequent
  36495. * updates.<br />
  36496. * By default, it is set to no-op.<br />
  36497. * Access Popper.js instance with `data.instance`.
  36498. * @prop {onUpdate}
  36499. */
  36500. onUpdate: function onUpdate() {},
  36501. /**
  36502. * List of modifiers used to modify the offsets before they are applied to the popper.
  36503. * They provide most of the functionalities of Popper.js.
  36504. * @prop {modifiers}
  36505. */
  36506. modifiers: modifiers
  36507. };
  36508. /**
  36509. * @callback onCreate
  36510. * @param {dataObject} data
  36511. */
  36512. /**
  36513. * @callback onUpdate
  36514. * @param {dataObject} data
  36515. */
  36516. // Utils
  36517. // Methods
  36518. var Popper = function () {
  36519. /**
  36520. * Creates a new Popper.js instance.
  36521. * @class Popper
  36522. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36523. * @param {Element} popper - The HTML / XML element used as the popper
  36524. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36525. * @return {Object} instance - The generated Popper.js instance
  36526. */
  36527. function Popper(reference, popper) {
  36528. var _this = this;
  36529. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36530. classCallCheck(this, Popper);
  36531. this.scheduleUpdate = function () {
  36532. return requestAnimationFrame(_this.update);
  36533. };
  36534. // make update() debounced, so that it only runs at most once-per-tick
  36535. this.update = debounce(this.update.bind(this));
  36536. // with {} we create a new object with the options inside it
  36537. this.options = _extends({}, Popper.Defaults, options);
  36538. // init state
  36539. this.state = {
  36540. isDestroyed: false,
  36541. isCreated: false,
  36542. scrollParents: []
  36543. };
  36544. // get reference and popper elements (allow jQuery wrappers)
  36545. this.reference = reference && reference.jquery ? reference[0] : reference;
  36546. this.popper = popper && popper.jquery ? popper[0] : popper;
  36547. // Deep merge modifiers options
  36548. this.options.modifiers = {};
  36549. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36550. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36551. });
  36552. // Refactoring modifiers' list (Object => Array)
  36553. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36554. return _extends({
  36555. name: name
  36556. }, _this.options.modifiers[name]);
  36557. })
  36558. // sort the modifiers by order
  36559. .sort(function (a, b) {
  36560. return a.order - b.order;
  36561. });
  36562. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36563. // such code is executed in the same order of its modifier
  36564. // they could add new properties to their options configuration
  36565. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36566. this.modifiers.forEach(function (modifierOptions) {
  36567. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36568. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36569. }
  36570. });
  36571. // fire the first update to position the popper in the right place
  36572. this.update();
  36573. var eventsEnabled = this.options.eventsEnabled;
  36574. if (eventsEnabled) {
  36575. // setup event listeners, they will take care of update the position in specific situations
  36576. this.enableEventListeners();
  36577. }
  36578. this.state.eventsEnabled = eventsEnabled;
  36579. }
  36580. // We can't use class properties because they don't get listed in the
  36581. // class prototype and break stuff like Sinon stubs
  36582. createClass(Popper, [{
  36583. key: 'update',
  36584. value: function update$$1() {
  36585. return update.call(this);
  36586. }
  36587. }, {
  36588. key: 'destroy',
  36589. value: function destroy$$1() {
  36590. return destroy.call(this);
  36591. }
  36592. }, {
  36593. key: 'enableEventListeners',
  36594. value: function enableEventListeners$$1() {
  36595. return enableEventListeners.call(this);
  36596. }
  36597. }, {
  36598. key: 'disableEventListeners',
  36599. value: function disableEventListeners$$1() {
  36600. return disableEventListeners.call(this);
  36601. }
  36602. /**
  36603. * Schedules an update. It will run on the next UI update available.
  36604. * @method scheduleUpdate
  36605. * @memberof Popper
  36606. */
  36607. /**
  36608. * Collection of utilities useful when writing custom modifiers.
  36609. * Starting from version 1.7, this method is available only if you
  36610. * include `popper-utils.js` before `popper.js`.
  36611. *
  36612. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36613. * and will be removed in v2! Use the PopperUtils module directly instead.
  36614. * Due to the high instability of the methods contained in Utils, we can't
  36615. * guarantee them to follow semver. Use them at your own risk!
  36616. * @static
  36617. * @private
  36618. * @type {Object}
  36619. * @deprecated since version 1.8
  36620. * @member Utils
  36621. * @memberof Popper
  36622. */
  36623. }]);
  36624. return Popper;
  36625. }();
  36626. /**
  36627. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36628. * and lets you use it as replacement of a real DOM node.<br />
  36629. * You can use this method to position a popper relatively to a set of coordinates
  36630. * in case you don't have a DOM node to use as reference.
  36631. *
  36632. * ```
  36633. * new Popper(referenceObject, popperNode);
  36634. * ```
  36635. *
  36636. * NB: This feature isn't supported in Internet Explorer 10.
  36637. * @name referenceObject
  36638. * @property {Function} data.getBoundingClientRect
  36639. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36640. * @property {number} data.clientWidth
  36641. * An ES6 getter that will return the width of the virtual reference element.
  36642. * @property {number} data.clientHeight
  36643. * An ES6 getter that will return the height of the virtual reference element.
  36644. */
  36645. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36646. Popper.placements = placements;
  36647. Popper.Defaults = Defaults;
  36648. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36649. //# sourceMappingURL=popper.js.map
  36650. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36651. /***/ }),
  36652. /***/ "./node_modules/process/browser.js":
  36653. /*!*****************************************!*\
  36654. !*** ./node_modules/process/browser.js ***!
  36655. \*****************************************/
  36656. /*! no static exports found */
  36657. /***/ (function(module, exports) {
  36658. // shim for using process in browser
  36659. var process = module.exports = {};
  36660. // cached from whatever global is present so that test runners that stub it
  36661. // don't break things. But we need to wrap it in a try catch in case it is
  36662. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36663. // function because try/catches deoptimize in certain engines.
  36664. var cachedSetTimeout;
  36665. var cachedClearTimeout;
  36666. function defaultSetTimout() {
  36667. throw new Error('setTimeout has not been defined');
  36668. }
  36669. function defaultClearTimeout () {
  36670. throw new Error('clearTimeout has not been defined');
  36671. }
  36672. (function () {
  36673. try {
  36674. if (typeof setTimeout === 'function') {
  36675. cachedSetTimeout = setTimeout;
  36676. } else {
  36677. cachedSetTimeout = defaultSetTimout;
  36678. }
  36679. } catch (e) {
  36680. cachedSetTimeout = defaultSetTimout;
  36681. }
  36682. try {
  36683. if (typeof clearTimeout === 'function') {
  36684. cachedClearTimeout = clearTimeout;
  36685. } else {
  36686. cachedClearTimeout = defaultClearTimeout;
  36687. }
  36688. } catch (e) {
  36689. cachedClearTimeout = defaultClearTimeout;
  36690. }
  36691. } ())
  36692. function runTimeout(fun) {
  36693. if (cachedSetTimeout === setTimeout) {
  36694. //normal enviroments in sane situations
  36695. return setTimeout(fun, 0);
  36696. }
  36697. // if setTimeout wasn't available but was latter defined
  36698. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36699. cachedSetTimeout = setTimeout;
  36700. return setTimeout(fun, 0);
  36701. }
  36702. try {
  36703. // when when somebody has screwed with setTimeout but no I.E. maddness
  36704. return cachedSetTimeout(fun, 0);
  36705. } catch(e){
  36706. try {
  36707. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36708. return cachedSetTimeout.call(null, fun, 0);
  36709. } catch(e){
  36710. // 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
  36711. return cachedSetTimeout.call(this, fun, 0);
  36712. }
  36713. }
  36714. }
  36715. function runClearTimeout(marker) {
  36716. if (cachedClearTimeout === clearTimeout) {
  36717. //normal enviroments in sane situations
  36718. return clearTimeout(marker);
  36719. }
  36720. // if clearTimeout wasn't available but was latter defined
  36721. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36722. cachedClearTimeout = clearTimeout;
  36723. return clearTimeout(marker);
  36724. }
  36725. try {
  36726. // when when somebody has screwed with setTimeout but no I.E. maddness
  36727. return cachedClearTimeout(marker);
  36728. } catch (e){
  36729. try {
  36730. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36731. return cachedClearTimeout.call(null, marker);
  36732. } catch (e){
  36733. // 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.
  36734. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36735. return cachedClearTimeout.call(this, marker);
  36736. }
  36737. }
  36738. }
  36739. var queue = [];
  36740. var draining = false;
  36741. var currentQueue;
  36742. var queueIndex = -1;
  36743. function cleanUpNextTick() {
  36744. if (!draining || !currentQueue) {
  36745. return;
  36746. }
  36747. draining = false;
  36748. if (currentQueue.length) {
  36749. queue = currentQueue.concat(queue);
  36750. } else {
  36751. queueIndex = -1;
  36752. }
  36753. if (queue.length) {
  36754. drainQueue();
  36755. }
  36756. }
  36757. function drainQueue() {
  36758. if (draining) {
  36759. return;
  36760. }
  36761. var timeout = runTimeout(cleanUpNextTick);
  36762. draining = true;
  36763. var len = queue.length;
  36764. while(len) {
  36765. currentQueue = queue;
  36766. queue = [];
  36767. while (++queueIndex < len) {
  36768. if (currentQueue) {
  36769. currentQueue[queueIndex].run();
  36770. }
  36771. }
  36772. queueIndex = -1;
  36773. len = queue.length;
  36774. }
  36775. currentQueue = null;
  36776. draining = false;
  36777. runClearTimeout(timeout);
  36778. }
  36779. process.nextTick = function (fun) {
  36780. var args = new Array(arguments.length - 1);
  36781. if (arguments.length > 1) {
  36782. for (var i = 1; i < arguments.length; i++) {
  36783. args[i - 1] = arguments[i];
  36784. }
  36785. }
  36786. queue.push(new Item(fun, args));
  36787. if (queue.length === 1 && !draining) {
  36788. runTimeout(drainQueue);
  36789. }
  36790. };
  36791. // v8 likes predictible objects
  36792. function Item(fun, array) {
  36793. this.fun = fun;
  36794. this.array = array;
  36795. }
  36796. Item.prototype.run = function () {
  36797. this.fun.apply(null, this.array);
  36798. };
  36799. process.title = 'browser';
  36800. process.browser = true;
  36801. process.env = {};
  36802. process.argv = [];
  36803. process.version = ''; // empty string to avoid regexp issues
  36804. process.versions = {};
  36805. function noop() {}
  36806. process.on = noop;
  36807. process.addListener = noop;
  36808. process.once = noop;
  36809. process.off = noop;
  36810. process.removeListener = noop;
  36811. process.removeAllListeners = noop;
  36812. process.emit = noop;
  36813. process.prependListener = noop;
  36814. process.prependOnceListener = noop;
  36815. process.listeners = function (name) { return [] }
  36816. process.binding = function (name) {
  36817. throw new Error('process.binding is not supported');
  36818. };
  36819. process.cwd = function () { return '/' };
  36820. process.chdir = function (dir) {
  36821. throw new Error('process.chdir is not supported');
  36822. };
  36823. process.umask = function() { return 0; };
  36824. /***/ }),
  36825. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36826. /*!***************************************************!*\
  36827. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36828. \***************************************************/
  36829. /*! no static exports found */
  36830. /***/ (function(module, exports, __webpack_require__) {
  36831. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36832. * Pusher JavaScript Library v5.0.3
  36833. * https://pusher.com/
  36834. *
  36835. * Copyright 2017, Pusher
  36836. * Released under the MIT licence.
  36837. */
  36838. (function webpackUniversalModuleDefinition(root, factory) {
  36839. if(true)
  36840. module.exports = factory();
  36841. else {}
  36842. })(window, function() {
  36843. return /******/ (function(modules) { // webpackBootstrap
  36844. /******/ // The module cache
  36845. /******/ var installedModules = {};
  36846. /******/
  36847. /******/ // The require function
  36848. /******/ function __webpack_require__(moduleId) {
  36849. /******/
  36850. /******/ // Check if module is in cache
  36851. /******/ if(installedModules[moduleId]) {
  36852. /******/ return installedModules[moduleId].exports;
  36853. /******/ }
  36854. /******/ // Create a new module (and put it into the cache)
  36855. /******/ var module = installedModules[moduleId] = {
  36856. /******/ i: moduleId,
  36857. /******/ l: false,
  36858. /******/ exports: {}
  36859. /******/ };
  36860. /******/
  36861. /******/ // Execute the module function
  36862. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36863. /******/
  36864. /******/ // Flag the module as loaded
  36865. /******/ module.l = true;
  36866. /******/
  36867. /******/ // Return the exports of the module
  36868. /******/ return module.exports;
  36869. /******/ }
  36870. /******/
  36871. /******/
  36872. /******/ // expose the modules object (__webpack_modules__)
  36873. /******/ __webpack_require__.m = modules;
  36874. /******/
  36875. /******/ // expose the module cache
  36876. /******/ __webpack_require__.c = installedModules;
  36877. /******/
  36878. /******/ // define getter function for harmony exports
  36879. /******/ __webpack_require__.d = function(exports, name, getter) {
  36880. /******/ if(!__webpack_require__.o(exports, name)) {
  36881. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36882. /******/ }
  36883. /******/ };
  36884. /******/
  36885. /******/ // define __esModule on exports
  36886. /******/ __webpack_require__.r = function(exports) {
  36887. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36888. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36889. /******/ }
  36890. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36891. /******/ };
  36892. /******/
  36893. /******/ // create a fake namespace object
  36894. /******/ // mode & 1: value is a module id, require it
  36895. /******/ // mode & 2: merge all properties of value into the ns
  36896. /******/ // mode & 4: return value when already ns object
  36897. /******/ // mode & 8|1: behave like require
  36898. /******/ __webpack_require__.t = function(value, mode) {
  36899. /******/ if(mode & 1) value = __webpack_require__(value);
  36900. /******/ if(mode & 8) return value;
  36901. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36902. /******/ var ns = Object.create(null);
  36903. /******/ __webpack_require__.r(ns);
  36904. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36905. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36906. /******/ return ns;
  36907. /******/ };
  36908. /******/
  36909. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36910. /******/ __webpack_require__.n = function(module) {
  36911. /******/ var getter = module && module.__esModule ?
  36912. /******/ function getDefault() { return module['default']; } :
  36913. /******/ function getModuleExports() { return module; };
  36914. /******/ __webpack_require__.d(getter, 'a', getter);
  36915. /******/ return getter;
  36916. /******/ };
  36917. /******/
  36918. /******/ // Object.prototype.hasOwnProperty.call
  36919. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36920. /******/
  36921. /******/ // __webpack_public_path__
  36922. /******/ __webpack_require__.p = "";
  36923. /******/
  36924. /******/
  36925. /******/ // Load entry module and return exports
  36926. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36927. /******/ })
  36928. /************************************************************************/
  36929. /******/ ([
  36930. /* 0 */
  36931. /***/ (function(module, exports, __webpack_require__) {
  36932. (function(nacl) {
  36933. 'use strict';
  36934. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36935. // Public domain.
  36936. //
  36937. // Implementation derived from TweetNaCl version 20140427.
  36938. // See for details: http://tweetnacl.cr.yp.to/
  36939. var gf = function(init) {
  36940. var i, r = new Float64Array(16);
  36941. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36942. return r;
  36943. };
  36944. // Pluggable, initialized in high-level API below.
  36945. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36946. var _0 = new Uint8Array(16);
  36947. var _9 = new Uint8Array(32); _9[0] = 9;
  36948. var gf0 = gf(),
  36949. gf1 = gf([1]),
  36950. _121665 = gf([0xdb41, 1]),
  36951. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36952. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36953. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36954. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36955. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36956. function ts64(x, i, h, l) {
  36957. x[i] = (h >> 24) & 0xff;
  36958. x[i+1] = (h >> 16) & 0xff;
  36959. x[i+2] = (h >> 8) & 0xff;
  36960. x[i+3] = h & 0xff;
  36961. x[i+4] = (l >> 24) & 0xff;
  36962. x[i+5] = (l >> 16) & 0xff;
  36963. x[i+6] = (l >> 8) & 0xff;
  36964. x[i+7] = l & 0xff;
  36965. }
  36966. function vn(x, xi, y, yi, n) {
  36967. var i,d = 0;
  36968. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36969. return (1 & ((d - 1) >>> 8)) - 1;
  36970. }
  36971. function crypto_verify_16(x, xi, y, yi) {
  36972. return vn(x,xi,y,yi,16);
  36973. }
  36974. function crypto_verify_32(x, xi, y, yi) {
  36975. return vn(x,xi,y,yi,32);
  36976. }
  36977. function core_salsa20(o, p, k, c) {
  36978. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36979. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36980. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36981. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36982. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36983. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36984. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36985. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36986. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36987. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36988. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36989. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36990. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36991. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36992. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36993. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36994. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36995. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36996. x15 = j15, u;
  36997. for (var i = 0; i < 20; i += 2) {
  36998. u = x0 + x12 | 0;
  36999. x4 ^= u<<7 | u>>>(32-7);
  37000. u = x4 + x0 | 0;
  37001. x8 ^= u<<9 | u>>>(32-9);
  37002. u = x8 + x4 | 0;
  37003. x12 ^= u<<13 | u>>>(32-13);
  37004. u = x12 + x8 | 0;
  37005. x0 ^= u<<18 | u>>>(32-18);
  37006. u = x5 + x1 | 0;
  37007. x9 ^= u<<7 | u>>>(32-7);
  37008. u = x9 + x5 | 0;
  37009. x13 ^= u<<9 | u>>>(32-9);
  37010. u = x13 + x9 | 0;
  37011. x1 ^= u<<13 | u>>>(32-13);
  37012. u = x1 + x13 | 0;
  37013. x5 ^= u<<18 | u>>>(32-18);
  37014. u = x10 + x6 | 0;
  37015. x14 ^= u<<7 | u>>>(32-7);
  37016. u = x14 + x10 | 0;
  37017. x2 ^= u<<9 | u>>>(32-9);
  37018. u = x2 + x14 | 0;
  37019. x6 ^= u<<13 | u>>>(32-13);
  37020. u = x6 + x2 | 0;
  37021. x10 ^= u<<18 | u>>>(32-18);
  37022. u = x15 + x11 | 0;
  37023. x3 ^= u<<7 | u>>>(32-7);
  37024. u = x3 + x15 | 0;
  37025. x7 ^= u<<9 | u>>>(32-9);
  37026. u = x7 + x3 | 0;
  37027. x11 ^= u<<13 | u>>>(32-13);
  37028. u = x11 + x7 | 0;
  37029. x15 ^= u<<18 | u>>>(32-18);
  37030. u = x0 + x3 | 0;
  37031. x1 ^= u<<7 | u>>>(32-7);
  37032. u = x1 + x0 | 0;
  37033. x2 ^= u<<9 | u>>>(32-9);
  37034. u = x2 + x1 | 0;
  37035. x3 ^= u<<13 | u>>>(32-13);
  37036. u = x3 + x2 | 0;
  37037. x0 ^= u<<18 | u>>>(32-18);
  37038. u = x5 + x4 | 0;
  37039. x6 ^= u<<7 | u>>>(32-7);
  37040. u = x6 + x5 | 0;
  37041. x7 ^= u<<9 | u>>>(32-9);
  37042. u = x7 + x6 | 0;
  37043. x4 ^= u<<13 | u>>>(32-13);
  37044. u = x4 + x7 | 0;
  37045. x5 ^= u<<18 | u>>>(32-18);
  37046. u = x10 + x9 | 0;
  37047. x11 ^= u<<7 | u>>>(32-7);
  37048. u = x11 + x10 | 0;
  37049. x8 ^= u<<9 | u>>>(32-9);
  37050. u = x8 + x11 | 0;
  37051. x9 ^= u<<13 | u>>>(32-13);
  37052. u = x9 + x8 | 0;
  37053. x10 ^= u<<18 | u>>>(32-18);
  37054. u = x15 + x14 | 0;
  37055. x12 ^= u<<7 | u>>>(32-7);
  37056. u = x12 + x15 | 0;
  37057. x13 ^= u<<9 | u>>>(32-9);
  37058. u = x13 + x12 | 0;
  37059. x14 ^= u<<13 | u>>>(32-13);
  37060. u = x14 + x13 | 0;
  37061. x15 ^= u<<18 | u>>>(32-18);
  37062. }
  37063. x0 = x0 + j0 | 0;
  37064. x1 = x1 + j1 | 0;
  37065. x2 = x2 + j2 | 0;
  37066. x3 = x3 + j3 | 0;
  37067. x4 = x4 + j4 | 0;
  37068. x5 = x5 + j5 | 0;
  37069. x6 = x6 + j6 | 0;
  37070. x7 = x7 + j7 | 0;
  37071. x8 = x8 + j8 | 0;
  37072. x9 = x9 + j9 | 0;
  37073. x10 = x10 + j10 | 0;
  37074. x11 = x11 + j11 | 0;
  37075. x12 = x12 + j12 | 0;
  37076. x13 = x13 + j13 | 0;
  37077. x14 = x14 + j14 | 0;
  37078. x15 = x15 + j15 | 0;
  37079. o[ 0] = x0 >>> 0 & 0xff;
  37080. o[ 1] = x0 >>> 8 & 0xff;
  37081. o[ 2] = x0 >>> 16 & 0xff;
  37082. o[ 3] = x0 >>> 24 & 0xff;
  37083. o[ 4] = x1 >>> 0 & 0xff;
  37084. o[ 5] = x1 >>> 8 & 0xff;
  37085. o[ 6] = x1 >>> 16 & 0xff;
  37086. o[ 7] = x1 >>> 24 & 0xff;
  37087. o[ 8] = x2 >>> 0 & 0xff;
  37088. o[ 9] = x2 >>> 8 & 0xff;
  37089. o[10] = x2 >>> 16 & 0xff;
  37090. o[11] = x2 >>> 24 & 0xff;
  37091. o[12] = x3 >>> 0 & 0xff;
  37092. o[13] = x3 >>> 8 & 0xff;
  37093. o[14] = x3 >>> 16 & 0xff;
  37094. o[15] = x3 >>> 24 & 0xff;
  37095. o[16] = x4 >>> 0 & 0xff;
  37096. o[17] = x4 >>> 8 & 0xff;
  37097. o[18] = x4 >>> 16 & 0xff;
  37098. o[19] = x4 >>> 24 & 0xff;
  37099. o[20] = x5 >>> 0 & 0xff;
  37100. o[21] = x5 >>> 8 & 0xff;
  37101. o[22] = x5 >>> 16 & 0xff;
  37102. o[23] = x5 >>> 24 & 0xff;
  37103. o[24] = x6 >>> 0 & 0xff;
  37104. o[25] = x6 >>> 8 & 0xff;
  37105. o[26] = x6 >>> 16 & 0xff;
  37106. o[27] = x6 >>> 24 & 0xff;
  37107. o[28] = x7 >>> 0 & 0xff;
  37108. o[29] = x7 >>> 8 & 0xff;
  37109. o[30] = x7 >>> 16 & 0xff;
  37110. o[31] = x7 >>> 24 & 0xff;
  37111. o[32] = x8 >>> 0 & 0xff;
  37112. o[33] = x8 >>> 8 & 0xff;
  37113. o[34] = x8 >>> 16 & 0xff;
  37114. o[35] = x8 >>> 24 & 0xff;
  37115. o[36] = x9 >>> 0 & 0xff;
  37116. o[37] = x9 >>> 8 & 0xff;
  37117. o[38] = x9 >>> 16 & 0xff;
  37118. o[39] = x9 >>> 24 & 0xff;
  37119. o[40] = x10 >>> 0 & 0xff;
  37120. o[41] = x10 >>> 8 & 0xff;
  37121. o[42] = x10 >>> 16 & 0xff;
  37122. o[43] = x10 >>> 24 & 0xff;
  37123. o[44] = x11 >>> 0 & 0xff;
  37124. o[45] = x11 >>> 8 & 0xff;
  37125. o[46] = x11 >>> 16 & 0xff;
  37126. o[47] = x11 >>> 24 & 0xff;
  37127. o[48] = x12 >>> 0 & 0xff;
  37128. o[49] = x12 >>> 8 & 0xff;
  37129. o[50] = x12 >>> 16 & 0xff;
  37130. o[51] = x12 >>> 24 & 0xff;
  37131. o[52] = x13 >>> 0 & 0xff;
  37132. o[53] = x13 >>> 8 & 0xff;
  37133. o[54] = x13 >>> 16 & 0xff;
  37134. o[55] = x13 >>> 24 & 0xff;
  37135. o[56] = x14 >>> 0 & 0xff;
  37136. o[57] = x14 >>> 8 & 0xff;
  37137. o[58] = x14 >>> 16 & 0xff;
  37138. o[59] = x14 >>> 24 & 0xff;
  37139. o[60] = x15 >>> 0 & 0xff;
  37140. o[61] = x15 >>> 8 & 0xff;
  37141. o[62] = x15 >>> 16 & 0xff;
  37142. o[63] = x15 >>> 24 & 0xff;
  37143. }
  37144. function core_hsalsa20(o,p,k,c) {
  37145. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37146. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37147. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37148. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37149. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37150. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37151. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37152. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37153. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37154. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37155. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37156. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37157. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37158. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37159. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37160. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37161. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37162. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37163. x15 = j15, u;
  37164. for (var i = 0; i < 20; i += 2) {
  37165. u = x0 + x12 | 0;
  37166. x4 ^= u<<7 | u>>>(32-7);
  37167. u = x4 + x0 | 0;
  37168. x8 ^= u<<9 | u>>>(32-9);
  37169. u = x8 + x4 | 0;
  37170. x12 ^= u<<13 | u>>>(32-13);
  37171. u = x12 + x8 | 0;
  37172. x0 ^= u<<18 | u>>>(32-18);
  37173. u = x5 + x1 | 0;
  37174. x9 ^= u<<7 | u>>>(32-7);
  37175. u = x9 + x5 | 0;
  37176. x13 ^= u<<9 | u>>>(32-9);
  37177. u = x13 + x9 | 0;
  37178. x1 ^= u<<13 | u>>>(32-13);
  37179. u = x1 + x13 | 0;
  37180. x5 ^= u<<18 | u>>>(32-18);
  37181. u = x10 + x6 | 0;
  37182. x14 ^= u<<7 | u>>>(32-7);
  37183. u = x14 + x10 | 0;
  37184. x2 ^= u<<9 | u>>>(32-9);
  37185. u = x2 + x14 | 0;
  37186. x6 ^= u<<13 | u>>>(32-13);
  37187. u = x6 + x2 | 0;
  37188. x10 ^= u<<18 | u>>>(32-18);
  37189. u = x15 + x11 | 0;
  37190. x3 ^= u<<7 | u>>>(32-7);
  37191. u = x3 + x15 | 0;
  37192. x7 ^= u<<9 | u>>>(32-9);
  37193. u = x7 + x3 | 0;
  37194. x11 ^= u<<13 | u>>>(32-13);
  37195. u = x11 + x7 | 0;
  37196. x15 ^= u<<18 | u>>>(32-18);
  37197. u = x0 + x3 | 0;
  37198. x1 ^= u<<7 | u>>>(32-7);
  37199. u = x1 + x0 | 0;
  37200. x2 ^= u<<9 | u>>>(32-9);
  37201. u = x2 + x1 | 0;
  37202. x3 ^= u<<13 | u>>>(32-13);
  37203. u = x3 + x2 | 0;
  37204. x0 ^= u<<18 | u>>>(32-18);
  37205. u = x5 + x4 | 0;
  37206. x6 ^= u<<7 | u>>>(32-7);
  37207. u = x6 + x5 | 0;
  37208. x7 ^= u<<9 | u>>>(32-9);
  37209. u = x7 + x6 | 0;
  37210. x4 ^= u<<13 | u>>>(32-13);
  37211. u = x4 + x7 | 0;
  37212. x5 ^= u<<18 | u>>>(32-18);
  37213. u = x10 + x9 | 0;
  37214. x11 ^= u<<7 | u>>>(32-7);
  37215. u = x11 + x10 | 0;
  37216. x8 ^= u<<9 | u>>>(32-9);
  37217. u = x8 + x11 | 0;
  37218. x9 ^= u<<13 | u>>>(32-13);
  37219. u = x9 + x8 | 0;
  37220. x10 ^= u<<18 | u>>>(32-18);
  37221. u = x15 + x14 | 0;
  37222. x12 ^= u<<7 | u>>>(32-7);
  37223. u = x12 + x15 | 0;
  37224. x13 ^= u<<9 | u>>>(32-9);
  37225. u = x13 + x12 | 0;
  37226. x14 ^= u<<13 | u>>>(32-13);
  37227. u = x14 + x13 | 0;
  37228. x15 ^= u<<18 | u>>>(32-18);
  37229. }
  37230. o[ 0] = x0 >>> 0 & 0xff;
  37231. o[ 1] = x0 >>> 8 & 0xff;
  37232. o[ 2] = x0 >>> 16 & 0xff;
  37233. o[ 3] = x0 >>> 24 & 0xff;
  37234. o[ 4] = x5 >>> 0 & 0xff;
  37235. o[ 5] = x5 >>> 8 & 0xff;
  37236. o[ 6] = x5 >>> 16 & 0xff;
  37237. o[ 7] = x5 >>> 24 & 0xff;
  37238. o[ 8] = x10 >>> 0 & 0xff;
  37239. o[ 9] = x10 >>> 8 & 0xff;
  37240. o[10] = x10 >>> 16 & 0xff;
  37241. o[11] = x10 >>> 24 & 0xff;
  37242. o[12] = x15 >>> 0 & 0xff;
  37243. o[13] = x15 >>> 8 & 0xff;
  37244. o[14] = x15 >>> 16 & 0xff;
  37245. o[15] = x15 >>> 24 & 0xff;
  37246. o[16] = x6 >>> 0 & 0xff;
  37247. o[17] = x6 >>> 8 & 0xff;
  37248. o[18] = x6 >>> 16 & 0xff;
  37249. o[19] = x6 >>> 24 & 0xff;
  37250. o[20] = x7 >>> 0 & 0xff;
  37251. o[21] = x7 >>> 8 & 0xff;
  37252. o[22] = x7 >>> 16 & 0xff;
  37253. o[23] = x7 >>> 24 & 0xff;
  37254. o[24] = x8 >>> 0 & 0xff;
  37255. o[25] = x8 >>> 8 & 0xff;
  37256. o[26] = x8 >>> 16 & 0xff;
  37257. o[27] = x8 >>> 24 & 0xff;
  37258. o[28] = x9 >>> 0 & 0xff;
  37259. o[29] = x9 >>> 8 & 0xff;
  37260. o[30] = x9 >>> 16 & 0xff;
  37261. o[31] = x9 >>> 24 & 0xff;
  37262. }
  37263. function crypto_core_salsa20(out,inp,k,c) {
  37264. core_salsa20(out,inp,k,c);
  37265. }
  37266. function crypto_core_hsalsa20(out,inp,k,c) {
  37267. core_hsalsa20(out,inp,k,c);
  37268. }
  37269. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37270. // "expand 32-byte k"
  37271. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37272. var z = new Uint8Array(16), x = new Uint8Array(64);
  37273. var u, i;
  37274. for (i = 0; i < 16; i++) z[i] = 0;
  37275. for (i = 0; i < 8; i++) z[i] = n[i];
  37276. while (b >= 64) {
  37277. crypto_core_salsa20(x,z,k,sigma);
  37278. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37279. u = 1;
  37280. for (i = 8; i < 16; i++) {
  37281. u = u + (z[i] & 0xff) | 0;
  37282. z[i] = u & 0xff;
  37283. u >>>= 8;
  37284. }
  37285. b -= 64;
  37286. cpos += 64;
  37287. mpos += 64;
  37288. }
  37289. if (b > 0) {
  37290. crypto_core_salsa20(x,z,k,sigma);
  37291. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37292. }
  37293. return 0;
  37294. }
  37295. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37296. var z = new Uint8Array(16), x = new Uint8Array(64);
  37297. var u, i;
  37298. for (i = 0; i < 16; i++) z[i] = 0;
  37299. for (i = 0; i < 8; i++) z[i] = n[i];
  37300. while (b >= 64) {
  37301. crypto_core_salsa20(x,z,k,sigma);
  37302. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37303. u = 1;
  37304. for (i = 8; i < 16; i++) {
  37305. u = u + (z[i] & 0xff) | 0;
  37306. z[i] = u & 0xff;
  37307. u >>>= 8;
  37308. }
  37309. b -= 64;
  37310. cpos += 64;
  37311. }
  37312. if (b > 0) {
  37313. crypto_core_salsa20(x,z,k,sigma);
  37314. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37315. }
  37316. return 0;
  37317. }
  37318. function crypto_stream(c,cpos,d,n,k) {
  37319. var s = new Uint8Array(32);
  37320. crypto_core_hsalsa20(s,n,k,sigma);
  37321. var sn = new Uint8Array(8);
  37322. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37323. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37324. }
  37325. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37326. var s = new Uint8Array(32);
  37327. crypto_core_hsalsa20(s,n,k,sigma);
  37328. var sn = new Uint8Array(8);
  37329. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37330. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37331. }
  37332. /*
  37333. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37334. * https://github.com/floodyberry/poly1305-donna
  37335. */
  37336. var poly1305 = function(key) {
  37337. this.buffer = new Uint8Array(16);
  37338. this.r = new Uint16Array(10);
  37339. this.h = new Uint16Array(10);
  37340. this.pad = new Uint16Array(8);
  37341. this.leftover = 0;
  37342. this.fin = 0;
  37343. var t0, t1, t2, t3, t4, t5, t6, t7;
  37344. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37345. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37346. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37347. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37348. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37349. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37350. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37351. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37352. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37353. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37354. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37355. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37356. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37357. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37358. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37359. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37360. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37361. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37362. };
  37363. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37364. var hibit = this.fin ? 0 : (1 << 11);
  37365. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37366. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37367. var h0 = this.h[0],
  37368. h1 = this.h[1],
  37369. h2 = this.h[2],
  37370. h3 = this.h[3],
  37371. h4 = this.h[4],
  37372. h5 = this.h[5],
  37373. h6 = this.h[6],
  37374. h7 = this.h[7],
  37375. h8 = this.h[8],
  37376. h9 = this.h[9];
  37377. var r0 = this.r[0],
  37378. r1 = this.r[1],
  37379. r2 = this.r[2],
  37380. r3 = this.r[3],
  37381. r4 = this.r[4],
  37382. r5 = this.r[5],
  37383. r6 = this.r[6],
  37384. r7 = this.r[7],
  37385. r8 = this.r[8],
  37386. r9 = this.r[9];
  37387. while (bytes >= 16) {
  37388. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37389. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37390. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37391. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37392. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37393. h5 += ((t4 >>> 1)) & 0x1fff;
  37394. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37395. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37396. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37397. h9 += ((t7 >>> 5)) | hibit;
  37398. c = 0;
  37399. d0 = c;
  37400. d0 += h0 * r0;
  37401. d0 += h1 * (5 * r9);
  37402. d0 += h2 * (5 * r8);
  37403. d0 += h3 * (5 * r7);
  37404. d0 += h4 * (5 * r6);
  37405. c = (d0 >>> 13); d0 &= 0x1fff;
  37406. d0 += h5 * (5 * r5);
  37407. d0 += h6 * (5 * r4);
  37408. d0 += h7 * (5 * r3);
  37409. d0 += h8 * (5 * r2);
  37410. d0 += h9 * (5 * r1);
  37411. c += (d0 >>> 13); d0 &= 0x1fff;
  37412. d1 = c;
  37413. d1 += h0 * r1;
  37414. d1 += h1 * r0;
  37415. d1 += h2 * (5 * r9);
  37416. d1 += h3 * (5 * r8);
  37417. d1 += h4 * (5 * r7);
  37418. c = (d1 >>> 13); d1 &= 0x1fff;
  37419. d1 += h5 * (5 * r6);
  37420. d1 += h6 * (5 * r5);
  37421. d1 += h7 * (5 * r4);
  37422. d1 += h8 * (5 * r3);
  37423. d1 += h9 * (5 * r2);
  37424. c += (d1 >>> 13); d1 &= 0x1fff;
  37425. d2 = c;
  37426. d2 += h0 * r2;
  37427. d2 += h1 * r1;
  37428. d2 += h2 * r0;
  37429. d2 += h3 * (5 * r9);
  37430. d2 += h4 * (5 * r8);
  37431. c = (d2 >>> 13); d2 &= 0x1fff;
  37432. d2 += h5 * (5 * r7);
  37433. d2 += h6 * (5 * r6);
  37434. d2 += h7 * (5 * r5);
  37435. d2 += h8 * (5 * r4);
  37436. d2 += h9 * (5 * r3);
  37437. c += (d2 >>> 13); d2 &= 0x1fff;
  37438. d3 = c;
  37439. d3 += h0 * r3;
  37440. d3 += h1 * r2;
  37441. d3 += h2 * r1;
  37442. d3 += h3 * r0;
  37443. d3 += h4 * (5 * r9);
  37444. c = (d3 >>> 13); d3 &= 0x1fff;
  37445. d3 += h5 * (5 * r8);
  37446. d3 += h6 * (5 * r7);
  37447. d3 += h7 * (5 * r6);
  37448. d3 += h8 * (5 * r5);
  37449. d3 += h9 * (5 * r4);
  37450. c += (d3 >>> 13); d3 &= 0x1fff;
  37451. d4 = c;
  37452. d4 += h0 * r4;
  37453. d4 += h1 * r3;
  37454. d4 += h2 * r2;
  37455. d4 += h3 * r1;
  37456. d4 += h4 * r0;
  37457. c = (d4 >>> 13); d4 &= 0x1fff;
  37458. d4 += h5 * (5 * r9);
  37459. d4 += h6 * (5 * r8);
  37460. d4 += h7 * (5 * r7);
  37461. d4 += h8 * (5 * r6);
  37462. d4 += h9 * (5 * r5);
  37463. c += (d4 >>> 13); d4 &= 0x1fff;
  37464. d5 = c;
  37465. d5 += h0 * r5;
  37466. d5 += h1 * r4;
  37467. d5 += h2 * r3;
  37468. d5 += h3 * r2;
  37469. d5 += h4 * r1;
  37470. c = (d5 >>> 13); d5 &= 0x1fff;
  37471. d5 += h5 * r0;
  37472. d5 += h6 * (5 * r9);
  37473. d5 += h7 * (5 * r8);
  37474. d5 += h8 * (5 * r7);
  37475. d5 += h9 * (5 * r6);
  37476. c += (d5 >>> 13); d5 &= 0x1fff;
  37477. d6 = c;
  37478. d6 += h0 * r6;
  37479. d6 += h1 * r5;
  37480. d6 += h2 * r4;
  37481. d6 += h3 * r3;
  37482. d6 += h4 * r2;
  37483. c = (d6 >>> 13); d6 &= 0x1fff;
  37484. d6 += h5 * r1;
  37485. d6 += h6 * r0;
  37486. d6 += h7 * (5 * r9);
  37487. d6 += h8 * (5 * r8);
  37488. d6 += h9 * (5 * r7);
  37489. c += (d6 >>> 13); d6 &= 0x1fff;
  37490. d7 = c;
  37491. d7 += h0 * r7;
  37492. d7 += h1 * r6;
  37493. d7 += h2 * r5;
  37494. d7 += h3 * r4;
  37495. d7 += h4 * r3;
  37496. c = (d7 >>> 13); d7 &= 0x1fff;
  37497. d7 += h5 * r2;
  37498. d7 += h6 * r1;
  37499. d7 += h7 * r0;
  37500. d7 += h8 * (5 * r9);
  37501. d7 += h9 * (5 * r8);
  37502. c += (d7 >>> 13); d7 &= 0x1fff;
  37503. d8 = c;
  37504. d8 += h0 * r8;
  37505. d8 += h1 * r7;
  37506. d8 += h2 * r6;
  37507. d8 += h3 * r5;
  37508. d8 += h4 * r4;
  37509. c = (d8 >>> 13); d8 &= 0x1fff;
  37510. d8 += h5 * r3;
  37511. d8 += h6 * r2;
  37512. d8 += h7 * r1;
  37513. d8 += h8 * r0;
  37514. d8 += h9 * (5 * r9);
  37515. c += (d8 >>> 13); d8 &= 0x1fff;
  37516. d9 = c;
  37517. d9 += h0 * r9;
  37518. d9 += h1 * r8;
  37519. d9 += h2 * r7;
  37520. d9 += h3 * r6;
  37521. d9 += h4 * r5;
  37522. c = (d9 >>> 13); d9 &= 0x1fff;
  37523. d9 += h5 * r4;
  37524. d9 += h6 * r3;
  37525. d9 += h7 * r2;
  37526. d9 += h8 * r1;
  37527. d9 += h9 * r0;
  37528. c += (d9 >>> 13); d9 &= 0x1fff;
  37529. c = (((c << 2) + c)) | 0;
  37530. c = (c + d0) | 0;
  37531. d0 = c & 0x1fff;
  37532. c = (c >>> 13);
  37533. d1 += c;
  37534. h0 = d0;
  37535. h1 = d1;
  37536. h2 = d2;
  37537. h3 = d3;
  37538. h4 = d4;
  37539. h5 = d5;
  37540. h6 = d6;
  37541. h7 = d7;
  37542. h8 = d8;
  37543. h9 = d9;
  37544. mpos += 16;
  37545. bytes -= 16;
  37546. }
  37547. this.h[0] = h0;
  37548. this.h[1] = h1;
  37549. this.h[2] = h2;
  37550. this.h[3] = h3;
  37551. this.h[4] = h4;
  37552. this.h[5] = h5;
  37553. this.h[6] = h6;
  37554. this.h[7] = h7;
  37555. this.h[8] = h8;
  37556. this.h[9] = h9;
  37557. };
  37558. poly1305.prototype.finish = function(mac, macpos) {
  37559. var g = new Uint16Array(10);
  37560. var c, mask, f, i;
  37561. if (this.leftover) {
  37562. i = this.leftover;
  37563. this.buffer[i++] = 1;
  37564. for (; i < 16; i++) this.buffer[i] = 0;
  37565. this.fin = 1;
  37566. this.blocks(this.buffer, 0, 16);
  37567. }
  37568. c = this.h[1] >>> 13;
  37569. this.h[1] &= 0x1fff;
  37570. for (i = 2; i < 10; i++) {
  37571. this.h[i] += c;
  37572. c = this.h[i] >>> 13;
  37573. this.h[i] &= 0x1fff;
  37574. }
  37575. this.h[0] += (c * 5);
  37576. c = this.h[0] >>> 13;
  37577. this.h[0] &= 0x1fff;
  37578. this.h[1] += c;
  37579. c = this.h[1] >>> 13;
  37580. this.h[1] &= 0x1fff;
  37581. this.h[2] += c;
  37582. g[0] = this.h[0] + 5;
  37583. c = g[0] >>> 13;
  37584. g[0] &= 0x1fff;
  37585. for (i = 1; i < 10; i++) {
  37586. g[i] = this.h[i] + c;
  37587. c = g[i] >>> 13;
  37588. g[i] &= 0x1fff;
  37589. }
  37590. g[9] -= (1 << 13);
  37591. mask = (c ^ 1) - 1;
  37592. for (i = 0; i < 10; i++) g[i] &= mask;
  37593. mask = ~mask;
  37594. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37595. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37596. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37597. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37598. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37599. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37600. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37601. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37602. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37603. f = this.h[0] + this.pad[0];
  37604. this.h[0] = f & 0xffff;
  37605. for (i = 1; i < 8; i++) {
  37606. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37607. this.h[i] = f & 0xffff;
  37608. }
  37609. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37610. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37611. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37612. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37613. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37614. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37615. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37616. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37617. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37618. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37619. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37620. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37621. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37622. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37623. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37624. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37625. };
  37626. poly1305.prototype.update = function(m, mpos, bytes) {
  37627. var i, want;
  37628. if (this.leftover) {
  37629. want = (16 - this.leftover);
  37630. if (want > bytes)
  37631. want = bytes;
  37632. for (i = 0; i < want; i++)
  37633. this.buffer[this.leftover + i] = m[mpos+i];
  37634. bytes -= want;
  37635. mpos += want;
  37636. this.leftover += want;
  37637. if (this.leftover < 16)
  37638. return;
  37639. this.blocks(this.buffer, 0, 16);
  37640. this.leftover = 0;
  37641. }
  37642. if (bytes >= 16) {
  37643. want = bytes - (bytes % 16);
  37644. this.blocks(m, mpos, want);
  37645. mpos += want;
  37646. bytes -= want;
  37647. }
  37648. if (bytes) {
  37649. for (i = 0; i < bytes; i++)
  37650. this.buffer[this.leftover + i] = m[mpos+i];
  37651. this.leftover += bytes;
  37652. }
  37653. };
  37654. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37655. var s = new poly1305(k);
  37656. s.update(m, mpos, n);
  37657. s.finish(out, outpos);
  37658. return 0;
  37659. }
  37660. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37661. var x = new Uint8Array(16);
  37662. crypto_onetimeauth(x,0,m,mpos,n,k);
  37663. return crypto_verify_16(h,hpos,x,0);
  37664. }
  37665. function crypto_secretbox(c,m,d,n,k) {
  37666. var i;
  37667. if (d < 32) return -1;
  37668. crypto_stream_xor(c,0,m,0,d,n,k);
  37669. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37670. for (i = 0; i < 16; i++) c[i] = 0;
  37671. return 0;
  37672. }
  37673. function crypto_secretbox_open(m,c,d,n,k) {
  37674. var i;
  37675. var x = new Uint8Array(32);
  37676. if (d < 32) return -1;
  37677. crypto_stream(x,0,32,n,k);
  37678. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37679. crypto_stream_xor(m,0,c,0,d,n,k);
  37680. for (i = 0; i < 32; i++) m[i] = 0;
  37681. return 0;
  37682. }
  37683. function set25519(r, a) {
  37684. var i;
  37685. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37686. }
  37687. function car25519(o) {
  37688. var i, v, c = 1;
  37689. for (i = 0; i < 16; i++) {
  37690. v = o[i] + c + 65535;
  37691. c = Math.floor(v / 65536);
  37692. o[i] = v - c * 65536;
  37693. }
  37694. o[0] += c-1 + 37 * (c-1);
  37695. }
  37696. function sel25519(p, q, b) {
  37697. var t, c = ~(b-1);
  37698. for (var i = 0; i < 16; i++) {
  37699. t = c & (p[i] ^ q[i]);
  37700. p[i] ^= t;
  37701. q[i] ^= t;
  37702. }
  37703. }
  37704. function pack25519(o, n) {
  37705. var i, j, b;
  37706. var m = gf(), t = gf();
  37707. for (i = 0; i < 16; i++) t[i] = n[i];
  37708. car25519(t);
  37709. car25519(t);
  37710. car25519(t);
  37711. for (j = 0; j < 2; j++) {
  37712. m[0] = t[0] - 0xffed;
  37713. for (i = 1; i < 15; i++) {
  37714. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37715. m[i-1] &= 0xffff;
  37716. }
  37717. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37718. b = (m[15]>>16) & 1;
  37719. m[14] &= 0xffff;
  37720. sel25519(t, m, 1-b);
  37721. }
  37722. for (i = 0; i < 16; i++) {
  37723. o[2*i] = t[i] & 0xff;
  37724. o[2*i+1] = t[i]>>8;
  37725. }
  37726. }
  37727. function neq25519(a, b) {
  37728. var c = new Uint8Array(32), d = new Uint8Array(32);
  37729. pack25519(c, a);
  37730. pack25519(d, b);
  37731. return crypto_verify_32(c, 0, d, 0);
  37732. }
  37733. function par25519(a) {
  37734. var d = new Uint8Array(32);
  37735. pack25519(d, a);
  37736. return d[0] & 1;
  37737. }
  37738. function unpack25519(o, n) {
  37739. var i;
  37740. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37741. o[15] &= 0x7fff;
  37742. }
  37743. function A(o, a, b) {
  37744. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37745. }
  37746. function Z(o, a, b) {
  37747. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37748. }
  37749. function M(o, a, b) {
  37750. var v, c,
  37751. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37752. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37753. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37754. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37755. b0 = b[0],
  37756. b1 = b[1],
  37757. b2 = b[2],
  37758. b3 = b[3],
  37759. b4 = b[4],
  37760. b5 = b[5],
  37761. b6 = b[6],
  37762. b7 = b[7],
  37763. b8 = b[8],
  37764. b9 = b[9],
  37765. b10 = b[10],
  37766. b11 = b[11],
  37767. b12 = b[12],
  37768. b13 = b[13],
  37769. b14 = b[14],
  37770. b15 = b[15];
  37771. v = a[0];
  37772. t0 += v * b0;
  37773. t1 += v * b1;
  37774. t2 += v * b2;
  37775. t3 += v * b3;
  37776. t4 += v * b4;
  37777. t5 += v * b5;
  37778. t6 += v * b6;
  37779. t7 += v * b7;
  37780. t8 += v * b8;
  37781. t9 += v * b9;
  37782. t10 += v * b10;
  37783. t11 += v * b11;
  37784. t12 += v * b12;
  37785. t13 += v * b13;
  37786. t14 += v * b14;
  37787. t15 += v * b15;
  37788. v = a[1];
  37789. t1 += v * b0;
  37790. t2 += v * b1;
  37791. t3 += v * b2;
  37792. t4 += v * b3;
  37793. t5 += v * b4;
  37794. t6 += v * b5;
  37795. t7 += v * b6;
  37796. t8 += v * b7;
  37797. t9 += v * b8;
  37798. t10 += v * b9;
  37799. t11 += v * b10;
  37800. t12 += v * b11;
  37801. t13 += v * b12;
  37802. t14 += v * b13;
  37803. t15 += v * b14;
  37804. t16 += v * b15;
  37805. v = a[2];
  37806. t2 += v * b0;
  37807. t3 += v * b1;
  37808. t4 += v * b2;
  37809. t5 += v * b3;
  37810. t6 += v * b4;
  37811. t7 += v * b5;
  37812. t8 += v * b6;
  37813. t9 += v * b7;
  37814. t10 += v * b8;
  37815. t11 += v * b9;
  37816. t12 += v * b10;
  37817. t13 += v * b11;
  37818. t14 += v * b12;
  37819. t15 += v * b13;
  37820. t16 += v * b14;
  37821. t17 += v * b15;
  37822. v = a[3];
  37823. t3 += v * b0;
  37824. t4 += v * b1;
  37825. t5 += v * b2;
  37826. t6 += v * b3;
  37827. t7 += v * b4;
  37828. t8 += v * b5;
  37829. t9 += v * b6;
  37830. t10 += v * b7;
  37831. t11 += v * b8;
  37832. t12 += v * b9;
  37833. t13 += v * b10;
  37834. t14 += v * b11;
  37835. t15 += v * b12;
  37836. t16 += v * b13;
  37837. t17 += v * b14;
  37838. t18 += v * b15;
  37839. v = a[4];
  37840. t4 += v * b0;
  37841. t5 += v * b1;
  37842. t6 += v * b2;
  37843. t7 += v * b3;
  37844. t8 += v * b4;
  37845. t9 += v * b5;
  37846. t10 += v * b6;
  37847. t11 += v * b7;
  37848. t12 += v * b8;
  37849. t13 += v * b9;
  37850. t14 += v * b10;
  37851. t15 += v * b11;
  37852. t16 += v * b12;
  37853. t17 += v * b13;
  37854. t18 += v * b14;
  37855. t19 += v * b15;
  37856. v = a[5];
  37857. t5 += v * b0;
  37858. t6 += v * b1;
  37859. t7 += v * b2;
  37860. t8 += v * b3;
  37861. t9 += v * b4;
  37862. t10 += v * b5;
  37863. t11 += v * b6;
  37864. t12 += v * b7;
  37865. t13 += v * b8;
  37866. t14 += v * b9;
  37867. t15 += v * b10;
  37868. t16 += v * b11;
  37869. t17 += v * b12;
  37870. t18 += v * b13;
  37871. t19 += v * b14;
  37872. t20 += v * b15;
  37873. v = a[6];
  37874. t6 += v * b0;
  37875. t7 += v * b1;
  37876. t8 += v * b2;
  37877. t9 += v * b3;
  37878. t10 += v * b4;
  37879. t11 += v * b5;
  37880. t12 += v * b6;
  37881. t13 += v * b7;
  37882. t14 += v * b8;
  37883. t15 += v * b9;
  37884. t16 += v * b10;
  37885. t17 += v * b11;
  37886. t18 += v * b12;
  37887. t19 += v * b13;
  37888. t20 += v * b14;
  37889. t21 += v * b15;
  37890. v = a[7];
  37891. t7 += v * b0;
  37892. t8 += v * b1;
  37893. t9 += v * b2;
  37894. t10 += v * b3;
  37895. t11 += v * b4;
  37896. t12 += v * b5;
  37897. t13 += v * b6;
  37898. t14 += v * b7;
  37899. t15 += v * b8;
  37900. t16 += v * b9;
  37901. t17 += v * b10;
  37902. t18 += v * b11;
  37903. t19 += v * b12;
  37904. t20 += v * b13;
  37905. t21 += v * b14;
  37906. t22 += v * b15;
  37907. v = a[8];
  37908. t8 += v * b0;
  37909. t9 += v * b1;
  37910. t10 += v * b2;
  37911. t11 += v * b3;
  37912. t12 += v * b4;
  37913. t13 += v * b5;
  37914. t14 += v * b6;
  37915. t15 += v * b7;
  37916. t16 += v * b8;
  37917. t17 += v * b9;
  37918. t18 += v * b10;
  37919. t19 += v * b11;
  37920. t20 += v * b12;
  37921. t21 += v * b13;
  37922. t22 += v * b14;
  37923. t23 += v * b15;
  37924. v = a[9];
  37925. t9 += v * b0;
  37926. t10 += v * b1;
  37927. t11 += v * b2;
  37928. t12 += v * b3;
  37929. t13 += v * b4;
  37930. t14 += v * b5;
  37931. t15 += v * b6;
  37932. t16 += v * b7;
  37933. t17 += v * b8;
  37934. t18 += v * b9;
  37935. t19 += v * b10;
  37936. t20 += v * b11;
  37937. t21 += v * b12;
  37938. t22 += v * b13;
  37939. t23 += v * b14;
  37940. t24 += v * b15;
  37941. v = a[10];
  37942. t10 += v * b0;
  37943. t11 += v * b1;
  37944. t12 += v * b2;
  37945. t13 += v * b3;
  37946. t14 += v * b4;
  37947. t15 += v * b5;
  37948. t16 += v * b6;
  37949. t17 += v * b7;
  37950. t18 += v * b8;
  37951. t19 += v * b9;
  37952. t20 += v * b10;
  37953. t21 += v * b11;
  37954. t22 += v * b12;
  37955. t23 += v * b13;
  37956. t24 += v * b14;
  37957. t25 += v * b15;
  37958. v = a[11];
  37959. t11 += v * b0;
  37960. t12 += v * b1;
  37961. t13 += v * b2;
  37962. t14 += v * b3;
  37963. t15 += v * b4;
  37964. t16 += v * b5;
  37965. t17 += v * b6;
  37966. t18 += v * b7;
  37967. t19 += v * b8;
  37968. t20 += v * b9;
  37969. t21 += v * b10;
  37970. t22 += v * b11;
  37971. t23 += v * b12;
  37972. t24 += v * b13;
  37973. t25 += v * b14;
  37974. t26 += v * b15;
  37975. v = a[12];
  37976. t12 += v * b0;
  37977. t13 += v * b1;
  37978. t14 += v * b2;
  37979. t15 += v * b3;
  37980. t16 += v * b4;
  37981. t17 += v * b5;
  37982. t18 += v * b6;
  37983. t19 += v * b7;
  37984. t20 += v * b8;
  37985. t21 += v * b9;
  37986. t22 += v * b10;
  37987. t23 += v * b11;
  37988. t24 += v * b12;
  37989. t25 += v * b13;
  37990. t26 += v * b14;
  37991. t27 += v * b15;
  37992. v = a[13];
  37993. t13 += v * b0;
  37994. t14 += v * b1;
  37995. t15 += v * b2;
  37996. t16 += v * b3;
  37997. t17 += v * b4;
  37998. t18 += v * b5;
  37999. t19 += v * b6;
  38000. t20 += v * b7;
  38001. t21 += v * b8;
  38002. t22 += v * b9;
  38003. t23 += v * b10;
  38004. t24 += v * b11;
  38005. t25 += v * b12;
  38006. t26 += v * b13;
  38007. t27 += v * b14;
  38008. t28 += v * b15;
  38009. v = a[14];
  38010. t14 += v * b0;
  38011. t15 += v * b1;
  38012. t16 += v * b2;
  38013. t17 += v * b3;
  38014. t18 += v * b4;
  38015. t19 += v * b5;
  38016. t20 += v * b6;
  38017. t21 += v * b7;
  38018. t22 += v * b8;
  38019. t23 += v * b9;
  38020. t24 += v * b10;
  38021. t25 += v * b11;
  38022. t26 += v * b12;
  38023. t27 += v * b13;
  38024. t28 += v * b14;
  38025. t29 += v * b15;
  38026. v = a[15];
  38027. t15 += v * b0;
  38028. t16 += v * b1;
  38029. t17 += v * b2;
  38030. t18 += v * b3;
  38031. t19 += v * b4;
  38032. t20 += v * b5;
  38033. t21 += v * b6;
  38034. t22 += v * b7;
  38035. t23 += v * b8;
  38036. t24 += v * b9;
  38037. t25 += v * b10;
  38038. t26 += v * b11;
  38039. t27 += v * b12;
  38040. t28 += v * b13;
  38041. t29 += v * b14;
  38042. t30 += v * b15;
  38043. t0 += 38 * t16;
  38044. t1 += 38 * t17;
  38045. t2 += 38 * t18;
  38046. t3 += 38 * t19;
  38047. t4 += 38 * t20;
  38048. t5 += 38 * t21;
  38049. t6 += 38 * t22;
  38050. t7 += 38 * t23;
  38051. t8 += 38 * t24;
  38052. t9 += 38 * t25;
  38053. t10 += 38 * t26;
  38054. t11 += 38 * t27;
  38055. t12 += 38 * t28;
  38056. t13 += 38 * t29;
  38057. t14 += 38 * t30;
  38058. // t15 left as is
  38059. // first car
  38060. c = 1;
  38061. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38062. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38063. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38064. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38065. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38066. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38067. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38068. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38069. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38070. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38071. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38072. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38073. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38074. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38075. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38076. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38077. t0 += c-1 + 37 * (c-1);
  38078. // second car
  38079. c = 1;
  38080. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38081. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38082. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38083. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38084. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38085. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38086. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38087. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38088. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38089. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38090. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38091. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38092. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38093. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38094. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38095. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38096. t0 += c-1 + 37 * (c-1);
  38097. o[ 0] = t0;
  38098. o[ 1] = t1;
  38099. o[ 2] = t2;
  38100. o[ 3] = t3;
  38101. o[ 4] = t4;
  38102. o[ 5] = t5;
  38103. o[ 6] = t6;
  38104. o[ 7] = t7;
  38105. o[ 8] = t8;
  38106. o[ 9] = t9;
  38107. o[10] = t10;
  38108. o[11] = t11;
  38109. o[12] = t12;
  38110. o[13] = t13;
  38111. o[14] = t14;
  38112. o[15] = t15;
  38113. }
  38114. function S(o, a) {
  38115. M(o, a, a);
  38116. }
  38117. function inv25519(o, i) {
  38118. var c = gf();
  38119. var a;
  38120. for (a = 0; a < 16; a++) c[a] = i[a];
  38121. for (a = 253; a >= 0; a--) {
  38122. S(c, c);
  38123. if(a !== 2 && a !== 4) M(c, c, i);
  38124. }
  38125. for (a = 0; a < 16; a++) o[a] = c[a];
  38126. }
  38127. function pow2523(o, i) {
  38128. var c = gf();
  38129. var a;
  38130. for (a = 0; a < 16; a++) c[a] = i[a];
  38131. for (a = 250; a >= 0; a--) {
  38132. S(c, c);
  38133. if(a !== 1) M(c, c, i);
  38134. }
  38135. for (a = 0; a < 16; a++) o[a] = c[a];
  38136. }
  38137. function crypto_scalarmult(q, n, p) {
  38138. var z = new Uint8Array(32);
  38139. var x = new Float64Array(80), r, i;
  38140. var a = gf(), b = gf(), c = gf(),
  38141. d = gf(), e = gf(), f = gf();
  38142. for (i = 0; i < 31; i++) z[i] = n[i];
  38143. z[31]=(n[31]&127)|64;
  38144. z[0]&=248;
  38145. unpack25519(x,p);
  38146. for (i = 0; i < 16; i++) {
  38147. b[i]=x[i];
  38148. d[i]=a[i]=c[i]=0;
  38149. }
  38150. a[0]=d[0]=1;
  38151. for (i=254; i>=0; --i) {
  38152. r=(z[i>>>3]>>>(i&7))&1;
  38153. sel25519(a,b,r);
  38154. sel25519(c,d,r);
  38155. A(e,a,c);
  38156. Z(a,a,c);
  38157. A(c,b,d);
  38158. Z(b,b,d);
  38159. S(d,e);
  38160. S(f,a);
  38161. M(a,c,a);
  38162. M(c,b,e);
  38163. A(e,a,c);
  38164. Z(a,a,c);
  38165. S(b,a);
  38166. Z(c,d,f);
  38167. M(a,c,_121665);
  38168. A(a,a,d);
  38169. M(c,c,a);
  38170. M(a,d,f);
  38171. M(d,b,x);
  38172. S(b,e);
  38173. sel25519(a,b,r);
  38174. sel25519(c,d,r);
  38175. }
  38176. for (i = 0; i < 16; i++) {
  38177. x[i+16]=a[i];
  38178. x[i+32]=c[i];
  38179. x[i+48]=b[i];
  38180. x[i+64]=d[i];
  38181. }
  38182. var x32 = x.subarray(32);
  38183. var x16 = x.subarray(16);
  38184. inv25519(x32,x32);
  38185. M(x16,x16,x32);
  38186. pack25519(q,x16);
  38187. return 0;
  38188. }
  38189. function crypto_scalarmult_base(q, n) {
  38190. return crypto_scalarmult(q, n, _9);
  38191. }
  38192. function crypto_box_keypair(y, x) {
  38193. randombytes(x, 32);
  38194. return crypto_scalarmult_base(y, x);
  38195. }
  38196. function crypto_box_beforenm(k, y, x) {
  38197. var s = new Uint8Array(32);
  38198. crypto_scalarmult(s, x, y);
  38199. return crypto_core_hsalsa20(k, _0, s, sigma);
  38200. }
  38201. var crypto_box_afternm = crypto_secretbox;
  38202. var crypto_box_open_afternm = crypto_secretbox_open;
  38203. function crypto_box(c, m, d, n, y, x) {
  38204. var k = new Uint8Array(32);
  38205. crypto_box_beforenm(k, y, x);
  38206. return crypto_box_afternm(c, m, d, n, k);
  38207. }
  38208. function crypto_box_open(m, c, d, n, y, x) {
  38209. var k = new Uint8Array(32);
  38210. crypto_box_beforenm(k, y, x);
  38211. return crypto_box_open_afternm(m, c, d, n, k);
  38212. }
  38213. var K = [
  38214. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38215. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38216. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38217. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38218. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38219. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38220. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38221. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38222. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38223. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38224. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38225. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38226. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38227. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38228. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38229. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38230. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38231. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38232. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38233. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38234. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38235. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38236. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38237. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38238. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38239. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38240. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38241. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38242. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38243. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38244. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38245. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38246. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38247. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38248. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38249. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38250. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38251. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38252. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38253. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38254. ];
  38255. function crypto_hashblocks_hl(hh, hl, m, n) {
  38256. var wh = new Int32Array(16), wl = new Int32Array(16),
  38257. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38258. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38259. th, tl, i, j, h, l, a, b, c, d;
  38260. var ah0 = hh[0],
  38261. ah1 = hh[1],
  38262. ah2 = hh[2],
  38263. ah3 = hh[3],
  38264. ah4 = hh[4],
  38265. ah5 = hh[5],
  38266. ah6 = hh[6],
  38267. ah7 = hh[7],
  38268. al0 = hl[0],
  38269. al1 = hl[1],
  38270. al2 = hl[2],
  38271. al3 = hl[3],
  38272. al4 = hl[4],
  38273. al5 = hl[5],
  38274. al6 = hl[6],
  38275. al7 = hl[7];
  38276. var pos = 0;
  38277. while (n >= 128) {
  38278. for (i = 0; i < 16; i++) {
  38279. j = 8 * i + pos;
  38280. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38281. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38282. }
  38283. for (i = 0; i < 80; i++) {
  38284. bh0 = ah0;
  38285. bh1 = ah1;
  38286. bh2 = ah2;
  38287. bh3 = ah3;
  38288. bh4 = ah4;
  38289. bh5 = ah5;
  38290. bh6 = ah6;
  38291. bh7 = ah7;
  38292. bl0 = al0;
  38293. bl1 = al1;
  38294. bl2 = al2;
  38295. bl3 = al3;
  38296. bl4 = al4;
  38297. bl5 = al5;
  38298. bl6 = al6;
  38299. bl7 = al7;
  38300. // add
  38301. h = ah7;
  38302. l = al7;
  38303. a = l & 0xffff; b = l >>> 16;
  38304. c = h & 0xffff; d = h >>> 16;
  38305. // Sigma1
  38306. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38307. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38308. a += l & 0xffff; b += l >>> 16;
  38309. c += h & 0xffff; d += h >>> 16;
  38310. // Ch
  38311. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38312. l = (al4 & al5) ^ (~al4 & al6);
  38313. a += l & 0xffff; b += l >>> 16;
  38314. c += h & 0xffff; d += h >>> 16;
  38315. // K
  38316. h = K[i*2];
  38317. l = K[i*2+1];
  38318. a += l & 0xffff; b += l >>> 16;
  38319. c += h & 0xffff; d += h >>> 16;
  38320. // w
  38321. h = wh[i%16];
  38322. l = wl[i%16];
  38323. a += l & 0xffff; b += l >>> 16;
  38324. c += h & 0xffff; d += h >>> 16;
  38325. b += a >>> 16;
  38326. c += b >>> 16;
  38327. d += c >>> 16;
  38328. th = c & 0xffff | d << 16;
  38329. tl = a & 0xffff | b << 16;
  38330. // add
  38331. h = th;
  38332. l = tl;
  38333. a = l & 0xffff; b = l >>> 16;
  38334. c = h & 0xffff; d = h >>> 16;
  38335. // Sigma0
  38336. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38337. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38338. a += l & 0xffff; b += l >>> 16;
  38339. c += h & 0xffff; d += h >>> 16;
  38340. // Maj
  38341. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38342. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38343. a += l & 0xffff; b += l >>> 16;
  38344. c += h & 0xffff; d += h >>> 16;
  38345. b += a >>> 16;
  38346. c += b >>> 16;
  38347. d += c >>> 16;
  38348. bh7 = (c & 0xffff) | (d << 16);
  38349. bl7 = (a & 0xffff) | (b << 16);
  38350. // add
  38351. h = bh3;
  38352. l = bl3;
  38353. a = l & 0xffff; b = l >>> 16;
  38354. c = h & 0xffff; d = h >>> 16;
  38355. h = th;
  38356. l = tl;
  38357. a += l & 0xffff; b += l >>> 16;
  38358. c += h & 0xffff; d += h >>> 16;
  38359. b += a >>> 16;
  38360. c += b >>> 16;
  38361. d += c >>> 16;
  38362. bh3 = (c & 0xffff) | (d << 16);
  38363. bl3 = (a & 0xffff) | (b << 16);
  38364. ah1 = bh0;
  38365. ah2 = bh1;
  38366. ah3 = bh2;
  38367. ah4 = bh3;
  38368. ah5 = bh4;
  38369. ah6 = bh5;
  38370. ah7 = bh6;
  38371. ah0 = bh7;
  38372. al1 = bl0;
  38373. al2 = bl1;
  38374. al3 = bl2;
  38375. al4 = bl3;
  38376. al5 = bl4;
  38377. al6 = bl5;
  38378. al7 = bl6;
  38379. al0 = bl7;
  38380. if (i%16 === 15) {
  38381. for (j = 0; j < 16; j++) {
  38382. // add
  38383. h = wh[j];
  38384. l = wl[j];
  38385. a = l & 0xffff; b = l >>> 16;
  38386. c = h & 0xffff; d = h >>> 16;
  38387. h = wh[(j+9)%16];
  38388. l = wl[(j+9)%16];
  38389. a += l & 0xffff; b += l >>> 16;
  38390. c += h & 0xffff; d += h >>> 16;
  38391. // sigma0
  38392. th = wh[(j+1)%16];
  38393. tl = wl[(j+1)%16];
  38394. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38395. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38396. a += l & 0xffff; b += l >>> 16;
  38397. c += h & 0xffff; d += h >>> 16;
  38398. // sigma1
  38399. th = wh[(j+14)%16];
  38400. tl = wl[(j+14)%16];
  38401. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38402. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38403. a += l & 0xffff; b += l >>> 16;
  38404. c += h & 0xffff; d += h >>> 16;
  38405. b += a >>> 16;
  38406. c += b >>> 16;
  38407. d += c >>> 16;
  38408. wh[j] = (c & 0xffff) | (d << 16);
  38409. wl[j] = (a & 0xffff) | (b << 16);
  38410. }
  38411. }
  38412. }
  38413. // add
  38414. h = ah0;
  38415. l = al0;
  38416. a = l & 0xffff; b = l >>> 16;
  38417. c = h & 0xffff; d = h >>> 16;
  38418. h = hh[0];
  38419. l = hl[0];
  38420. a += l & 0xffff; b += l >>> 16;
  38421. c += h & 0xffff; d += h >>> 16;
  38422. b += a >>> 16;
  38423. c += b >>> 16;
  38424. d += c >>> 16;
  38425. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38426. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38427. h = ah1;
  38428. l = al1;
  38429. a = l & 0xffff; b = l >>> 16;
  38430. c = h & 0xffff; d = h >>> 16;
  38431. h = hh[1];
  38432. l = hl[1];
  38433. a += l & 0xffff; b += l >>> 16;
  38434. c += h & 0xffff; d += h >>> 16;
  38435. b += a >>> 16;
  38436. c += b >>> 16;
  38437. d += c >>> 16;
  38438. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38439. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38440. h = ah2;
  38441. l = al2;
  38442. a = l & 0xffff; b = l >>> 16;
  38443. c = h & 0xffff; d = h >>> 16;
  38444. h = hh[2];
  38445. l = hl[2];
  38446. a += l & 0xffff; b += l >>> 16;
  38447. c += h & 0xffff; d += h >>> 16;
  38448. b += a >>> 16;
  38449. c += b >>> 16;
  38450. d += c >>> 16;
  38451. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38452. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38453. h = ah3;
  38454. l = al3;
  38455. a = l & 0xffff; b = l >>> 16;
  38456. c = h & 0xffff; d = h >>> 16;
  38457. h = hh[3];
  38458. l = hl[3];
  38459. a += l & 0xffff; b += l >>> 16;
  38460. c += h & 0xffff; d += h >>> 16;
  38461. b += a >>> 16;
  38462. c += b >>> 16;
  38463. d += c >>> 16;
  38464. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38465. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38466. h = ah4;
  38467. l = al4;
  38468. a = l & 0xffff; b = l >>> 16;
  38469. c = h & 0xffff; d = h >>> 16;
  38470. h = hh[4];
  38471. l = hl[4];
  38472. a += l & 0xffff; b += l >>> 16;
  38473. c += h & 0xffff; d += h >>> 16;
  38474. b += a >>> 16;
  38475. c += b >>> 16;
  38476. d += c >>> 16;
  38477. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38478. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38479. h = ah5;
  38480. l = al5;
  38481. a = l & 0xffff; b = l >>> 16;
  38482. c = h & 0xffff; d = h >>> 16;
  38483. h = hh[5];
  38484. l = hl[5];
  38485. a += l & 0xffff; b += l >>> 16;
  38486. c += h & 0xffff; d += h >>> 16;
  38487. b += a >>> 16;
  38488. c += b >>> 16;
  38489. d += c >>> 16;
  38490. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38491. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38492. h = ah6;
  38493. l = al6;
  38494. a = l & 0xffff; b = l >>> 16;
  38495. c = h & 0xffff; d = h >>> 16;
  38496. h = hh[6];
  38497. l = hl[6];
  38498. a += l & 0xffff; b += l >>> 16;
  38499. c += h & 0xffff; d += h >>> 16;
  38500. b += a >>> 16;
  38501. c += b >>> 16;
  38502. d += c >>> 16;
  38503. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38504. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38505. h = ah7;
  38506. l = al7;
  38507. a = l & 0xffff; b = l >>> 16;
  38508. c = h & 0xffff; d = h >>> 16;
  38509. h = hh[7];
  38510. l = hl[7];
  38511. a += l & 0xffff; b += l >>> 16;
  38512. c += h & 0xffff; d += h >>> 16;
  38513. b += a >>> 16;
  38514. c += b >>> 16;
  38515. d += c >>> 16;
  38516. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38517. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38518. pos += 128;
  38519. n -= 128;
  38520. }
  38521. return n;
  38522. }
  38523. function crypto_hash(out, m, n) {
  38524. var hh = new Int32Array(8),
  38525. hl = new Int32Array(8),
  38526. x = new Uint8Array(256),
  38527. i, b = n;
  38528. hh[0] = 0x6a09e667;
  38529. hh[1] = 0xbb67ae85;
  38530. hh[2] = 0x3c6ef372;
  38531. hh[3] = 0xa54ff53a;
  38532. hh[4] = 0x510e527f;
  38533. hh[5] = 0x9b05688c;
  38534. hh[6] = 0x1f83d9ab;
  38535. hh[7] = 0x5be0cd19;
  38536. hl[0] = 0xf3bcc908;
  38537. hl[1] = 0x84caa73b;
  38538. hl[2] = 0xfe94f82b;
  38539. hl[3] = 0x5f1d36f1;
  38540. hl[4] = 0xade682d1;
  38541. hl[5] = 0x2b3e6c1f;
  38542. hl[6] = 0xfb41bd6b;
  38543. hl[7] = 0x137e2179;
  38544. crypto_hashblocks_hl(hh, hl, m, n);
  38545. n %= 128;
  38546. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38547. x[n] = 128;
  38548. n = 256-128*(n<112?1:0);
  38549. x[n-9] = 0;
  38550. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38551. crypto_hashblocks_hl(hh, hl, x, n);
  38552. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38553. return 0;
  38554. }
  38555. function add(p, q) {
  38556. var a = gf(), b = gf(), c = gf(),
  38557. d = gf(), e = gf(), f = gf(),
  38558. g = gf(), h = gf(), t = gf();
  38559. Z(a, p[1], p[0]);
  38560. Z(t, q[1], q[0]);
  38561. M(a, a, t);
  38562. A(b, p[0], p[1]);
  38563. A(t, q[0], q[1]);
  38564. M(b, b, t);
  38565. M(c, p[3], q[3]);
  38566. M(c, c, D2);
  38567. M(d, p[2], q[2]);
  38568. A(d, d, d);
  38569. Z(e, b, a);
  38570. Z(f, d, c);
  38571. A(g, d, c);
  38572. A(h, b, a);
  38573. M(p[0], e, f);
  38574. M(p[1], h, g);
  38575. M(p[2], g, f);
  38576. M(p[3], e, h);
  38577. }
  38578. function cswap(p, q, b) {
  38579. var i;
  38580. for (i = 0; i < 4; i++) {
  38581. sel25519(p[i], q[i], b);
  38582. }
  38583. }
  38584. function pack(r, p) {
  38585. var tx = gf(), ty = gf(), zi = gf();
  38586. inv25519(zi, p[2]);
  38587. M(tx, p[0], zi);
  38588. M(ty, p[1], zi);
  38589. pack25519(r, ty);
  38590. r[31] ^= par25519(tx) << 7;
  38591. }
  38592. function scalarmult(p, q, s) {
  38593. var b, i;
  38594. set25519(p[0], gf0);
  38595. set25519(p[1], gf1);
  38596. set25519(p[2], gf1);
  38597. set25519(p[3], gf0);
  38598. for (i = 255; i >= 0; --i) {
  38599. b = (s[(i/8)|0] >> (i&7)) & 1;
  38600. cswap(p, q, b);
  38601. add(q, p);
  38602. add(p, p);
  38603. cswap(p, q, b);
  38604. }
  38605. }
  38606. function scalarbase(p, s) {
  38607. var q = [gf(), gf(), gf(), gf()];
  38608. set25519(q[0], X);
  38609. set25519(q[1], Y);
  38610. set25519(q[2], gf1);
  38611. M(q[3], X, Y);
  38612. scalarmult(p, q, s);
  38613. }
  38614. function crypto_sign_keypair(pk, sk, seeded) {
  38615. var d = new Uint8Array(64);
  38616. var p = [gf(), gf(), gf(), gf()];
  38617. var i;
  38618. if (!seeded) randombytes(sk, 32);
  38619. crypto_hash(d, sk, 32);
  38620. d[0] &= 248;
  38621. d[31] &= 127;
  38622. d[31] |= 64;
  38623. scalarbase(p, d);
  38624. pack(pk, p);
  38625. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38626. return 0;
  38627. }
  38628. 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]);
  38629. function modL(r, x) {
  38630. var carry, i, j, k;
  38631. for (i = 63; i >= 32; --i) {
  38632. carry = 0;
  38633. for (j = i - 32, k = i - 12; j < k; ++j) {
  38634. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38635. carry = (x[j] + 128) >> 8;
  38636. x[j] -= carry * 256;
  38637. }
  38638. x[j] += carry;
  38639. x[i] = 0;
  38640. }
  38641. carry = 0;
  38642. for (j = 0; j < 32; j++) {
  38643. x[j] += carry - (x[31] >> 4) * L[j];
  38644. carry = x[j] >> 8;
  38645. x[j] &= 255;
  38646. }
  38647. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38648. for (i = 0; i < 32; i++) {
  38649. x[i+1] += x[i] >> 8;
  38650. r[i] = x[i] & 255;
  38651. }
  38652. }
  38653. function reduce(r) {
  38654. var x = new Float64Array(64), i;
  38655. for (i = 0; i < 64; i++) x[i] = r[i];
  38656. for (i = 0; i < 64; i++) r[i] = 0;
  38657. modL(r, x);
  38658. }
  38659. // Note: difference from C - smlen returned, not passed as argument.
  38660. function crypto_sign(sm, m, n, sk) {
  38661. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38662. var i, j, x = new Float64Array(64);
  38663. var p = [gf(), gf(), gf(), gf()];
  38664. crypto_hash(d, sk, 32);
  38665. d[0] &= 248;
  38666. d[31] &= 127;
  38667. d[31] |= 64;
  38668. var smlen = n + 64;
  38669. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38670. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38671. crypto_hash(r, sm.subarray(32), n+32);
  38672. reduce(r);
  38673. scalarbase(p, r);
  38674. pack(sm, p);
  38675. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38676. crypto_hash(h, sm, n + 64);
  38677. reduce(h);
  38678. for (i = 0; i < 64; i++) x[i] = 0;
  38679. for (i = 0; i < 32; i++) x[i] = r[i];
  38680. for (i = 0; i < 32; i++) {
  38681. for (j = 0; j < 32; j++) {
  38682. x[i+j] += h[i] * d[j];
  38683. }
  38684. }
  38685. modL(sm.subarray(32), x);
  38686. return smlen;
  38687. }
  38688. function unpackneg(r, p) {
  38689. var t = gf(), chk = gf(), num = gf(),
  38690. den = gf(), den2 = gf(), den4 = gf(),
  38691. den6 = gf();
  38692. set25519(r[2], gf1);
  38693. unpack25519(r[1], p);
  38694. S(num, r[1]);
  38695. M(den, num, D);
  38696. Z(num, num, r[2]);
  38697. A(den, r[2], den);
  38698. S(den2, den);
  38699. S(den4, den2);
  38700. M(den6, den4, den2);
  38701. M(t, den6, num);
  38702. M(t, t, den);
  38703. pow2523(t, t);
  38704. M(t, t, num);
  38705. M(t, t, den);
  38706. M(t, t, den);
  38707. M(r[0], t, den);
  38708. S(chk, r[0]);
  38709. M(chk, chk, den);
  38710. if (neq25519(chk, num)) M(r[0], r[0], I);
  38711. S(chk, r[0]);
  38712. M(chk, chk, den);
  38713. if (neq25519(chk, num)) return -1;
  38714. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38715. M(r[3], r[0], r[1]);
  38716. return 0;
  38717. }
  38718. function crypto_sign_open(m, sm, n, pk) {
  38719. var i, mlen;
  38720. var t = new Uint8Array(32), h = new Uint8Array(64);
  38721. var p = [gf(), gf(), gf(), gf()],
  38722. q = [gf(), gf(), gf(), gf()];
  38723. mlen = -1;
  38724. if (n < 64) return -1;
  38725. if (unpackneg(q, pk)) return -1;
  38726. for (i = 0; i < n; i++) m[i] = sm[i];
  38727. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38728. crypto_hash(h, m, n);
  38729. reduce(h);
  38730. scalarmult(p, q, h);
  38731. scalarbase(q, sm.subarray(32));
  38732. add(p, q);
  38733. pack(t, p);
  38734. n -= 64;
  38735. if (crypto_verify_32(sm, 0, t, 0)) {
  38736. for (i = 0; i < n; i++) m[i] = 0;
  38737. return -1;
  38738. }
  38739. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38740. mlen = n;
  38741. return mlen;
  38742. }
  38743. var crypto_secretbox_KEYBYTES = 32,
  38744. crypto_secretbox_NONCEBYTES = 24,
  38745. crypto_secretbox_ZEROBYTES = 32,
  38746. crypto_secretbox_BOXZEROBYTES = 16,
  38747. crypto_scalarmult_BYTES = 32,
  38748. crypto_scalarmult_SCALARBYTES = 32,
  38749. crypto_box_PUBLICKEYBYTES = 32,
  38750. crypto_box_SECRETKEYBYTES = 32,
  38751. crypto_box_BEFORENMBYTES = 32,
  38752. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38753. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38754. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38755. crypto_sign_BYTES = 64,
  38756. crypto_sign_PUBLICKEYBYTES = 32,
  38757. crypto_sign_SECRETKEYBYTES = 64,
  38758. crypto_sign_SEEDBYTES = 32,
  38759. crypto_hash_BYTES = 64;
  38760. nacl.lowlevel = {
  38761. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38762. crypto_stream_xor: crypto_stream_xor,
  38763. crypto_stream: crypto_stream,
  38764. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38765. crypto_stream_salsa20: crypto_stream_salsa20,
  38766. crypto_onetimeauth: crypto_onetimeauth,
  38767. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38768. crypto_verify_16: crypto_verify_16,
  38769. crypto_verify_32: crypto_verify_32,
  38770. crypto_secretbox: crypto_secretbox,
  38771. crypto_secretbox_open: crypto_secretbox_open,
  38772. crypto_scalarmult: crypto_scalarmult,
  38773. crypto_scalarmult_base: crypto_scalarmult_base,
  38774. crypto_box_beforenm: crypto_box_beforenm,
  38775. crypto_box_afternm: crypto_box_afternm,
  38776. crypto_box: crypto_box,
  38777. crypto_box_open: crypto_box_open,
  38778. crypto_box_keypair: crypto_box_keypair,
  38779. crypto_hash: crypto_hash,
  38780. crypto_sign: crypto_sign,
  38781. crypto_sign_keypair: crypto_sign_keypair,
  38782. crypto_sign_open: crypto_sign_open,
  38783. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38784. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38785. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38786. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38787. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38788. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38789. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38790. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38791. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38792. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38793. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38794. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38795. crypto_sign_BYTES: crypto_sign_BYTES,
  38796. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38797. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38798. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38799. crypto_hash_BYTES: crypto_hash_BYTES
  38800. };
  38801. /* High-level API */
  38802. function checkLengths(k, n) {
  38803. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38804. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38805. }
  38806. function checkBoxLengths(pk, sk) {
  38807. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38808. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38809. }
  38810. function checkArrayTypes() {
  38811. for (var i = 0; i < arguments.length; i++) {
  38812. if (!(arguments[i] instanceof Uint8Array))
  38813. throw new TypeError('unexpected type, use Uint8Array');
  38814. }
  38815. }
  38816. function cleanup(arr) {
  38817. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38818. }
  38819. nacl.randomBytes = function(n) {
  38820. var b = new Uint8Array(n);
  38821. randombytes(b, n);
  38822. return b;
  38823. };
  38824. nacl.secretbox = function(msg, nonce, key) {
  38825. checkArrayTypes(msg, nonce, key);
  38826. checkLengths(key, nonce);
  38827. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38828. var c = new Uint8Array(m.length);
  38829. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38830. crypto_secretbox(c, m, m.length, nonce, key);
  38831. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38832. };
  38833. nacl.secretbox.open = function(box, nonce, key) {
  38834. checkArrayTypes(box, nonce, key);
  38835. checkLengths(key, nonce);
  38836. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38837. var m = new Uint8Array(c.length);
  38838. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38839. if (c.length < 32) return null;
  38840. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38841. return m.subarray(crypto_secretbox_ZEROBYTES);
  38842. };
  38843. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38844. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38845. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38846. nacl.scalarMult = function(n, p) {
  38847. checkArrayTypes(n, p);
  38848. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38849. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38850. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38851. crypto_scalarmult(q, n, p);
  38852. return q;
  38853. };
  38854. nacl.scalarMult.base = function(n) {
  38855. checkArrayTypes(n);
  38856. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38857. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38858. crypto_scalarmult_base(q, n);
  38859. return q;
  38860. };
  38861. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38862. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38863. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38864. var k = nacl.box.before(publicKey, secretKey);
  38865. return nacl.secretbox(msg, nonce, k);
  38866. };
  38867. nacl.box.before = function(publicKey, secretKey) {
  38868. checkArrayTypes(publicKey, secretKey);
  38869. checkBoxLengths(publicKey, secretKey);
  38870. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38871. crypto_box_beforenm(k, publicKey, secretKey);
  38872. return k;
  38873. };
  38874. nacl.box.after = nacl.secretbox;
  38875. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38876. var k = nacl.box.before(publicKey, secretKey);
  38877. return nacl.secretbox.open(msg, nonce, k);
  38878. };
  38879. nacl.box.open.after = nacl.secretbox.open;
  38880. nacl.box.keyPair = function() {
  38881. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38882. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38883. crypto_box_keypair(pk, sk);
  38884. return {publicKey: pk, secretKey: sk};
  38885. };
  38886. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38887. checkArrayTypes(secretKey);
  38888. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38889. throw new Error('bad secret key size');
  38890. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38891. crypto_scalarmult_base(pk, secretKey);
  38892. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38893. };
  38894. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38895. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38896. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38897. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38898. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38899. nacl.sign = function(msg, secretKey) {
  38900. checkArrayTypes(msg, secretKey);
  38901. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38902. throw new Error('bad secret key size');
  38903. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38904. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38905. return signedMsg;
  38906. };
  38907. nacl.sign.open = function(signedMsg, publicKey) {
  38908. checkArrayTypes(signedMsg, publicKey);
  38909. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38910. throw new Error('bad public key size');
  38911. var tmp = new Uint8Array(signedMsg.length);
  38912. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38913. if (mlen < 0) return null;
  38914. var m = new Uint8Array(mlen);
  38915. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38916. return m;
  38917. };
  38918. nacl.sign.detached = function(msg, secretKey) {
  38919. var signedMsg = nacl.sign(msg, secretKey);
  38920. var sig = new Uint8Array(crypto_sign_BYTES);
  38921. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38922. return sig;
  38923. };
  38924. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38925. checkArrayTypes(msg, sig, publicKey);
  38926. if (sig.length !== crypto_sign_BYTES)
  38927. throw new Error('bad signature size');
  38928. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38929. throw new Error('bad public key size');
  38930. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38931. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38932. var i;
  38933. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38934. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38935. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38936. };
  38937. nacl.sign.keyPair = function() {
  38938. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38939. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38940. crypto_sign_keypair(pk, sk);
  38941. return {publicKey: pk, secretKey: sk};
  38942. };
  38943. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38944. checkArrayTypes(secretKey);
  38945. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38946. throw new Error('bad secret key size');
  38947. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38948. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38949. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38950. };
  38951. nacl.sign.keyPair.fromSeed = function(seed) {
  38952. checkArrayTypes(seed);
  38953. if (seed.length !== crypto_sign_SEEDBYTES)
  38954. throw new Error('bad seed size');
  38955. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38956. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38957. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38958. crypto_sign_keypair(pk, sk, true);
  38959. return {publicKey: pk, secretKey: sk};
  38960. };
  38961. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38962. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38963. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38964. nacl.sign.signatureLength = crypto_sign_BYTES;
  38965. nacl.hash = function(msg) {
  38966. checkArrayTypes(msg);
  38967. var h = new Uint8Array(crypto_hash_BYTES);
  38968. crypto_hash(h, msg, msg.length);
  38969. return h;
  38970. };
  38971. nacl.hash.hashLength = crypto_hash_BYTES;
  38972. nacl.verify = function(x, y) {
  38973. checkArrayTypes(x, y);
  38974. // Zero length arguments are considered not equal.
  38975. if (x.length === 0 || y.length === 0) return false;
  38976. if (x.length !== y.length) return false;
  38977. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38978. };
  38979. nacl.setPRNG = function(fn) {
  38980. randombytes = fn;
  38981. };
  38982. (function() {
  38983. // Initialize PRNG if environment provides CSPRNG.
  38984. // If not, methods calling randombytes will throw.
  38985. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38986. if (crypto && crypto.getRandomValues) {
  38987. // Browsers.
  38988. var QUOTA = 65536;
  38989. nacl.setPRNG(function(x, n) {
  38990. var i, v = new Uint8Array(n);
  38991. for (i = 0; i < n; i += QUOTA) {
  38992. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38993. }
  38994. for (i = 0; i < n; i++) x[i] = v[i];
  38995. cleanup(v);
  38996. });
  38997. } else if (true) {
  38998. // Node.js.
  38999. crypto = __webpack_require__(3);
  39000. if (crypto && crypto.randomBytes) {
  39001. nacl.setPRNG(function(x, n) {
  39002. var i, v = crypto.randomBytes(n);
  39003. for (i = 0; i < n; i++) x[i] = v[i];
  39004. cleanup(v);
  39005. });
  39006. }
  39007. }
  39008. })();
  39009. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39010. /***/ }),
  39011. /* 1 */
  39012. /***/ (function(module, exports, __webpack_require__) {
  39013. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39014. // Public domain.
  39015. (function(root, f) {
  39016. 'use strict';
  39017. if ( true && module.exports) module.exports = f();
  39018. else if (root.nacl) root.nacl.util = f();
  39019. else {
  39020. root.nacl = {};
  39021. root.nacl.util = f();
  39022. }
  39023. }(this, function() {
  39024. 'use strict';
  39025. var util = {};
  39026. function validateBase64(s) {
  39027. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39028. throw new TypeError('invalid encoding');
  39029. }
  39030. }
  39031. util.decodeUTF8 = function(s) {
  39032. if (typeof s !== 'string') throw new TypeError('expected string');
  39033. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39034. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39035. return b;
  39036. };
  39037. util.encodeUTF8 = function(arr) {
  39038. var i, s = [];
  39039. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39040. return decodeURIComponent(escape(s.join('')));
  39041. };
  39042. if (typeof atob === 'undefined') {
  39043. // Node.js
  39044. if (typeof Buffer.from !== 'undefined') {
  39045. // Node v6 and later
  39046. util.encodeBase64 = function (arr) { // v6 and later
  39047. return Buffer.from(arr).toString('base64');
  39048. };
  39049. util.decodeBase64 = function (s) {
  39050. validateBase64(s);
  39051. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39052. };
  39053. } else {
  39054. // Node earlier than v6
  39055. util.encodeBase64 = function (arr) { // v6 and later
  39056. return (new Buffer(arr)).toString('base64');
  39057. };
  39058. util.decodeBase64 = function(s) {
  39059. validateBase64(s);
  39060. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39061. };
  39062. }
  39063. } else {
  39064. // Browsers
  39065. util.encodeBase64 = function(arr) {
  39066. var i, s = [], len = arr.length;
  39067. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39068. return btoa(s.join(''));
  39069. };
  39070. util.decodeBase64 = function(s) {
  39071. validateBase64(s);
  39072. var i, d = atob(s), b = new Uint8Array(d.length);
  39073. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39074. return b;
  39075. };
  39076. }
  39077. return util;
  39078. }));
  39079. /***/ }),
  39080. /* 2 */
  39081. /***/ (function(module, exports, __webpack_require__) {
  39082. // required so we don't have to do require('pusher').default etc.
  39083. module.exports = __webpack_require__(4).default;
  39084. /***/ }),
  39085. /* 3 */
  39086. /***/ (function(module, exports) {
  39087. /* (ignored) */
  39088. /***/ }),
  39089. /* 4 */
  39090. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39091. "use strict";
  39092. __webpack_require__.r(__webpack_exports__);
  39093. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39094. var ScriptReceiverFactory = (function () {
  39095. function ScriptReceiverFactory(prefix, name) {
  39096. this.lastId = 0;
  39097. this.prefix = prefix;
  39098. this.name = name;
  39099. }
  39100. ScriptReceiverFactory.prototype.create = function (callback) {
  39101. this.lastId++;
  39102. var number = this.lastId;
  39103. var id = this.prefix + number;
  39104. var name = this.name + "[" + number + "]";
  39105. var called = false;
  39106. var callbackWrapper = function () {
  39107. if (!called) {
  39108. callback.apply(null, arguments);
  39109. called = true;
  39110. }
  39111. };
  39112. this[number] = callbackWrapper;
  39113. return { number: number, id: id, name: name, callback: callbackWrapper };
  39114. };
  39115. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39116. delete this[receiver.number];
  39117. };
  39118. return ScriptReceiverFactory;
  39119. }());
  39120. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39121. // CONCATENATED MODULE: ./src/core/defaults.ts
  39122. var Defaults = {
  39123. VERSION: "5.0.3",
  39124. PROTOCOL: 7,
  39125. host: 'ws.pusherapp.com',
  39126. ws_port: 80,
  39127. wss_port: 443,
  39128. ws_path: '',
  39129. sockjs_host: 'sockjs.pusher.com',
  39130. sockjs_http_port: 80,
  39131. sockjs_https_port: 443,
  39132. sockjs_path: '/pusher',
  39133. stats_host: 'stats.pusher.com',
  39134. channel_auth_endpoint: '/pusher/auth',
  39135. channel_auth_transport: 'ajax',
  39136. activity_timeout: 120000,
  39137. pong_timeout: 30000,
  39138. unavailable_timeout: 10000,
  39139. cdn_http: "http://js.pusher.com",
  39140. cdn_https: "https://js.pusher.com",
  39141. dependency_suffix: ""
  39142. };
  39143. /* harmony default export */ var defaults = (Defaults);
  39144. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39145. var dependency_loader_DependencyLoader = (function () {
  39146. function DependencyLoader(options) {
  39147. this.options = options;
  39148. this.receivers = options.receivers || ScriptReceivers;
  39149. this.loading = {};
  39150. }
  39151. DependencyLoader.prototype.load = function (name, options, callback) {
  39152. var self = this;
  39153. if (self.loading[name] && self.loading[name].length > 0) {
  39154. self.loading[name].push(callback);
  39155. }
  39156. else {
  39157. self.loading[name] = [callback];
  39158. var request = runtime.createScriptRequest(self.getPath(name, options));
  39159. var receiver = self.receivers.create(function (error) {
  39160. self.receivers.remove(receiver);
  39161. if (self.loading[name]) {
  39162. var callbacks = self.loading[name];
  39163. delete self.loading[name];
  39164. var successCallback = function (wasSuccessful) {
  39165. if (!wasSuccessful) {
  39166. request.cleanup();
  39167. }
  39168. };
  39169. for (var i = 0; i < callbacks.length; i++) {
  39170. callbacks[i](error, successCallback);
  39171. }
  39172. }
  39173. });
  39174. request.send(receiver);
  39175. }
  39176. };
  39177. DependencyLoader.prototype.getRoot = function (options) {
  39178. var cdn;
  39179. var protocol = runtime.getDocument().location.protocol;
  39180. if ((options && options.useTLS) || protocol === "https:") {
  39181. cdn = this.options.cdn_https;
  39182. }
  39183. else {
  39184. cdn = this.options.cdn_http;
  39185. }
  39186. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39187. };
  39188. DependencyLoader.prototype.getPath = function (name, options) {
  39189. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39190. };
  39191. ;
  39192. return DependencyLoader;
  39193. }());
  39194. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39195. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39196. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39197. var Dependencies = new dependency_loader({
  39198. cdn_http: defaults.cdn_http,
  39199. cdn_https: defaults.cdn_https,
  39200. version: defaults.VERSION,
  39201. suffix: defaults.dependency_suffix,
  39202. receivers: DependenciesReceivers
  39203. });
  39204. // CONCATENATED MODULE: ./src/core/base64.ts
  39205. function encode(s) {
  39206. return btoa(utob(s));
  39207. }
  39208. var fromCharCode = String.fromCharCode;
  39209. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39210. var b64tab = {};
  39211. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39212. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39213. }
  39214. var cb_utob = function (c) {
  39215. var cc = c.charCodeAt(0);
  39216. return cc < 0x80
  39217. ? c
  39218. : cc < 0x800
  39219. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39220. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39221. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39222. fromCharCode(0x80 | (cc & 0x3f));
  39223. };
  39224. var utob = function (u) {
  39225. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39226. };
  39227. var cb_encode = function (ccc) {
  39228. var padlen = [0, 2, 1][ccc.length % 3];
  39229. var ord = (ccc.charCodeAt(0) << 16) |
  39230. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39231. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39232. var chars = [
  39233. b64chars.charAt(ord >>> 18),
  39234. b64chars.charAt((ord >>> 12) & 63),
  39235. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39236. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39237. ];
  39238. return chars.join('');
  39239. };
  39240. var btoa = window.btoa ||
  39241. function (b) {
  39242. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39243. };
  39244. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39245. var Timer = (function () {
  39246. function Timer(set, clear, delay, callback) {
  39247. var _this = this;
  39248. this.clear = clear;
  39249. this.timer = set(function () {
  39250. if (_this.timer) {
  39251. _this.timer = callback(_this.timer);
  39252. }
  39253. }, delay);
  39254. }
  39255. Timer.prototype.isRunning = function () {
  39256. return this.timer !== null;
  39257. };
  39258. Timer.prototype.ensureAborted = function () {
  39259. if (this.timer) {
  39260. this.clear(this.timer);
  39261. this.timer = null;
  39262. }
  39263. };
  39264. return Timer;
  39265. }());
  39266. /* harmony default export */ var abstract_timer = (Timer);
  39267. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39268. var __extends = (undefined && undefined.__extends) || (function () {
  39269. var extendStatics = function (d, b) {
  39270. extendStatics = Object.setPrototypeOf ||
  39271. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39272. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39273. return extendStatics(d, b);
  39274. };
  39275. return function (d, b) {
  39276. extendStatics(d, b);
  39277. function __() { this.constructor = d; }
  39278. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39279. };
  39280. })();
  39281. function timers_clearTimeout(timer) {
  39282. window.clearTimeout(timer);
  39283. }
  39284. function timers_clearInterval(timer) {
  39285. window.clearInterval(timer);
  39286. }
  39287. var OneOffTimer = (function (_super) {
  39288. __extends(OneOffTimer, _super);
  39289. function OneOffTimer(delay, callback) {
  39290. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39291. callback();
  39292. return null;
  39293. }) || this;
  39294. }
  39295. return OneOffTimer;
  39296. }(abstract_timer));
  39297. var PeriodicTimer = (function (_super) {
  39298. __extends(PeriodicTimer, _super);
  39299. function PeriodicTimer(delay, callback) {
  39300. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39301. callback();
  39302. return timer;
  39303. }) || this;
  39304. }
  39305. return PeriodicTimer;
  39306. }(abstract_timer));
  39307. // CONCATENATED MODULE: ./src/core/util.ts
  39308. var Util = {
  39309. now: function () {
  39310. if (Date.now) {
  39311. return Date.now();
  39312. }
  39313. else {
  39314. return new Date().valueOf();
  39315. }
  39316. },
  39317. defer: function (callback) {
  39318. return new OneOffTimer(0, callback);
  39319. },
  39320. method: function (name) {
  39321. var args = [];
  39322. for (var _i = 1; _i < arguments.length; _i++) {
  39323. args[_i - 1] = arguments[_i];
  39324. }
  39325. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39326. return function (object) {
  39327. return object[name].apply(object, boundArguments.concat(arguments));
  39328. };
  39329. }
  39330. };
  39331. /* harmony default export */ var util = (Util);
  39332. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39333. function extend(target) {
  39334. var sources = [];
  39335. for (var _i = 1; _i < arguments.length; _i++) {
  39336. sources[_i - 1] = arguments[_i];
  39337. }
  39338. for (var i = 0; i < sources.length; i++) {
  39339. var extensions = sources[i];
  39340. for (var property in extensions) {
  39341. if (extensions[property] && extensions[property].constructor &&
  39342. extensions[property].constructor === Object) {
  39343. target[property] = extend(target[property] || {}, extensions[property]);
  39344. }
  39345. else {
  39346. target[property] = extensions[property];
  39347. }
  39348. }
  39349. }
  39350. return target;
  39351. }
  39352. function stringify() {
  39353. var m = ["Pusher"];
  39354. for (var i = 0; i < arguments.length; i++) {
  39355. if (typeof arguments[i] === "string") {
  39356. m.push(arguments[i]);
  39357. }
  39358. else {
  39359. m.push(safeJSONStringify(arguments[i]));
  39360. }
  39361. }
  39362. return m.join(" : ");
  39363. }
  39364. function arrayIndexOf(array, item) {
  39365. var nativeIndexOf = Array.prototype.indexOf;
  39366. if (array === null) {
  39367. return -1;
  39368. }
  39369. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39370. return array.indexOf(item);
  39371. }
  39372. for (var i = 0, l = array.length; i < l; i++) {
  39373. if (array[i] === item) {
  39374. return i;
  39375. }
  39376. }
  39377. return -1;
  39378. }
  39379. function objectApply(object, f) {
  39380. for (var key in object) {
  39381. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39382. f(object[key], key, object);
  39383. }
  39384. }
  39385. }
  39386. function keys(object) {
  39387. var keys = [];
  39388. objectApply(object, function (_, key) {
  39389. keys.push(key);
  39390. });
  39391. return keys;
  39392. }
  39393. function values(object) {
  39394. var values = [];
  39395. objectApply(object, function (value) {
  39396. values.push(value);
  39397. });
  39398. return values;
  39399. }
  39400. function apply(array, f, context) {
  39401. for (var i = 0; i < array.length; i++) {
  39402. f.call(context || window, array[i], i, array);
  39403. }
  39404. }
  39405. function map(array, f) {
  39406. var result = [];
  39407. for (var i = 0; i < array.length; i++) {
  39408. result.push(f(array[i], i, array, result));
  39409. }
  39410. return result;
  39411. }
  39412. function mapObject(object, f) {
  39413. var result = {};
  39414. objectApply(object, function (value, key) {
  39415. result[key] = f(value);
  39416. });
  39417. return result;
  39418. }
  39419. function filter(array, test) {
  39420. test = test || function (value) { return !!value; };
  39421. var result = [];
  39422. for (var i = 0; i < array.length; i++) {
  39423. if (test(array[i], i, array, result)) {
  39424. result.push(array[i]);
  39425. }
  39426. }
  39427. return result;
  39428. }
  39429. function filterObject(object, test) {
  39430. var result = {};
  39431. objectApply(object, function (value, key) {
  39432. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39433. result[key] = value;
  39434. }
  39435. });
  39436. return result;
  39437. }
  39438. function flatten(object) {
  39439. var result = [];
  39440. objectApply(object, function (value, key) {
  39441. result.push([key, value]);
  39442. });
  39443. return result;
  39444. }
  39445. function any(array, test) {
  39446. for (var i = 0; i < array.length; i++) {
  39447. if (test(array[i], i, array)) {
  39448. return true;
  39449. }
  39450. }
  39451. return false;
  39452. }
  39453. function collections_all(array, test) {
  39454. for (var i = 0; i < array.length; i++) {
  39455. if (!test(array[i], i, array)) {
  39456. return false;
  39457. }
  39458. }
  39459. return true;
  39460. }
  39461. function encodeParamsObject(data) {
  39462. return mapObject(data, function (value) {
  39463. if (typeof value === "object") {
  39464. value = safeJSONStringify(value);
  39465. }
  39466. return encodeURIComponent(encode(value.toString()));
  39467. });
  39468. }
  39469. function buildQueryString(data) {
  39470. var params = filterObject(data, function (value) {
  39471. return value !== undefined;
  39472. });
  39473. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39474. return query;
  39475. }
  39476. function decycleObject(object) {
  39477. var objects = [], paths = [];
  39478. return (function derez(value, path) {
  39479. var i, name, nu;
  39480. switch (typeof value) {
  39481. case 'object':
  39482. if (!value) {
  39483. return null;
  39484. }
  39485. for (i = 0; i < objects.length; i += 1) {
  39486. if (objects[i] === value) {
  39487. return { $ref: paths[i] };
  39488. }
  39489. }
  39490. objects.push(value);
  39491. paths.push(path);
  39492. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39493. nu = [];
  39494. for (i = 0; i < value.length; i += 1) {
  39495. nu[i] = derez(value[i], path + '[' + i + ']');
  39496. }
  39497. }
  39498. else {
  39499. nu = {};
  39500. for (name in value) {
  39501. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39502. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39503. }
  39504. }
  39505. }
  39506. return nu;
  39507. case 'number':
  39508. case 'string':
  39509. case 'boolean':
  39510. return value;
  39511. }
  39512. }(object, '$'));
  39513. }
  39514. function safeJSONStringify(source) {
  39515. try {
  39516. return JSON.stringify(source);
  39517. }
  39518. catch (e) {
  39519. return JSON.stringify(decycleObject(source));
  39520. }
  39521. }
  39522. // CONCATENATED MODULE: ./src/core/logger.ts
  39523. var logger_Logger = (function () {
  39524. function Logger() {
  39525. this.globalLog = function (message) {
  39526. if (window.console && window.console.log) {
  39527. window.console.log(message);
  39528. }
  39529. };
  39530. }
  39531. Logger.prototype.debug = function () {
  39532. var args = [];
  39533. for (var _i = 0; _i < arguments.length; _i++) {
  39534. args[_i] = arguments[_i];
  39535. }
  39536. this.log(this.globalLog, args);
  39537. };
  39538. Logger.prototype.warn = function () {
  39539. var args = [];
  39540. for (var _i = 0; _i < arguments.length; _i++) {
  39541. args[_i] = arguments[_i];
  39542. }
  39543. this.log(this.globalLogWarn, args);
  39544. };
  39545. Logger.prototype.error = function () {
  39546. var args = [];
  39547. for (var _i = 0; _i < arguments.length; _i++) {
  39548. args[_i] = arguments[_i];
  39549. }
  39550. this.log(this.globalLogError, args);
  39551. };
  39552. Logger.prototype.globalLogWarn = function (message) {
  39553. if (window.console && window.console.warn) {
  39554. window.console.warn(message);
  39555. }
  39556. else {
  39557. this.globalLog(message);
  39558. }
  39559. };
  39560. Logger.prototype.globalLogError = function (message) {
  39561. if (window.console && window.console.error) {
  39562. window.console.error(message);
  39563. }
  39564. else {
  39565. this.globalLogWarn(message);
  39566. }
  39567. };
  39568. Logger.prototype.log = function (defaultLoggingFunction) {
  39569. var args = [];
  39570. for (var _i = 1; _i < arguments.length; _i++) {
  39571. args[_i - 1] = arguments[_i];
  39572. }
  39573. var message = stringify.apply(this, arguments);
  39574. if (core_pusher.log) {
  39575. core_pusher.log(message);
  39576. }
  39577. else if (core_pusher.logToConsole) {
  39578. var log = defaultLoggingFunction.bind(this);
  39579. log(message);
  39580. }
  39581. };
  39582. return Logger;
  39583. }());
  39584. /* harmony default export */ var logger = (new logger_Logger());
  39585. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39586. var urlStore = {
  39587. baseUrl: "https://pusher.com",
  39588. urls: {
  39589. authenticationEndpoint: {
  39590. path: "/docs/authenticating_users",
  39591. },
  39592. javascriptQuickStart: {
  39593. path: "/docs/javascript_quick_start"
  39594. },
  39595. triggeringClientEvents: {
  39596. path: "/docs/client_api_guide/client_events#trigger-events"
  39597. }
  39598. }
  39599. };
  39600. var buildLogSuffix = function (key) {
  39601. var urlPrefix = "See:";
  39602. var urlObj = urlStore.urls[key];
  39603. if (!urlObj)
  39604. return "";
  39605. var url;
  39606. if (urlObj.fullUrl) {
  39607. url = urlObj.fullUrl;
  39608. }
  39609. else if (urlObj.path) {
  39610. url = urlStore.baseUrl + urlObj.path;
  39611. }
  39612. if (!url)
  39613. return "";
  39614. return urlPrefix + " " + url;
  39615. };
  39616. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39617. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39618. var ajax = function (context, socketId, callback) {
  39619. var self = this, xhr;
  39620. xhr = runtime.createXHR();
  39621. xhr.open("POST", self.options.authEndpoint, true);
  39622. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39623. for (var headerName in this.authOptions.headers) {
  39624. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39625. }
  39626. xhr.onreadystatechange = function () {
  39627. if (xhr.readyState === 4) {
  39628. if (xhr.status === 200) {
  39629. var data, parsed = false;
  39630. try {
  39631. data = JSON.parse(xhr.responseText);
  39632. parsed = true;
  39633. }
  39634. catch (e) {
  39635. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39636. }
  39637. if (parsed) {
  39638. callback(false, data);
  39639. }
  39640. }
  39641. else {
  39642. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39643. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39644. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39645. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39646. callback(true, xhr.status);
  39647. }
  39648. }
  39649. };
  39650. xhr.send(this.composeQuery(socketId));
  39651. return xhr;
  39652. };
  39653. /* harmony default export */ var xhr_auth = (ajax);
  39654. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39655. var jsonp = function (context, socketId, callback) {
  39656. if (this.authOptions.headers !== undefined) {
  39657. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39658. }
  39659. var callbackName = context.nextAuthCallbackID.toString();
  39660. context.nextAuthCallbackID++;
  39661. var document = context.getDocument();
  39662. var script = document.createElement("script");
  39663. context.auth_callbacks[callbackName] = function (data) {
  39664. callback(false, data);
  39665. };
  39666. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39667. script.src = this.options.authEndpoint +
  39668. '?callback=' +
  39669. encodeURIComponent(callback_name) +
  39670. '&' +
  39671. this.composeQuery(socketId);
  39672. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39673. head.insertBefore(script, head.firstChild);
  39674. };
  39675. /* harmony default export */ var jsonp_auth = (jsonp);
  39676. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39677. var ScriptRequest = (function () {
  39678. function ScriptRequest(src) {
  39679. this.src = src;
  39680. }
  39681. ScriptRequest.prototype.send = function (receiver) {
  39682. var self = this;
  39683. var errorString = "Error loading " + self.src;
  39684. self.script = document.createElement("script");
  39685. self.script.id = receiver.id;
  39686. self.script.src = self.src;
  39687. self.script.type = "text/javascript";
  39688. self.script.charset = "UTF-8";
  39689. if (self.script.addEventListener) {
  39690. self.script.onerror = function () {
  39691. receiver.callback(errorString);
  39692. };
  39693. self.script.onload = function () {
  39694. receiver.callback(null);
  39695. };
  39696. }
  39697. else {
  39698. self.script.onreadystatechange = function () {
  39699. if (self.script.readyState === 'loaded' ||
  39700. self.script.readyState === 'complete') {
  39701. receiver.callback(null);
  39702. }
  39703. };
  39704. }
  39705. if (self.script.async === undefined && document.attachEvent &&
  39706. /opera/i.test(navigator.userAgent)) {
  39707. self.errorScript = document.createElement("script");
  39708. self.errorScript.id = receiver.id + "_error";
  39709. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39710. self.script.async = self.errorScript.async = false;
  39711. }
  39712. else {
  39713. self.script.async = true;
  39714. }
  39715. var head = document.getElementsByTagName('head')[0];
  39716. head.insertBefore(self.script, head.firstChild);
  39717. if (self.errorScript) {
  39718. head.insertBefore(self.errorScript, self.script.nextSibling);
  39719. }
  39720. };
  39721. ScriptRequest.prototype.cleanup = function () {
  39722. if (this.script) {
  39723. this.script.onload = this.script.onerror = null;
  39724. this.script.onreadystatechange = null;
  39725. }
  39726. if (this.script && this.script.parentNode) {
  39727. this.script.parentNode.removeChild(this.script);
  39728. }
  39729. if (this.errorScript && this.errorScript.parentNode) {
  39730. this.errorScript.parentNode.removeChild(this.errorScript);
  39731. }
  39732. this.script = null;
  39733. this.errorScript = null;
  39734. };
  39735. return ScriptRequest;
  39736. }());
  39737. /* harmony default export */ var script_request = (ScriptRequest);
  39738. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39739. var jsonp_request_JSONPRequest = (function () {
  39740. function JSONPRequest(url, data) {
  39741. this.url = url;
  39742. this.data = data;
  39743. }
  39744. JSONPRequest.prototype.send = function (receiver) {
  39745. if (this.request) {
  39746. return;
  39747. }
  39748. var query = buildQueryString(this.data);
  39749. var url = this.url + "/" + receiver.number + "?" + query;
  39750. this.request = runtime.createScriptRequest(url);
  39751. this.request.send(receiver);
  39752. };
  39753. JSONPRequest.prototype.cleanup = function () {
  39754. if (this.request) {
  39755. this.request.cleanup();
  39756. }
  39757. };
  39758. return JSONPRequest;
  39759. }());
  39760. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39761. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39762. var getAgent = function (sender, useTLS) {
  39763. return function (data, callback) {
  39764. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39765. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39766. var request = runtime.createJSONPRequest(url, data);
  39767. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39768. ScriptReceivers.remove(receiver);
  39769. request.cleanup();
  39770. if (result && result.host) {
  39771. sender.host = result.host;
  39772. }
  39773. if (callback) {
  39774. callback(error, result);
  39775. }
  39776. });
  39777. request.send(receiver);
  39778. };
  39779. };
  39780. var jsonp_timeline_jsonp = {
  39781. name: 'jsonp',
  39782. getAgent: getAgent
  39783. };
  39784. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39785. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39786. function getGenericURL(baseScheme, params, path) {
  39787. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39788. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39789. return scheme + "://" + host + path;
  39790. }
  39791. function getGenericPath(key, queryString) {
  39792. var path = "/app/" + key;
  39793. var query = "?protocol=" + defaults.PROTOCOL +
  39794. "&client=js" +
  39795. "&version=" + defaults.VERSION +
  39796. (queryString ? ("&" + queryString) : "");
  39797. return path + query;
  39798. }
  39799. var ws = {
  39800. getInitial: function (key, params) {
  39801. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39802. return getGenericURL("ws", params, path);
  39803. }
  39804. };
  39805. var http = {
  39806. getInitial: function (key, params) {
  39807. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39808. return getGenericURL("http", params, path);
  39809. }
  39810. };
  39811. var sockjs = {
  39812. getInitial: function (key, params) {
  39813. return getGenericURL("http", params, params.httpPath || "/pusher");
  39814. },
  39815. getPath: function (key, params) {
  39816. return getGenericPath(key);
  39817. }
  39818. };
  39819. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39820. var callback_registry_CallbackRegistry = (function () {
  39821. function CallbackRegistry() {
  39822. this._callbacks = {};
  39823. }
  39824. CallbackRegistry.prototype.get = function (name) {
  39825. return this._callbacks[prefix(name)];
  39826. };
  39827. CallbackRegistry.prototype.add = function (name, callback, context) {
  39828. var prefixedEventName = prefix(name);
  39829. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39830. this._callbacks[prefixedEventName].push({
  39831. fn: callback,
  39832. context: context
  39833. });
  39834. };
  39835. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39836. if (!name && !callback && !context) {
  39837. this._callbacks = {};
  39838. return;
  39839. }
  39840. var names = name ? [prefix(name)] : keys(this._callbacks);
  39841. if (callback || context) {
  39842. this.removeCallback(names, callback, context);
  39843. }
  39844. else {
  39845. this.removeAllCallbacks(names);
  39846. }
  39847. };
  39848. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39849. apply(names, function (name) {
  39850. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39851. return (callback && callback !== binding.fn) ||
  39852. (context && context !== binding.context);
  39853. });
  39854. if (this._callbacks[name].length === 0) {
  39855. delete this._callbacks[name];
  39856. }
  39857. }, this);
  39858. };
  39859. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39860. apply(names, function (name) {
  39861. delete this._callbacks[name];
  39862. }, this);
  39863. };
  39864. return CallbackRegistry;
  39865. }());
  39866. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39867. function prefix(name) {
  39868. return "_" + name;
  39869. }
  39870. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39871. var dispatcher_Dispatcher = (function () {
  39872. function Dispatcher(failThrough) {
  39873. this.callbacks = new callback_registry();
  39874. this.global_callbacks = [];
  39875. this.failThrough = failThrough;
  39876. }
  39877. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39878. this.callbacks.add(eventName, callback, context);
  39879. return this;
  39880. };
  39881. Dispatcher.prototype.bind_global = function (callback) {
  39882. this.global_callbacks.push(callback);
  39883. return this;
  39884. };
  39885. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39886. this.callbacks.remove(eventName, callback, context);
  39887. return this;
  39888. };
  39889. Dispatcher.prototype.unbind_global = function (callback) {
  39890. if (!callback) {
  39891. this.global_callbacks = [];
  39892. return this;
  39893. }
  39894. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39895. return this;
  39896. };
  39897. Dispatcher.prototype.unbind_all = function () {
  39898. this.unbind();
  39899. this.unbind_global();
  39900. return this;
  39901. };
  39902. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39903. for (var i = 0; i < this.global_callbacks.length; i++) {
  39904. this.global_callbacks[i](eventName, data);
  39905. }
  39906. var callbacks = this.callbacks.get(eventName);
  39907. var args = [];
  39908. if (metadata) {
  39909. args.push(data, metadata);
  39910. }
  39911. else if (data) {
  39912. args.push(data);
  39913. }
  39914. if (callbacks && callbacks.length > 0) {
  39915. for (var i = 0; i < callbacks.length; i++) {
  39916. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39917. }
  39918. }
  39919. else if (this.failThrough) {
  39920. this.failThrough(eventName, data);
  39921. }
  39922. return this;
  39923. };
  39924. return Dispatcher;
  39925. }());
  39926. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39927. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39928. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39929. var extendStatics = function (d, b) {
  39930. extendStatics = Object.setPrototypeOf ||
  39931. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39932. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39933. return extendStatics(d, b);
  39934. };
  39935. return function (d, b) {
  39936. extendStatics(d, b);
  39937. function __() { this.constructor = d; }
  39938. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39939. };
  39940. })();
  39941. var transport_connection_TransportConnection = (function (_super) {
  39942. transport_connection_extends(TransportConnection, _super);
  39943. function TransportConnection(hooks, name, priority, key, options) {
  39944. var _this = _super.call(this) || this;
  39945. _this.initialize = runtime.transportConnectionInitializer;
  39946. _this.hooks = hooks;
  39947. _this.name = name;
  39948. _this.priority = priority;
  39949. _this.key = key;
  39950. _this.options = options;
  39951. _this.state = "new";
  39952. _this.timeline = options.timeline;
  39953. _this.activityTimeout = options.activityTimeout;
  39954. _this.id = _this.timeline.generateUniqueID();
  39955. return _this;
  39956. }
  39957. TransportConnection.prototype.handlesActivityChecks = function () {
  39958. return Boolean(this.hooks.handlesActivityChecks);
  39959. };
  39960. TransportConnection.prototype.supportsPing = function () {
  39961. return Boolean(this.hooks.supportsPing);
  39962. };
  39963. TransportConnection.prototype.connect = function () {
  39964. var _this = this;
  39965. if (this.socket || this.state !== "initialized") {
  39966. return false;
  39967. }
  39968. var url = this.hooks.urls.getInitial(this.key, this.options);
  39969. try {
  39970. this.socket = this.hooks.getSocket(url, this.options);
  39971. }
  39972. catch (e) {
  39973. util.defer(function () {
  39974. _this.onError(e);
  39975. _this.changeState("closed");
  39976. });
  39977. return false;
  39978. }
  39979. this.bindListeners();
  39980. logger.debug("Connecting", { transport: this.name, url: url });
  39981. this.changeState("connecting");
  39982. return true;
  39983. };
  39984. TransportConnection.prototype.close = function () {
  39985. if (this.socket) {
  39986. this.socket.close();
  39987. return true;
  39988. }
  39989. else {
  39990. return false;
  39991. }
  39992. };
  39993. TransportConnection.prototype.send = function (data) {
  39994. var _this = this;
  39995. if (this.state === "open") {
  39996. util.defer(function () {
  39997. if (_this.socket) {
  39998. _this.socket.send(data);
  39999. }
  40000. });
  40001. return true;
  40002. }
  40003. else {
  40004. return false;
  40005. }
  40006. };
  40007. TransportConnection.prototype.ping = function () {
  40008. if (this.state === "open" && this.supportsPing()) {
  40009. this.socket.ping();
  40010. }
  40011. };
  40012. TransportConnection.prototype.onOpen = function () {
  40013. if (this.hooks.beforeOpen) {
  40014. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40015. }
  40016. this.changeState("open");
  40017. this.socket.onopen = undefined;
  40018. };
  40019. TransportConnection.prototype.onError = function (error) {
  40020. this.emit("error", { type: 'WebSocketError', error: error });
  40021. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40022. };
  40023. TransportConnection.prototype.onClose = function (closeEvent) {
  40024. if (closeEvent) {
  40025. this.changeState("closed", {
  40026. code: closeEvent.code,
  40027. reason: closeEvent.reason,
  40028. wasClean: closeEvent.wasClean
  40029. });
  40030. }
  40031. else {
  40032. this.changeState("closed");
  40033. }
  40034. this.unbindListeners();
  40035. this.socket = undefined;
  40036. };
  40037. TransportConnection.prototype.onMessage = function (message) {
  40038. this.emit("message", message);
  40039. };
  40040. TransportConnection.prototype.onActivity = function () {
  40041. this.emit("activity");
  40042. };
  40043. TransportConnection.prototype.bindListeners = function () {
  40044. var _this = this;
  40045. this.socket.onopen = function () {
  40046. _this.onOpen();
  40047. };
  40048. this.socket.onerror = function (error) {
  40049. _this.onError(error);
  40050. };
  40051. this.socket.onclose = function (closeEvent) {
  40052. _this.onClose(closeEvent);
  40053. };
  40054. this.socket.onmessage = function (message) {
  40055. _this.onMessage(message);
  40056. };
  40057. if (this.supportsPing()) {
  40058. this.socket.onactivity = function () { _this.onActivity(); };
  40059. }
  40060. };
  40061. TransportConnection.prototype.unbindListeners = function () {
  40062. if (this.socket) {
  40063. this.socket.onopen = undefined;
  40064. this.socket.onerror = undefined;
  40065. this.socket.onclose = undefined;
  40066. this.socket.onmessage = undefined;
  40067. if (this.supportsPing()) {
  40068. this.socket.onactivity = undefined;
  40069. }
  40070. }
  40071. };
  40072. TransportConnection.prototype.changeState = function (state, params) {
  40073. this.state = state;
  40074. this.timeline.info(this.buildTimelineMessage({
  40075. state: state,
  40076. params: params
  40077. }));
  40078. this.emit(state, params);
  40079. };
  40080. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40081. return extend({ cid: this.id }, message);
  40082. };
  40083. return TransportConnection;
  40084. }(dispatcher));
  40085. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40086. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40087. var transport_Transport = (function () {
  40088. function Transport(hooks) {
  40089. this.hooks = hooks;
  40090. }
  40091. Transport.prototype.isSupported = function (environment) {
  40092. return this.hooks.isSupported(environment);
  40093. };
  40094. Transport.prototype.createConnection = function (name, priority, key, options) {
  40095. return new transport_connection(this.hooks, name, priority, key, options);
  40096. };
  40097. return Transport;
  40098. }());
  40099. /* harmony default export */ var transports_transport = (transport_Transport);
  40100. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40101. var WSTransport = new transports_transport({
  40102. urls: ws,
  40103. handlesActivityChecks: false,
  40104. supportsPing: false,
  40105. isInitialized: function () {
  40106. return Boolean(runtime.getWebSocketAPI());
  40107. },
  40108. isSupported: function () {
  40109. return Boolean(runtime.getWebSocketAPI());
  40110. },
  40111. getSocket: function (url) {
  40112. return runtime.createWebSocket(url);
  40113. }
  40114. });
  40115. var httpConfiguration = {
  40116. urls: http,
  40117. handlesActivityChecks: false,
  40118. supportsPing: true,
  40119. isInitialized: function () {
  40120. return true;
  40121. }
  40122. };
  40123. var streamingConfiguration = extend({ getSocket: function (url) {
  40124. return runtime.HTTPFactory.createStreamingSocket(url);
  40125. }
  40126. }, httpConfiguration);
  40127. var pollingConfiguration = extend({ getSocket: function (url) {
  40128. return runtime.HTTPFactory.createPollingSocket(url);
  40129. }
  40130. }, httpConfiguration);
  40131. var xhrConfiguration = {
  40132. isSupported: function () {
  40133. return runtime.isXHRSupported();
  40134. }
  40135. };
  40136. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40137. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40138. var Transports = {
  40139. ws: WSTransport,
  40140. xhr_streaming: XHRStreamingTransport,
  40141. xhr_polling: XHRPollingTransport
  40142. };
  40143. /* harmony default export */ var transports = (Transports);
  40144. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40145. var SockJSTransport = new transports_transport({
  40146. file: "sockjs",
  40147. urls: sockjs,
  40148. handlesActivityChecks: true,
  40149. supportsPing: false,
  40150. isSupported: function () {
  40151. return true;
  40152. },
  40153. isInitialized: function () {
  40154. return window.SockJS !== undefined;
  40155. },
  40156. getSocket: function (url, options) {
  40157. return new window.SockJS(url, null, {
  40158. js_path: Dependencies.getPath("sockjs", {
  40159. useTLS: options.useTLS
  40160. }),
  40161. ignore_null_origin: options.ignoreNullOrigin
  40162. });
  40163. },
  40164. beforeOpen: function (socket, path) {
  40165. socket.send(JSON.stringify({
  40166. path: path
  40167. }));
  40168. }
  40169. });
  40170. var xdrConfiguration = {
  40171. isSupported: function (environment) {
  40172. var yes = runtime.isXDRSupported(environment.useTLS);
  40173. return yes;
  40174. }
  40175. };
  40176. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40177. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40178. transports.xdr_streaming = XDRStreamingTransport;
  40179. transports.xdr_polling = XDRPollingTransport;
  40180. transports.sockjs = SockJSTransport;
  40181. /* harmony default export */ var transports_transports = (transports);
  40182. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40183. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40184. var extendStatics = function (d, b) {
  40185. extendStatics = Object.setPrototypeOf ||
  40186. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40187. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40188. return extendStatics(d, b);
  40189. };
  40190. return function (d, b) {
  40191. extendStatics(d, b);
  40192. function __() { this.constructor = d; }
  40193. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40194. };
  40195. })();
  40196. var NetInfo = (function (_super) {
  40197. net_info_extends(NetInfo, _super);
  40198. function NetInfo() {
  40199. var _this = _super.call(this) || this;
  40200. var self = _this;
  40201. if (window.addEventListener !== undefined) {
  40202. window.addEventListener("online", function () {
  40203. self.emit('online');
  40204. }, false);
  40205. window.addEventListener("offline", function () {
  40206. self.emit('offline');
  40207. }, false);
  40208. }
  40209. return _this;
  40210. }
  40211. NetInfo.prototype.isOnline = function () {
  40212. if (window.navigator.onLine === undefined) {
  40213. return true;
  40214. }
  40215. else {
  40216. return window.navigator.onLine;
  40217. }
  40218. };
  40219. return NetInfo;
  40220. }(dispatcher));
  40221. var net_info_Network = new NetInfo();
  40222. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40223. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40224. function AssistantToTheTransportManager(manager, transport, options) {
  40225. this.manager = manager;
  40226. this.transport = transport;
  40227. this.minPingDelay = options.minPingDelay;
  40228. this.maxPingDelay = options.maxPingDelay;
  40229. this.pingDelay = undefined;
  40230. }
  40231. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40232. var _this = this;
  40233. options = extend({}, options, {
  40234. activityTimeout: this.pingDelay
  40235. });
  40236. var connection = this.transport.createConnection(name, priority, key, options);
  40237. var openTimestamp = null;
  40238. var onOpen = function () {
  40239. connection.unbind("open", onOpen);
  40240. connection.bind("closed", onClosed);
  40241. openTimestamp = util.now();
  40242. };
  40243. var onClosed = function (closeEvent) {
  40244. connection.unbind("closed", onClosed);
  40245. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40246. _this.manager.reportDeath();
  40247. }
  40248. else if (!closeEvent.wasClean && openTimestamp) {
  40249. var lifespan = util.now() - openTimestamp;
  40250. if (lifespan < 2 * _this.maxPingDelay) {
  40251. _this.manager.reportDeath();
  40252. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40253. }
  40254. }
  40255. };
  40256. connection.bind("open", onOpen);
  40257. return connection;
  40258. };
  40259. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40260. return this.manager.isAlive() && this.transport.isSupported(environment);
  40261. };
  40262. return AssistantToTheTransportManager;
  40263. }());
  40264. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40265. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40266. var Protocol = {
  40267. decodeMessage: function (messageEvent) {
  40268. try {
  40269. var messageData = JSON.parse(messageEvent.data);
  40270. var pusherEventData = messageData.data;
  40271. if (typeof pusherEventData === 'string') {
  40272. try {
  40273. pusherEventData = JSON.parse(messageData.data);
  40274. }
  40275. catch (e) { }
  40276. }
  40277. var pusherEvent = {
  40278. event: messageData.event,
  40279. channel: messageData.channel,
  40280. data: pusherEventData,
  40281. };
  40282. if (messageData.user_id) {
  40283. pusherEvent.user_id = messageData.user_id;
  40284. }
  40285. return pusherEvent;
  40286. }
  40287. catch (e) {
  40288. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40289. }
  40290. },
  40291. encodeMessage: function (event) {
  40292. return JSON.stringify(event);
  40293. },
  40294. processHandshake: function (messageEvent) {
  40295. var message = Protocol.decodeMessage(messageEvent);
  40296. if (message.event === "pusher:connection_established") {
  40297. if (!message.data.activity_timeout) {
  40298. throw "No activity timeout specified in handshake";
  40299. }
  40300. return {
  40301. action: "connected",
  40302. id: message.data.socket_id,
  40303. activityTimeout: message.data.activity_timeout * 1000
  40304. };
  40305. }
  40306. else if (message.event === "pusher:error") {
  40307. return {
  40308. action: this.getCloseAction(message.data),
  40309. error: this.getCloseError(message.data)
  40310. };
  40311. }
  40312. else {
  40313. throw "Invalid handshake";
  40314. }
  40315. },
  40316. getCloseAction: function (closeEvent) {
  40317. if (closeEvent.code < 4000) {
  40318. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40319. return "backoff";
  40320. }
  40321. else {
  40322. return null;
  40323. }
  40324. }
  40325. else if (closeEvent.code === 4000) {
  40326. return "tls_only";
  40327. }
  40328. else if (closeEvent.code < 4100) {
  40329. return "refused";
  40330. }
  40331. else if (closeEvent.code < 4200) {
  40332. return "backoff";
  40333. }
  40334. else if (closeEvent.code < 4300) {
  40335. return "retry";
  40336. }
  40337. else {
  40338. return "refused";
  40339. }
  40340. },
  40341. getCloseError: function (closeEvent) {
  40342. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40343. return {
  40344. type: 'PusherError',
  40345. data: {
  40346. code: closeEvent.code,
  40347. message: closeEvent.reason || closeEvent.message
  40348. }
  40349. };
  40350. }
  40351. else {
  40352. return null;
  40353. }
  40354. }
  40355. };
  40356. /* harmony default export */ var protocol_protocol = (Protocol);
  40357. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40358. var connection_extends = (undefined && undefined.__extends) || (function () {
  40359. var extendStatics = function (d, b) {
  40360. extendStatics = Object.setPrototypeOf ||
  40361. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40362. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40363. return extendStatics(d, b);
  40364. };
  40365. return function (d, b) {
  40366. extendStatics(d, b);
  40367. function __() { this.constructor = d; }
  40368. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40369. };
  40370. })();
  40371. var connection_Connection = (function (_super) {
  40372. connection_extends(Connection, _super);
  40373. function Connection(id, transport) {
  40374. var _this = _super.call(this) || this;
  40375. _this.id = id;
  40376. _this.transport = transport;
  40377. _this.activityTimeout = transport.activityTimeout;
  40378. _this.bindListeners();
  40379. return _this;
  40380. }
  40381. Connection.prototype.handlesActivityChecks = function () {
  40382. return this.transport.handlesActivityChecks();
  40383. };
  40384. Connection.prototype.send = function (data) {
  40385. return this.transport.send(data);
  40386. };
  40387. Connection.prototype.send_event = function (name, data, channel) {
  40388. var event = { event: name, data: data };
  40389. if (channel) {
  40390. event.channel = channel;
  40391. }
  40392. logger.debug('Event sent', event);
  40393. return this.send(protocol_protocol.encodeMessage(event));
  40394. };
  40395. Connection.prototype.ping = function () {
  40396. if (this.transport.supportsPing()) {
  40397. this.transport.ping();
  40398. }
  40399. else {
  40400. this.send_event('pusher:ping', {});
  40401. }
  40402. };
  40403. Connection.prototype.close = function () {
  40404. this.transport.close();
  40405. };
  40406. Connection.prototype.bindListeners = function () {
  40407. var _this = this;
  40408. var listeners = {
  40409. message: function (messageEvent) {
  40410. var pusherEvent;
  40411. try {
  40412. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40413. }
  40414. catch (e) {
  40415. _this.emit('error', {
  40416. type: 'MessageParseError',
  40417. error: e,
  40418. data: messageEvent.data
  40419. });
  40420. }
  40421. if (pusherEvent !== undefined) {
  40422. logger.debug('Event recd', pusherEvent);
  40423. switch (pusherEvent.event) {
  40424. case 'pusher:error':
  40425. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40426. break;
  40427. case 'pusher:ping':
  40428. _this.emit("ping");
  40429. break;
  40430. case 'pusher:pong':
  40431. _this.emit("pong");
  40432. break;
  40433. }
  40434. _this.emit('message', pusherEvent);
  40435. }
  40436. },
  40437. activity: function () {
  40438. _this.emit("activity");
  40439. },
  40440. error: function (error) {
  40441. _this.emit("error", { type: "WebSocketError", error: error });
  40442. },
  40443. closed: function (closeEvent) {
  40444. unbindListeners();
  40445. if (closeEvent && closeEvent.code) {
  40446. _this.handleCloseEvent(closeEvent);
  40447. }
  40448. _this.transport = null;
  40449. _this.emit("closed");
  40450. }
  40451. };
  40452. var unbindListeners = function () {
  40453. objectApply(listeners, function (listener, event) {
  40454. _this.transport.unbind(event, listener);
  40455. });
  40456. };
  40457. objectApply(listeners, function (listener, event) {
  40458. _this.transport.bind(event, listener);
  40459. });
  40460. };
  40461. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40462. var action = protocol_protocol.getCloseAction(closeEvent);
  40463. var error = protocol_protocol.getCloseError(closeEvent);
  40464. if (error) {
  40465. this.emit('error', error);
  40466. }
  40467. if (action) {
  40468. this.emit(action, { action: action, error: error });
  40469. }
  40470. };
  40471. return Connection;
  40472. }(dispatcher));
  40473. /* harmony default export */ var connection_connection = (connection_Connection);
  40474. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40475. var handshake_Handshake = (function () {
  40476. function Handshake(transport, callback) {
  40477. this.transport = transport;
  40478. this.callback = callback;
  40479. this.bindListeners();
  40480. }
  40481. Handshake.prototype.close = function () {
  40482. this.unbindListeners();
  40483. this.transport.close();
  40484. };
  40485. Handshake.prototype.bindListeners = function () {
  40486. var _this = this;
  40487. this.onMessage = function (m) {
  40488. _this.unbindListeners();
  40489. var result;
  40490. try {
  40491. result = protocol_protocol.processHandshake(m);
  40492. }
  40493. catch (e) {
  40494. _this.finish("error", { error: e });
  40495. _this.transport.close();
  40496. return;
  40497. }
  40498. if (result.action === "connected") {
  40499. _this.finish("connected", {
  40500. connection: new connection_connection(result.id, _this.transport),
  40501. activityTimeout: result.activityTimeout
  40502. });
  40503. }
  40504. else {
  40505. _this.finish(result.action, { error: result.error });
  40506. _this.transport.close();
  40507. }
  40508. };
  40509. this.onClosed = function (closeEvent) {
  40510. _this.unbindListeners();
  40511. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40512. var error = protocol_protocol.getCloseError(closeEvent);
  40513. _this.finish(action, { error: error });
  40514. };
  40515. this.transport.bind("message", this.onMessage);
  40516. this.transport.bind("closed", this.onClosed);
  40517. };
  40518. Handshake.prototype.unbindListeners = function () {
  40519. this.transport.unbind("message", this.onMessage);
  40520. this.transport.unbind("closed", this.onClosed);
  40521. };
  40522. Handshake.prototype.finish = function (action, params) {
  40523. this.callback(extend({ transport: this.transport, action: action }, params));
  40524. };
  40525. return Handshake;
  40526. }());
  40527. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40528. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40529. var pusher_authorizer_PusherAuthorizer = (function () {
  40530. function PusherAuthorizer(channel, options) {
  40531. this.channel = channel;
  40532. var authTransport = options.authTransport;
  40533. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40534. throw "'" + authTransport + "' is not a recognized auth transport";
  40535. }
  40536. this.type = authTransport;
  40537. this.options = options;
  40538. this.authOptions = (options || {}).auth || {};
  40539. }
  40540. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40541. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40542. '&channel_name=' + encodeURIComponent(this.channel.name);
  40543. for (var i in this.authOptions.params) {
  40544. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40545. }
  40546. return query;
  40547. };
  40548. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40549. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40550. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40551. };
  40552. return PusherAuthorizer;
  40553. }());
  40554. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40555. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40556. var timeline_sender_TimelineSender = (function () {
  40557. function TimelineSender(timeline, options) {
  40558. this.timeline = timeline;
  40559. this.options = options || {};
  40560. }
  40561. TimelineSender.prototype.send = function (useTLS, callback) {
  40562. if (this.timeline.isEmpty()) {
  40563. return;
  40564. }
  40565. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40566. };
  40567. return TimelineSender;
  40568. }());
  40569. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40570. // CONCATENATED MODULE: ./src/core/errors.ts
  40571. var errors_extends = (undefined && undefined.__extends) || (function () {
  40572. var extendStatics = function (d, b) {
  40573. extendStatics = Object.setPrototypeOf ||
  40574. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40575. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40576. return extendStatics(d, b);
  40577. };
  40578. return function (d, b) {
  40579. extendStatics(d, b);
  40580. function __() { this.constructor = d; }
  40581. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40582. };
  40583. })();
  40584. var BadEventName = (function (_super) {
  40585. errors_extends(BadEventName, _super);
  40586. function BadEventName(msg) {
  40587. var _newTarget = this.constructor;
  40588. var _this = _super.call(this, msg) || this;
  40589. Object.setPrototypeOf(_this, _newTarget.prototype);
  40590. return _this;
  40591. }
  40592. return BadEventName;
  40593. }(Error));
  40594. var RequestTimedOut = (function (_super) {
  40595. errors_extends(RequestTimedOut, _super);
  40596. function RequestTimedOut(msg) {
  40597. var _newTarget = this.constructor;
  40598. var _this = _super.call(this, msg) || this;
  40599. Object.setPrototypeOf(_this, _newTarget.prototype);
  40600. return _this;
  40601. }
  40602. return RequestTimedOut;
  40603. }(Error));
  40604. var TransportPriorityTooLow = (function (_super) {
  40605. errors_extends(TransportPriorityTooLow, _super);
  40606. function TransportPriorityTooLow(msg) {
  40607. var _newTarget = this.constructor;
  40608. var _this = _super.call(this, msg) || this;
  40609. Object.setPrototypeOf(_this, _newTarget.prototype);
  40610. return _this;
  40611. }
  40612. return TransportPriorityTooLow;
  40613. }(Error));
  40614. var TransportClosed = (function (_super) {
  40615. errors_extends(TransportClosed, _super);
  40616. function TransportClosed(msg) {
  40617. var _newTarget = this.constructor;
  40618. var _this = _super.call(this, msg) || this;
  40619. Object.setPrototypeOf(_this, _newTarget.prototype);
  40620. return _this;
  40621. }
  40622. return TransportClosed;
  40623. }(Error));
  40624. var UnsupportedFeature = (function (_super) {
  40625. errors_extends(UnsupportedFeature, _super);
  40626. function UnsupportedFeature(msg) {
  40627. var _newTarget = this.constructor;
  40628. var _this = _super.call(this, msg) || this;
  40629. Object.setPrototypeOf(_this, _newTarget.prototype);
  40630. return _this;
  40631. }
  40632. return UnsupportedFeature;
  40633. }(Error));
  40634. var UnsupportedTransport = (function (_super) {
  40635. errors_extends(UnsupportedTransport, _super);
  40636. function UnsupportedTransport(msg) {
  40637. var _newTarget = this.constructor;
  40638. var _this = _super.call(this, msg) || this;
  40639. Object.setPrototypeOf(_this, _newTarget.prototype);
  40640. return _this;
  40641. }
  40642. return UnsupportedTransport;
  40643. }(Error));
  40644. var UnsupportedStrategy = (function (_super) {
  40645. errors_extends(UnsupportedStrategy, _super);
  40646. function UnsupportedStrategy(msg) {
  40647. var _newTarget = this.constructor;
  40648. var _this = _super.call(this, msg) || this;
  40649. Object.setPrototypeOf(_this, _newTarget.prototype);
  40650. return _this;
  40651. }
  40652. return UnsupportedStrategy;
  40653. }(Error));
  40654. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40655. var channel_extends = (undefined && undefined.__extends) || (function () {
  40656. var extendStatics = function (d, b) {
  40657. extendStatics = Object.setPrototypeOf ||
  40658. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40659. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40660. return extendStatics(d, b);
  40661. };
  40662. return function (d, b) {
  40663. extendStatics(d, b);
  40664. function __() { this.constructor = d; }
  40665. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40666. };
  40667. })();
  40668. var channel_Channel = (function (_super) {
  40669. channel_extends(Channel, _super);
  40670. function Channel(name, pusher) {
  40671. var _this = _super.call(this, function (event, data) {
  40672. logger.debug('No callbacks on ' + name + ' for ' + event);
  40673. }) || this;
  40674. _this.name = name;
  40675. _this.pusher = pusher;
  40676. _this.subscribed = false;
  40677. _this.subscriptionPending = false;
  40678. _this.subscriptionCancelled = false;
  40679. return _this;
  40680. }
  40681. Channel.prototype.authorize = function (socketId, callback) {
  40682. return callback(false, {});
  40683. };
  40684. Channel.prototype.trigger = function (event, data) {
  40685. if (event.indexOf("client-") !== 0) {
  40686. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40687. }
  40688. if (!this.subscribed) {
  40689. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40690. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40691. }
  40692. return this.pusher.send_event(event, data, this.name);
  40693. };
  40694. Channel.prototype.disconnect = function () {
  40695. this.subscribed = false;
  40696. this.subscriptionPending = false;
  40697. };
  40698. Channel.prototype.handleEvent = function (event) {
  40699. var eventName = event.event;
  40700. var data = event.data;
  40701. if (eventName === "pusher_internal:subscription_succeeded") {
  40702. this.handleSubscriptionSucceededEvent(event);
  40703. }
  40704. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40705. var metadata = {};
  40706. this.emit(eventName, data, metadata);
  40707. }
  40708. };
  40709. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40710. this.subscriptionPending = false;
  40711. this.subscribed = true;
  40712. if (this.subscriptionCancelled) {
  40713. this.pusher.unsubscribe(this.name);
  40714. }
  40715. else {
  40716. this.emit("pusher:subscription_succeeded", event.data);
  40717. }
  40718. };
  40719. Channel.prototype.subscribe = function () {
  40720. var _this = this;
  40721. if (this.subscribed) {
  40722. return;
  40723. }
  40724. this.subscriptionPending = true;
  40725. this.subscriptionCancelled = false;
  40726. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40727. if (error) {
  40728. logger.error(data);
  40729. _this.emit('pusher:subscription_error', data);
  40730. }
  40731. else {
  40732. _this.pusher.send_event('pusher:subscribe', {
  40733. auth: data.auth,
  40734. channel_data: data.channel_data,
  40735. channel: _this.name
  40736. });
  40737. }
  40738. });
  40739. };
  40740. Channel.prototype.unsubscribe = function () {
  40741. this.subscribed = false;
  40742. this.pusher.send_event('pusher:unsubscribe', {
  40743. channel: this.name
  40744. });
  40745. };
  40746. Channel.prototype.cancelSubscription = function () {
  40747. this.subscriptionCancelled = true;
  40748. };
  40749. Channel.prototype.reinstateSubscription = function () {
  40750. this.subscriptionCancelled = false;
  40751. };
  40752. return Channel;
  40753. }(dispatcher));
  40754. /* harmony default export */ var channels_channel = (channel_Channel);
  40755. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40756. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40757. var extendStatics = function (d, b) {
  40758. extendStatics = Object.setPrototypeOf ||
  40759. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40760. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40761. return extendStatics(d, b);
  40762. };
  40763. return function (d, b) {
  40764. extendStatics(d, b);
  40765. function __() { this.constructor = d; }
  40766. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40767. };
  40768. })();
  40769. var private_channel_PrivateChannel = (function (_super) {
  40770. private_channel_extends(PrivateChannel, _super);
  40771. function PrivateChannel() {
  40772. return _super !== null && _super.apply(this, arguments) || this;
  40773. }
  40774. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40775. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40776. return authorizer.authorize(socketId, callback);
  40777. };
  40778. return PrivateChannel;
  40779. }(channels_channel));
  40780. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40781. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40782. var members_Members = (function () {
  40783. function Members() {
  40784. this.reset();
  40785. }
  40786. Members.prototype.get = function (id) {
  40787. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40788. return {
  40789. id: id,
  40790. info: this.members[id]
  40791. };
  40792. }
  40793. else {
  40794. return null;
  40795. }
  40796. };
  40797. Members.prototype.each = function (callback) {
  40798. var _this = this;
  40799. objectApply(this.members, function (member, id) {
  40800. callback(_this.get(id));
  40801. });
  40802. };
  40803. Members.prototype.setMyID = function (id) {
  40804. this.myID = id;
  40805. };
  40806. Members.prototype.onSubscription = function (subscriptionData) {
  40807. this.members = subscriptionData.presence.hash;
  40808. this.count = subscriptionData.presence.count;
  40809. this.me = this.get(this.myID);
  40810. };
  40811. Members.prototype.addMember = function (memberData) {
  40812. if (this.get(memberData.user_id) === null) {
  40813. this.count++;
  40814. }
  40815. this.members[memberData.user_id] = memberData.user_info;
  40816. return this.get(memberData.user_id);
  40817. };
  40818. Members.prototype.removeMember = function (memberData) {
  40819. var member = this.get(memberData.user_id);
  40820. if (member) {
  40821. delete this.members[memberData.user_id];
  40822. this.count--;
  40823. }
  40824. return member;
  40825. };
  40826. Members.prototype.reset = function () {
  40827. this.members = {};
  40828. this.count = 0;
  40829. this.myID = null;
  40830. this.me = null;
  40831. };
  40832. return Members;
  40833. }());
  40834. /* harmony default export */ var members = (members_Members);
  40835. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40836. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40837. var extendStatics = function (d, b) {
  40838. extendStatics = Object.setPrototypeOf ||
  40839. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40840. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40841. return extendStatics(d, b);
  40842. };
  40843. return function (d, b) {
  40844. extendStatics(d, b);
  40845. function __() { this.constructor = d; }
  40846. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40847. };
  40848. })();
  40849. var presence_channel_PresenceChannel = (function (_super) {
  40850. presence_channel_extends(PresenceChannel, _super);
  40851. function PresenceChannel(name, pusher) {
  40852. var _this = _super.call(this, name, pusher) || this;
  40853. _this.members = new members();
  40854. return _this;
  40855. }
  40856. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40857. var _this = this;
  40858. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40859. if (!error) {
  40860. if (authData.channel_data === undefined) {
  40861. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40862. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40863. ("expected 'channel_data' field. " + suffix));
  40864. callback("Invalid auth response");
  40865. return;
  40866. }
  40867. var channelData = JSON.parse(authData.channel_data);
  40868. _this.members.setMyID(channelData.user_id);
  40869. }
  40870. callback(error, authData);
  40871. });
  40872. };
  40873. PresenceChannel.prototype.handleEvent = function (event) {
  40874. var eventName = event.event;
  40875. if (eventName.indexOf("pusher_internal:") === 0) {
  40876. this.handleInternalEvent(event);
  40877. }
  40878. else {
  40879. var data = event.data;
  40880. var metadata = {};
  40881. if (event.user_id) {
  40882. metadata.user_id = event.user_id;
  40883. }
  40884. this.emit(eventName, data, metadata);
  40885. }
  40886. };
  40887. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40888. var eventName = event.event;
  40889. var data = event.data;
  40890. switch (eventName) {
  40891. case "pusher_internal:subscription_succeeded":
  40892. this.handleSubscriptionSucceededEvent(event);
  40893. break;
  40894. case "pusher_internal:member_added":
  40895. var addedMember = this.members.addMember(data);
  40896. this.emit('pusher:member_added', addedMember);
  40897. break;
  40898. case "pusher_internal:member_removed":
  40899. var removedMember = this.members.removeMember(data);
  40900. if (removedMember) {
  40901. this.emit('pusher:member_removed', removedMember);
  40902. }
  40903. break;
  40904. }
  40905. };
  40906. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40907. this.subscriptionPending = false;
  40908. this.subscribed = true;
  40909. if (this.subscriptionCancelled) {
  40910. this.pusher.unsubscribe(this.name);
  40911. }
  40912. else {
  40913. this.members.onSubscription(event.data);
  40914. this.emit("pusher:subscription_succeeded", this.members);
  40915. }
  40916. };
  40917. PresenceChannel.prototype.disconnect = function () {
  40918. this.members.reset();
  40919. _super.prototype.disconnect.call(this);
  40920. };
  40921. return PresenceChannel;
  40922. }(private_channel));
  40923. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40924. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40925. var nacl_fast = __webpack_require__(0);
  40926. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40927. var nacl_util = __webpack_require__(1);
  40928. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40929. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40930. var extendStatics = function (d, b) {
  40931. extendStatics = Object.setPrototypeOf ||
  40932. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40933. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40934. return extendStatics(d, b);
  40935. };
  40936. return function (d, b) {
  40937. extendStatics(d, b);
  40938. function __() { this.constructor = d; }
  40939. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40940. };
  40941. })();
  40942. var encrypted_channel_EncryptedChannel = (function (_super) {
  40943. encrypted_channel_extends(EncryptedChannel, _super);
  40944. function EncryptedChannel() {
  40945. var _this = _super !== null && _super.apply(this, arguments) || this;
  40946. _this.key = null;
  40947. return _this;
  40948. }
  40949. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40950. var _this = this;
  40951. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40952. if (error) {
  40953. callback(true, authData);
  40954. return;
  40955. }
  40956. var sharedSecret = authData["shared_secret"];
  40957. if (!sharedSecret) {
  40958. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40959. callback(true, errorMsg);
  40960. return;
  40961. }
  40962. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40963. delete authData["shared_secret"];
  40964. callback(false, authData);
  40965. });
  40966. };
  40967. EncryptedChannel.prototype.trigger = function (event, data) {
  40968. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40969. };
  40970. EncryptedChannel.prototype.handleEvent = function (event) {
  40971. var eventName = event.event;
  40972. var data = event.data;
  40973. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40974. _super.prototype.handleEvent.call(this, event);
  40975. return;
  40976. }
  40977. this.handleEncryptedEvent(eventName, data);
  40978. };
  40979. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40980. var _this = this;
  40981. if (!this.key) {
  40982. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40983. return;
  40984. }
  40985. if (!data.ciphertext || !data.nonce) {
  40986. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40987. return;
  40988. }
  40989. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40990. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40991. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40992. return;
  40993. }
  40994. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40995. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40996. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40997. return;
  40998. }
  40999. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41000. if (bytes === null) {
  41001. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41002. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41003. if (error) {
  41004. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41005. return;
  41006. }
  41007. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41008. if (bytes === null) {
  41009. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41010. return;
  41011. }
  41012. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41013. return;
  41014. });
  41015. return;
  41016. }
  41017. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41018. };
  41019. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41020. try {
  41021. this.emit(eventName, JSON.parse(data));
  41022. }
  41023. catch (e) {
  41024. this.emit(eventName, data);
  41025. }
  41026. return this;
  41027. };
  41028. return EncryptedChannel;
  41029. }(private_channel));
  41030. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41031. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41032. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41033. var extendStatics = function (d, b) {
  41034. extendStatics = Object.setPrototypeOf ||
  41035. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41036. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41037. return extendStatics(d, b);
  41038. };
  41039. return function (d, b) {
  41040. extendStatics(d, b);
  41041. function __() { this.constructor = d; }
  41042. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41043. };
  41044. })();
  41045. var connection_manager_ConnectionManager = (function (_super) {
  41046. connection_manager_extends(ConnectionManager, _super);
  41047. function ConnectionManager(key, options) {
  41048. var _this = _super.call(this) || this;
  41049. _this.key = key;
  41050. _this.options = options || {};
  41051. _this.state = "initialized";
  41052. _this.connection = null;
  41053. _this.usingTLS = !!options.useTLS;
  41054. _this.timeline = _this.options.timeline;
  41055. _this.errorCallbacks = _this.buildErrorCallbacks();
  41056. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41057. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41058. var Network = runtime.getNetwork();
  41059. Network.bind("online", function () {
  41060. _this.timeline.info({ netinfo: "online" });
  41061. if (_this.state === "connecting" || _this.state === "unavailable") {
  41062. _this.retryIn(0);
  41063. }
  41064. });
  41065. Network.bind("offline", function () {
  41066. _this.timeline.info({ netinfo: "offline" });
  41067. if (_this.connection) {
  41068. _this.sendActivityCheck();
  41069. }
  41070. });
  41071. _this.updateStrategy();
  41072. return _this;
  41073. }
  41074. ConnectionManager.prototype.connect = function () {
  41075. if (this.connection || this.runner) {
  41076. return;
  41077. }
  41078. if (!this.strategy.isSupported()) {
  41079. this.updateState("failed");
  41080. return;
  41081. }
  41082. this.updateState("connecting");
  41083. this.startConnecting();
  41084. this.setUnavailableTimer();
  41085. };
  41086. ;
  41087. ConnectionManager.prototype.send = function (data) {
  41088. if (this.connection) {
  41089. return this.connection.send(data);
  41090. }
  41091. else {
  41092. return false;
  41093. }
  41094. };
  41095. ;
  41096. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41097. if (this.connection) {
  41098. return this.connection.send_event(name, data, channel);
  41099. }
  41100. else {
  41101. return false;
  41102. }
  41103. };
  41104. ;
  41105. ConnectionManager.prototype.disconnect = function () {
  41106. this.disconnectInternally();
  41107. this.updateState("disconnected");
  41108. };
  41109. ;
  41110. ConnectionManager.prototype.isUsingTLS = function () {
  41111. return this.usingTLS;
  41112. };
  41113. ;
  41114. ConnectionManager.prototype.startConnecting = function () {
  41115. var _this = this;
  41116. var callback = function (error, handshake) {
  41117. if (error) {
  41118. _this.runner = _this.strategy.connect(0, callback);
  41119. }
  41120. else {
  41121. if (handshake.action === "error") {
  41122. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41123. _this.timeline.error({ handshakeError: handshake.error });
  41124. }
  41125. else {
  41126. _this.abortConnecting();
  41127. _this.handshakeCallbacks[handshake.action](handshake);
  41128. }
  41129. }
  41130. };
  41131. this.runner = this.strategy.connect(0, callback);
  41132. };
  41133. ;
  41134. ConnectionManager.prototype.abortConnecting = function () {
  41135. if (this.runner) {
  41136. this.runner.abort();
  41137. this.runner = null;
  41138. }
  41139. };
  41140. ;
  41141. ConnectionManager.prototype.disconnectInternally = function () {
  41142. this.abortConnecting();
  41143. this.clearRetryTimer();
  41144. this.clearUnavailableTimer();
  41145. if (this.connection) {
  41146. var connection = this.abandonConnection();
  41147. connection.close();
  41148. }
  41149. };
  41150. ;
  41151. ConnectionManager.prototype.updateStrategy = function () {
  41152. this.strategy = this.options.getStrategy({
  41153. key: this.key,
  41154. timeline: this.timeline,
  41155. useTLS: this.usingTLS
  41156. });
  41157. };
  41158. ;
  41159. ConnectionManager.prototype.retryIn = function (delay) {
  41160. var _this = this;
  41161. this.timeline.info({ action: "retry", delay: delay });
  41162. if (delay > 0) {
  41163. this.emit("connecting_in", Math.round(delay / 1000));
  41164. }
  41165. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41166. _this.disconnectInternally();
  41167. _this.connect();
  41168. });
  41169. };
  41170. ;
  41171. ConnectionManager.prototype.clearRetryTimer = function () {
  41172. if (this.retryTimer) {
  41173. this.retryTimer.ensureAborted();
  41174. this.retryTimer = null;
  41175. }
  41176. };
  41177. ;
  41178. ConnectionManager.prototype.setUnavailableTimer = function () {
  41179. var _this = this;
  41180. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41181. _this.updateState("unavailable");
  41182. });
  41183. };
  41184. ;
  41185. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41186. if (this.unavailableTimer) {
  41187. this.unavailableTimer.ensureAborted();
  41188. }
  41189. };
  41190. ;
  41191. ConnectionManager.prototype.sendActivityCheck = function () {
  41192. var _this = this;
  41193. this.stopActivityCheck();
  41194. this.connection.ping();
  41195. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41196. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41197. _this.retryIn(0);
  41198. });
  41199. };
  41200. ;
  41201. ConnectionManager.prototype.resetActivityCheck = function () {
  41202. var _this = this;
  41203. this.stopActivityCheck();
  41204. if (this.connection && !this.connection.handlesActivityChecks()) {
  41205. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41206. _this.sendActivityCheck();
  41207. });
  41208. }
  41209. };
  41210. ;
  41211. ConnectionManager.prototype.stopActivityCheck = function () {
  41212. if (this.activityTimer) {
  41213. this.activityTimer.ensureAborted();
  41214. }
  41215. };
  41216. ;
  41217. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41218. var _this = this;
  41219. return extend({}, errorCallbacks, {
  41220. message: function (message) {
  41221. _this.resetActivityCheck();
  41222. _this.emit('message', message);
  41223. },
  41224. ping: function () {
  41225. _this.send_event('pusher:pong', {});
  41226. },
  41227. activity: function () {
  41228. _this.resetActivityCheck();
  41229. },
  41230. error: function (error) {
  41231. _this.emit("error", { type: "WebSocketError", error: error });
  41232. },
  41233. closed: function () {
  41234. _this.abandonConnection();
  41235. if (_this.shouldRetry()) {
  41236. _this.retryIn(1000);
  41237. }
  41238. }
  41239. });
  41240. };
  41241. ;
  41242. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41243. var _this = this;
  41244. return extend({}, errorCallbacks, {
  41245. connected: function (handshake) {
  41246. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41247. _this.clearUnavailableTimer();
  41248. _this.setConnection(handshake.connection);
  41249. _this.socket_id = _this.connection.id;
  41250. _this.updateState("connected", { socket_id: _this.socket_id });
  41251. }
  41252. });
  41253. };
  41254. ;
  41255. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41256. var _this = this;
  41257. var withErrorEmitted = function (callback) {
  41258. return function (result) {
  41259. if (result.error) {
  41260. _this.emit("error", { type: "WebSocketError", error: result.error });
  41261. }
  41262. callback(result);
  41263. };
  41264. };
  41265. return {
  41266. tls_only: withErrorEmitted(function () {
  41267. _this.usingTLS = true;
  41268. _this.updateStrategy();
  41269. _this.retryIn(0);
  41270. }),
  41271. refused: withErrorEmitted(function () {
  41272. _this.disconnect();
  41273. }),
  41274. backoff: withErrorEmitted(function () {
  41275. _this.retryIn(1000);
  41276. }),
  41277. retry: withErrorEmitted(function () {
  41278. _this.retryIn(0);
  41279. })
  41280. };
  41281. };
  41282. ;
  41283. ConnectionManager.prototype.setConnection = function (connection) {
  41284. this.connection = connection;
  41285. for (var event in this.connectionCallbacks) {
  41286. this.connection.bind(event, this.connectionCallbacks[event]);
  41287. }
  41288. this.resetActivityCheck();
  41289. };
  41290. ;
  41291. ConnectionManager.prototype.abandonConnection = function () {
  41292. if (!this.connection) {
  41293. return;
  41294. }
  41295. this.stopActivityCheck();
  41296. for (var event in this.connectionCallbacks) {
  41297. this.connection.unbind(event, this.connectionCallbacks[event]);
  41298. }
  41299. var connection = this.connection;
  41300. this.connection = null;
  41301. return connection;
  41302. };
  41303. ConnectionManager.prototype.updateState = function (newState, data) {
  41304. var previousState = this.state;
  41305. this.state = newState;
  41306. if (previousState !== newState) {
  41307. var newStateDescription = newState;
  41308. if (newStateDescription === "connected") {
  41309. newStateDescription += " with new socket ID " + data.socket_id;
  41310. }
  41311. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41312. this.timeline.info({ state: newState, params: data });
  41313. this.emit('state_change', { previous: previousState, current: newState });
  41314. this.emit(newState, data);
  41315. }
  41316. };
  41317. ConnectionManager.prototype.shouldRetry = function () {
  41318. return this.state === "connecting" || this.state === "connected";
  41319. };
  41320. return ConnectionManager;
  41321. }(dispatcher));
  41322. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41323. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41324. var channels_Channels = (function () {
  41325. function Channels() {
  41326. this.channels = {};
  41327. }
  41328. Channels.prototype.add = function (name, pusher) {
  41329. if (!this.channels[name]) {
  41330. this.channels[name] = createChannel(name, pusher);
  41331. }
  41332. return this.channels[name];
  41333. };
  41334. Channels.prototype.all = function () {
  41335. return values(this.channels);
  41336. };
  41337. Channels.prototype.find = function (name) {
  41338. return this.channels[name];
  41339. };
  41340. Channels.prototype.remove = function (name) {
  41341. var channel = this.channels[name];
  41342. delete this.channels[name];
  41343. return channel;
  41344. };
  41345. Channels.prototype.disconnect = function () {
  41346. objectApply(this.channels, function (channel) {
  41347. channel.disconnect();
  41348. });
  41349. };
  41350. return Channels;
  41351. }());
  41352. /* harmony default export */ var channels = (channels_Channels);
  41353. function createChannel(name, pusher) {
  41354. if (name.indexOf('private-encrypted-') === 0) {
  41355. if (false) { var errorMsg; }
  41356. return factory.createEncryptedChannel(name, pusher);
  41357. }
  41358. else if (name.indexOf('private-') === 0) {
  41359. return factory.createPrivateChannel(name, pusher);
  41360. }
  41361. else if (name.indexOf('presence-') === 0) {
  41362. return factory.createPresenceChannel(name, pusher);
  41363. }
  41364. else {
  41365. return factory.createChannel(name, pusher);
  41366. }
  41367. }
  41368. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41369. var Factory = {
  41370. createChannels: function () {
  41371. return new channels();
  41372. },
  41373. createConnectionManager: function (key, options) {
  41374. return new connection_manager(key, options);
  41375. },
  41376. createChannel: function (name, pusher) {
  41377. return new channels_channel(name, pusher);
  41378. },
  41379. createPrivateChannel: function (name, pusher) {
  41380. return new private_channel(name, pusher);
  41381. },
  41382. createPresenceChannel: function (name, pusher) {
  41383. return new presence_channel(name, pusher);
  41384. },
  41385. createEncryptedChannel: function (name, pusher) {
  41386. return new encrypted_channel(name, pusher);
  41387. },
  41388. createTimelineSender: function (timeline, options) {
  41389. return new timeline_sender(timeline, options);
  41390. },
  41391. createAuthorizer: function (channel, options) {
  41392. if (options.authorizer) {
  41393. return options.authorizer(channel, options);
  41394. }
  41395. return new pusher_authorizer(channel, options);
  41396. },
  41397. createHandshake: function (transport, callback) {
  41398. return new connection_handshake(transport, callback);
  41399. },
  41400. createAssistantToTheTransportManager: function (manager, transport, options) {
  41401. return new assistant_to_the_transport_manager(manager, transport, options);
  41402. }
  41403. };
  41404. /* harmony default export */ var factory = (Factory);
  41405. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41406. var transport_manager_TransportManager = (function () {
  41407. function TransportManager(options) {
  41408. this.options = options || {};
  41409. this.livesLeft = this.options.lives || Infinity;
  41410. }
  41411. TransportManager.prototype.getAssistant = function (transport) {
  41412. return factory.createAssistantToTheTransportManager(this, transport, {
  41413. minPingDelay: this.options.minPingDelay,
  41414. maxPingDelay: this.options.maxPingDelay
  41415. });
  41416. };
  41417. TransportManager.prototype.isAlive = function () {
  41418. return this.livesLeft > 0;
  41419. };
  41420. TransportManager.prototype.reportDeath = function () {
  41421. this.livesLeft -= 1;
  41422. };
  41423. return TransportManager;
  41424. }());
  41425. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41426. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41427. var sequential_strategy_SequentialStrategy = (function () {
  41428. function SequentialStrategy(strategies, options) {
  41429. this.strategies = strategies;
  41430. this.loop = Boolean(options.loop);
  41431. this.failFast = Boolean(options.failFast);
  41432. this.timeout = options.timeout;
  41433. this.timeoutLimit = options.timeoutLimit;
  41434. }
  41435. SequentialStrategy.prototype.isSupported = function () {
  41436. return any(this.strategies, util.method("isSupported"));
  41437. };
  41438. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41439. var _this = this;
  41440. var strategies = this.strategies;
  41441. var current = 0;
  41442. var timeout = this.timeout;
  41443. var runner = null;
  41444. var tryNextStrategy = function (error, handshake) {
  41445. if (handshake) {
  41446. callback(null, handshake);
  41447. }
  41448. else {
  41449. current = current + 1;
  41450. if (_this.loop) {
  41451. current = current % strategies.length;
  41452. }
  41453. if (current < strategies.length) {
  41454. if (timeout) {
  41455. timeout = timeout * 2;
  41456. if (_this.timeoutLimit) {
  41457. timeout = Math.min(timeout, _this.timeoutLimit);
  41458. }
  41459. }
  41460. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41461. }
  41462. else {
  41463. callback(true);
  41464. }
  41465. }
  41466. };
  41467. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41468. return {
  41469. abort: function () {
  41470. runner.abort();
  41471. },
  41472. forceMinPriority: function (p) {
  41473. minPriority = p;
  41474. if (runner) {
  41475. runner.forceMinPriority(p);
  41476. }
  41477. }
  41478. };
  41479. };
  41480. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41481. var timer = null;
  41482. var runner = null;
  41483. if (options.timeout > 0) {
  41484. timer = new OneOffTimer(options.timeout, function () {
  41485. runner.abort();
  41486. callback(true);
  41487. });
  41488. }
  41489. runner = strategy.connect(minPriority, function (error, handshake) {
  41490. if (error && timer && timer.isRunning() && !options.failFast) {
  41491. return;
  41492. }
  41493. if (timer) {
  41494. timer.ensureAborted();
  41495. }
  41496. callback(error, handshake);
  41497. });
  41498. return {
  41499. abort: function () {
  41500. if (timer) {
  41501. timer.ensureAborted();
  41502. }
  41503. runner.abort();
  41504. },
  41505. forceMinPriority: function (p) {
  41506. runner.forceMinPriority(p);
  41507. }
  41508. };
  41509. };
  41510. return SequentialStrategy;
  41511. }());
  41512. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41513. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41514. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41515. function BestConnectedEverStrategy(strategies) {
  41516. this.strategies = strategies;
  41517. }
  41518. BestConnectedEverStrategy.prototype.isSupported = function () {
  41519. return any(this.strategies, util.method("isSupported"));
  41520. };
  41521. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41522. return connect(this.strategies, minPriority, function (i, runners) {
  41523. return function (error, handshake) {
  41524. runners[i].error = error;
  41525. if (error) {
  41526. if (allRunnersFailed(runners)) {
  41527. callback(true);
  41528. }
  41529. return;
  41530. }
  41531. apply(runners, function (runner) {
  41532. runner.forceMinPriority(handshake.transport.priority);
  41533. });
  41534. callback(null, handshake);
  41535. };
  41536. });
  41537. };
  41538. return BestConnectedEverStrategy;
  41539. }());
  41540. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41541. function connect(strategies, minPriority, callbackBuilder) {
  41542. var runners = map(strategies, function (strategy, i, _, rs) {
  41543. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41544. });
  41545. return {
  41546. abort: function () {
  41547. apply(runners, abortRunner);
  41548. },
  41549. forceMinPriority: function (p) {
  41550. apply(runners, function (runner) {
  41551. runner.forceMinPriority(p);
  41552. });
  41553. }
  41554. };
  41555. }
  41556. function allRunnersFailed(runners) {
  41557. return collections_all(runners, function (runner) {
  41558. return Boolean(runner.error);
  41559. });
  41560. }
  41561. function abortRunner(runner) {
  41562. if (!runner.error && !runner.aborted) {
  41563. runner.abort();
  41564. runner.aborted = true;
  41565. }
  41566. }
  41567. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41568. var cached_strategy_CachedStrategy = (function () {
  41569. function CachedStrategy(strategy, transports, options) {
  41570. this.strategy = strategy;
  41571. this.transports = transports;
  41572. this.ttl = options.ttl || 1800 * 1000;
  41573. this.usingTLS = options.useTLS;
  41574. this.timeline = options.timeline;
  41575. }
  41576. CachedStrategy.prototype.isSupported = function () {
  41577. return this.strategy.isSupported();
  41578. };
  41579. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41580. var usingTLS = this.usingTLS;
  41581. var info = fetchTransportCache(usingTLS);
  41582. var strategies = [this.strategy];
  41583. if (info && info.timestamp + this.ttl >= util.now()) {
  41584. var transport = this.transports[info.transport];
  41585. if (transport) {
  41586. this.timeline.info({
  41587. cached: true,
  41588. transport: info.transport,
  41589. latency: info.latency
  41590. });
  41591. strategies.push(new sequential_strategy([transport], {
  41592. timeout: info.latency * 2 + 1000,
  41593. failFast: true
  41594. }));
  41595. }
  41596. }
  41597. var startTimestamp = util.now();
  41598. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41599. if (error) {
  41600. flushTransportCache(usingTLS);
  41601. if (strategies.length > 0) {
  41602. startTimestamp = util.now();
  41603. runner = strategies.pop().connect(minPriority, cb);
  41604. }
  41605. else {
  41606. callback(error);
  41607. }
  41608. }
  41609. else {
  41610. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41611. callback(null, handshake);
  41612. }
  41613. });
  41614. return {
  41615. abort: function () {
  41616. runner.abort();
  41617. },
  41618. forceMinPriority: function (p) {
  41619. minPriority = p;
  41620. if (runner) {
  41621. runner.forceMinPriority(p);
  41622. }
  41623. }
  41624. };
  41625. };
  41626. return CachedStrategy;
  41627. }());
  41628. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41629. function getTransportCacheKey(usingTLS) {
  41630. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41631. }
  41632. function fetchTransportCache(usingTLS) {
  41633. var storage = runtime.getLocalStorage();
  41634. if (storage) {
  41635. try {
  41636. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41637. if (serializedCache) {
  41638. return JSON.parse(serializedCache);
  41639. }
  41640. }
  41641. catch (e) {
  41642. flushTransportCache(usingTLS);
  41643. }
  41644. }
  41645. return null;
  41646. }
  41647. function storeTransportCache(usingTLS, transport, latency) {
  41648. var storage = runtime.getLocalStorage();
  41649. if (storage) {
  41650. try {
  41651. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41652. timestamp: util.now(),
  41653. transport: transport,
  41654. latency: latency
  41655. });
  41656. }
  41657. catch (e) {
  41658. }
  41659. }
  41660. }
  41661. function flushTransportCache(usingTLS) {
  41662. var storage = runtime.getLocalStorage();
  41663. if (storage) {
  41664. try {
  41665. delete storage[getTransportCacheKey(usingTLS)];
  41666. }
  41667. catch (e) {
  41668. }
  41669. }
  41670. }
  41671. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41672. var delayed_strategy_DelayedStrategy = (function () {
  41673. function DelayedStrategy(strategy, _a) {
  41674. var number = _a.delay;
  41675. this.strategy = strategy;
  41676. this.options = { delay: number };
  41677. }
  41678. DelayedStrategy.prototype.isSupported = function () {
  41679. return this.strategy.isSupported();
  41680. };
  41681. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41682. var strategy = this.strategy;
  41683. var runner;
  41684. var timer = new OneOffTimer(this.options.delay, function () {
  41685. runner = strategy.connect(minPriority, callback);
  41686. });
  41687. return {
  41688. abort: function () {
  41689. timer.ensureAborted();
  41690. if (runner) {
  41691. runner.abort();
  41692. }
  41693. },
  41694. forceMinPriority: function (p) {
  41695. minPriority = p;
  41696. if (runner) {
  41697. runner.forceMinPriority(p);
  41698. }
  41699. }
  41700. };
  41701. };
  41702. return DelayedStrategy;
  41703. }());
  41704. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41705. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41706. var IfStrategy = (function () {
  41707. function IfStrategy(test, trueBranch, falseBranch) {
  41708. this.test = test;
  41709. this.trueBranch = trueBranch;
  41710. this.falseBranch = falseBranch;
  41711. }
  41712. IfStrategy.prototype.isSupported = function () {
  41713. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41714. return branch.isSupported();
  41715. };
  41716. IfStrategy.prototype.connect = function (minPriority, callback) {
  41717. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41718. return branch.connect(minPriority, callback);
  41719. };
  41720. return IfStrategy;
  41721. }());
  41722. /* harmony default export */ var if_strategy = (IfStrategy);
  41723. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41724. var FirstConnectedStrategy = (function () {
  41725. function FirstConnectedStrategy(strategy) {
  41726. this.strategy = strategy;
  41727. }
  41728. FirstConnectedStrategy.prototype.isSupported = function () {
  41729. return this.strategy.isSupported();
  41730. };
  41731. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41732. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41733. if (handshake) {
  41734. runner.abort();
  41735. }
  41736. callback(error, handshake);
  41737. });
  41738. return runner;
  41739. };
  41740. return FirstConnectedStrategy;
  41741. }());
  41742. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41743. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41744. function testSupportsStrategy(strategy) {
  41745. return function () {
  41746. return strategy.isSupported();
  41747. };
  41748. }
  41749. var getDefaultStrategy = function (config, defineTransport) {
  41750. var definedTransports = {};
  41751. function defineTransportStrategy(name, type, priority, options, manager) {
  41752. var transport = defineTransport(config, name, type, priority, options, manager);
  41753. definedTransports[name] = transport;
  41754. return transport;
  41755. }
  41756. var ws_options = {
  41757. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41758. hostTLS: config.wsHost + ":" + config.wssPort,
  41759. httpPath: config.wsPath
  41760. };
  41761. var wss_options = extend({}, ws_options, {
  41762. useTLS: true
  41763. });
  41764. var sockjs_options = {
  41765. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41766. hostTLS: config.httpHost + ":" + config.httpsPort,
  41767. httpPath: config.httpPath
  41768. };
  41769. var timeouts = {
  41770. loop: true,
  41771. timeout: 15000,
  41772. timeoutLimit: 60000
  41773. };
  41774. var ws_manager = new transport_manager({
  41775. lives: 2,
  41776. minPingDelay: 10000,
  41777. maxPingDelay: config.activity_timeout
  41778. });
  41779. var streaming_manager = new transport_manager({
  41780. lives: 2,
  41781. minPingDelay: 10000,
  41782. maxPingDelay: config.activity_timeout
  41783. });
  41784. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41785. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41786. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41787. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41788. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41789. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41790. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41791. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41792. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41793. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41794. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41795. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41796. 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);
  41797. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41798. var wsStrategy;
  41799. if (config.useTLS) {
  41800. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41801. }
  41802. else {
  41803. wsStrategy = new best_connected_ever_strategy([
  41804. ws_loop,
  41805. new delayed_strategy(wss_loop, { delay: 2000 }),
  41806. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41807. ]);
  41808. }
  41809. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41810. ttl: 1800000,
  41811. timeline: config.timeline,
  41812. useTLS: config.useTLS
  41813. });
  41814. };
  41815. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41816. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41817. /* harmony default export */ var transport_connection_initializer = (function () {
  41818. var self = this;
  41819. self.timeline.info(self.buildTimelineMessage({
  41820. transport: self.name + (self.options.useTLS ? "s" : "")
  41821. }));
  41822. if (self.hooks.isInitialized()) {
  41823. self.changeState("initialized");
  41824. }
  41825. else if (self.hooks.file) {
  41826. self.changeState("initializing");
  41827. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41828. if (self.hooks.isInitialized()) {
  41829. self.changeState("initialized");
  41830. callback(true);
  41831. }
  41832. else {
  41833. if (error) {
  41834. self.onError(error);
  41835. }
  41836. self.onClose();
  41837. callback(false);
  41838. }
  41839. });
  41840. }
  41841. else {
  41842. self.onClose();
  41843. }
  41844. });
  41845. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41846. var http_xdomain_request_hooks = {
  41847. getRequest: function (socket) {
  41848. var xdr = new window.XDomainRequest();
  41849. xdr.ontimeout = function () {
  41850. socket.emit("error", new RequestTimedOut());
  41851. socket.close();
  41852. };
  41853. xdr.onerror = function (e) {
  41854. socket.emit("error", e);
  41855. socket.close();
  41856. };
  41857. xdr.onprogress = function () {
  41858. if (xdr.responseText && xdr.responseText.length > 0) {
  41859. socket.onChunk(200, xdr.responseText);
  41860. }
  41861. };
  41862. xdr.onload = function () {
  41863. if (xdr.responseText && xdr.responseText.length > 0) {
  41864. socket.onChunk(200, xdr.responseText);
  41865. }
  41866. socket.emit("finished", 200);
  41867. socket.close();
  41868. };
  41869. return xdr;
  41870. },
  41871. abortRequest: function (xdr) {
  41872. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41873. xdr.abort();
  41874. }
  41875. };
  41876. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41877. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41878. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41879. var extendStatics = function (d, b) {
  41880. extendStatics = Object.setPrototypeOf ||
  41881. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41882. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41883. return extendStatics(d, b);
  41884. };
  41885. return function (d, b) {
  41886. extendStatics(d, b);
  41887. function __() { this.constructor = d; }
  41888. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41889. };
  41890. })();
  41891. var MAX_BUFFER_LENGTH = 256 * 1024;
  41892. var http_request_HTTPRequest = (function (_super) {
  41893. http_request_extends(HTTPRequest, _super);
  41894. function HTTPRequest(hooks, method, url) {
  41895. var _this = _super.call(this) || this;
  41896. _this.hooks = hooks;
  41897. _this.method = method;
  41898. _this.url = url;
  41899. return _this;
  41900. }
  41901. HTTPRequest.prototype.start = function (payload) {
  41902. var _this = this;
  41903. this.position = 0;
  41904. this.xhr = this.hooks.getRequest(this);
  41905. this.unloader = function () {
  41906. _this.close();
  41907. };
  41908. runtime.addUnloadListener(this.unloader);
  41909. this.xhr.open(this.method, this.url, true);
  41910. if (this.xhr.setRequestHeader) {
  41911. this.xhr.setRequestHeader("Content-Type", "application/json");
  41912. }
  41913. this.xhr.send(payload);
  41914. };
  41915. HTTPRequest.prototype.close = function () {
  41916. if (this.unloader) {
  41917. runtime.removeUnloadListener(this.unloader);
  41918. this.unloader = null;
  41919. }
  41920. if (this.xhr) {
  41921. this.hooks.abortRequest(this.xhr);
  41922. this.xhr = null;
  41923. }
  41924. };
  41925. HTTPRequest.prototype.onChunk = function (status, data) {
  41926. while (true) {
  41927. var chunk = this.advanceBuffer(data);
  41928. if (chunk) {
  41929. this.emit("chunk", { status: status, data: chunk });
  41930. }
  41931. else {
  41932. break;
  41933. }
  41934. }
  41935. if (this.isBufferTooLong(data)) {
  41936. this.emit("buffer_too_long");
  41937. }
  41938. };
  41939. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41940. var unreadData = buffer.slice(this.position);
  41941. var endOfLinePosition = unreadData.indexOf("\n");
  41942. if (endOfLinePosition !== -1) {
  41943. this.position += endOfLinePosition + 1;
  41944. return unreadData.slice(0, endOfLinePosition);
  41945. }
  41946. else {
  41947. return null;
  41948. }
  41949. };
  41950. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41951. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41952. };
  41953. return HTTPRequest;
  41954. }(dispatcher));
  41955. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41956. // CONCATENATED MODULE: ./src/core/http/state.ts
  41957. var State;
  41958. (function (State) {
  41959. State[State["CONNECTING"] = 0] = "CONNECTING";
  41960. State[State["OPEN"] = 1] = "OPEN";
  41961. State[State["CLOSED"] = 3] = "CLOSED";
  41962. })(State || (State = {}));
  41963. /* harmony default export */ var state = (State);
  41964. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41965. var autoIncrement = 1;
  41966. var http_socket_HTTPSocket = (function () {
  41967. function HTTPSocket(hooks, url) {
  41968. this.hooks = hooks;
  41969. this.session = randomNumber(1000) + "/" + randomString(8);
  41970. this.location = getLocation(url);
  41971. this.readyState = state.CONNECTING;
  41972. this.openStream();
  41973. }
  41974. HTTPSocket.prototype.send = function (payload) {
  41975. return this.sendRaw(JSON.stringify([payload]));
  41976. };
  41977. HTTPSocket.prototype.ping = function () {
  41978. this.hooks.sendHeartbeat(this);
  41979. };
  41980. HTTPSocket.prototype.close = function (code, reason) {
  41981. this.onClose(code, reason, true);
  41982. };
  41983. HTTPSocket.prototype.sendRaw = function (payload) {
  41984. if (this.readyState === state.OPEN) {
  41985. try {
  41986. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41987. return true;
  41988. }
  41989. catch (e) {
  41990. return false;
  41991. }
  41992. }
  41993. else {
  41994. return false;
  41995. }
  41996. };
  41997. HTTPSocket.prototype.reconnect = function () {
  41998. this.closeStream();
  41999. this.openStream();
  42000. };
  42001. ;
  42002. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42003. this.closeStream();
  42004. this.readyState = state.CLOSED;
  42005. if (this.onclose) {
  42006. this.onclose({
  42007. code: code,
  42008. reason: reason,
  42009. wasClean: wasClean
  42010. });
  42011. }
  42012. };
  42013. HTTPSocket.prototype.onChunk = function (chunk) {
  42014. if (chunk.status !== 200) {
  42015. return;
  42016. }
  42017. if (this.readyState === state.OPEN) {
  42018. this.onActivity();
  42019. }
  42020. var payload;
  42021. var type = chunk.data.slice(0, 1);
  42022. switch (type) {
  42023. case 'o':
  42024. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42025. this.onOpen(payload);
  42026. break;
  42027. case 'a':
  42028. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42029. for (var i = 0; i < payload.length; i++) {
  42030. this.onEvent(payload[i]);
  42031. }
  42032. break;
  42033. case 'm':
  42034. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42035. this.onEvent(payload);
  42036. break;
  42037. case 'h':
  42038. this.hooks.onHeartbeat(this);
  42039. break;
  42040. case 'c':
  42041. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42042. this.onClose(payload[0], payload[1], true);
  42043. break;
  42044. }
  42045. };
  42046. HTTPSocket.prototype.onOpen = function (options) {
  42047. if (this.readyState === state.CONNECTING) {
  42048. if (options && options.hostname) {
  42049. this.location.base = replaceHost(this.location.base, options.hostname);
  42050. }
  42051. this.readyState = state.OPEN;
  42052. if (this.onopen) {
  42053. this.onopen();
  42054. }
  42055. }
  42056. else {
  42057. this.onClose(1006, "Server lost session", true);
  42058. }
  42059. };
  42060. HTTPSocket.prototype.onEvent = function (event) {
  42061. if (this.readyState === state.OPEN && this.onmessage) {
  42062. this.onmessage({ data: event });
  42063. }
  42064. };
  42065. HTTPSocket.prototype.onActivity = function () {
  42066. if (this.onactivity) {
  42067. this.onactivity();
  42068. }
  42069. };
  42070. HTTPSocket.prototype.onError = function (error) {
  42071. if (this.onerror) {
  42072. this.onerror(error);
  42073. }
  42074. };
  42075. HTTPSocket.prototype.openStream = function () {
  42076. var _this = this;
  42077. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42078. this.stream.bind("chunk", function (chunk) {
  42079. _this.onChunk(chunk);
  42080. });
  42081. this.stream.bind("finished", function (status) {
  42082. _this.hooks.onFinished(_this, status);
  42083. });
  42084. this.stream.bind("buffer_too_long", function () {
  42085. _this.reconnect();
  42086. });
  42087. try {
  42088. this.stream.start();
  42089. }
  42090. catch (error) {
  42091. util.defer(function () {
  42092. _this.onError(error);
  42093. _this.onClose(1006, "Could not start streaming", false);
  42094. });
  42095. }
  42096. };
  42097. HTTPSocket.prototype.closeStream = function () {
  42098. if (this.stream) {
  42099. this.stream.unbind_all();
  42100. this.stream.close();
  42101. this.stream = null;
  42102. }
  42103. };
  42104. return HTTPSocket;
  42105. }());
  42106. function getLocation(url) {
  42107. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42108. return {
  42109. base: parts[1],
  42110. queryString: parts[2]
  42111. };
  42112. }
  42113. function getSendURL(url, session) {
  42114. return url.base + "/" + session + "/xhr_send";
  42115. }
  42116. function getUniqueURL(url) {
  42117. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42118. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42119. }
  42120. function replaceHost(url, hostname) {
  42121. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42122. return urlParts[1] + hostname + urlParts[3];
  42123. }
  42124. function randomNumber(max) {
  42125. return Math.floor(Math.random() * max);
  42126. }
  42127. function randomString(length) {
  42128. var result = [];
  42129. for (var i = 0; i < length; i++) {
  42130. result.push(randomNumber(32).toString(32));
  42131. }
  42132. return result.join('');
  42133. }
  42134. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42135. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42136. var http_streaming_socket_hooks = {
  42137. getReceiveURL: function (url, session) {
  42138. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42139. },
  42140. onHeartbeat: function (socket) {
  42141. socket.sendRaw("[]");
  42142. },
  42143. sendHeartbeat: function (socket) {
  42144. socket.sendRaw("[]");
  42145. },
  42146. onFinished: function (socket, status) {
  42147. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42148. }
  42149. };
  42150. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42151. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42152. var http_polling_socket_hooks = {
  42153. getReceiveURL: function (url, session) {
  42154. return url.base + "/" + session + "/xhr" + url.queryString;
  42155. },
  42156. onHeartbeat: function () {
  42157. },
  42158. sendHeartbeat: function (socket) {
  42159. socket.sendRaw("[]");
  42160. },
  42161. onFinished: function (socket, status) {
  42162. if (status === 200) {
  42163. socket.reconnect();
  42164. }
  42165. else {
  42166. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42167. }
  42168. }
  42169. };
  42170. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42171. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42172. var http_xhr_request_hooks = {
  42173. getRequest: function (socket) {
  42174. var Constructor = runtime.getXHRAPI();
  42175. var xhr = new Constructor();
  42176. xhr.onreadystatechange = xhr.onprogress = function () {
  42177. switch (xhr.readyState) {
  42178. case 3:
  42179. if (xhr.responseText && xhr.responseText.length > 0) {
  42180. socket.onChunk(xhr.status, xhr.responseText);
  42181. }
  42182. break;
  42183. case 4:
  42184. if (xhr.responseText && xhr.responseText.length > 0) {
  42185. socket.onChunk(xhr.status, xhr.responseText);
  42186. }
  42187. socket.emit("finished", xhr.status);
  42188. socket.close();
  42189. break;
  42190. }
  42191. };
  42192. return xhr;
  42193. },
  42194. abortRequest: function (xhr) {
  42195. xhr.onreadystatechange = null;
  42196. xhr.abort();
  42197. }
  42198. };
  42199. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42200. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42201. var HTTP = {
  42202. createStreamingSocket: function (url) {
  42203. return this.createSocket(http_streaming_socket, url);
  42204. },
  42205. createPollingSocket: function (url) {
  42206. return this.createSocket(http_polling_socket, url);
  42207. },
  42208. createSocket: function (hooks, url) {
  42209. return new http_socket(hooks, url);
  42210. },
  42211. createXHR: function (method, url) {
  42212. return this.createRequest(http_xhr_request, method, url);
  42213. },
  42214. createRequest: function (hooks, method, url) {
  42215. return new http_request(hooks, method, url);
  42216. }
  42217. };
  42218. /* harmony default export */ var http_http = (HTTP);
  42219. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42220. http_http.createXDR = function (method, url) {
  42221. return this.createRequest(http_xdomain_request, method, url);
  42222. };
  42223. /* harmony default export */ var web_http_http = (http_http);
  42224. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42225. var Runtime = {
  42226. nextAuthCallbackID: 1,
  42227. auth_callbacks: {},
  42228. ScriptReceivers: ScriptReceivers,
  42229. DependenciesReceivers: DependenciesReceivers,
  42230. getDefaultStrategy: default_strategy,
  42231. Transports: transports_transports,
  42232. transportConnectionInitializer: transport_connection_initializer,
  42233. HTTPFactory: web_http_http,
  42234. TimelineTransport: jsonp_timeline,
  42235. getXHRAPI: function () {
  42236. return window.XMLHttpRequest;
  42237. },
  42238. getWebSocketAPI: function () {
  42239. return window.WebSocket || window.MozWebSocket;
  42240. },
  42241. setup: function (PusherClass) {
  42242. var _this = this;
  42243. window.Pusher = PusherClass;
  42244. var initializeOnDocumentBody = function () {
  42245. _this.onDocumentBody(PusherClass.ready);
  42246. };
  42247. if (!window.JSON) {
  42248. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42249. }
  42250. else {
  42251. initializeOnDocumentBody();
  42252. }
  42253. },
  42254. getDocument: function () {
  42255. return document;
  42256. },
  42257. getProtocol: function () {
  42258. return this.getDocument().location.protocol;
  42259. },
  42260. getAuthorizers: function () {
  42261. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42262. },
  42263. onDocumentBody: function (callback) {
  42264. var _this = this;
  42265. if (document.body) {
  42266. callback();
  42267. }
  42268. else {
  42269. setTimeout(function () {
  42270. _this.onDocumentBody(callback);
  42271. }, 0);
  42272. }
  42273. },
  42274. createJSONPRequest: function (url, data) {
  42275. return new jsonp_request(url, data);
  42276. },
  42277. createScriptRequest: function (src) {
  42278. return new script_request(src);
  42279. },
  42280. getLocalStorage: function () {
  42281. try {
  42282. return window.localStorage;
  42283. }
  42284. catch (e) {
  42285. return undefined;
  42286. }
  42287. },
  42288. createXHR: function () {
  42289. if (this.getXHRAPI()) {
  42290. return this.createXMLHttpRequest();
  42291. }
  42292. else {
  42293. return this.createMicrosoftXHR();
  42294. }
  42295. },
  42296. createXMLHttpRequest: function () {
  42297. var Constructor = this.getXHRAPI();
  42298. return new Constructor();
  42299. },
  42300. createMicrosoftXHR: function () {
  42301. return new ActiveXObject("Microsoft.XMLHTTP");
  42302. },
  42303. getNetwork: function () {
  42304. return net_info_Network;
  42305. },
  42306. createWebSocket: function (url) {
  42307. var Constructor = this.getWebSocketAPI();
  42308. return new Constructor(url);
  42309. },
  42310. createSocketRequest: function (method, url) {
  42311. if (this.isXHRSupported()) {
  42312. return this.HTTPFactory.createXHR(method, url);
  42313. }
  42314. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42315. return this.HTTPFactory.createXDR(method, url);
  42316. }
  42317. else {
  42318. throw "Cross-origin HTTP requests are not supported";
  42319. }
  42320. },
  42321. isXHRSupported: function () {
  42322. var Constructor = this.getXHRAPI();
  42323. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42324. },
  42325. isXDRSupported: function (useTLS) {
  42326. var protocol = useTLS ? "https:" : "http:";
  42327. var documentProtocol = this.getProtocol();
  42328. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42329. },
  42330. addUnloadListener: function (listener) {
  42331. if (window.addEventListener !== undefined) {
  42332. window.addEventListener("unload", listener, false);
  42333. }
  42334. else if (window.attachEvent !== undefined) {
  42335. window.attachEvent("onunload", listener);
  42336. }
  42337. },
  42338. removeUnloadListener: function (listener) {
  42339. if (window.addEventListener !== undefined) {
  42340. window.removeEventListener("unload", listener, false);
  42341. }
  42342. else if (window.detachEvent !== undefined) {
  42343. window.detachEvent("onunload", listener);
  42344. }
  42345. }
  42346. };
  42347. /* harmony default export */ var runtime = (Runtime);
  42348. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42349. var TimelineLevel;
  42350. (function (TimelineLevel) {
  42351. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42352. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42353. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42354. })(TimelineLevel || (TimelineLevel = {}));
  42355. /* harmony default export */ var timeline_level = (TimelineLevel);
  42356. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42357. var timeline_Timeline = (function () {
  42358. function Timeline(key, session, options) {
  42359. this.key = key;
  42360. this.session = session;
  42361. this.events = [];
  42362. this.options = options || {};
  42363. this.sent = 0;
  42364. this.uniqueID = 0;
  42365. }
  42366. Timeline.prototype.log = function (level, event) {
  42367. if (level <= this.options.level) {
  42368. this.events.push(extend({}, event, { timestamp: util.now() }));
  42369. if (this.options.limit && this.events.length > this.options.limit) {
  42370. this.events.shift();
  42371. }
  42372. }
  42373. };
  42374. Timeline.prototype.error = function (event) {
  42375. this.log(timeline_level.ERROR, event);
  42376. };
  42377. Timeline.prototype.info = function (event) {
  42378. this.log(timeline_level.INFO, event);
  42379. };
  42380. Timeline.prototype.debug = function (event) {
  42381. this.log(timeline_level.DEBUG, event);
  42382. };
  42383. Timeline.prototype.isEmpty = function () {
  42384. return this.events.length === 0;
  42385. };
  42386. Timeline.prototype.send = function (sendfn, callback) {
  42387. var _this = this;
  42388. var data = extend({
  42389. session: this.session,
  42390. bundle: this.sent + 1,
  42391. key: this.key,
  42392. lib: "js",
  42393. version: this.options.version,
  42394. cluster: this.options.cluster,
  42395. features: this.options.features,
  42396. timeline: this.events
  42397. }, this.options.params);
  42398. this.events = [];
  42399. sendfn(data, function (error, result) {
  42400. if (!error) {
  42401. _this.sent++;
  42402. }
  42403. if (callback) {
  42404. callback(error, result);
  42405. }
  42406. });
  42407. return true;
  42408. };
  42409. Timeline.prototype.generateUniqueID = function () {
  42410. this.uniqueID++;
  42411. return this.uniqueID;
  42412. };
  42413. return Timeline;
  42414. }());
  42415. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42416. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42417. var transport_strategy_TransportStrategy = (function () {
  42418. function TransportStrategy(name, priority, transport, options) {
  42419. this.name = name;
  42420. this.priority = priority;
  42421. this.transport = transport;
  42422. this.options = options || {};
  42423. }
  42424. TransportStrategy.prototype.isSupported = function () {
  42425. return this.transport.isSupported({
  42426. useTLS: this.options.useTLS
  42427. });
  42428. };
  42429. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42430. var _this = this;
  42431. if (!this.isSupported()) {
  42432. return failAttempt(new UnsupportedStrategy(), callback);
  42433. }
  42434. else if (this.priority < minPriority) {
  42435. return failAttempt(new TransportPriorityTooLow(), callback);
  42436. }
  42437. var connected = false;
  42438. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42439. var handshake = null;
  42440. var onInitialized = function () {
  42441. transport.unbind("initialized", onInitialized);
  42442. transport.connect();
  42443. };
  42444. var onOpen = function () {
  42445. handshake = factory.createHandshake(transport, function (result) {
  42446. connected = true;
  42447. unbindListeners();
  42448. callback(null, result);
  42449. });
  42450. };
  42451. var onError = function (error) {
  42452. unbindListeners();
  42453. callback(error);
  42454. };
  42455. var onClosed = function () {
  42456. unbindListeners();
  42457. var serializedTransport;
  42458. serializedTransport = safeJSONStringify(transport);
  42459. callback(new TransportClosed(serializedTransport));
  42460. };
  42461. var unbindListeners = function () {
  42462. transport.unbind("initialized", onInitialized);
  42463. transport.unbind("open", onOpen);
  42464. transport.unbind("error", onError);
  42465. transport.unbind("closed", onClosed);
  42466. };
  42467. transport.bind("initialized", onInitialized);
  42468. transport.bind("open", onOpen);
  42469. transport.bind("error", onError);
  42470. transport.bind("closed", onClosed);
  42471. transport.initialize();
  42472. return {
  42473. abort: function () {
  42474. if (connected) {
  42475. return;
  42476. }
  42477. unbindListeners();
  42478. if (handshake) {
  42479. handshake.close();
  42480. }
  42481. else {
  42482. transport.close();
  42483. }
  42484. },
  42485. forceMinPriority: function (p) {
  42486. if (connected) {
  42487. return;
  42488. }
  42489. if (_this.priority < p) {
  42490. if (handshake) {
  42491. handshake.close();
  42492. }
  42493. else {
  42494. transport.close();
  42495. }
  42496. }
  42497. }
  42498. };
  42499. };
  42500. return TransportStrategy;
  42501. }());
  42502. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42503. function failAttempt(error, callback) {
  42504. util.defer(function () {
  42505. callback(error);
  42506. });
  42507. return {
  42508. abort: function () { },
  42509. forceMinPriority: function () { }
  42510. };
  42511. }
  42512. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42513. var strategy_builder_Transports = runtime.Transports;
  42514. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42515. var transportClass = strategy_builder_Transports[type];
  42516. if (!transportClass) {
  42517. throw new UnsupportedTransport(type);
  42518. }
  42519. var enabled = (!config.enabledTransports ||
  42520. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42521. (!config.disabledTransports ||
  42522. arrayIndexOf(config.disabledTransports, name) === -1);
  42523. var transport;
  42524. if (enabled) {
  42525. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42526. key: config.key,
  42527. useTLS: config.useTLS,
  42528. timeline: config.timeline,
  42529. ignoreNullOrigin: config.ignoreNullOrigin
  42530. }, options));
  42531. }
  42532. else {
  42533. transport = strategy_builder_UnsupportedStrategy;
  42534. }
  42535. return transport;
  42536. };
  42537. var strategy_builder_UnsupportedStrategy = {
  42538. isSupported: function () {
  42539. return false;
  42540. },
  42541. connect: function (_, callback) {
  42542. var deferred = util.defer(function () {
  42543. callback(new UnsupportedStrategy());
  42544. });
  42545. return {
  42546. abort: function () {
  42547. deferred.ensureAborted();
  42548. },
  42549. forceMinPriority: function () { }
  42550. };
  42551. }
  42552. };
  42553. // CONCATENATED MODULE: ./src/core/config.ts
  42554. var getGlobalConfig = function () {
  42555. return {
  42556. wsHost: defaults.host,
  42557. wsPort: defaults.ws_port,
  42558. wssPort: defaults.wss_port,
  42559. wsPath: defaults.ws_path,
  42560. httpHost: defaults.sockjs_host,
  42561. httpPort: defaults.sockjs_http_port,
  42562. httpsPort: defaults.sockjs_https_port,
  42563. httpPath: defaults.sockjs_path,
  42564. statsHost: defaults.stats_host,
  42565. authEndpoint: defaults.channel_auth_endpoint,
  42566. authTransport: defaults.channel_auth_transport,
  42567. activity_timeout: defaults.activity_timeout,
  42568. pong_timeout: defaults.pong_timeout,
  42569. unavailable_timeout: defaults.unavailable_timeout
  42570. };
  42571. };
  42572. var getClusterConfig = function (clusterName) {
  42573. return {
  42574. wsHost: 'ws-' + clusterName + '.pusher.com',
  42575. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42576. };
  42577. };
  42578. // CONCATENATED MODULE: ./src/core/pusher.ts
  42579. var pusher_Pusher = (function () {
  42580. function Pusher(app_key, options) {
  42581. var _this = this;
  42582. checkAppKey(app_key);
  42583. options = options || {};
  42584. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42585. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42586. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42587. }
  42588. this.key = app_key;
  42589. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42590. this.channels = factory.createChannels();
  42591. this.global_emitter = new dispatcher();
  42592. this.sessionID = Math.floor(Math.random() * 1000000000);
  42593. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42594. cluster: this.config.cluster,
  42595. features: Pusher.getClientFeatures(),
  42596. params: this.config.timelineParams || {},
  42597. limit: 50,
  42598. level: timeline_level.INFO,
  42599. version: defaults.VERSION
  42600. });
  42601. if (!this.config.disableStats) {
  42602. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42603. host: this.config.statsHost,
  42604. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42605. });
  42606. }
  42607. var getStrategy = function (options) {
  42608. var config = extend({}, _this.config, options);
  42609. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42610. };
  42611. this.connection = factory.createConnectionManager(this.key, extend({
  42612. getStrategy: getStrategy,
  42613. timeline: this.timeline,
  42614. activityTimeout: this.config.activity_timeout,
  42615. pongTimeout: this.config.pong_timeout,
  42616. unavailableTimeout: this.config.unavailable_timeout
  42617. }, this.config, { useTLS: this.shouldUseTLS() }));
  42618. this.connection.bind('connected', function () {
  42619. _this.subscribeAll();
  42620. if (_this.timelineSender) {
  42621. _this.timelineSender.send(_this.connection.isUsingTLS());
  42622. }
  42623. });
  42624. this.connection.bind('message', function (event) {
  42625. var eventName = event.event;
  42626. var internal = eventName.indexOf('pusher_internal:') === 0;
  42627. if (event.channel) {
  42628. var channel = _this.channel(event.channel);
  42629. if (channel) {
  42630. channel.handleEvent(event);
  42631. }
  42632. }
  42633. if (!internal) {
  42634. _this.global_emitter.emit(event.event, event.data);
  42635. }
  42636. });
  42637. this.connection.bind('connecting', function () {
  42638. _this.channels.disconnect();
  42639. });
  42640. this.connection.bind('disconnected', function () {
  42641. _this.channels.disconnect();
  42642. });
  42643. this.connection.bind('error', function (err) {
  42644. logger.warn(err);
  42645. });
  42646. Pusher.instances.push(this);
  42647. this.timeline.info({ instances: Pusher.instances.length });
  42648. if (Pusher.isReady) {
  42649. this.connect();
  42650. }
  42651. }
  42652. Pusher.ready = function () {
  42653. Pusher.isReady = true;
  42654. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42655. Pusher.instances[i].connect();
  42656. }
  42657. };
  42658. Pusher.getClientFeatures = function () {
  42659. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42660. return t.isSupported({});
  42661. }));
  42662. };
  42663. Pusher.prototype.channel = function (name) {
  42664. return this.channels.find(name);
  42665. };
  42666. Pusher.prototype.allChannels = function () {
  42667. return this.channels.all();
  42668. };
  42669. Pusher.prototype.connect = function () {
  42670. this.connection.connect();
  42671. if (this.timelineSender) {
  42672. if (!this.timelineSenderTimer) {
  42673. var usingTLS = this.connection.isUsingTLS();
  42674. var timelineSender = this.timelineSender;
  42675. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42676. timelineSender.send(usingTLS);
  42677. });
  42678. }
  42679. }
  42680. };
  42681. Pusher.prototype.disconnect = function () {
  42682. this.connection.disconnect();
  42683. if (this.timelineSenderTimer) {
  42684. this.timelineSenderTimer.ensureAborted();
  42685. this.timelineSenderTimer = null;
  42686. }
  42687. };
  42688. Pusher.prototype.bind = function (event_name, callback, context) {
  42689. this.global_emitter.bind(event_name, callback, context);
  42690. return this;
  42691. };
  42692. Pusher.prototype.unbind = function (event_name, callback, context) {
  42693. this.global_emitter.unbind(event_name, callback, context);
  42694. return this;
  42695. };
  42696. Pusher.prototype.bind_global = function (callback) {
  42697. this.global_emitter.bind_global(callback);
  42698. return this;
  42699. };
  42700. Pusher.prototype.unbind_global = function (callback) {
  42701. this.global_emitter.unbind_global(callback);
  42702. return this;
  42703. };
  42704. Pusher.prototype.unbind_all = function (callback) {
  42705. this.global_emitter.unbind_all();
  42706. return this;
  42707. };
  42708. Pusher.prototype.subscribeAll = function () {
  42709. var channelName;
  42710. for (channelName in this.channels.channels) {
  42711. if (this.channels.channels.hasOwnProperty(channelName)) {
  42712. this.subscribe(channelName);
  42713. }
  42714. }
  42715. };
  42716. Pusher.prototype.subscribe = function (channel_name) {
  42717. var channel = this.channels.add(channel_name, this);
  42718. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42719. channel.reinstateSubscription();
  42720. }
  42721. else if (!channel.subscriptionPending &&
  42722. this.connection.state === 'connected') {
  42723. channel.subscribe();
  42724. }
  42725. return channel;
  42726. };
  42727. Pusher.prototype.unsubscribe = function (channel_name) {
  42728. var channel = this.channels.find(channel_name);
  42729. if (channel && channel.subscriptionPending) {
  42730. channel.cancelSubscription();
  42731. }
  42732. else {
  42733. channel = this.channels.remove(channel_name);
  42734. if (channel && this.connection.state === 'connected') {
  42735. channel.unsubscribe();
  42736. }
  42737. }
  42738. };
  42739. Pusher.prototype.send_event = function (event_name, data, channel) {
  42740. return this.connection.send_event(event_name, data, channel);
  42741. };
  42742. Pusher.prototype.shouldUseTLS = function () {
  42743. if (runtime.getProtocol() === 'https:') {
  42744. return true;
  42745. }
  42746. else if (this.config.forceTLS === true) {
  42747. return true;
  42748. }
  42749. else {
  42750. return Boolean(this.config.encrypted);
  42751. }
  42752. };
  42753. Pusher.instances = [];
  42754. Pusher.isReady = false;
  42755. Pusher.logToConsole = false;
  42756. Pusher.Runtime = runtime;
  42757. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42758. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42759. Pusher.auth_callbacks = runtime.auth_callbacks;
  42760. return Pusher;
  42761. }());
  42762. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42763. function checkAppKey(key) {
  42764. if (key === null || key === undefined) {
  42765. throw 'You must pass your app key when you instantiate Pusher.';
  42766. }
  42767. }
  42768. runtime.setup(pusher_Pusher);
  42769. /***/ })
  42770. /******/ ]);
  42771. });
  42772. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42773. /***/ }),
  42774. /***/ "./node_modules/setimmediate/setImmediate.js":
  42775. /*!***************************************************!*\
  42776. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42777. \***************************************************/
  42778. /*! no static exports found */
  42779. /***/ (function(module, exports, __webpack_require__) {
  42780. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42781. "use strict";
  42782. if (global.setImmediate) {
  42783. return;
  42784. }
  42785. var nextHandle = 1; // Spec says greater than zero
  42786. var tasksByHandle = {};
  42787. var currentlyRunningATask = false;
  42788. var doc = global.document;
  42789. var registerImmediate;
  42790. function setImmediate(callback) {
  42791. // Callback can either be a function or a string
  42792. if (typeof callback !== "function") {
  42793. callback = new Function("" + callback);
  42794. }
  42795. // Copy function arguments
  42796. var args = new Array(arguments.length - 1);
  42797. for (var i = 0; i < args.length; i++) {
  42798. args[i] = arguments[i + 1];
  42799. }
  42800. // Store and register the task
  42801. var task = { callback: callback, args: args };
  42802. tasksByHandle[nextHandle] = task;
  42803. registerImmediate(nextHandle);
  42804. return nextHandle++;
  42805. }
  42806. function clearImmediate(handle) {
  42807. delete tasksByHandle[handle];
  42808. }
  42809. function run(task) {
  42810. var callback = task.callback;
  42811. var args = task.args;
  42812. switch (args.length) {
  42813. case 0:
  42814. callback();
  42815. break;
  42816. case 1:
  42817. callback(args[0]);
  42818. break;
  42819. case 2:
  42820. callback(args[0], args[1]);
  42821. break;
  42822. case 3:
  42823. callback(args[0], args[1], args[2]);
  42824. break;
  42825. default:
  42826. callback.apply(undefined, args);
  42827. break;
  42828. }
  42829. }
  42830. function runIfPresent(handle) {
  42831. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42832. // So if we're currently running a task, we'll need to delay this invocation.
  42833. if (currentlyRunningATask) {
  42834. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42835. // "too much recursion" error.
  42836. setTimeout(runIfPresent, 0, handle);
  42837. } else {
  42838. var task = tasksByHandle[handle];
  42839. if (task) {
  42840. currentlyRunningATask = true;
  42841. try {
  42842. run(task);
  42843. } finally {
  42844. clearImmediate(handle);
  42845. currentlyRunningATask = false;
  42846. }
  42847. }
  42848. }
  42849. }
  42850. function installNextTickImplementation() {
  42851. registerImmediate = function(handle) {
  42852. process.nextTick(function () { runIfPresent(handle); });
  42853. };
  42854. }
  42855. function canUsePostMessage() {
  42856. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42857. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42858. if (global.postMessage && !global.importScripts) {
  42859. var postMessageIsAsynchronous = true;
  42860. var oldOnMessage = global.onmessage;
  42861. global.onmessage = function() {
  42862. postMessageIsAsynchronous = false;
  42863. };
  42864. global.postMessage("", "*");
  42865. global.onmessage = oldOnMessage;
  42866. return postMessageIsAsynchronous;
  42867. }
  42868. }
  42869. function installPostMessageImplementation() {
  42870. // Installs an event handler on `global` for the `message` event: see
  42871. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42872. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42873. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42874. var onGlobalMessage = function(event) {
  42875. if (event.source === global &&
  42876. typeof event.data === "string" &&
  42877. event.data.indexOf(messagePrefix) === 0) {
  42878. runIfPresent(+event.data.slice(messagePrefix.length));
  42879. }
  42880. };
  42881. if (global.addEventListener) {
  42882. global.addEventListener("message", onGlobalMessage, false);
  42883. } else {
  42884. global.attachEvent("onmessage", onGlobalMessage);
  42885. }
  42886. registerImmediate = function(handle) {
  42887. global.postMessage(messagePrefix + handle, "*");
  42888. };
  42889. }
  42890. function installMessageChannelImplementation() {
  42891. var channel = new MessageChannel();
  42892. channel.port1.onmessage = function(event) {
  42893. var handle = event.data;
  42894. runIfPresent(handle);
  42895. };
  42896. registerImmediate = function(handle) {
  42897. channel.port2.postMessage(handle);
  42898. };
  42899. }
  42900. function installReadyStateChangeImplementation() {
  42901. var html = doc.documentElement;
  42902. registerImmediate = function(handle) {
  42903. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42904. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42905. var script = doc.createElement("script");
  42906. script.onreadystatechange = function () {
  42907. runIfPresent(handle);
  42908. script.onreadystatechange = null;
  42909. html.removeChild(script);
  42910. script = null;
  42911. };
  42912. html.appendChild(script);
  42913. };
  42914. }
  42915. function installSetTimeoutImplementation() {
  42916. registerImmediate = function(handle) {
  42917. setTimeout(runIfPresent, 0, handle);
  42918. };
  42919. }
  42920. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42921. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42922. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42923. // Don't get fooled by e.g. browserify environments.
  42924. if ({}.toString.call(global.process) === "[object process]") {
  42925. // For Node.js before 0.9
  42926. installNextTickImplementation();
  42927. } else if (canUsePostMessage()) {
  42928. // For non-IE10 modern browsers
  42929. installPostMessageImplementation();
  42930. } else if (global.MessageChannel) {
  42931. // For web workers, where supported
  42932. installMessageChannelImplementation();
  42933. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42934. // For IE 6–8
  42935. installReadyStateChangeImplementation();
  42936. } else {
  42937. // For older browsers
  42938. installSetTimeoutImplementation();
  42939. }
  42940. attachTo.setImmediate = setImmediate;
  42941. attachTo.clearImmediate = clearImmediate;
  42942. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42943. /* 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")))
  42944. /***/ }),
  42945. /***/ "./node_modules/timers-browserify/main.js":
  42946. /*!************************************************!*\
  42947. !*** ./node_modules/timers-browserify/main.js ***!
  42948. \************************************************/
  42949. /*! no static exports found */
  42950. /***/ (function(module, exports, __webpack_require__) {
  42951. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42952. (typeof self !== "undefined" && self) ||
  42953. window;
  42954. var apply = Function.prototype.apply;
  42955. // DOM APIs, for completeness
  42956. exports.setTimeout = function() {
  42957. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42958. };
  42959. exports.setInterval = function() {
  42960. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42961. };
  42962. exports.clearTimeout =
  42963. exports.clearInterval = function(timeout) {
  42964. if (timeout) {
  42965. timeout.close();
  42966. }
  42967. };
  42968. function Timeout(id, clearFn) {
  42969. this._id = id;
  42970. this._clearFn = clearFn;
  42971. }
  42972. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42973. Timeout.prototype.close = function() {
  42974. this._clearFn.call(scope, this._id);
  42975. };
  42976. // Does not start the time, just sets up the members needed.
  42977. exports.enroll = function(item, msecs) {
  42978. clearTimeout(item._idleTimeoutId);
  42979. item._idleTimeout = msecs;
  42980. };
  42981. exports.unenroll = function(item) {
  42982. clearTimeout(item._idleTimeoutId);
  42983. item._idleTimeout = -1;
  42984. };
  42985. exports._unrefActive = exports.active = function(item) {
  42986. clearTimeout(item._idleTimeoutId);
  42987. var msecs = item._idleTimeout;
  42988. if (msecs >= 0) {
  42989. item._idleTimeoutId = setTimeout(function onTimeout() {
  42990. if (item._onTimeout)
  42991. item._onTimeout();
  42992. }, msecs);
  42993. }
  42994. };
  42995. // setimmediate attaches itself to the global object
  42996. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42997. // On some exotic environments, it's not clear which object `setimmediate` was
  42998. // able to install onto. Search each possibility in the same order as the
  42999. // `setimmediate` library.
  43000. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43001. (typeof global !== "undefined" && global.setImmediate) ||
  43002. (this && this.setImmediate);
  43003. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43004. (typeof global !== "undefined" && global.clearImmediate) ||
  43005. (this && this.clearImmediate);
  43006. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43007. /***/ }),
  43008. /***/ "./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&":
  43009. /*!*******************************************************************************************************************************************************************************************************************!*\
  43010. !*** ./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& ***!
  43011. \*******************************************************************************************************************************************************************************************************************/
  43012. /*! exports provided: render, staticRenderFns */
  43013. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43014. "use strict";
  43015. __webpack_require__.r(__webpack_exports__);
  43016. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43017. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43018. var render = function() {
  43019. var _vm = this
  43020. var _h = _vm.$createElement
  43021. var _c = _vm._self._c || _h
  43022. return _vm._m(0)
  43023. }
  43024. var staticRenderFns = [
  43025. function() {
  43026. var _vm = this
  43027. var _h = _vm.$createElement
  43028. var _c = _vm._self._c || _h
  43029. return _c("div", { staticClass: "container" }, [
  43030. _c("div", { staticClass: "row justify-content-center" }, [
  43031. _c("div", { staticClass: "col-md-8" }, [
  43032. _c("div", { staticClass: "card" }, [
  43033. _c("div", { staticClass: "card-header" }, [
  43034. _vm._v("Example Component")
  43035. ]),
  43036. _vm._v(" "),
  43037. _c("div", { staticClass: "card-body" }, [
  43038. _vm._v(
  43039. "\n I'm an example component.\n "
  43040. )
  43041. ])
  43042. ])
  43043. ])
  43044. ])
  43045. ])
  43046. }
  43047. ]
  43048. render._withStripped = true
  43049. /***/ }),
  43050. /***/ "./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&":
  43051. /*!************************************************************************************************************************************************************************************************************!*\
  43052. !*** ./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& ***!
  43053. \************************************************************************************************************************************************************************************************************/
  43054. /*! exports provided: render, staticRenderFns */
  43055. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43056. "use strict";
  43057. __webpack_require__.r(__webpack_exports__);
  43058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43059. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43060. var render = function() {
  43061. var _vm = this
  43062. var _h = _vm.$createElement
  43063. var _c = _vm._self._c || _h
  43064. return _c(
  43065. "div",
  43066. [
  43067. _c(
  43068. "modal",
  43069. {
  43070. attrs: {
  43071. id: "asseteditModal",
  43072. tabindex: "-1",
  43073. role: "dialog",
  43074. "aria-labelledby": "asseteditModalLabel"
  43075. }
  43076. },
  43077. [
  43078. _c(
  43079. "h5",
  43080. {
  43081. staticClass: "modal-title",
  43082. attrs: { slot: "header", id: "asseteditModalLabel" },
  43083. slot: "header"
  43084. },
  43085. [_vm._v("\n Edit Work Order Information\n ")]
  43086. ),
  43087. _vm._v(" "),
  43088. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43089. _c("div", { staticClass: "form-group" }, [
  43090. _c("label", { attrs: { for: "manufacturer" } }, [
  43091. _vm._v("Manufacturer")
  43092. ]),
  43093. _vm._v(" "),
  43094. _c("input", {
  43095. directives: [
  43096. {
  43097. name: "model",
  43098. rawName: "v-model.lazy",
  43099. value: _vm.data.pcmanu,
  43100. expression: "data.pcmanu",
  43101. modifiers: { lazy: true }
  43102. }
  43103. ],
  43104. staticClass: "form-control",
  43105. attrs: {
  43106. type: "text",
  43107. name: "manufacturer",
  43108. id: "manufacturer"
  43109. },
  43110. domProps: { value: _vm.data.pcmanu },
  43111. on: {
  43112. change: function($event) {
  43113. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43114. }
  43115. }
  43116. })
  43117. ]),
  43118. _vm._v(" "),
  43119. _c("div", { staticClass: "form-group" }, [
  43120. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43121. _vm._v(" "),
  43122. _c("input", {
  43123. directives: [
  43124. {
  43125. name: "model",
  43126. rawName: "v-model.lazy",
  43127. value: _vm.data.pcmake,
  43128. expression: "data.pcmake",
  43129. modifiers: { lazy: true }
  43130. }
  43131. ],
  43132. staticClass: "form-control",
  43133. attrs: { type: "text", name: "make", id: "make" },
  43134. domProps: { value: _vm.data.pcmake },
  43135. on: {
  43136. change: function($event) {
  43137. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43138. }
  43139. }
  43140. })
  43141. ]),
  43142. _vm._v(" "),
  43143. _c("div", { staticClass: "form-group" }, [
  43144. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43145. _vm._v(" "),
  43146. _c("input", {
  43147. directives: [
  43148. {
  43149. name: "model",
  43150. rawName: "v-model.lazy",
  43151. value: _vm.data.pcnickname,
  43152. expression: "data.pcnickname",
  43153. modifiers: { lazy: true }
  43154. }
  43155. ],
  43156. staticClass: "form-control",
  43157. attrs: { type: "text", name: "nickname", id: "nickname" },
  43158. domProps: { value: _vm.data.pcnickname },
  43159. on: {
  43160. change: function($event) {
  43161. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43162. }
  43163. }
  43164. })
  43165. ]),
  43166. _vm._v(" "),
  43167. _c("div", { staticClass: "form-group" }, [
  43168. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43169. _vm._v(" "),
  43170. _c("input", {
  43171. directives: [
  43172. {
  43173. name: "model",
  43174. rawName: "v-model.lazy",
  43175. value: _vm.pcextra[2],
  43176. expression: "pcextra[2]",
  43177. modifiers: { lazy: true }
  43178. }
  43179. ],
  43180. staticClass: "form-control",
  43181. attrs: { type: "text", name: "os", id: "os" },
  43182. domProps: { value: _vm.pcextra[2] },
  43183. on: {
  43184. change: function($event) {
  43185. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43186. }
  43187. }
  43188. })
  43189. ]),
  43190. _vm._v(" "),
  43191. _c("div", { staticClass: "form-group" }, [
  43192. _c("label", { attrs: { for: "serial" } }, [
  43193. _vm._v("Serial Number")
  43194. ]),
  43195. _vm._v(" "),
  43196. _c("input", {
  43197. directives: [
  43198. {
  43199. name: "model",
  43200. rawName: "v-model.lazy",
  43201. value: _vm.pcextra[104],
  43202. expression: "pcextra[104]",
  43203. modifiers: { lazy: true }
  43204. }
  43205. ],
  43206. staticClass: "form-control",
  43207. attrs: { type: "text", id: "serial", name: "serial" },
  43208. domProps: { value: _vm.pcextra[104] },
  43209. on: {
  43210. change: function($event) {
  43211. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43212. }
  43213. }
  43214. })
  43215. ]),
  43216. _vm._v(" "),
  43217. _c("div", { staticClass: "form-group" }, [
  43218. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43219. _vm._v(" "),
  43220. _c("input", {
  43221. directives: [
  43222. {
  43223. name: "model",
  43224. rawName: "v-model.lazy",
  43225. value: _vm.pcextra[101],
  43226. expression: "pcextra[101]",
  43227. modifiers: { lazy: true }
  43228. }
  43229. ],
  43230. staticClass: "form-control",
  43231. attrs: { type: "text", id: "cpu", name: "cpu" },
  43232. domProps: { value: _vm.pcextra[101] },
  43233. on: {
  43234. change: function($event) {
  43235. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43236. }
  43237. }
  43238. })
  43239. ]),
  43240. _vm._v(" "),
  43241. _c("div", { staticClass: "form-group" }, [
  43242. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43243. _vm._v(" "),
  43244. _c("input", {
  43245. directives: [
  43246. {
  43247. name: "model",
  43248. rawName: "v-model.lazy",
  43249. value: _vm.pcextra[100],
  43250. expression: "pcextra[100]",
  43251. modifiers: { lazy: true }
  43252. }
  43253. ],
  43254. staticClass: "form-control",
  43255. attrs: { type: "text", name: "ram", id: "ram" },
  43256. domProps: { value: _vm.pcextra[100] },
  43257. on: {
  43258. change: function($event) {
  43259. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43260. }
  43261. }
  43262. })
  43263. ]),
  43264. _vm._v(" "),
  43265. _c("div", { staticClass: "form-group" }, [
  43266. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43267. _vm._v(" "),
  43268. _c("input", {
  43269. directives: [
  43270. {
  43271. name: "model",
  43272. rawName: "v-model.lazy",
  43273. value: _vm.pcextra[4],
  43274. expression: "pcextra[4]",
  43275. modifiers: { lazy: true }
  43276. }
  43277. ],
  43278. staticClass: "form-control",
  43279. attrs: { type: "text", name: "graphics", id: "grapics" },
  43280. domProps: { value: _vm.pcextra[4] },
  43281. on: {
  43282. change: function($event) {
  43283. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43284. }
  43285. }
  43286. })
  43287. ])
  43288. ]),
  43289. _vm._v(" "),
  43290. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43291. _c(
  43292. "button",
  43293. {
  43294. staticClass: "btn btn-secondary",
  43295. attrs: { type: "button", "data-dismiss": "modal" }
  43296. },
  43297. [_vm._v("Close")]
  43298. ),
  43299. _vm._v(" "),
  43300. _c(
  43301. "button",
  43302. {
  43303. staticClass: "btn btn-primary",
  43304. attrs: { type: "button" },
  43305. on: {
  43306. click: function($event) {
  43307. return _vm.updateAsset()
  43308. }
  43309. }
  43310. },
  43311. [_vm._v("Save")]
  43312. )
  43313. ])
  43314. ]
  43315. ),
  43316. _vm._v(" "),
  43317. _c("h4", { staticClass: "text-center" }, [
  43318. _vm._v(
  43319. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43320. ),
  43321. _c("small", { staticClass: "text-muted" }, [
  43322. _vm._v(_vm._s(this.data.pcnickname))
  43323. ])
  43324. ]),
  43325. _vm._v(" "),
  43326. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43327. _vm._v(" "),
  43328. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43329. _vm._v(" "),
  43330. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43331. _vm._v(" "),
  43332. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43333. _vm._v(" "),
  43334. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43335. _vm._v(" "),
  43336. _c(
  43337. "button",
  43338. {
  43339. staticClass: "btn btn-primary",
  43340. attrs: {
  43341. type: "button",
  43342. "data-toggle": "modal",
  43343. "data-target": "#asseteditModal"
  43344. }
  43345. },
  43346. [_vm._v("Edit")]
  43347. )
  43348. ],
  43349. 1
  43350. )
  43351. }
  43352. var staticRenderFns = []
  43353. render._withStripped = true
  43354. /***/ }),
  43355. /***/ "./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&":
  43356. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43357. !*** ./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& ***!
  43358. \*******************************************************************************************************************************************************************************************************************************/
  43359. /*! exports provided: render, staticRenderFns */
  43360. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43361. "use strict";
  43362. __webpack_require__.r(__webpack_exports__);
  43363. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43364. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43365. var render = function() {
  43366. var _vm = this
  43367. var _h = _vm.$createElement
  43368. var _c = _vm._self._c || _h
  43369. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43370. _c("div", { staticClass: "input-group" }, [
  43371. _c("input", {
  43372. directives: [
  43373. {
  43374. name: "model",
  43375. rawName: "v-model",
  43376. value: _vm.searchText,
  43377. expression: "searchText"
  43378. }
  43379. ],
  43380. staticClass: "form-control",
  43381. attrs: { type: "text" },
  43382. domProps: { value: _vm.searchText },
  43383. on: {
  43384. input: [
  43385. function($event) {
  43386. if ($event.target.composing) {
  43387. return
  43388. }
  43389. _vm.searchText = $event.target.value
  43390. },
  43391. _vm.searchChanged
  43392. ]
  43393. }
  43394. }),
  43395. _vm._v(" "),
  43396. _c("div", { staticClass: "form-group-append" }, [
  43397. _c(
  43398. "a",
  43399. {
  43400. staticClass: "toggle input-group-text bg-primary text-light",
  43401. on: {
  43402. mousedown: function($event) {
  43403. $event.preventDefault()
  43404. },
  43405. click: function($event) {
  43406. return _vm.setOpen(!_vm.open)
  43407. }
  43408. }
  43409. },
  43410. [
  43411. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43412. _vm._v(" "),
  43413. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43414. ]
  43415. )
  43416. ])
  43417. ]),
  43418. _vm._v(" "),
  43419. _c(
  43420. "ul",
  43421. { staticClass: "suggestion-list list-unstyled" },
  43422. _vm._l(_vm.matches, function(suggestion, index) {
  43423. return _c(
  43424. "li",
  43425. {
  43426. key: index,
  43427. on: {
  43428. mousedown: function($event) {
  43429. $event.preventDefault()
  43430. },
  43431. click: function($event) {
  43432. return _vm.suggestionSelected(suggestion)
  43433. }
  43434. }
  43435. },
  43436. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43437. )
  43438. }),
  43439. 0
  43440. )
  43441. ])
  43442. }
  43443. var staticRenderFns = []
  43444. render._withStripped = true
  43445. /***/ }),
  43446. /***/ "./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&":
  43447. /*!************************************************************************************************************************************************************************************************************************!*\
  43448. !*** ./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& ***!
  43449. \************************************************************************************************************************************************************************************************************************/
  43450. /*! exports provided: render, staticRenderFns */
  43451. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43452. "use strict";
  43453. __webpack_require__.r(__webpack_exports__);
  43454. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43455. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43456. var render = function() {
  43457. var _vm = this
  43458. var _h = _vm.$createElement
  43459. var _c = _vm._self._c || _h
  43460. return _c(
  43461. "modal",
  43462. {
  43463. attrs: {
  43464. id: _vm.id,
  43465. tabindex: "-1",
  43466. role: "dialog",
  43467. "aria-labelledby": _vm.id + "Label"
  43468. }
  43469. },
  43470. [
  43471. _c(
  43472. "h5",
  43473. {
  43474. staticClass: "modal-title",
  43475. attrs: { slot: "header", id: _vm.id + "Label" },
  43476. slot: "header"
  43477. },
  43478. [_vm._v("\n Edit Credential\n ")]
  43479. ),
  43480. _vm._v(" "),
  43481. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43482. _c(
  43483. "div",
  43484. { staticClass: "form" },
  43485. [
  43486. _c("autocomplete-custom-dropdown", {
  43487. attrs: {
  43488. options: _vm.descriptions,
  43489. value: _vm.creddesc,
  43490. "allow-custom": true
  43491. },
  43492. model: {
  43493. value: _vm.creddesc,
  43494. callback: function($$v) {
  43495. _vm.creddesc = $$v
  43496. },
  43497. expression: "creddesc"
  43498. }
  43499. })
  43500. ],
  43501. 1
  43502. ),
  43503. _vm._v(" "),
  43504. _c("div", { staticClass: "form-group" }, [
  43505. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43506. _vm._v(" "),
  43507. _c("input", {
  43508. directives: [
  43509. {
  43510. name: "model",
  43511. rawName: "v-model",
  43512. value: _vm.data.creduser,
  43513. expression: "data.creduser"
  43514. }
  43515. ],
  43516. staticClass: "form-control credential",
  43517. attrs: {
  43518. type: "text",
  43519. name: "newusername" + _vm.data.credid,
  43520. id: "newusername" + _vm.data.credid
  43521. },
  43522. domProps: { value: _vm.data.creduser },
  43523. on: {
  43524. input: function($event) {
  43525. if ($event.target.composing) {
  43526. return
  43527. }
  43528. _vm.$set(_vm.data, "creduser", $event.target.value)
  43529. }
  43530. }
  43531. })
  43532. ]),
  43533. _vm._v(" "),
  43534. _c("div", { staticClass: "form-group" }, [
  43535. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43536. _vm._v(" "),
  43537. _c("input", {
  43538. directives: [
  43539. {
  43540. name: "model",
  43541. rawName: "v-model",
  43542. value: _vm.data.credpass,
  43543. expression: "data.credpass"
  43544. }
  43545. ],
  43546. staticClass: "form-control credential",
  43547. attrs: {
  43548. type: "text",
  43549. name: "newpassword" + _vm.data.credid,
  43550. id: "newpassword" + _vm.data.credid
  43551. },
  43552. domProps: { value: _vm.data.credpass },
  43553. on: {
  43554. input: function($event) {
  43555. if ($event.target.composing) {
  43556. return
  43557. }
  43558. _vm.$set(_vm.data, "credpass", $event.target.value)
  43559. }
  43560. }
  43561. }),
  43562. _vm._v(" "),
  43563. _c(
  43564. "button",
  43565. {
  43566. staticClass: "btn btn-secondary",
  43567. attrs: { type: "button" },
  43568. on: {
  43569. click: function($event) {
  43570. return _vm.getRandomPassword(_vm.data.credid)
  43571. }
  43572. }
  43573. },
  43574. [_vm._v("Generate Random")]
  43575. )
  43576. ]),
  43577. _vm._v(" "),
  43578. _c("div", { staticClass: "form-group" })
  43579. ]),
  43580. _vm._v(" "),
  43581. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43582. _c(
  43583. "button",
  43584. {
  43585. staticClass: "btn btn-secondary",
  43586. attrs: { type: "button", "data-dismiss": "modal" }
  43587. },
  43588. [_vm._v("Close")]
  43589. ),
  43590. _vm._v(" "),
  43591. _c(
  43592. "button",
  43593. {
  43594. staticClass: "btn btn-primary",
  43595. attrs: { type: "button" },
  43596. on: {
  43597. click: function($event) {
  43598. return _vm.updateCredential()
  43599. }
  43600. }
  43601. },
  43602. [_vm._v("Save")]
  43603. )
  43604. ])
  43605. ]
  43606. )
  43607. }
  43608. var staticRenderFns = []
  43609. render._withStripped = true
  43610. /***/ }),
  43611. /***/ "./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&":
  43612. /*!******************************************************************************************************************************************************************************************************************!*\
  43613. !*** ./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& ***!
  43614. \******************************************************************************************************************************************************************************************************************/
  43615. /*! exports provided: render, staticRenderFns */
  43616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43617. "use strict";
  43618. __webpack_require__.r(__webpack_exports__);
  43619. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43620. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43621. var render = function() {
  43622. var _vm = this
  43623. var _h = _vm.$createElement
  43624. var _c = _vm._self._c || _h
  43625. return _c(
  43626. "div",
  43627. [
  43628. _c("credential-form-modal", {
  43629. attrs: {
  43630. "modal-id": "newCredentialModal",
  43631. descriptions: _vm.creddescList,
  43632. create: true,
  43633. pcid: _vm.pcid
  43634. }
  43635. }),
  43636. _vm._v(" "),
  43637. _c(
  43638. "button",
  43639. {
  43640. staticClass: "btn btn-primary",
  43641. attrs: {
  43642. type: "button",
  43643. "data-toggle": "modal",
  43644. "data-target": "#newCredentialModal"
  43645. }
  43646. },
  43647. [_vm._v("New Credential")]
  43648. ),
  43649. _vm._v(" "),
  43650. _vm._l(_vm.credentials, function(credential) {
  43651. return _c(
  43652. "div",
  43653. { key: credential.credid },
  43654. [
  43655. _c("credential", {
  43656. attrs: { credential: credential, descriptions: _vm.creddescList }
  43657. })
  43658. ],
  43659. 1
  43660. )
  43661. })
  43662. ],
  43663. 2
  43664. )
  43665. }
  43666. var staticRenderFns = []
  43667. render._withStripped = true
  43668. /***/ }),
  43669. /***/ "./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&":
  43670. /*!*************************************************************************************************************************************************************************************************************!*\
  43671. !*** ./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& ***!
  43672. \*************************************************************************************************************************************************************************************************************/
  43673. /*! exports provided: render, staticRenderFns */
  43674. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43675. "use strict";
  43676. __webpack_require__.r(__webpack_exports__);
  43677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43679. var render = function() {
  43680. var _vm = this
  43681. var _h = _vm.$createElement
  43682. var _c = _vm._self._c || _h
  43683. return _c(
  43684. "div",
  43685. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43686. [
  43687. _c("credential-form-modal", {
  43688. attrs: {
  43689. descriptions: _vm.creddescList,
  43690. "modal-id": "credential" + this.data.credid + "editModal",
  43691. populateWith: this.data
  43692. }
  43693. }),
  43694. _vm._v(" "),
  43695. _c(
  43696. "modal",
  43697. {
  43698. attrs: {
  43699. id: "credential" + this.data.credid + "deleteModal",
  43700. tabindex: "-1"
  43701. }
  43702. },
  43703. [
  43704. _c(
  43705. "h5",
  43706. {
  43707. staticClass: "modal-title",
  43708. attrs: {
  43709. slot: "header",
  43710. id: "credential" + this.data.credid + "deleteModalLabel"
  43711. },
  43712. slot: "header"
  43713. },
  43714. [_vm._v("\r\n Delete Credential\r\n ")]
  43715. ),
  43716. _vm._v(" "),
  43717. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43718. _vm._v("\r\n Are you sure?\r\n ")
  43719. ]),
  43720. _vm._v(" "),
  43721. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43722. _c(
  43723. "button",
  43724. {
  43725. staticClass: "btn btn-secondary",
  43726. attrs: { type: "button", "data-dismiss": "modal" }
  43727. },
  43728. [_vm._v("Cancel")]
  43729. ),
  43730. _vm._v(" "),
  43731. _c(
  43732. "button",
  43733. {
  43734. staticClass: "btn btn-danger",
  43735. attrs: { type: "button" },
  43736. on: {
  43737. click: function($event) {
  43738. return _vm.deleteCredential()
  43739. }
  43740. }
  43741. },
  43742. [_vm._v("Confirm")]
  43743. )
  43744. ])
  43745. ]
  43746. ),
  43747. _vm._v(" "),
  43748. _c("div", { staticClass: "row no-gutters" }, [
  43749. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43750. _vm._v(_vm._s(this.data.creddesc))
  43751. ]),
  43752. _vm._v(" "),
  43753. _c("div", { staticClass: "col-9 text-right" }, [
  43754. _vm._v(_vm._s(this.data.creddate))
  43755. ])
  43756. ]),
  43757. _vm._v(" "),
  43758. _c("div", { staticClass: "row" }, [
  43759. _c("div", { staticClass: "col-lg-9" }, [
  43760. _c("div", [
  43761. _vm._m(0),
  43762. _vm._v(" "),
  43763. _c("input", {
  43764. staticClass: "border-0 credential",
  43765. attrs: {
  43766. type: "text",
  43767. id: "username" + this.data.credid,
  43768. readonly: ""
  43769. },
  43770. domProps: { value: this.data.creduser }
  43771. }),
  43772. _vm._v(" "),
  43773. _c(
  43774. "button",
  43775. {
  43776. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43777. attrs: {
  43778. id: "btn-username" + this.data.credid,
  43779. "data-clipboard-target": "#username" + this.data.credid
  43780. }
  43781. },
  43782. [_c("i", { staticClass: "far fa-clone" })]
  43783. )
  43784. ]),
  43785. _vm._v(" "),
  43786. _c("div", [
  43787. _vm._m(1),
  43788. _vm._v(" "),
  43789. _c("input", {
  43790. staticClass: "border-0 credential",
  43791. attrs: {
  43792. type: "text",
  43793. id: "password" + this.data.credid,
  43794. readonly: ""
  43795. },
  43796. domProps: { value: this.data.credpass }
  43797. }),
  43798. _vm._v(" "),
  43799. _c(
  43800. "button",
  43801. {
  43802. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43803. attrs: {
  43804. id: "btn-password" + this.data.credid,
  43805. "data-clipboard-target": "#password" + this.data.credid
  43806. }
  43807. },
  43808. [_c("i", { staticClass: "far fa-clone" })]
  43809. )
  43810. ])
  43811. ]),
  43812. _vm._v(" "),
  43813. _c(
  43814. "div",
  43815. {
  43816. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43817. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43818. },
  43819. [
  43820. _c(
  43821. "button",
  43822. {
  43823. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43824. attrs: {
  43825. type: "button",
  43826. "data-toggle": "modal",
  43827. "data-target": "#credential" + this.data.credid + "editModal"
  43828. }
  43829. },
  43830. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43831. ),
  43832. _vm._v(" "),
  43833. _c(
  43834. "button",
  43835. {
  43836. staticClass: "btn btn-sm btn-danger p-lg-1",
  43837. attrs: {
  43838. type: "button",
  43839. "data-toggle": "modal",
  43840. "data-target":
  43841. "#credential" + this.data.credid + "deleteModal"
  43842. }
  43843. },
  43844. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43845. )
  43846. ]
  43847. )
  43848. ])
  43849. ],
  43850. 1
  43851. )
  43852. }
  43853. var staticRenderFns = [
  43854. function() {
  43855. var _vm = this
  43856. var _h = _vm.$createElement
  43857. var _c = _vm._self._c || _h
  43858. return _c("label", { attrs: { for: "username" } }, [
  43859. _c("i", { staticClass: "fas fa-fw fa-user" })
  43860. ])
  43861. },
  43862. function() {
  43863. var _vm = this
  43864. var _h = _vm.$createElement
  43865. var _c = _vm._self._c || _h
  43866. return _c("label", { attrs: { for: "password" } }, [
  43867. _c("i", { staticClass: "fas fa-fw fa-key" })
  43868. ])
  43869. }
  43870. ]
  43871. render._withStripped = true
  43872. /***/ }),
  43873. /***/ "./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&":
  43874. /*!************************************************************************************************************************************************************************************************************!*\
  43875. !*** ./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& ***!
  43876. \************************************************************************************************************************************************************************************************************/
  43877. /*! exports provided: render, staticRenderFns */
  43878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43879. "use strict";
  43880. __webpack_require__.r(__webpack_exports__);
  43881. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43882. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43883. var render = function() {
  43884. var _vm = this
  43885. var _h = _vm.$createElement
  43886. var _c = _vm._self._c || _h
  43887. return _c(
  43888. "ul",
  43889. { staticClass: "list-unstyled" },
  43890. _vm._l(_vm.errorList, function(error) {
  43891. return _c("li", { key: error, staticClass: "text-danger" }, [
  43892. _vm._v(" " + _vm._s(error) + " ")
  43893. ])
  43894. }),
  43895. 0
  43896. )
  43897. }
  43898. var staticRenderFns = []
  43899. render._withStripped = true
  43900. /***/ }),
  43901. /***/ "./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&":
  43902. /*!********************************************************************************************************************************************************************************************************!*\
  43903. !*** ./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& ***!
  43904. \********************************************************************************************************************************************************************************************************/
  43905. /*! exports provided: render, staticRenderFns */
  43906. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43907. "use strict";
  43908. __webpack_require__.r(__webpack_exports__);
  43909. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43910. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43911. var render = function() {
  43912. var _vm = this
  43913. var _h = _vm.$createElement
  43914. var _c = _vm._self._c || _h
  43915. return _c("div", { staticClass: "modal fade" }, [
  43916. _c(
  43917. "div",
  43918. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43919. [
  43920. _c("div", { staticClass: "modal-content" }, [
  43921. _c(
  43922. "div",
  43923. { staticClass: "modal-header" },
  43924. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43925. 2
  43926. ),
  43927. _vm._v(" "),
  43928. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43929. _vm._v(" "),
  43930. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43931. ])
  43932. ]
  43933. )
  43934. ])
  43935. }
  43936. var staticRenderFns = [
  43937. function() {
  43938. var _vm = this
  43939. var _h = _vm.$createElement
  43940. var _c = _vm._self._c || _h
  43941. return _c(
  43942. "button",
  43943. {
  43944. staticClass: "close",
  43945. attrs: {
  43946. type: "button",
  43947. "data-dismiss": "modal",
  43948. "aria-label": "Close"
  43949. }
  43950. },
  43951. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43952. )
  43953. }
  43954. ]
  43955. render._withStripped = true
  43956. /***/ }),
  43957. /***/ "./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&":
  43958. /*!********************************************************************************************************************************************************************************************************!*\
  43959. !*** ./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& ***!
  43960. \********************************************************************************************************************************************************************************************************/
  43961. /*! exports provided: render, staticRenderFns */
  43962. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43963. "use strict";
  43964. __webpack_require__.r(__webpack_exports__);
  43965. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43966. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43967. var render = function() {
  43968. var _vm = this
  43969. var _h = _vm.$createElement
  43970. var _c = _vm._self._c || _h
  43971. return _c(
  43972. "ul",
  43973. { staticClass: "list-unstyled" },
  43974. _vm._l(this.notes, function(note) {
  43975. return _c(
  43976. "li",
  43977. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43978. [
  43979. _c(
  43980. "modal",
  43981. {
  43982. attrs: {
  43983. id: "note" + note.noteid + "editModal",
  43984. tabindex: "-1",
  43985. role: "dialog",
  43986. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43987. }
  43988. },
  43989. [
  43990. _c(
  43991. "h5",
  43992. {
  43993. staticClass: "modal-title",
  43994. attrs: {
  43995. slot: "header",
  43996. id: "note" + note.noteid + "editModalLabel"
  43997. },
  43998. slot: "header"
  43999. },
  44000. [_vm._v("\n Edit Note\n ")]
  44001. ),
  44002. _vm._v(" "),
  44003. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44004. _c("div", { staticClass: "form-group" }, [
  44005. _c("label", { attrs: { for: "content" } }, [
  44006. _vm._v("Content")
  44007. ]),
  44008. _vm._v(" "),
  44009. _c("textarea", {
  44010. directives: [
  44011. {
  44012. name: "model",
  44013. rawName: "v-model",
  44014. value: note.thenote,
  44015. expression: "note.thenote"
  44016. }
  44017. ],
  44018. staticClass: "form-control",
  44019. attrs: {
  44020. name: "content" + note.noteid,
  44021. id: "content" + note.noteid
  44022. },
  44023. domProps: { value: note.thenote },
  44024. on: {
  44025. input: function($event) {
  44026. if ($event.target.composing) {
  44027. return
  44028. }
  44029. _vm.$set(note, "thenote", $event.target.value)
  44030. }
  44031. }
  44032. })
  44033. ])
  44034. ]),
  44035. _vm._v(" "),
  44036. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44037. _c(
  44038. "button",
  44039. {
  44040. staticClass: "btn btn-secondary",
  44041. attrs: { type: "button", "data-dismiss": "modal" }
  44042. },
  44043. [_vm._v("Close")]
  44044. ),
  44045. _vm._v(" "),
  44046. _c(
  44047. "button",
  44048. {
  44049. staticClass: "btn btn-primary",
  44050. attrs: { type: "button" },
  44051. on: {
  44052. click: function($event) {
  44053. return _vm.updateNote(note.noteid)
  44054. }
  44055. }
  44056. },
  44057. [_vm._v("Save")]
  44058. )
  44059. ])
  44060. ]
  44061. ),
  44062. _vm._v(" "),
  44063. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44064. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44065. _vm._v(_vm._s(note.noteuser))
  44066. ]),
  44067. _vm._v(" "),
  44068. _c(
  44069. "div",
  44070. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44071. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44072. ),
  44073. _vm._v(" "),
  44074. _c(
  44075. "div",
  44076. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44077. [
  44078. _vm.authusername === note.noteuser ||
  44079. _vm.authusername === "admin"
  44080. ? [
  44081. _c(
  44082. "button",
  44083. {
  44084. staticClass: "btn btn-sm btn-primary m-1",
  44085. attrs: {
  44086. "data-toggle": "modal",
  44087. "data-target": "#note" + note.noteid + "editModal"
  44088. }
  44089. },
  44090. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44091. ),
  44092. _vm._v(" "),
  44093. _vm._m(0, true),
  44094. _vm._v(" "),
  44095. _vm._m(1, true)
  44096. ]
  44097. : _vm._e()
  44098. ],
  44099. 2
  44100. )
  44101. ]),
  44102. _vm._v(" "),
  44103. _c("div", { staticClass: "col-md-10" }, [
  44104. _c("div", { staticClass: "card m-2" }, [
  44105. _c("div", { staticClass: "card-body p-2" }, [
  44106. _vm._v(
  44107. "\n " +
  44108. _vm._s(note.thenote) +
  44109. "\n "
  44110. )
  44111. ])
  44112. ])
  44113. ])
  44114. ],
  44115. 1
  44116. )
  44117. }),
  44118. 0
  44119. )
  44120. }
  44121. var staticRenderFns = [
  44122. function() {
  44123. var _vm = this
  44124. var _h = _vm.$createElement
  44125. var _c = _vm._self._c || _h
  44126. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44127. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44128. ])
  44129. },
  44130. function() {
  44131. var _vm = this
  44132. var _h = _vm.$createElement
  44133. var _c = _vm._self._c || _h
  44134. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44135. _c("i", { staticClass: "fa fa-fw fa-random" })
  44136. ])
  44137. }
  44138. ]
  44139. render._withStripped = true
  44140. /***/ }),
  44141. /***/ "./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&":
  44142. /*!********************************************************************************************************************************************************************************************************************!*\
  44143. !*** ./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& ***!
  44144. \********************************************************************************************************************************************************************************************************************/
  44145. /*! exports provided: render, staticRenderFns */
  44146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44147. "use strict";
  44148. __webpack_require__.r(__webpack_exports__);
  44149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44150. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44151. var render = function() {
  44152. var _vm = this
  44153. var _h = _vm.$createElement
  44154. var _c = _vm._self._c || _h
  44155. return _c(
  44156. "modal",
  44157. {
  44158. attrs: {
  44159. id: _vm.id,
  44160. tabindex: "-1",
  44161. role: "dialog",
  44162. "aria-labelledby": _vm.id + "Label"
  44163. }
  44164. },
  44165. [
  44166. _c(
  44167. "h5",
  44168. {
  44169. staticClass: "modal-title",
  44170. attrs: { slot: "header", id: _vm.id + "Label" },
  44171. slot: "header"
  44172. },
  44173. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44174. ),
  44175. _vm._v(" "),
  44176. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44177. _c(
  44178. "div",
  44179. { staticClass: "form-group" },
  44180. [
  44181. _c("label", { attrs: { for: "probdesc" } }, [
  44182. _vm._v("Problem Description")
  44183. ]),
  44184. _vm._v(" "),
  44185. _c("textarea", {
  44186. directives: [
  44187. {
  44188. name: "model",
  44189. rawName: "v-model",
  44190. value: _vm.data.probdesc,
  44191. expression: "data.probdesc"
  44192. }
  44193. ],
  44194. class: {
  44195. "form-control": true,
  44196. "is-invalid": _vm.errors.probdesc
  44197. },
  44198. attrs: { id: "probdesc", name: "probdesc" },
  44199. domProps: { value: _vm.data.probdesc },
  44200. on: {
  44201. input: function($event) {
  44202. if ($event.target.composing) {
  44203. return
  44204. }
  44205. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44206. }
  44207. }
  44208. }),
  44209. _vm._v(" "),
  44210. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44211. ],
  44212. 1
  44213. ),
  44214. _vm._v(" "),
  44215. _c(
  44216. "div",
  44217. { staticClass: "form-group" },
  44218. [
  44219. _c("label", { attrs: { for: "suggested" } }, [
  44220. _vm._v("Suggested Solution")
  44221. ]),
  44222. _vm._v(" "),
  44223. _c("textarea", {
  44224. directives: [
  44225. {
  44226. name: "model",
  44227. rawName: "v-model",
  44228. value: _vm.data.suggested,
  44229. expression: "data.suggested"
  44230. }
  44231. ],
  44232. class: {
  44233. "form-control": true,
  44234. "is-invalid": _vm.errors.suggested
  44235. },
  44236. attrs: { id: "suggested", name: "suggested" },
  44237. domProps: { value: _vm.data.suggested },
  44238. on: {
  44239. input: function($event) {
  44240. if ($event.target.composing) {
  44241. return
  44242. }
  44243. _vm.$set(_vm.data, "suggested", $event.target.value)
  44244. }
  44245. }
  44246. }),
  44247. _vm._v(" "),
  44248. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44249. ],
  44250. 1
  44251. ),
  44252. _vm._v(" "),
  44253. _c(
  44254. "div",
  44255. { staticClass: "form-group" },
  44256. [
  44257. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44258. _vm._v(" "),
  44259. _c("autocomplete-custom-dropdown", {
  44260. attrs: { options: _vm.storeList, value: this.store },
  44261. model: {
  44262. value: _vm.store,
  44263. callback: function($$v) {
  44264. _vm.store = $$v
  44265. },
  44266. expression: "store"
  44267. }
  44268. })
  44269. ],
  44270. 1
  44271. )
  44272. ]),
  44273. _vm._v(" "),
  44274. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44275. _c(
  44276. "button",
  44277. {
  44278. staticClass: "btn btn-secondary",
  44279. attrs: { type: "button", "data-dismiss": "modal" }
  44280. },
  44281. [_vm._v("Close")]
  44282. ),
  44283. _vm._v(" "),
  44284. _c(
  44285. "button",
  44286. {
  44287. staticClass: "btn btn-primary",
  44288. attrs: { type: "button" },
  44289. on: {
  44290. click: function($event) {
  44291. return _vm.updateWorkOrder()
  44292. }
  44293. }
  44294. },
  44295. [_vm._v("Save")]
  44296. )
  44297. ])
  44298. ]
  44299. )
  44300. }
  44301. var staticRenderFns = []
  44302. render._withStripped = true
  44303. /***/ }),
  44304. /***/ "./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&":
  44305. /*!*********************************************************************************************************************************************************************************************************!*\
  44306. !*** ./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& ***!
  44307. \*********************************************************************************************************************************************************************************************************/
  44308. /*! exports provided: render, staticRenderFns */
  44309. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44310. "use strict";
  44311. __webpack_require__.r(__webpack_exports__);
  44312. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44313. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44314. var render = function() {
  44315. var _vm = this
  44316. var _h = _vm.$createElement
  44317. var _c = _vm._self._c || _h
  44318. return _c(
  44319. "div",
  44320. [
  44321. _c("woinfo-edit-modal", {
  44322. attrs: {
  44323. "modal-id": "workordereditModal",
  44324. "populate-with": this.data,
  44325. "store-list": this.storeList
  44326. }
  44327. }),
  44328. _vm._v(" "),
  44329. _c("p", [
  44330. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44331. _vm._v(" "),
  44332. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44333. ]),
  44334. _vm._v(" "),
  44335. _c("p", [
  44336. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44337. _vm._v(" "),
  44338. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44339. ]),
  44340. _vm._v(" "),
  44341. _c("p", [
  44342. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44343. _vm._v(" "),
  44344. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44345. ]),
  44346. _vm._v(" "),
  44347. _c("p", [
  44348. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44349. _vm._v(" "),
  44350. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44351. ]),
  44352. _vm._v(" "),
  44353. _c("p", [
  44354. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44355. _vm._v(" "),
  44356. _c(
  44357. "span",
  44358. {
  44359. staticClass: "dashed-underline",
  44360. attrs: {
  44361. "data-toggle": "tooltip",
  44362. "data-placement": "bottom",
  44363. title: this.getHRDate(this.data.dropdate)
  44364. }
  44365. },
  44366. [
  44367. _vm._v(
  44368. "\n " +
  44369. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44370. " days ago\n "
  44371. )
  44372. ]
  44373. )
  44374. ]),
  44375. _vm._v(" "),
  44376. _c("p", [
  44377. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44378. _vm._v(" "),
  44379. !this.isZero(this.data.pickupdate)
  44380. ? _c(
  44381. "span",
  44382. {
  44383. staticClass: "dashed-underline",
  44384. attrs: {
  44385. "data-toggle": "tooltip",
  44386. "data-placement": "bottom",
  44387. title: this.getHRDate(this.data.pickupdate)
  44388. }
  44389. },
  44390. [
  44391. _vm._v(
  44392. "\n " +
  44393. _vm._s(
  44394. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44395. ) +
  44396. " days ago\n "
  44397. )
  44398. ]
  44399. )
  44400. : _vm._e()
  44401. ]),
  44402. _vm._v(" "),
  44403. _c(
  44404. "button",
  44405. {
  44406. staticClass: "btn btn-primary",
  44407. attrs: {
  44408. type: "button",
  44409. "data-toggle": "modal",
  44410. "data-target": "#workordereditModal"
  44411. }
  44412. },
  44413. [_vm._v("Edit")]
  44414. )
  44415. ],
  44416. 1
  44417. )
  44418. }
  44419. var staticRenderFns = []
  44420. render._withStripped = true
  44421. /***/ }),
  44422. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44423. /*!********************************************************************!*\
  44424. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44425. \********************************************************************/
  44426. /*! exports provided: default */
  44427. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44428. "use strict";
  44429. __webpack_require__.r(__webpack_exports__);
  44430. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44431. /* globals __VUE_SSR_CONTEXT__ */
  44432. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44433. // This module is a runtime utility for cleaner component module output and will
  44434. // be included in the final webpack user bundle.
  44435. function normalizeComponent (
  44436. scriptExports,
  44437. render,
  44438. staticRenderFns,
  44439. functionalTemplate,
  44440. injectStyles,
  44441. scopeId,
  44442. moduleIdentifier, /* server only */
  44443. shadowMode /* vue-cli only */
  44444. ) {
  44445. // Vue.extend constructor export interop
  44446. var options = typeof scriptExports === 'function'
  44447. ? scriptExports.options
  44448. : scriptExports
  44449. // render functions
  44450. if (render) {
  44451. options.render = render
  44452. options.staticRenderFns = staticRenderFns
  44453. options._compiled = true
  44454. }
  44455. // functional template
  44456. if (functionalTemplate) {
  44457. options.functional = true
  44458. }
  44459. // scopedId
  44460. if (scopeId) {
  44461. options._scopeId = 'data-v-' + scopeId
  44462. }
  44463. var hook
  44464. if (moduleIdentifier) { // server build
  44465. hook = function (context) {
  44466. // 2.3 injection
  44467. context =
  44468. context || // cached call
  44469. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44470. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44471. // 2.2 with runInNewContext: true
  44472. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44473. context = __VUE_SSR_CONTEXT__
  44474. }
  44475. // inject component styles
  44476. if (injectStyles) {
  44477. injectStyles.call(this, context)
  44478. }
  44479. // register component module identifier for async chunk inferrence
  44480. if (context && context._registeredComponents) {
  44481. context._registeredComponents.add(moduleIdentifier)
  44482. }
  44483. }
  44484. // used by ssr in case component is cached and beforeCreate
  44485. // never gets called
  44486. options._ssrRegister = hook
  44487. } else if (injectStyles) {
  44488. hook = shadowMode
  44489. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44490. : injectStyles
  44491. }
  44492. if (hook) {
  44493. if (options.functional) {
  44494. // for template-only hot-reload because in that case the render fn doesn't
  44495. // go through the normalizer
  44496. options._injectStyles = hook
  44497. // register for functioal component in vue file
  44498. var originalRender = options.render
  44499. options.render = function renderWithStyleInjection (h, context) {
  44500. hook.call(context)
  44501. return originalRender(h, context)
  44502. }
  44503. } else {
  44504. // inject component registration as beforeCreate hook
  44505. var existing = options.beforeCreate
  44506. options.beforeCreate = existing
  44507. ? [].concat(existing, hook)
  44508. : [hook]
  44509. }
  44510. }
  44511. return {
  44512. exports: scriptExports,
  44513. options: options
  44514. }
  44515. }
  44516. /***/ }),
  44517. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44518. /*!*************************************************!*\
  44519. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44520. \*************************************************/
  44521. /*! no static exports found */
  44522. /***/ (function(module, exports, __webpack_require__) {
  44523. "use strict";
  44524. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44525. * Vue.js v2.6.11
  44526. * (c) 2014-2019 Evan You
  44527. * Released under the MIT License.
  44528. */
  44529. /* */
  44530. var emptyObject = Object.freeze({});
  44531. // These helpers produce better VM code in JS engines due to their
  44532. // explicitness and function inlining.
  44533. function isUndef (v) {
  44534. return v === undefined || v === null
  44535. }
  44536. function isDef (v) {
  44537. return v !== undefined && v !== null
  44538. }
  44539. function isTrue (v) {
  44540. return v === true
  44541. }
  44542. function isFalse (v) {
  44543. return v === false
  44544. }
  44545. /**
  44546. * Check if value is primitive.
  44547. */
  44548. function isPrimitive (value) {
  44549. return (
  44550. typeof value === 'string' ||
  44551. typeof value === 'number' ||
  44552. // $flow-disable-line
  44553. typeof value === 'symbol' ||
  44554. typeof value === 'boolean'
  44555. )
  44556. }
  44557. /**
  44558. * Quick object check - this is primarily used to tell
  44559. * Objects from primitive values when we know the value
  44560. * is a JSON-compliant type.
  44561. */
  44562. function isObject (obj) {
  44563. return obj !== null && typeof obj === 'object'
  44564. }
  44565. /**
  44566. * Get the raw type string of a value, e.g., [object Object].
  44567. */
  44568. var _toString = Object.prototype.toString;
  44569. function toRawType (value) {
  44570. return _toString.call(value).slice(8, -1)
  44571. }
  44572. /**
  44573. * Strict object type check. Only returns true
  44574. * for plain JavaScript objects.
  44575. */
  44576. function isPlainObject (obj) {
  44577. return _toString.call(obj) === '[object Object]'
  44578. }
  44579. function isRegExp (v) {
  44580. return _toString.call(v) === '[object RegExp]'
  44581. }
  44582. /**
  44583. * Check if val is a valid array index.
  44584. */
  44585. function isValidArrayIndex (val) {
  44586. var n = parseFloat(String(val));
  44587. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44588. }
  44589. function isPromise (val) {
  44590. return (
  44591. isDef(val) &&
  44592. typeof val.then === 'function' &&
  44593. typeof val.catch === 'function'
  44594. )
  44595. }
  44596. /**
  44597. * Convert a value to a string that is actually rendered.
  44598. */
  44599. function toString (val) {
  44600. return val == null
  44601. ? ''
  44602. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44603. ? JSON.stringify(val, null, 2)
  44604. : String(val)
  44605. }
  44606. /**
  44607. * Convert an input value to a number for persistence.
  44608. * If the conversion fails, return original string.
  44609. */
  44610. function toNumber (val) {
  44611. var n = parseFloat(val);
  44612. return isNaN(n) ? val : n
  44613. }
  44614. /**
  44615. * Make a map and return a function for checking if a key
  44616. * is in that map.
  44617. */
  44618. function makeMap (
  44619. str,
  44620. expectsLowerCase
  44621. ) {
  44622. var map = Object.create(null);
  44623. var list = str.split(',');
  44624. for (var i = 0; i < list.length; i++) {
  44625. map[list[i]] = true;
  44626. }
  44627. return expectsLowerCase
  44628. ? function (val) { return map[val.toLowerCase()]; }
  44629. : function (val) { return map[val]; }
  44630. }
  44631. /**
  44632. * Check if a tag is a built-in tag.
  44633. */
  44634. var isBuiltInTag = makeMap('slot,component', true);
  44635. /**
  44636. * Check if an attribute is a reserved attribute.
  44637. */
  44638. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44639. /**
  44640. * Remove an item from an array.
  44641. */
  44642. function remove (arr, item) {
  44643. if (arr.length) {
  44644. var index = arr.indexOf(item);
  44645. if (index > -1) {
  44646. return arr.splice(index, 1)
  44647. }
  44648. }
  44649. }
  44650. /**
  44651. * Check whether an object has the property.
  44652. */
  44653. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44654. function hasOwn (obj, key) {
  44655. return hasOwnProperty.call(obj, key)
  44656. }
  44657. /**
  44658. * Create a cached version of a pure function.
  44659. */
  44660. function cached (fn) {
  44661. var cache = Object.create(null);
  44662. return (function cachedFn (str) {
  44663. var hit = cache[str];
  44664. return hit || (cache[str] = fn(str))
  44665. })
  44666. }
  44667. /**
  44668. * Camelize a hyphen-delimited string.
  44669. */
  44670. var camelizeRE = /-(\w)/g;
  44671. var camelize = cached(function (str) {
  44672. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44673. });
  44674. /**
  44675. * Capitalize a string.
  44676. */
  44677. var capitalize = cached(function (str) {
  44678. return str.charAt(0).toUpperCase() + str.slice(1)
  44679. });
  44680. /**
  44681. * Hyphenate a camelCase string.
  44682. */
  44683. var hyphenateRE = /\B([A-Z])/g;
  44684. var hyphenate = cached(function (str) {
  44685. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44686. });
  44687. /**
  44688. * Simple bind polyfill for environments that do not support it,
  44689. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44690. * since native bind is now performant enough in most browsers.
  44691. * But removing it would mean breaking code that was able to run in
  44692. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44693. */
  44694. /* istanbul ignore next */
  44695. function polyfillBind (fn, ctx) {
  44696. function boundFn (a) {
  44697. var l = arguments.length;
  44698. return l
  44699. ? l > 1
  44700. ? fn.apply(ctx, arguments)
  44701. : fn.call(ctx, a)
  44702. : fn.call(ctx)
  44703. }
  44704. boundFn._length = fn.length;
  44705. return boundFn
  44706. }
  44707. function nativeBind (fn, ctx) {
  44708. return fn.bind(ctx)
  44709. }
  44710. var bind = Function.prototype.bind
  44711. ? nativeBind
  44712. : polyfillBind;
  44713. /**
  44714. * Convert an Array-like object to a real Array.
  44715. */
  44716. function toArray (list, start) {
  44717. start = start || 0;
  44718. var i = list.length - start;
  44719. var ret = new Array(i);
  44720. while (i--) {
  44721. ret[i] = list[i + start];
  44722. }
  44723. return ret
  44724. }
  44725. /**
  44726. * Mix properties into target object.
  44727. */
  44728. function extend (to, _from) {
  44729. for (var key in _from) {
  44730. to[key] = _from[key];
  44731. }
  44732. return to
  44733. }
  44734. /**
  44735. * Merge an Array of Objects into a single Object.
  44736. */
  44737. function toObject (arr) {
  44738. var res = {};
  44739. for (var i = 0; i < arr.length; i++) {
  44740. if (arr[i]) {
  44741. extend(res, arr[i]);
  44742. }
  44743. }
  44744. return res
  44745. }
  44746. /* eslint-disable no-unused-vars */
  44747. /**
  44748. * Perform no operation.
  44749. * Stubbing args to make Flow happy without leaving useless transpiled code
  44750. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44751. */
  44752. function noop (a, b, c) {}
  44753. /**
  44754. * Always return false.
  44755. */
  44756. var no = function (a, b, c) { return false; };
  44757. /* eslint-enable no-unused-vars */
  44758. /**
  44759. * Return the same value.
  44760. */
  44761. var identity = function (_) { return _; };
  44762. /**
  44763. * Generate a string containing static keys from compiler modules.
  44764. */
  44765. function genStaticKeys (modules) {
  44766. return modules.reduce(function (keys, m) {
  44767. return keys.concat(m.staticKeys || [])
  44768. }, []).join(',')
  44769. }
  44770. /**
  44771. * Check if two values are loosely equal - that is,
  44772. * if they are plain objects, do they have the same shape?
  44773. */
  44774. function looseEqual (a, b) {
  44775. if (a === b) { return true }
  44776. var isObjectA = isObject(a);
  44777. var isObjectB = isObject(b);
  44778. if (isObjectA && isObjectB) {
  44779. try {
  44780. var isArrayA = Array.isArray(a);
  44781. var isArrayB = Array.isArray(b);
  44782. if (isArrayA && isArrayB) {
  44783. return a.length === b.length && a.every(function (e, i) {
  44784. return looseEqual(e, b[i])
  44785. })
  44786. } else if (a instanceof Date && b instanceof Date) {
  44787. return a.getTime() === b.getTime()
  44788. } else if (!isArrayA && !isArrayB) {
  44789. var keysA = Object.keys(a);
  44790. var keysB = Object.keys(b);
  44791. return keysA.length === keysB.length && keysA.every(function (key) {
  44792. return looseEqual(a[key], b[key])
  44793. })
  44794. } else {
  44795. /* istanbul ignore next */
  44796. return false
  44797. }
  44798. } catch (e) {
  44799. /* istanbul ignore next */
  44800. return false
  44801. }
  44802. } else if (!isObjectA && !isObjectB) {
  44803. return String(a) === String(b)
  44804. } else {
  44805. return false
  44806. }
  44807. }
  44808. /**
  44809. * Return the first index at which a loosely equal value can be
  44810. * found in the array (if value is a plain object, the array must
  44811. * contain an object of the same shape), or -1 if it is not present.
  44812. */
  44813. function looseIndexOf (arr, val) {
  44814. for (var i = 0; i < arr.length; i++) {
  44815. if (looseEqual(arr[i], val)) { return i }
  44816. }
  44817. return -1
  44818. }
  44819. /**
  44820. * Ensure a function is called only once.
  44821. */
  44822. function once (fn) {
  44823. var called = false;
  44824. return function () {
  44825. if (!called) {
  44826. called = true;
  44827. fn.apply(this, arguments);
  44828. }
  44829. }
  44830. }
  44831. var SSR_ATTR = 'data-server-rendered';
  44832. var ASSET_TYPES = [
  44833. 'component',
  44834. 'directive',
  44835. 'filter'
  44836. ];
  44837. var LIFECYCLE_HOOKS = [
  44838. 'beforeCreate',
  44839. 'created',
  44840. 'beforeMount',
  44841. 'mounted',
  44842. 'beforeUpdate',
  44843. 'updated',
  44844. 'beforeDestroy',
  44845. 'destroyed',
  44846. 'activated',
  44847. 'deactivated',
  44848. 'errorCaptured',
  44849. 'serverPrefetch'
  44850. ];
  44851. /* */
  44852. var config = ({
  44853. /**
  44854. * Option merge strategies (used in core/util/options)
  44855. */
  44856. // $flow-disable-line
  44857. optionMergeStrategies: Object.create(null),
  44858. /**
  44859. * Whether to suppress warnings.
  44860. */
  44861. silent: false,
  44862. /**
  44863. * Show production mode tip message on boot?
  44864. */
  44865. productionTip: "development" !== 'production',
  44866. /**
  44867. * Whether to enable devtools
  44868. */
  44869. devtools: "development" !== 'production',
  44870. /**
  44871. * Whether to record perf
  44872. */
  44873. performance: false,
  44874. /**
  44875. * Error handler for watcher errors
  44876. */
  44877. errorHandler: null,
  44878. /**
  44879. * Warn handler for watcher warns
  44880. */
  44881. warnHandler: null,
  44882. /**
  44883. * Ignore certain custom elements
  44884. */
  44885. ignoredElements: [],
  44886. /**
  44887. * Custom user key aliases for v-on
  44888. */
  44889. // $flow-disable-line
  44890. keyCodes: Object.create(null),
  44891. /**
  44892. * Check if a tag is reserved so that it cannot be registered as a
  44893. * component. This is platform-dependent and may be overwritten.
  44894. */
  44895. isReservedTag: no,
  44896. /**
  44897. * Check if an attribute is reserved so that it cannot be used as a component
  44898. * prop. This is platform-dependent and may be overwritten.
  44899. */
  44900. isReservedAttr: no,
  44901. /**
  44902. * Check if a tag is an unknown element.
  44903. * Platform-dependent.
  44904. */
  44905. isUnknownElement: no,
  44906. /**
  44907. * Get the namespace of an element
  44908. */
  44909. getTagNamespace: noop,
  44910. /**
  44911. * Parse the real tag name for the specific platform.
  44912. */
  44913. parsePlatformTagName: identity,
  44914. /**
  44915. * Check if an attribute must be bound using property, e.g. value
  44916. * Platform-dependent.
  44917. */
  44918. mustUseProp: no,
  44919. /**
  44920. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44921. * This will significantly reduce performance if set to false.
  44922. */
  44923. async: true,
  44924. /**
  44925. * Exposed for legacy reasons
  44926. */
  44927. _lifecycleHooks: LIFECYCLE_HOOKS
  44928. });
  44929. /* */
  44930. /**
  44931. * unicode letters used for parsing html tags, component names and property paths.
  44932. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44933. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44934. */
  44935. 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/;
  44936. /**
  44937. * Check if a string starts with $ or _
  44938. */
  44939. function isReserved (str) {
  44940. var c = (str + '').charCodeAt(0);
  44941. return c === 0x24 || c === 0x5F
  44942. }
  44943. /**
  44944. * Define a property.
  44945. */
  44946. function def (obj, key, val, enumerable) {
  44947. Object.defineProperty(obj, key, {
  44948. value: val,
  44949. enumerable: !!enumerable,
  44950. writable: true,
  44951. configurable: true
  44952. });
  44953. }
  44954. /**
  44955. * Parse simple path.
  44956. */
  44957. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44958. function parsePath (path) {
  44959. if (bailRE.test(path)) {
  44960. return
  44961. }
  44962. var segments = path.split('.');
  44963. return function (obj) {
  44964. for (var i = 0; i < segments.length; i++) {
  44965. if (!obj) { return }
  44966. obj = obj[segments[i]];
  44967. }
  44968. return obj
  44969. }
  44970. }
  44971. /* */
  44972. // can we use __proto__?
  44973. var hasProto = '__proto__' in {};
  44974. // Browser environment sniffing
  44975. var inBrowser = typeof window !== 'undefined';
  44976. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44977. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44978. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44979. var isIE = UA && /msie|trident/.test(UA);
  44980. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44981. var isEdge = UA && UA.indexOf('edge/') > 0;
  44982. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44983. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44984. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44985. var isPhantomJS = UA && /phantomjs/.test(UA);
  44986. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44987. // Firefox has a "watch" function on Object.prototype...
  44988. var nativeWatch = ({}).watch;
  44989. var supportsPassive = false;
  44990. if (inBrowser) {
  44991. try {
  44992. var opts = {};
  44993. Object.defineProperty(opts, 'passive', ({
  44994. get: function get () {
  44995. /* istanbul ignore next */
  44996. supportsPassive = true;
  44997. }
  44998. })); // https://github.com/facebook/flow/issues/285
  44999. window.addEventListener('test-passive', null, opts);
  45000. } catch (e) {}
  45001. }
  45002. // this needs to be lazy-evaled because vue may be required before
  45003. // vue-server-renderer can set VUE_ENV
  45004. var _isServer;
  45005. var isServerRendering = function () {
  45006. if (_isServer === undefined) {
  45007. /* istanbul ignore if */
  45008. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45009. // detect presence of vue-server-renderer and avoid
  45010. // Webpack shimming the process
  45011. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45012. } else {
  45013. _isServer = false;
  45014. }
  45015. }
  45016. return _isServer
  45017. };
  45018. // detect devtools
  45019. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45020. /* istanbul ignore next */
  45021. function isNative (Ctor) {
  45022. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45023. }
  45024. var hasSymbol =
  45025. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45026. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45027. var _Set;
  45028. /* istanbul ignore if */ // $flow-disable-line
  45029. if (typeof Set !== 'undefined' && isNative(Set)) {
  45030. // use native Set when available.
  45031. _Set = Set;
  45032. } else {
  45033. // a non-standard Set polyfill that only works with primitive keys.
  45034. _Set = /*@__PURE__*/(function () {
  45035. function Set () {
  45036. this.set = Object.create(null);
  45037. }
  45038. Set.prototype.has = function has (key) {
  45039. return this.set[key] === true
  45040. };
  45041. Set.prototype.add = function add (key) {
  45042. this.set[key] = true;
  45043. };
  45044. Set.prototype.clear = function clear () {
  45045. this.set = Object.create(null);
  45046. };
  45047. return Set;
  45048. }());
  45049. }
  45050. /* */
  45051. var warn = noop;
  45052. var tip = noop;
  45053. var generateComponentTrace = (noop); // work around flow check
  45054. var formatComponentName = (noop);
  45055. {
  45056. var hasConsole = typeof console !== 'undefined';
  45057. var classifyRE = /(?:^|[-_])(\w)/g;
  45058. var classify = function (str) { return str
  45059. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45060. .replace(/[-_]/g, ''); };
  45061. warn = function (msg, vm) {
  45062. var trace = vm ? generateComponentTrace(vm) : '';
  45063. if (config.warnHandler) {
  45064. config.warnHandler.call(null, msg, vm, trace);
  45065. } else if (hasConsole && (!config.silent)) {
  45066. console.error(("[Vue warn]: " + msg + trace));
  45067. }
  45068. };
  45069. tip = function (msg, vm) {
  45070. if (hasConsole && (!config.silent)) {
  45071. console.warn("[Vue tip]: " + msg + (
  45072. vm ? generateComponentTrace(vm) : ''
  45073. ));
  45074. }
  45075. };
  45076. formatComponentName = function (vm, includeFile) {
  45077. if (vm.$root === vm) {
  45078. return '<Root>'
  45079. }
  45080. var options = typeof vm === 'function' && vm.cid != null
  45081. ? vm.options
  45082. : vm._isVue
  45083. ? vm.$options || vm.constructor.options
  45084. : vm;
  45085. var name = options.name || options._componentTag;
  45086. var file = options.__file;
  45087. if (!name && file) {
  45088. var match = file.match(/([^/\\]+)\.vue$/);
  45089. name = match && match[1];
  45090. }
  45091. return (
  45092. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45093. (file && includeFile !== false ? (" at " + file) : '')
  45094. )
  45095. };
  45096. var repeat = function (str, n) {
  45097. var res = '';
  45098. while (n) {
  45099. if (n % 2 === 1) { res += str; }
  45100. if (n > 1) { str += str; }
  45101. n >>= 1;
  45102. }
  45103. return res
  45104. };
  45105. generateComponentTrace = function (vm) {
  45106. if (vm._isVue && vm.$parent) {
  45107. var tree = [];
  45108. var currentRecursiveSequence = 0;
  45109. while (vm) {
  45110. if (tree.length > 0) {
  45111. var last = tree[tree.length - 1];
  45112. if (last.constructor === vm.constructor) {
  45113. currentRecursiveSequence++;
  45114. vm = vm.$parent;
  45115. continue
  45116. } else if (currentRecursiveSequence > 0) {
  45117. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45118. currentRecursiveSequence = 0;
  45119. }
  45120. }
  45121. tree.push(vm);
  45122. vm = vm.$parent;
  45123. }
  45124. return '\n\nfound in\n\n' + tree
  45125. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45126. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45127. : formatComponentName(vm))); })
  45128. .join('\n')
  45129. } else {
  45130. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45131. }
  45132. };
  45133. }
  45134. /* */
  45135. var uid = 0;
  45136. /**
  45137. * A dep is an observable that can have multiple
  45138. * directives subscribing to it.
  45139. */
  45140. var Dep = function Dep () {
  45141. this.id = uid++;
  45142. this.subs = [];
  45143. };
  45144. Dep.prototype.addSub = function addSub (sub) {
  45145. this.subs.push(sub);
  45146. };
  45147. Dep.prototype.removeSub = function removeSub (sub) {
  45148. remove(this.subs, sub);
  45149. };
  45150. Dep.prototype.depend = function depend () {
  45151. if (Dep.target) {
  45152. Dep.target.addDep(this);
  45153. }
  45154. };
  45155. Dep.prototype.notify = function notify () {
  45156. // stabilize the subscriber list first
  45157. var subs = this.subs.slice();
  45158. if (!config.async) {
  45159. // subs aren't sorted in scheduler if not running async
  45160. // we need to sort them now to make sure they fire in correct
  45161. // order
  45162. subs.sort(function (a, b) { return a.id - b.id; });
  45163. }
  45164. for (var i = 0, l = subs.length; i < l; i++) {
  45165. subs[i].update();
  45166. }
  45167. };
  45168. // The current target watcher being evaluated.
  45169. // This is globally unique because only one watcher
  45170. // can be evaluated at a time.
  45171. Dep.target = null;
  45172. var targetStack = [];
  45173. function pushTarget (target) {
  45174. targetStack.push(target);
  45175. Dep.target = target;
  45176. }
  45177. function popTarget () {
  45178. targetStack.pop();
  45179. Dep.target = targetStack[targetStack.length - 1];
  45180. }
  45181. /* */
  45182. var VNode = function VNode (
  45183. tag,
  45184. data,
  45185. children,
  45186. text,
  45187. elm,
  45188. context,
  45189. componentOptions,
  45190. asyncFactory
  45191. ) {
  45192. this.tag = tag;
  45193. this.data = data;
  45194. this.children = children;
  45195. this.text = text;
  45196. this.elm = elm;
  45197. this.ns = undefined;
  45198. this.context = context;
  45199. this.fnContext = undefined;
  45200. this.fnOptions = undefined;
  45201. this.fnScopeId = undefined;
  45202. this.key = data && data.key;
  45203. this.componentOptions = componentOptions;
  45204. this.componentInstance = undefined;
  45205. this.parent = undefined;
  45206. this.raw = false;
  45207. this.isStatic = false;
  45208. this.isRootInsert = true;
  45209. this.isComment = false;
  45210. this.isCloned = false;
  45211. this.isOnce = false;
  45212. this.asyncFactory = asyncFactory;
  45213. this.asyncMeta = undefined;
  45214. this.isAsyncPlaceholder = false;
  45215. };
  45216. var prototypeAccessors = { child: { configurable: true } };
  45217. // DEPRECATED: alias for componentInstance for backwards compat.
  45218. /* istanbul ignore next */
  45219. prototypeAccessors.child.get = function () {
  45220. return this.componentInstance
  45221. };
  45222. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45223. var createEmptyVNode = function (text) {
  45224. if ( text === void 0 ) text = '';
  45225. var node = new VNode();
  45226. node.text = text;
  45227. node.isComment = true;
  45228. return node
  45229. };
  45230. function createTextVNode (val) {
  45231. return new VNode(undefined, undefined, undefined, String(val))
  45232. }
  45233. // optimized shallow clone
  45234. // used for static nodes and slot nodes because they may be reused across
  45235. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45236. // on their elm reference.
  45237. function cloneVNode (vnode) {
  45238. var cloned = new VNode(
  45239. vnode.tag,
  45240. vnode.data,
  45241. // #7975
  45242. // clone children array to avoid mutating original in case of cloning
  45243. // a child.
  45244. vnode.children && vnode.children.slice(),
  45245. vnode.text,
  45246. vnode.elm,
  45247. vnode.context,
  45248. vnode.componentOptions,
  45249. vnode.asyncFactory
  45250. );
  45251. cloned.ns = vnode.ns;
  45252. cloned.isStatic = vnode.isStatic;
  45253. cloned.key = vnode.key;
  45254. cloned.isComment = vnode.isComment;
  45255. cloned.fnContext = vnode.fnContext;
  45256. cloned.fnOptions = vnode.fnOptions;
  45257. cloned.fnScopeId = vnode.fnScopeId;
  45258. cloned.asyncMeta = vnode.asyncMeta;
  45259. cloned.isCloned = true;
  45260. return cloned
  45261. }
  45262. /*
  45263. * not type checking this file because flow doesn't play well with
  45264. * dynamically accessing methods on Array prototype
  45265. */
  45266. var arrayProto = Array.prototype;
  45267. var arrayMethods = Object.create(arrayProto);
  45268. var methodsToPatch = [
  45269. 'push',
  45270. 'pop',
  45271. 'shift',
  45272. 'unshift',
  45273. 'splice',
  45274. 'sort',
  45275. 'reverse'
  45276. ];
  45277. /**
  45278. * Intercept mutating methods and emit events
  45279. */
  45280. methodsToPatch.forEach(function (method) {
  45281. // cache original method
  45282. var original = arrayProto[method];
  45283. def(arrayMethods, method, function mutator () {
  45284. var args = [], len = arguments.length;
  45285. while ( len-- ) args[ len ] = arguments[ len ];
  45286. var result = original.apply(this, args);
  45287. var ob = this.__ob__;
  45288. var inserted;
  45289. switch (method) {
  45290. case 'push':
  45291. case 'unshift':
  45292. inserted = args;
  45293. break
  45294. case 'splice':
  45295. inserted = args.slice(2);
  45296. break
  45297. }
  45298. if (inserted) { ob.observeArray(inserted); }
  45299. // notify change
  45300. ob.dep.notify();
  45301. return result
  45302. });
  45303. });
  45304. /* */
  45305. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45306. /**
  45307. * In some cases we may want to disable observation inside a component's
  45308. * update computation.
  45309. */
  45310. var shouldObserve = true;
  45311. function toggleObserving (value) {
  45312. shouldObserve = value;
  45313. }
  45314. /**
  45315. * Observer class that is attached to each observed
  45316. * object. Once attached, the observer converts the target
  45317. * object's property keys into getter/setters that
  45318. * collect dependencies and dispatch updates.
  45319. */
  45320. var Observer = function Observer (value) {
  45321. this.value = value;
  45322. this.dep = new Dep();
  45323. this.vmCount = 0;
  45324. def(value, '__ob__', this);
  45325. if (Array.isArray(value)) {
  45326. if (hasProto) {
  45327. protoAugment(value, arrayMethods);
  45328. } else {
  45329. copyAugment(value, arrayMethods, arrayKeys);
  45330. }
  45331. this.observeArray(value);
  45332. } else {
  45333. this.walk(value);
  45334. }
  45335. };
  45336. /**
  45337. * Walk through all properties and convert them into
  45338. * getter/setters. This method should only be called when
  45339. * value type is Object.
  45340. */
  45341. Observer.prototype.walk = function walk (obj) {
  45342. var keys = Object.keys(obj);
  45343. for (var i = 0; i < keys.length; i++) {
  45344. defineReactive$$1(obj, keys[i]);
  45345. }
  45346. };
  45347. /**
  45348. * Observe a list of Array items.
  45349. */
  45350. Observer.prototype.observeArray = function observeArray (items) {
  45351. for (var i = 0, l = items.length; i < l; i++) {
  45352. observe(items[i]);
  45353. }
  45354. };
  45355. // helpers
  45356. /**
  45357. * Augment a target Object or Array by intercepting
  45358. * the prototype chain using __proto__
  45359. */
  45360. function protoAugment (target, src) {
  45361. /* eslint-disable no-proto */
  45362. target.__proto__ = src;
  45363. /* eslint-enable no-proto */
  45364. }
  45365. /**
  45366. * Augment a target Object or Array by defining
  45367. * hidden properties.
  45368. */
  45369. /* istanbul ignore next */
  45370. function copyAugment (target, src, keys) {
  45371. for (var i = 0, l = keys.length; i < l; i++) {
  45372. var key = keys[i];
  45373. def(target, key, src[key]);
  45374. }
  45375. }
  45376. /**
  45377. * Attempt to create an observer instance for a value,
  45378. * returns the new observer if successfully observed,
  45379. * or the existing observer if the value already has one.
  45380. */
  45381. function observe (value, asRootData) {
  45382. if (!isObject(value) || value instanceof VNode) {
  45383. return
  45384. }
  45385. var ob;
  45386. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45387. ob = value.__ob__;
  45388. } else if (
  45389. shouldObserve &&
  45390. !isServerRendering() &&
  45391. (Array.isArray(value) || isPlainObject(value)) &&
  45392. Object.isExtensible(value) &&
  45393. !value._isVue
  45394. ) {
  45395. ob = new Observer(value);
  45396. }
  45397. if (asRootData && ob) {
  45398. ob.vmCount++;
  45399. }
  45400. return ob
  45401. }
  45402. /**
  45403. * Define a reactive property on an Object.
  45404. */
  45405. function defineReactive$$1 (
  45406. obj,
  45407. key,
  45408. val,
  45409. customSetter,
  45410. shallow
  45411. ) {
  45412. var dep = new Dep();
  45413. var property = Object.getOwnPropertyDescriptor(obj, key);
  45414. if (property && property.configurable === false) {
  45415. return
  45416. }
  45417. // cater for pre-defined getter/setters
  45418. var getter = property && property.get;
  45419. var setter = property && property.set;
  45420. if ((!getter || setter) && arguments.length === 2) {
  45421. val = obj[key];
  45422. }
  45423. var childOb = !shallow && observe(val);
  45424. Object.defineProperty(obj, key, {
  45425. enumerable: true,
  45426. configurable: true,
  45427. get: function reactiveGetter () {
  45428. var value = getter ? getter.call(obj) : val;
  45429. if (Dep.target) {
  45430. dep.depend();
  45431. if (childOb) {
  45432. childOb.dep.depend();
  45433. if (Array.isArray(value)) {
  45434. dependArray(value);
  45435. }
  45436. }
  45437. }
  45438. return value
  45439. },
  45440. set: function reactiveSetter (newVal) {
  45441. var value = getter ? getter.call(obj) : val;
  45442. /* eslint-disable no-self-compare */
  45443. if (newVal === value || (newVal !== newVal && value !== value)) {
  45444. return
  45445. }
  45446. /* eslint-enable no-self-compare */
  45447. if (customSetter) {
  45448. customSetter();
  45449. }
  45450. // #7981: for accessor properties without setter
  45451. if (getter && !setter) { return }
  45452. if (setter) {
  45453. setter.call(obj, newVal);
  45454. } else {
  45455. val = newVal;
  45456. }
  45457. childOb = !shallow && observe(newVal);
  45458. dep.notify();
  45459. }
  45460. });
  45461. }
  45462. /**
  45463. * Set a property on an object. Adds the new property and
  45464. * triggers change notification if the property doesn't
  45465. * already exist.
  45466. */
  45467. function set (target, key, val) {
  45468. if (isUndef(target) || isPrimitive(target)
  45469. ) {
  45470. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45471. }
  45472. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45473. target.length = Math.max(target.length, key);
  45474. target.splice(key, 1, val);
  45475. return val
  45476. }
  45477. if (key in target && !(key in Object.prototype)) {
  45478. target[key] = val;
  45479. return val
  45480. }
  45481. var ob = (target).__ob__;
  45482. if (target._isVue || (ob && ob.vmCount)) {
  45483. warn(
  45484. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45485. 'at runtime - declare it upfront in the data option.'
  45486. );
  45487. return val
  45488. }
  45489. if (!ob) {
  45490. target[key] = val;
  45491. return val
  45492. }
  45493. defineReactive$$1(ob.value, key, val);
  45494. ob.dep.notify();
  45495. return val
  45496. }
  45497. /**
  45498. * Delete a property and trigger change if necessary.
  45499. */
  45500. function del (target, key) {
  45501. if (isUndef(target) || isPrimitive(target)
  45502. ) {
  45503. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45504. }
  45505. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45506. target.splice(key, 1);
  45507. return
  45508. }
  45509. var ob = (target).__ob__;
  45510. if (target._isVue || (ob && ob.vmCount)) {
  45511. warn(
  45512. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45513. '- just set it to null.'
  45514. );
  45515. return
  45516. }
  45517. if (!hasOwn(target, key)) {
  45518. return
  45519. }
  45520. delete target[key];
  45521. if (!ob) {
  45522. return
  45523. }
  45524. ob.dep.notify();
  45525. }
  45526. /**
  45527. * Collect dependencies on array elements when the array is touched, since
  45528. * we cannot intercept array element access like property getters.
  45529. */
  45530. function dependArray (value) {
  45531. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45532. e = value[i];
  45533. e && e.__ob__ && e.__ob__.dep.depend();
  45534. if (Array.isArray(e)) {
  45535. dependArray(e);
  45536. }
  45537. }
  45538. }
  45539. /* */
  45540. /**
  45541. * Option overwriting strategies are functions that handle
  45542. * how to merge a parent option value and a child option
  45543. * value into the final value.
  45544. */
  45545. var strats = config.optionMergeStrategies;
  45546. /**
  45547. * Options with restrictions
  45548. */
  45549. {
  45550. strats.el = strats.propsData = function (parent, child, vm, key) {
  45551. if (!vm) {
  45552. warn(
  45553. "option \"" + key + "\" can only be used during instance " +
  45554. 'creation with the `new` keyword.'
  45555. );
  45556. }
  45557. return defaultStrat(parent, child)
  45558. };
  45559. }
  45560. /**
  45561. * Helper that recursively merges two data objects together.
  45562. */
  45563. function mergeData (to, from) {
  45564. if (!from) { return to }
  45565. var key, toVal, fromVal;
  45566. var keys = hasSymbol
  45567. ? Reflect.ownKeys(from)
  45568. : Object.keys(from);
  45569. for (var i = 0; i < keys.length; i++) {
  45570. key = keys[i];
  45571. // in case the object is already observed...
  45572. if (key === '__ob__') { continue }
  45573. toVal = to[key];
  45574. fromVal = from[key];
  45575. if (!hasOwn(to, key)) {
  45576. set(to, key, fromVal);
  45577. } else if (
  45578. toVal !== fromVal &&
  45579. isPlainObject(toVal) &&
  45580. isPlainObject(fromVal)
  45581. ) {
  45582. mergeData(toVal, fromVal);
  45583. }
  45584. }
  45585. return to
  45586. }
  45587. /**
  45588. * Data
  45589. */
  45590. function mergeDataOrFn (
  45591. parentVal,
  45592. childVal,
  45593. vm
  45594. ) {
  45595. if (!vm) {
  45596. // in a Vue.extend merge, both should be functions
  45597. if (!childVal) {
  45598. return parentVal
  45599. }
  45600. if (!parentVal) {
  45601. return childVal
  45602. }
  45603. // when parentVal & childVal are both present,
  45604. // we need to return a function that returns the
  45605. // merged result of both functions... no need to
  45606. // check if parentVal is a function here because
  45607. // it has to be a function to pass previous merges.
  45608. return function mergedDataFn () {
  45609. return mergeData(
  45610. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45611. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45612. )
  45613. }
  45614. } else {
  45615. return function mergedInstanceDataFn () {
  45616. // instance merge
  45617. var instanceData = typeof childVal === 'function'
  45618. ? childVal.call(vm, vm)
  45619. : childVal;
  45620. var defaultData = typeof parentVal === 'function'
  45621. ? parentVal.call(vm, vm)
  45622. : parentVal;
  45623. if (instanceData) {
  45624. return mergeData(instanceData, defaultData)
  45625. } else {
  45626. return defaultData
  45627. }
  45628. }
  45629. }
  45630. }
  45631. strats.data = function (
  45632. parentVal,
  45633. childVal,
  45634. vm
  45635. ) {
  45636. if (!vm) {
  45637. if (childVal && typeof childVal !== 'function') {
  45638. warn(
  45639. 'The "data" option should be a function ' +
  45640. 'that returns a per-instance value in component ' +
  45641. 'definitions.',
  45642. vm
  45643. );
  45644. return parentVal
  45645. }
  45646. return mergeDataOrFn(parentVal, childVal)
  45647. }
  45648. return mergeDataOrFn(parentVal, childVal, vm)
  45649. };
  45650. /**
  45651. * Hooks and props are merged as arrays.
  45652. */
  45653. function mergeHook (
  45654. parentVal,
  45655. childVal
  45656. ) {
  45657. var res = childVal
  45658. ? parentVal
  45659. ? parentVal.concat(childVal)
  45660. : Array.isArray(childVal)
  45661. ? childVal
  45662. : [childVal]
  45663. : parentVal;
  45664. return res
  45665. ? dedupeHooks(res)
  45666. : res
  45667. }
  45668. function dedupeHooks (hooks) {
  45669. var res = [];
  45670. for (var i = 0; i < hooks.length; i++) {
  45671. if (res.indexOf(hooks[i]) === -1) {
  45672. res.push(hooks[i]);
  45673. }
  45674. }
  45675. return res
  45676. }
  45677. LIFECYCLE_HOOKS.forEach(function (hook) {
  45678. strats[hook] = mergeHook;
  45679. });
  45680. /**
  45681. * Assets
  45682. *
  45683. * When a vm is present (instance creation), we need to do
  45684. * a three-way merge between constructor options, instance
  45685. * options and parent options.
  45686. */
  45687. function mergeAssets (
  45688. parentVal,
  45689. childVal,
  45690. vm,
  45691. key
  45692. ) {
  45693. var res = Object.create(parentVal || null);
  45694. if (childVal) {
  45695. assertObjectType(key, childVal, vm);
  45696. return extend(res, childVal)
  45697. } else {
  45698. return res
  45699. }
  45700. }
  45701. ASSET_TYPES.forEach(function (type) {
  45702. strats[type + 's'] = mergeAssets;
  45703. });
  45704. /**
  45705. * Watchers.
  45706. *
  45707. * Watchers hashes should not overwrite one
  45708. * another, so we merge them as arrays.
  45709. */
  45710. strats.watch = function (
  45711. parentVal,
  45712. childVal,
  45713. vm,
  45714. key
  45715. ) {
  45716. // work around Firefox's Object.prototype.watch...
  45717. if (parentVal === nativeWatch) { parentVal = undefined; }
  45718. if (childVal === nativeWatch) { childVal = undefined; }
  45719. /* istanbul ignore if */
  45720. if (!childVal) { return Object.create(parentVal || null) }
  45721. {
  45722. assertObjectType(key, childVal, vm);
  45723. }
  45724. if (!parentVal) { return childVal }
  45725. var ret = {};
  45726. extend(ret, parentVal);
  45727. for (var key$1 in childVal) {
  45728. var parent = ret[key$1];
  45729. var child = childVal[key$1];
  45730. if (parent && !Array.isArray(parent)) {
  45731. parent = [parent];
  45732. }
  45733. ret[key$1] = parent
  45734. ? parent.concat(child)
  45735. : Array.isArray(child) ? child : [child];
  45736. }
  45737. return ret
  45738. };
  45739. /**
  45740. * Other object hashes.
  45741. */
  45742. strats.props =
  45743. strats.methods =
  45744. strats.inject =
  45745. strats.computed = function (
  45746. parentVal,
  45747. childVal,
  45748. vm,
  45749. key
  45750. ) {
  45751. if (childVal && "development" !== 'production') {
  45752. assertObjectType(key, childVal, vm);
  45753. }
  45754. if (!parentVal) { return childVal }
  45755. var ret = Object.create(null);
  45756. extend(ret, parentVal);
  45757. if (childVal) { extend(ret, childVal); }
  45758. return ret
  45759. };
  45760. strats.provide = mergeDataOrFn;
  45761. /**
  45762. * Default strategy.
  45763. */
  45764. var defaultStrat = function (parentVal, childVal) {
  45765. return childVal === undefined
  45766. ? parentVal
  45767. : childVal
  45768. };
  45769. /**
  45770. * Validate component names
  45771. */
  45772. function checkComponents (options) {
  45773. for (var key in options.components) {
  45774. validateComponentName(key);
  45775. }
  45776. }
  45777. function validateComponentName (name) {
  45778. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45779. warn(
  45780. 'Invalid component name: "' + name + '". Component names ' +
  45781. 'should conform to valid custom element name in html5 specification.'
  45782. );
  45783. }
  45784. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45785. warn(
  45786. 'Do not use built-in or reserved HTML elements as component ' +
  45787. 'id: ' + name
  45788. );
  45789. }
  45790. }
  45791. /**
  45792. * Ensure all props option syntax are normalized into the
  45793. * Object-based format.
  45794. */
  45795. function normalizeProps (options, vm) {
  45796. var props = options.props;
  45797. if (!props) { return }
  45798. var res = {};
  45799. var i, val, name;
  45800. if (Array.isArray(props)) {
  45801. i = props.length;
  45802. while (i--) {
  45803. val = props[i];
  45804. if (typeof val === 'string') {
  45805. name = camelize(val);
  45806. res[name] = { type: null };
  45807. } else {
  45808. warn('props must be strings when using array syntax.');
  45809. }
  45810. }
  45811. } else if (isPlainObject(props)) {
  45812. for (var key in props) {
  45813. val = props[key];
  45814. name = camelize(key);
  45815. res[name] = isPlainObject(val)
  45816. ? val
  45817. : { type: val };
  45818. }
  45819. } else {
  45820. warn(
  45821. "Invalid value for option \"props\": expected an Array or an Object, " +
  45822. "but got " + (toRawType(props)) + ".",
  45823. vm
  45824. );
  45825. }
  45826. options.props = res;
  45827. }
  45828. /**
  45829. * Normalize all injections into Object-based format
  45830. */
  45831. function normalizeInject (options, vm) {
  45832. var inject = options.inject;
  45833. if (!inject) { return }
  45834. var normalized = options.inject = {};
  45835. if (Array.isArray(inject)) {
  45836. for (var i = 0; i < inject.length; i++) {
  45837. normalized[inject[i]] = { from: inject[i] };
  45838. }
  45839. } else if (isPlainObject(inject)) {
  45840. for (var key in inject) {
  45841. var val = inject[key];
  45842. normalized[key] = isPlainObject(val)
  45843. ? extend({ from: key }, val)
  45844. : { from: val };
  45845. }
  45846. } else {
  45847. warn(
  45848. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45849. "but got " + (toRawType(inject)) + ".",
  45850. vm
  45851. );
  45852. }
  45853. }
  45854. /**
  45855. * Normalize raw function directives into object format.
  45856. */
  45857. function normalizeDirectives (options) {
  45858. var dirs = options.directives;
  45859. if (dirs) {
  45860. for (var key in dirs) {
  45861. var def$$1 = dirs[key];
  45862. if (typeof def$$1 === 'function') {
  45863. dirs[key] = { bind: def$$1, update: def$$1 };
  45864. }
  45865. }
  45866. }
  45867. }
  45868. function assertObjectType (name, value, vm) {
  45869. if (!isPlainObject(value)) {
  45870. warn(
  45871. "Invalid value for option \"" + name + "\": expected an Object, " +
  45872. "but got " + (toRawType(value)) + ".",
  45873. vm
  45874. );
  45875. }
  45876. }
  45877. /**
  45878. * Merge two option objects into a new one.
  45879. * Core utility used in both instantiation and inheritance.
  45880. */
  45881. function mergeOptions (
  45882. parent,
  45883. child,
  45884. vm
  45885. ) {
  45886. {
  45887. checkComponents(child);
  45888. }
  45889. if (typeof child === 'function') {
  45890. child = child.options;
  45891. }
  45892. normalizeProps(child, vm);
  45893. normalizeInject(child, vm);
  45894. normalizeDirectives(child);
  45895. // Apply extends and mixins on the child options,
  45896. // but only if it is a raw options object that isn't
  45897. // the result of another mergeOptions call.
  45898. // Only merged options has the _base property.
  45899. if (!child._base) {
  45900. if (child.extends) {
  45901. parent = mergeOptions(parent, child.extends, vm);
  45902. }
  45903. if (child.mixins) {
  45904. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45905. parent = mergeOptions(parent, child.mixins[i], vm);
  45906. }
  45907. }
  45908. }
  45909. var options = {};
  45910. var key;
  45911. for (key in parent) {
  45912. mergeField(key);
  45913. }
  45914. for (key in child) {
  45915. if (!hasOwn(parent, key)) {
  45916. mergeField(key);
  45917. }
  45918. }
  45919. function mergeField (key) {
  45920. var strat = strats[key] || defaultStrat;
  45921. options[key] = strat(parent[key], child[key], vm, key);
  45922. }
  45923. return options
  45924. }
  45925. /**
  45926. * Resolve an asset.
  45927. * This function is used because child instances need access
  45928. * to assets defined in its ancestor chain.
  45929. */
  45930. function resolveAsset (
  45931. options,
  45932. type,
  45933. id,
  45934. warnMissing
  45935. ) {
  45936. /* istanbul ignore if */
  45937. if (typeof id !== 'string') {
  45938. return
  45939. }
  45940. var assets = options[type];
  45941. // check local registration variations first
  45942. if (hasOwn(assets, id)) { return assets[id] }
  45943. var camelizedId = camelize(id);
  45944. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45945. var PascalCaseId = capitalize(camelizedId);
  45946. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45947. // fallback to prototype chain
  45948. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45949. if (warnMissing && !res) {
  45950. warn(
  45951. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45952. options
  45953. );
  45954. }
  45955. return res
  45956. }
  45957. /* */
  45958. function validateProp (
  45959. key,
  45960. propOptions,
  45961. propsData,
  45962. vm
  45963. ) {
  45964. var prop = propOptions[key];
  45965. var absent = !hasOwn(propsData, key);
  45966. var value = propsData[key];
  45967. // boolean casting
  45968. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45969. if (booleanIndex > -1) {
  45970. if (absent && !hasOwn(prop, 'default')) {
  45971. value = false;
  45972. } else if (value === '' || value === hyphenate(key)) {
  45973. // only cast empty string / same name to boolean if
  45974. // boolean has higher priority
  45975. var stringIndex = getTypeIndex(String, prop.type);
  45976. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45977. value = true;
  45978. }
  45979. }
  45980. }
  45981. // check default value
  45982. if (value === undefined) {
  45983. value = getPropDefaultValue(vm, prop, key);
  45984. // since the default value is a fresh copy,
  45985. // make sure to observe it.
  45986. var prevShouldObserve = shouldObserve;
  45987. toggleObserving(true);
  45988. observe(value);
  45989. toggleObserving(prevShouldObserve);
  45990. }
  45991. {
  45992. assertProp(prop, key, value, vm, absent);
  45993. }
  45994. return value
  45995. }
  45996. /**
  45997. * Get the default value of a prop.
  45998. */
  45999. function getPropDefaultValue (vm, prop, key) {
  46000. // no default, return undefined
  46001. if (!hasOwn(prop, 'default')) {
  46002. return undefined
  46003. }
  46004. var def = prop.default;
  46005. // warn against non-factory defaults for Object & Array
  46006. if (isObject(def)) {
  46007. warn(
  46008. 'Invalid default value for prop "' + key + '": ' +
  46009. 'Props with type Object/Array must use a factory function ' +
  46010. 'to return the default value.',
  46011. vm
  46012. );
  46013. }
  46014. // the raw prop value was also undefined from previous render,
  46015. // return previous default value to avoid unnecessary watcher trigger
  46016. if (vm && vm.$options.propsData &&
  46017. vm.$options.propsData[key] === undefined &&
  46018. vm._props[key] !== undefined
  46019. ) {
  46020. return vm._props[key]
  46021. }
  46022. // call factory function for non-Function types
  46023. // a value is Function if its prototype is function even across different execution context
  46024. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46025. ? def.call(vm)
  46026. : def
  46027. }
  46028. /**
  46029. * Assert whether a prop is valid.
  46030. */
  46031. function assertProp (
  46032. prop,
  46033. name,
  46034. value,
  46035. vm,
  46036. absent
  46037. ) {
  46038. if (prop.required && absent) {
  46039. warn(
  46040. 'Missing required prop: "' + name + '"',
  46041. vm
  46042. );
  46043. return
  46044. }
  46045. if (value == null && !prop.required) {
  46046. return
  46047. }
  46048. var type = prop.type;
  46049. var valid = !type || type === true;
  46050. var expectedTypes = [];
  46051. if (type) {
  46052. if (!Array.isArray(type)) {
  46053. type = [type];
  46054. }
  46055. for (var i = 0; i < type.length && !valid; i++) {
  46056. var assertedType = assertType(value, type[i]);
  46057. expectedTypes.push(assertedType.expectedType || '');
  46058. valid = assertedType.valid;
  46059. }
  46060. }
  46061. if (!valid) {
  46062. warn(
  46063. getInvalidTypeMessage(name, value, expectedTypes),
  46064. vm
  46065. );
  46066. return
  46067. }
  46068. var validator = prop.validator;
  46069. if (validator) {
  46070. if (!validator(value)) {
  46071. warn(
  46072. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46073. vm
  46074. );
  46075. }
  46076. }
  46077. }
  46078. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46079. function assertType (value, type) {
  46080. var valid;
  46081. var expectedType = getType(type);
  46082. if (simpleCheckRE.test(expectedType)) {
  46083. var t = typeof value;
  46084. valid = t === expectedType.toLowerCase();
  46085. // for primitive wrapper objects
  46086. if (!valid && t === 'object') {
  46087. valid = value instanceof type;
  46088. }
  46089. } else if (expectedType === 'Object') {
  46090. valid = isPlainObject(value);
  46091. } else if (expectedType === 'Array') {
  46092. valid = Array.isArray(value);
  46093. } else {
  46094. valid = value instanceof type;
  46095. }
  46096. return {
  46097. valid: valid,
  46098. expectedType: expectedType
  46099. }
  46100. }
  46101. /**
  46102. * Use function string name to check built-in types,
  46103. * because a simple equality check will fail when running
  46104. * across different vms / iframes.
  46105. */
  46106. function getType (fn) {
  46107. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46108. return match ? match[1] : ''
  46109. }
  46110. function isSameType (a, b) {
  46111. return getType(a) === getType(b)
  46112. }
  46113. function getTypeIndex (type, expectedTypes) {
  46114. if (!Array.isArray(expectedTypes)) {
  46115. return isSameType(expectedTypes, type) ? 0 : -1
  46116. }
  46117. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46118. if (isSameType(expectedTypes[i], type)) {
  46119. return i
  46120. }
  46121. }
  46122. return -1
  46123. }
  46124. function getInvalidTypeMessage (name, value, expectedTypes) {
  46125. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46126. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46127. var expectedType = expectedTypes[0];
  46128. var receivedType = toRawType(value);
  46129. var expectedValue = styleValue(value, expectedType);
  46130. var receivedValue = styleValue(value, receivedType);
  46131. // check if we need to specify expected value
  46132. if (expectedTypes.length === 1 &&
  46133. isExplicable(expectedType) &&
  46134. !isBoolean(expectedType, receivedType)) {
  46135. message += " with value " + expectedValue;
  46136. }
  46137. message += ", got " + receivedType + " ";
  46138. // check if we need to specify received value
  46139. if (isExplicable(receivedType)) {
  46140. message += "with value " + receivedValue + ".";
  46141. }
  46142. return message
  46143. }
  46144. function styleValue (value, type) {
  46145. if (type === 'String') {
  46146. return ("\"" + value + "\"")
  46147. } else if (type === 'Number') {
  46148. return ("" + (Number(value)))
  46149. } else {
  46150. return ("" + value)
  46151. }
  46152. }
  46153. function isExplicable (value) {
  46154. var explicitTypes = ['string', 'number', 'boolean'];
  46155. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46156. }
  46157. function isBoolean () {
  46158. var args = [], len = arguments.length;
  46159. while ( len-- ) args[ len ] = arguments[ len ];
  46160. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46161. }
  46162. /* */
  46163. function handleError (err, vm, info) {
  46164. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46165. // See: https://github.com/vuejs/vuex/issues/1505
  46166. pushTarget();
  46167. try {
  46168. if (vm) {
  46169. var cur = vm;
  46170. while ((cur = cur.$parent)) {
  46171. var hooks = cur.$options.errorCaptured;
  46172. if (hooks) {
  46173. for (var i = 0; i < hooks.length; i++) {
  46174. try {
  46175. var capture = hooks[i].call(cur, err, vm, info) === false;
  46176. if (capture) { return }
  46177. } catch (e) {
  46178. globalHandleError(e, cur, 'errorCaptured hook');
  46179. }
  46180. }
  46181. }
  46182. }
  46183. }
  46184. globalHandleError(err, vm, info);
  46185. } finally {
  46186. popTarget();
  46187. }
  46188. }
  46189. function invokeWithErrorHandling (
  46190. handler,
  46191. context,
  46192. args,
  46193. vm,
  46194. info
  46195. ) {
  46196. var res;
  46197. try {
  46198. res = args ? handler.apply(context, args) : handler.call(context);
  46199. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46200. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46201. // issue #9511
  46202. // avoid catch triggering multiple times when nested calls
  46203. res._handled = true;
  46204. }
  46205. } catch (e) {
  46206. handleError(e, vm, info);
  46207. }
  46208. return res
  46209. }
  46210. function globalHandleError (err, vm, info) {
  46211. if (config.errorHandler) {
  46212. try {
  46213. return config.errorHandler.call(null, err, vm, info)
  46214. } catch (e) {
  46215. // if the user intentionally throws the original error in the handler,
  46216. // do not log it twice
  46217. if (e !== err) {
  46218. logError(e, null, 'config.errorHandler');
  46219. }
  46220. }
  46221. }
  46222. logError(err, vm, info);
  46223. }
  46224. function logError (err, vm, info) {
  46225. {
  46226. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46227. }
  46228. /* istanbul ignore else */
  46229. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46230. console.error(err);
  46231. } else {
  46232. throw err
  46233. }
  46234. }
  46235. /* */
  46236. var isUsingMicroTask = false;
  46237. var callbacks = [];
  46238. var pending = false;
  46239. function flushCallbacks () {
  46240. pending = false;
  46241. var copies = callbacks.slice(0);
  46242. callbacks.length = 0;
  46243. for (var i = 0; i < copies.length; i++) {
  46244. copies[i]();
  46245. }
  46246. }
  46247. // Here we have async deferring wrappers using microtasks.
  46248. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46249. // However, it has subtle problems when state is changed right before repaint
  46250. // (e.g. #6813, out-in transitions).
  46251. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46252. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46253. // So we now use microtasks everywhere, again.
  46254. // A major drawback of this tradeoff is that there are some scenarios
  46255. // where microtasks have too high a priority and fire in between supposedly
  46256. // sequential events (e.g. #4521, #6690, which have workarounds)
  46257. // or even between bubbling of the same event (#6566).
  46258. var timerFunc;
  46259. // The nextTick behavior leverages the microtask queue, which can be accessed
  46260. // via either native Promise.then or MutationObserver.
  46261. // MutationObserver has wider support, however it is seriously bugged in
  46262. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46263. // completely stops working after triggering a few times... so, if native
  46264. // Promise is available, we will use it:
  46265. /* istanbul ignore next, $flow-disable-line */
  46266. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46267. var p = Promise.resolve();
  46268. timerFunc = function () {
  46269. p.then(flushCallbacks);
  46270. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46271. // it can get stuck in a weird state where callbacks are pushed into the
  46272. // microtask queue but the queue isn't being flushed, until the browser
  46273. // needs to do some other work, e.g. handle a timer. Therefore we can
  46274. // "force" the microtask queue to be flushed by adding an empty timer.
  46275. if (isIOS) { setTimeout(noop); }
  46276. };
  46277. isUsingMicroTask = true;
  46278. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46279. isNative(MutationObserver) ||
  46280. // PhantomJS and iOS 7.x
  46281. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46282. )) {
  46283. // Use MutationObserver where native Promise is not available,
  46284. // e.g. PhantomJS, iOS7, Android 4.4
  46285. // (#6466 MutationObserver is unreliable in IE11)
  46286. var counter = 1;
  46287. var observer = new MutationObserver(flushCallbacks);
  46288. var textNode = document.createTextNode(String(counter));
  46289. observer.observe(textNode, {
  46290. characterData: true
  46291. });
  46292. timerFunc = function () {
  46293. counter = (counter + 1) % 2;
  46294. textNode.data = String(counter);
  46295. };
  46296. isUsingMicroTask = true;
  46297. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46298. // Fallback to setImmediate.
  46299. // Technically it leverages the (macro) task queue,
  46300. // but it is still a better choice than setTimeout.
  46301. timerFunc = function () {
  46302. setImmediate(flushCallbacks);
  46303. };
  46304. } else {
  46305. // Fallback to setTimeout.
  46306. timerFunc = function () {
  46307. setTimeout(flushCallbacks, 0);
  46308. };
  46309. }
  46310. function nextTick (cb, ctx) {
  46311. var _resolve;
  46312. callbacks.push(function () {
  46313. if (cb) {
  46314. try {
  46315. cb.call(ctx);
  46316. } catch (e) {
  46317. handleError(e, ctx, 'nextTick');
  46318. }
  46319. } else if (_resolve) {
  46320. _resolve(ctx);
  46321. }
  46322. });
  46323. if (!pending) {
  46324. pending = true;
  46325. timerFunc();
  46326. }
  46327. // $flow-disable-line
  46328. if (!cb && typeof Promise !== 'undefined') {
  46329. return new Promise(function (resolve) {
  46330. _resolve = resolve;
  46331. })
  46332. }
  46333. }
  46334. /* */
  46335. var mark;
  46336. var measure;
  46337. {
  46338. var perf = inBrowser && window.performance;
  46339. /* istanbul ignore if */
  46340. if (
  46341. perf &&
  46342. perf.mark &&
  46343. perf.measure &&
  46344. perf.clearMarks &&
  46345. perf.clearMeasures
  46346. ) {
  46347. mark = function (tag) { return perf.mark(tag); };
  46348. measure = function (name, startTag, endTag) {
  46349. perf.measure(name, startTag, endTag);
  46350. perf.clearMarks(startTag);
  46351. perf.clearMarks(endTag);
  46352. // perf.clearMeasures(name)
  46353. };
  46354. }
  46355. }
  46356. /* not type checking this file because flow doesn't play well with Proxy */
  46357. var initProxy;
  46358. {
  46359. var allowedGlobals = makeMap(
  46360. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46361. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46362. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46363. 'require' // for Webpack/Browserify
  46364. );
  46365. var warnNonPresent = function (target, key) {
  46366. warn(
  46367. "Property or method \"" + key + "\" is not defined on the instance but " +
  46368. 'referenced during render. Make sure that this property is reactive, ' +
  46369. 'either in the data option, or for class-based components, by ' +
  46370. 'initializing the property. ' +
  46371. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46372. target
  46373. );
  46374. };
  46375. var warnReservedPrefix = function (target, key) {
  46376. warn(
  46377. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46378. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46379. 'prevent conflicts with Vue internals. ' +
  46380. 'See: https://vuejs.org/v2/api/#data',
  46381. target
  46382. );
  46383. };
  46384. var hasProxy =
  46385. typeof Proxy !== 'undefined' && isNative(Proxy);
  46386. if (hasProxy) {
  46387. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46388. config.keyCodes = new Proxy(config.keyCodes, {
  46389. set: function set (target, key, value) {
  46390. if (isBuiltInModifier(key)) {
  46391. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46392. return false
  46393. } else {
  46394. target[key] = value;
  46395. return true
  46396. }
  46397. }
  46398. });
  46399. }
  46400. var hasHandler = {
  46401. has: function has (target, key) {
  46402. var has = key in target;
  46403. var isAllowed = allowedGlobals(key) ||
  46404. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46405. if (!has && !isAllowed) {
  46406. if (key in target.$data) { warnReservedPrefix(target, key); }
  46407. else { warnNonPresent(target, key); }
  46408. }
  46409. return has || !isAllowed
  46410. }
  46411. };
  46412. var getHandler = {
  46413. get: function get (target, key) {
  46414. if (typeof key === 'string' && !(key in target)) {
  46415. if (key in target.$data) { warnReservedPrefix(target, key); }
  46416. else { warnNonPresent(target, key); }
  46417. }
  46418. return target[key]
  46419. }
  46420. };
  46421. initProxy = function initProxy (vm) {
  46422. if (hasProxy) {
  46423. // determine which proxy handler to use
  46424. var options = vm.$options;
  46425. var handlers = options.render && options.render._withStripped
  46426. ? getHandler
  46427. : hasHandler;
  46428. vm._renderProxy = new Proxy(vm, handlers);
  46429. } else {
  46430. vm._renderProxy = vm;
  46431. }
  46432. };
  46433. }
  46434. /* */
  46435. var seenObjects = new _Set();
  46436. /**
  46437. * Recursively traverse an object to evoke all converted
  46438. * getters, so that every nested property inside the object
  46439. * is collected as a "deep" dependency.
  46440. */
  46441. function traverse (val) {
  46442. _traverse(val, seenObjects);
  46443. seenObjects.clear();
  46444. }
  46445. function _traverse (val, seen) {
  46446. var i, keys;
  46447. var isA = Array.isArray(val);
  46448. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46449. return
  46450. }
  46451. if (val.__ob__) {
  46452. var depId = val.__ob__.dep.id;
  46453. if (seen.has(depId)) {
  46454. return
  46455. }
  46456. seen.add(depId);
  46457. }
  46458. if (isA) {
  46459. i = val.length;
  46460. while (i--) { _traverse(val[i], seen); }
  46461. } else {
  46462. keys = Object.keys(val);
  46463. i = keys.length;
  46464. while (i--) { _traverse(val[keys[i]], seen); }
  46465. }
  46466. }
  46467. /* */
  46468. var normalizeEvent = cached(function (name) {
  46469. var passive = name.charAt(0) === '&';
  46470. name = passive ? name.slice(1) : name;
  46471. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46472. name = once$$1 ? name.slice(1) : name;
  46473. var capture = name.charAt(0) === '!';
  46474. name = capture ? name.slice(1) : name;
  46475. return {
  46476. name: name,
  46477. once: once$$1,
  46478. capture: capture,
  46479. passive: passive
  46480. }
  46481. });
  46482. function createFnInvoker (fns, vm) {
  46483. function invoker () {
  46484. var arguments$1 = arguments;
  46485. var fns = invoker.fns;
  46486. if (Array.isArray(fns)) {
  46487. var cloned = fns.slice();
  46488. for (var i = 0; i < cloned.length; i++) {
  46489. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46490. }
  46491. } else {
  46492. // return handler return value for single handlers
  46493. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46494. }
  46495. }
  46496. invoker.fns = fns;
  46497. return invoker
  46498. }
  46499. function updateListeners (
  46500. on,
  46501. oldOn,
  46502. add,
  46503. remove$$1,
  46504. createOnceHandler,
  46505. vm
  46506. ) {
  46507. var name, def$$1, cur, old, event;
  46508. for (name in on) {
  46509. def$$1 = cur = on[name];
  46510. old = oldOn[name];
  46511. event = normalizeEvent(name);
  46512. if (isUndef(cur)) {
  46513. warn(
  46514. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46515. vm
  46516. );
  46517. } else if (isUndef(old)) {
  46518. if (isUndef(cur.fns)) {
  46519. cur = on[name] = createFnInvoker(cur, vm);
  46520. }
  46521. if (isTrue(event.once)) {
  46522. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46523. }
  46524. add(event.name, cur, event.capture, event.passive, event.params);
  46525. } else if (cur !== old) {
  46526. old.fns = cur;
  46527. on[name] = old;
  46528. }
  46529. }
  46530. for (name in oldOn) {
  46531. if (isUndef(on[name])) {
  46532. event = normalizeEvent(name);
  46533. remove$$1(event.name, oldOn[name], event.capture);
  46534. }
  46535. }
  46536. }
  46537. /* */
  46538. function mergeVNodeHook (def, hookKey, hook) {
  46539. if (def instanceof VNode) {
  46540. def = def.data.hook || (def.data.hook = {});
  46541. }
  46542. var invoker;
  46543. var oldHook = def[hookKey];
  46544. function wrappedHook () {
  46545. hook.apply(this, arguments);
  46546. // important: remove merged hook to ensure it's called only once
  46547. // and prevent memory leak
  46548. remove(invoker.fns, wrappedHook);
  46549. }
  46550. if (isUndef(oldHook)) {
  46551. // no existing hook
  46552. invoker = createFnInvoker([wrappedHook]);
  46553. } else {
  46554. /* istanbul ignore if */
  46555. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46556. // already a merged invoker
  46557. invoker = oldHook;
  46558. invoker.fns.push(wrappedHook);
  46559. } else {
  46560. // existing plain hook
  46561. invoker = createFnInvoker([oldHook, wrappedHook]);
  46562. }
  46563. }
  46564. invoker.merged = true;
  46565. def[hookKey] = invoker;
  46566. }
  46567. /* */
  46568. function extractPropsFromVNodeData (
  46569. data,
  46570. Ctor,
  46571. tag
  46572. ) {
  46573. // we are only extracting raw values here.
  46574. // validation and default values are handled in the child
  46575. // component itself.
  46576. var propOptions = Ctor.options.props;
  46577. if (isUndef(propOptions)) {
  46578. return
  46579. }
  46580. var res = {};
  46581. var attrs = data.attrs;
  46582. var props = data.props;
  46583. if (isDef(attrs) || isDef(props)) {
  46584. for (var key in propOptions) {
  46585. var altKey = hyphenate(key);
  46586. {
  46587. var keyInLowerCase = key.toLowerCase();
  46588. if (
  46589. key !== keyInLowerCase &&
  46590. attrs && hasOwn(attrs, keyInLowerCase)
  46591. ) {
  46592. tip(
  46593. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46594. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46595. " \"" + key + "\". " +
  46596. "Note that HTML attributes are case-insensitive and camelCased " +
  46597. "props need to use their kebab-case equivalents when using in-DOM " +
  46598. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46599. );
  46600. }
  46601. }
  46602. checkProp(res, props, key, altKey, true) ||
  46603. checkProp(res, attrs, key, altKey, false);
  46604. }
  46605. }
  46606. return res
  46607. }
  46608. function checkProp (
  46609. res,
  46610. hash,
  46611. key,
  46612. altKey,
  46613. preserve
  46614. ) {
  46615. if (isDef(hash)) {
  46616. if (hasOwn(hash, key)) {
  46617. res[key] = hash[key];
  46618. if (!preserve) {
  46619. delete hash[key];
  46620. }
  46621. return true
  46622. } else if (hasOwn(hash, altKey)) {
  46623. res[key] = hash[altKey];
  46624. if (!preserve) {
  46625. delete hash[altKey];
  46626. }
  46627. return true
  46628. }
  46629. }
  46630. return false
  46631. }
  46632. /* */
  46633. // The template compiler attempts to minimize the need for normalization by
  46634. // statically analyzing the template at compile time.
  46635. //
  46636. // For plain HTML markup, normalization can be completely skipped because the
  46637. // generated render function is guaranteed to return Array<VNode>. There are
  46638. // two cases where extra normalization is needed:
  46639. // 1. When the children contains components - because a functional component
  46640. // may return an Array instead of a single root. In this case, just a simple
  46641. // normalization is needed - if any child is an Array, we flatten the whole
  46642. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46643. // because functional components already normalize their own children.
  46644. function simpleNormalizeChildren (children) {
  46645. for (var i = 0; i < children.length; i++) {
  46646. if (Array.isArray(children[i])) {
  46647. return Array.prototype.concat.apply([], children)
  46648. }
  46649. }
  46650. return children
  46651. }
  46652. // 2. When the children contains constructs that always generated nested Arrays,
  46653. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46654. // with hand-written render functions / JSX. In such cases a full normalization
  46655. // is needed to cater to all possible types of children values.
  46656. function normalizeChildren (children) {
  46657. return isPrimitive(children)
  46658. ? [createTextVNode(children)]
  46659. : Array.isArray(children)
  46660. ? normalizeArrayChildren(children)
  46661. : undefined
  46662. }
  46663. function isTextNode (node) {
  46664. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46665. }
  46666. function normalizeArrayChildren (children, nestedIndex) {
  46667. var res = [];
  46668. var i, c, lastIndex, last;
  46669. for (i = 0; i < children.length; i++) {
  46670. c = children[i];
  46671. if (isUndef(c) || typeof c === 'boolean') { continue }
  46672. lastIndex = res.length - 1;
  46673. last = res[lastIndex];
  46674. // nested
  46675. if (Array.isArray(c)) {
  46676. if (c.length > 0) {
  46677. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46678. // merge adjacent text nodes
  46679. if (isTextNode(c[0]) && isTextNode(last)) {
  46680. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46681. c.shift();
  46682. }
  46683. res.push.apply(res, c);
  46684. }
  46685. } else if (isPrimitive(c)) {
  46686. if (isTextNode(last)) {
  46687. // merge adjacent text nodes
  46688. // this is necessary for SSR hydration because text nodes are
  46689. // essentially merged when rendered to HTML strings
  46690. res[lastIndex] = createTextVNode(last.text + c);
  46691. } else if (c !== '') {
  46692. // convert primitive to vnode
  46693. res.push(createTextVNode(c));
  46694. }
  46695. } else {
  46696. if (isTextNode(c) && isTextNode(last)) {
  46697. // merge adjacent text nodes
  46698. res[lastIndex] = createTextVNode(last.text + c.text);
  46699. } else {
  46700. // default key for nested array children (likely generated by v-for)
  46701. if (isTrue(children._isVList) &&
  46702. isDef(c.tag) &&
  46703. isUndef(c.key) &&
  46704. isDef(nestedIndex)) {
  46705. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46706. }
  46707. res.push(c);
  46708. }
  46709. }
  46710. }
  46711. return res
  46712. }
  46713. /* */
  46714. function initProvide (vm) {
  46715. var provide = vm.$options.provide;
  46716. if (provide) {
  46717. vm._provided = typeof provide === 'function'
  46718. ? provide.call(vm)
  46719. : provide;
  46720. }
  46721. }
  46722. function initInjections (vm) {
  46723. var result = resolveInject(vm.$options.inject, vm);
  46724. if (result) {
  46725. toggleObserving(false);
  46726. Object.keys(result).forEach(function (key) {
  46727. /* istanbul ignore else */
  46728. {
  46729. defineReactive$$1(vm, key, result[key], function () {
  46730. warn(
  46731. "Avoid mutating an injected value directly since the changes will be " +
  46732. "overwritten whenever the provided component re-renders. " +
  46733. "injection being mutated: \"" + key + "\"",
  46734. vm
  46735. );
  46736. });
  46737. }
  46738. });
  46739. toggleObserving(true);
  46740. }
  46741. }
  46742. function resolveInject (inject, vm) {
  46743. if (inject) {
  46744. // inject is :any because flow is not smart enough to figure out cached
  46745. var result = Object.create(null);
  46746. var keys = hasSymbol
  46747. ? Reflect.ownKeys(inject)
  46748. : Object.keys(inject);
  46749. for (var i = 0; i < keys.length; i++) {
  46750. var key = keys[i];
  46751. // #6574 in case the inject object is observed...
  46752. if (key === '__ob__') { continue }
  46753. var provideKey = inject[key].from;
  46754. var source = vm;
  46755. while (source) {
  46756. if (source._provided && hasOwn(source._provided, provideKey)) {
  46757. result[key] = source._provided[provideKey];
  46758. break
  46759. }
  46760. source = source.$parent;
  46761. }
  46762. if (!source) {
  46763. if ('default' in inject[key]) {
  46764. var provideDefault = inject[key].default;
  46765. result[key] = typeof provideDefault === 'function'
  46766. ? provideDefault.call(vm)
  46767. : provideDefault;
  46768. } else {
  46769. warn(("Injection \"" + key + "\" not found"), vm);
  46770. }
  46771. }
  46772. }
  46773. return result
  46774. }
  46775. }
  46776. /* */
  46777. /**
  46778. * Runtime helper for resolving raw children VNodes into a slot object.
  46779. */
  46780. function resolveSlots (
  46781. children,
  46782. context
  46783. ) {
  46784. if (!children || !children.length) {
  46785. return {}
  46786. }
  46787. var slots = {};
  46788. for (var i = 0, l = children.length; i < l; i++) {
  46789. var child = children[i];
  46790. var data = child.data;
  46791. // remove slot attribute if the node is resolved as a Vue slot node
  46792. if (data && data.attrs && data.attrs.slot) {
  46793. delete data.attrs.slot;
  46794. }
  46795. // named slots should only be respected if the vnode was rendered in the
  46796. // same context.
  46797. if ((child.context === context || child.fnContext === context) &&
  46798. data && data.slot != null
  46799. ) {
  46800. var name = data.slot;
  46801. var slot = (slots[name] || (slots[name] = []));
  46802. if (child.tag === 'template') {
  46803. slot.push.apply(slot, child.children || []);
  46804. } else {
  46805. slot.push(child);
  46806. }
  46807. } else {
  46808. (slots.default || (slots.default = [])).push(child);
  46809. }
  46810. }
  46811. // ignore slots that contains only whitespace
  46812. for (var name$1 in slots) {
  46813. if (slots[name$1].every(isWhitespace)) {
  46814. delete slots[name$1];
  46815. }
  46816. }
  46817. return slots
  46818. }
  46819. function isWhitespace (node) {
  46820. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46821. }
  46822. /* */
  46823. function normalizeScopedSlots (
  46824. slots,
  46825. normalSlots,
  46826. prevSlots
  46827. ) {
  46828. var res;
  46829. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46830. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46831. var key = slots && slots.$key;
  46832. if (!slots) {
  46833. res = {};
  46834. } else if (slots._normalized) {
  46835. // fast path 1: child component re-render only, parent did not change
  46836. return slots._normalized
  46837. } else if (
  46838. isStable &&
  46839. prevSlots &&
  46840. prevSlots !== emptyObject &&
  46841. key === prevSlots.$key &&
  46842. !hasNormalSlots &&
  46843. !prevSlots.$hasNormal
  46844. ) {
  46845. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46846. // only need to normalize once
  46847. return prevSlots
  46848. } else {
  46849. res = {};
  46850. for (var key$1 in slots) {
  46851. if (slots[key$1] && key$1[0] !== '$') {
  46852. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46853. }
  46854. }
  46855. }
  46856. // expose normal slots on scopedSlots
  46857. for (var key$2 in normalSlots) {
  46858. if (!(key$2 in res)) {
  46859. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46860. }
  46861. }
  46862. // avoriaz seems to mock a non-extensible $scopedSlots object
  46863. // and when that is passed down this would cause an error
  46864. if (slots && Object.isExtensible(slots)) {
  46865. (slots)._normalized = res;
  46866. }
  46867. def(res, '$stable', isStable);
  46868. def(res, '$key', key);
  46869. def(res, '$hasNormal', hasNormalSlots);
  46870. return res
  46871. }
  46872. function normalizeScopedSlot(normalSlots, key, fn) {
  46873. var normalized = function () {
  46874. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46875. res = res && typeof res === 'object' && !Array.isArray(res)
  46876. ? [res] // single vnode
  46877. : normalizeChildren(res);
  46878. return res && (
  46879. res.length === 0 ||
  46880. (res.length === 1 && res[0].isComment) // #9658
  46881. ) ? undefined
  46882. : res
  46883. };
  46884. // this is a slot using the new v-slot syntax without scope. although it is
  46885. // compiled as a scoped slot, render fn users would expect it to be present
  46886. // on this.$slots because the usage is semantically a normal slot.
  46887. if (fn.proxy) {
  46888. Object.defineProperty(normalSlots, key, {
  46889. get: normalized,
  46890. enumerable: true,
  46891. configurable: true
  46892. });
  46893. }
  46894. return normalized
  46895. }
  46896. function proxyNormalSlot(slots, key) {
  46897. return function () { return slots[key]; }
  46898. }
  46899. /* */
  46900. /**
  46901. * Runtime helper for rendering v-for lists.
  46902. */
  46903. function renderList (
  46904. val,
  46905. render
  46906. ) {
  46907. var ret, i, l, keys, key;
  46908. if (Array.isArray(val) || typeof val === 'string') {
  46909. ret = new Array(val.length);
  46910. for (i = 0, l = val.length; i < l; i++) {
  46911. ret[i] = render(val[i], i);
  46912. }
  46913. } else if (typeof val === 'number') {
  46914. ret = new Array(val);
  46915. for (i = 0; i < val; i++) {
  46916. ret[i] = render(i + 1, i);
  46917. }
  46918. } else if (isObject(val)) {
  46919. if (hasSymbol && val[Symbol.iterator]) {
  46920. ret = [];
  46921. var iterator = val[Symbol.iterator]();
  46922. var result = iterator.next();
  46923. while (!result.done) {
  46924. ret.push(render(result.value, ret.length));
  46925. result = iterator.next();
  46926. }
  46927. } else {
  46928. keys = Object.keys(val);
  46929. ret = new Array(keys.length);
  46930. for (i = 0, l = keys.length; i < l; i++) {
  46931. key = keys[i];
  46932. ret[i] = render(val[key], key, i);
  46933. }
  46934. }
  46935. }
  46936. if (!isDef(ret)) {
  46937. ret = [];
  46938. }
  46939. (ret)._isVList = true;
  46940. return ret
  46941. }
  46942. /* */
  46943. /**
  46944. * Runtime helper for rendering <slot>
  46945. */
  46946. function renderSlot (
  46947. name,
  46948. fallback,
  46949. props,
  46950. bindObject
  46951. ) {
  46952. var scopedSlotFn = this.$scopedSlots[name];
  46953. var nodes;
  46954. if (scopedSlotFn) { // scoped slot
  46955. props = props || {};
  46956. if (bindObject) {
  46957. if (!isObject(bindObject)) {
  46958. warn(
  46959. 'slot v-bind without argument expects an Object',
  46960. this
  46961. );
  46962. }
  46963. props = extend(extend({}, bindObject), props);
  46964. }
  46965. nodes = scopedSlotFn(props) || fallback;
  46966. } else {
  46967. nodes = this.$slots[name] || fallback;
  46968. }
  46969. var target = props && props.slot;
  46970. if (target) {
  46971. return this.$createElement('template', { slot: target }, nodes)
  46972. } else {
  46973. return nodes
  46974. }
  46975. }
  46976. /* */
  46977. /**
  46978. * Runtime helper for resolving filters
  46979. */
  46980. function resolveFilter (id) {
  46981. return resolveAsset(this.$options, 'filters', id, true) || identity
  46982. }
  46983. /* */
  46984. function isKeyNotMatch (expect, actual) {
  46985. if (Array.isArray(expect)) {
  46986. return expect.indexOf(actual) === -1
  46987. } else {
  46988. return expect !== actual
  46989. }
  46990. }
  46991. /**
  46992. * Runtime helper for checking keyCodes from config.
  46993. * exposed as Vue.prototype._k
  46994. * passing in eventKeyName as last argument separately for backwards compat
  46995. */
  46996. function checkKeyCodes (
  46997. eventKeyCode,
  46998. key,
  46999. builtInKeyCode,
  47000. eventKeyName,
  47001. builtInKeyName
  47002. ) {
  47003. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47004. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47005. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47006. } else if (mappedKeyCode) {
  47007. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47008. } else if (eventKeyName) {
  47009. return hyphenate(eventKeyName) !== key
  47010. }
  47011. }
  47012. /* */
  47013. /**
  47014. * Runtime helper for merging v-bind="object" into a VNode's data.
  47015. */
  47016. function bindObjectProps (
  47017. data,
  47018. tag,
  47019. value,
  47020. asProp,
  47021. isSync
  47022. ) {
  47023. if (value) {
  47024. if (!isObject(value)) {
  47025. warn(
  47026. 'v-bind without argument expects an Object or Array value',
  47027. this
  47028. );
  47029. } else {
  47030. if (Array.isArray(value)) {
  47031. value = toObject(value);
  47032. }
  47033. var hash;
  47034. var loop = function ( key ) {
  47035. if (
  47036. key === 'class' ||
  47037. key === 'style' ||
  47038. isReservedAttribute(key)
  47039. ) {
  47040. hash = data;
  47041. } else {
  47042. var type = data.attrs && data.attrs.type;
  47043. hash = asProp || config.mustUseProp(tag, type, key)
  47044. ? data.domProps || (data.domProps = {})
  47045. : data.attrs || (data.attrs = {});
  47046. }
  47047. var camelizedKey = camelize(key);
  47048. var hyphenatedKey = hyphenate(key);
  47049. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47050. hash[key] = value[key];
  47051. if (isSync) {
  47052. var on = data.on || (data.on = {});
  47053. on[("update:" + key)] = function ($event) {
  47054. value[key] = $event;
  47055. };
  47056. }
  47057. }
  47058. };
  47059. for (var key in value) loop( key );
  47060. }
  47061. }
  47062. return data
  47063. }
  47064. /* */
  47065. /**
  47066. * Runtime helper for rendering static trees.
  47067. */
  47068. function renderStatic (
  47069. index,
  47070. isInFor
  47071. ) {
  47072. var cached = this._staticTrees || (this._staticTrees = []);
  47073. var tree = cached[index];
  47074. // if has already-rendered static tree and not inside v-for,
  47075. // we can reuse the same tree.
  47076. if (tree && !isInFor) {
  47077. return tree
  47078. }
  47079. // otherwise, render a fresh tree.
  47080. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47081. this._renderProxy,
  47082. null,
  47083. this // for render fns generated for functional component templates
  47084. );
  47085. markStatic(tree, ("__static__" + index), false);
  47086. return tree
  47087. }
  47088. /**
  47089. * Runtime helper for v-once.
  47090. * Effectively it means marking the node as static with a unique key.
  47091. */
  47092. function markOnce (
  47093. tree,
  47094. index,
  47095. key
  47096. ) {
  47097. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47098. return tree
  47099. }
  47100. function markStatic (
  47101. tree,
  47102. key,
  47103. isOnce
  47104. ) {
  47105. if (Array.isArray(tree)) {
  47106. for (var i = 0; i < tree.length; i++) {
  47107. if (tree[i] && typeof tree[i] !== 'string') {
  47108. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47109. }
  47110. }
  47111. } else {
  47112. markStaticNode(tree, key, isOnce);
  47113. }
  47114. }
  47115. function markStaticNode (node, key, isOnce) {
  47116. node.isStatic = true;
  47117. node.key = key;
  47118. node.isOnce = isOnce;
  47119. }
  47120. /* */
  47121. function bindObjectListeners (data, value) {
  47122. if (value) {
  47123. if (!isPlainObject(value)) {
  47124. warn(
  47125. 'v-on without argument expects an Object value',
  47126. this
  47127. );
  47128. } else {
  47129. var on = data.on = data.on ? extend({}, data.on) : {};
  47130. for (var key in value) {
  47131. var existing = on[key];
  47132. var ours = value[key];
  47133. on[key] = existing ? [].concat(existing, ours) : ours;
  47134. }
  47135. }
  47136. }
  47137. return data
  47138. }
  47139. /* */
  47140. function resolveScopedSlots (
  47141. fns, // see flow/vnode
  47142. res,
  47143. // the following are added in 2.6
  47144. hasDynamicKeys,
  47145. contentHashKey
  47146. ) {
  47147. res = res || { $stable: !hasDynamicKeys };
  47148. for (var i = 0; i < fns.length; i++) {
  47149. var slot = fns[i];
  47150. if (Array.isArray(slot)) {
  47151. resolveScopedSlots(slot, res, hasDynamicKeys);
  47152. } else if (slot) {
  47153. // marker for reverse proxying v-slot without scope on this.$slots
  47154. if (slot.proxy) {
  47155. slot.fn.proxy = true;
  47156. }
  47157. res[slot.key] = slot.fn;
  47158. }
  47159. }
  47160. if (contentHashKey) {
  47161. (res).$key = contentHashKey;
  47162. }
  47163. return res
  47164. }
  47165. /* */
  47166. function bindDynamicKeys (baseObj, values) {
  47167. for (var i = 0; i < values.length; i += 2) {
  47168. var key = values[i];
  47169. if (typeof key === 'string' && key) {
  47170. baseObj[values[i]] = values[i + 1];
  47171. } else if (key !== '' && key !== null) {
  47172. // null is a special value for explicitly removing a binding
  47173. warn(
  47174. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47175. this
  47176. );
  47177. }
  47178. }
  47179. return baseObj
  47180. }
  47181. // helper to dynamically append modifier runtime markers to event names.
  47182. // ensure only append when value is already string, otherwise it will be cast
  47183. // to string and cause the type check to miss.
  47184. function prependModifier (value, symbol) {
  47185. return typeof value === 'string' ? symbol + value : value
  47186. }
  47187. /* */
  47188. function installRenderHelpers (target) {
  47189. target._o = markOnce;
  47190. target._n = toNumber;
  47191. target._s = toString;
  47192. target._l = renderList;
  47193. target._t = renderSlot;
  47194. target._q = looseEqual;
  47195. target._i = looseIndexOf;
  47196. target._m = renderStatic;
  47197. target._f = resolveFilter;
  47198. target._k = checkKeyCodes;
  47199. target._b = bindObjectProps;
  47200. target._v = createTextVNode;
  47201. target._e = createEmptyVNode;
  47202. target._u = resolveScopedSlots;
  47203. target._g = bindObjectListeners;
  47204. target._d = bindDynamicKeys;
  47205. target._p = prependModifier;
  47206. }
  47207. /* */
  47208. function FunctionalRenderContext (
  47209. data,
  47210. props,
  47211. children,
  47212. parent,
  47213. Ctor
  47214. ) {
  47215. var this$1 = this;
  47216. var options = Ctor.options;
  47217. // ensure the createElement function in functional components
  47218. // gets a unique context - this is necessary for correct named slot check
  47219. var contextVm;
  47220. if (hasOwn(parent, '_uid')) {
  47221. contextVm = Object.create(parent);
  47222. // $flow-disable-line
  47223. contextVm._original = parent;
  47224. } else {
  47225. // the context vm passed in is a functional context as well.
  47226. // in this case we want to make sure we are able to get a hold to the
  47227. // real context instance.
  47228. contextVm = parent;
  47229. // $flow-disable-line
  47230. parent = parent._original;
  47231. }
  47232. var isCompiled = isTrue(options._compiled);
  47233. var needNormalization = !isCompiled;
  47234. this.data = data;
  47235. this.props = props;
  47236. this.children = children;
  47237. this.parent = parent;
  47238. this.listeners = data.on || emptyObject;
  47239. this.injections = resolveInject(options.inject, parent);
  47240. this.slots = function () {
  47241. if (!this$1.$slots) {
  47242. normalizeScopedSlots(
  47243. data.scopedSlots,
  47244. this$1.$slots = resolveSlots(children, parent)
  47245. );
  47246. }
  47247. return this$1.$slots
  47248. };
  47249. Object.defineProperty(this, 'scopedSlots', ({
  47250. enumerable: true,
  47251. get: function get () {
  47252. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47253. }
  47254. }));
  47255. // support for compiled functional template
  47256. if (isCompiled) {
  47257. // exposing $options for renderStatic()
  47258. this.$options = options;
  47259. // pre-resolve slots for renderSlot()
  47260. this.$slots = this.slots();
  47261. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47262. }
  47263. if (options._scopeId) {
  47264. this._c = function (a, b, c, d) {
  47265. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47266. if (vnode && !Array.isArray(vnode)) {
  47267. vnode.fnScopeId = options._scopeId;
  47268. vnode.fnContext = parent;
  47269. }
  47270. return vnode
  47271. };
  47272. } else {
  47273. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47274. }
  47275. }
  47276. installRenderHelpers(FunctionalRenderContext.prototype);
  47277. function createFunctionalComponent (
  47278. Ctor,
  47279. propsData,
  47280. data,
  47281. contextVm,
  47282. children
  47283. ) {
  47284. var options = Ctor.options;
  47285. var props = {};
  47286. var propOptions = options.props;
  47287. if (isDef(propOptions)) {
  47288. for (var key in propOptions) {
  47289. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47290. }
  47291. } else {
  47292. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47293. if (isDef(data.props)) { mergeProps(props, data.props); }
  47294. }
  47295. var renderContext = new FunctionalRenderContext(
  47296. data,
  47297. props,
  47298. children,
  47299. contextVm,
  47300. Ctor
  47301. );
  47302. var vnode = options.render.call(null, renderContext._c, renderContext);
  47303. if (vnode instanceof VNode) {
  47304. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47305. } else if (Array.isArray(vnode)) {
  47306. var vnodes = normalizeChildren(vnode) || [];
  47307. var res = new Array(vnodes.length);
  47308. for (var i = 0; i < vnodes.length; i++) {
  47309. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47310. }
  47311. return res
  47312. }
  47313. }
  47314. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47315. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47316. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47317. // that should not be matched to match.
  47318. var clone = cloneVNode(vnode);
  47319. clone.fnContext = contextVm;
  47320. clone.fnOptions = options;
  47321. {
  47322. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47323. }
  47324. if (data.slot) {
  47325. (clone.data || (clone.data = {})).slot = data.slot;
  47326. }
  47327. return clone
  47328. }
  47329. function mergeProps (to, from) {
  47330. for (var key in from) {
  47331. to[camelize(key)] = from[key];
  47332. }
  47333. }
  47334. /* */
  47335. /* */
  47336. /* */
  47337. /* */
  47338. // inline hooks to be invoked on component VNodes during patch
  47339. var componentVNodeHooks = {
  47340. init: function init (vnode, hydrating) {
  47341. if (
  47342. vnode.componentInstance &&
  47343. !vnode.componentInstance._isDestroyed &&
  47344. vnode.data.keepAlive
  47345. ) {
  47346. // kept-alive components, treat as a patch
  47347. var mountedNode = vnode; // work around flow
  47348. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47349. } else {
  47350. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47351. vnode,
  47352. activeInstance
  47353. );
  47354. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47355. }
  47356. },
  47357. prepatch: function prepatch (oldVnode, vnode) {
  47358. var options = vnode.componentOptions;
  47359. var child = vnode.componentInstance = oldVnode.componentInstance;
  47360. updateChildComponent(
  47361. child,
  47362. options.propsData, // updated props
  47363. options.listeners, // updated listeners
  47364. vnode, // new parent vnode
  47365. options.children // new children
  47366. );
  47367. },
  47368. insert: function insert (vnode) {
  47369. var context = vnode.context;
  47370. var componentInstance = vnode.componentInstance;
  47371. if (!componentInstance._isMounted) {
  47372. componentInstance._isMounted = true;
  47373. callHook(componentInstance, 'mounted');
  47374. }
  47375. if (vnode.data.keepAlive) {
  47376. if (context._isMounted) {
  47377. // vue-router#1212
  47378. // During updates, a kept-alive component's child components may
  47379. // change, so directly walking the tree here may call activated hooks
  47380. // on incorrect children. Instead we push them into a queue which will
  47381. // be processed after the whole patch process ended.
  47382. queueActivatedComponent(componentInstance);
  47383. } else {
  47384. activateChildComponent(componentInstance, true /* direct */);
  47385. }
  47386. }
  47387. },
  47388. destroy: function destroy (vnode) {
  47389. var componentInstance = vnode.componentInstance;
  47390. if (!componentInstance._isDestroyed) {
  47391. if (!vnode.data.keepAlive) {
  47392. componentInstance.$destroy();
  47393. } else {
  47394. deactivateChildComponent(componentInstance, true /* direct */);
  47395. }
  47396. }
  47397. }
  47398. };
  47399. var hooksToMerge = Object.keys(componentVNodeHooks);
  47400. function createComponent (
  47401. Ctor,
  47402. data,
  47403. context,
  47404. children,
  47405. tag
  47406. ) {
  47407. if (isUndef(Ctor)) {
  47408. return
  47409. }
  47410. var baseCtor = context.$options._base;
  47411. // plain options object: turn it into a constructor
  47412. if (isObject(Ctor)) {
  47413. Ctor = baseCtor.extend(Ctor);
  47414. }
  47415. // if at this stage it's not a constructor or an async component factory,
  47416. // reject.
  47417. if (typeof Ctor !== 'function') {
  47418. {
  47419. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47420. }
  47421. return
  47422. }
  47423. // async component
  47424. var asyncFactory;
  47425. if (isUndef(Ctor.cid)) {
  47426. asyncFactory = Ctor;
  47427. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47428. if (Ctor === undefined) {
  47429. // return a placeholder node for async component, which is rendered
  47430. // as a comment node but preserves all the raw information for the node.
  47431. // the information will be used for async server-rendering and hydration.
  47432. return createAsyncPlaceholder(
  47433. asyncFactory,
  47434. data,
  47435. context,
  47436. children,
  47437. tag
  47438. )
  47439. }
  47440. }
  47441. data = data || {};
  47442. // resolve constructor options in case global mixins are applied after
  47443. // component constructor creation
  47444. resolveConstructorOptions(Ctor);
  47445. // transform component v-model data into props & events
  47446. if (isDef(data.model)) {
  47447. transformModel(Ctor.options, data);
  47448. }
  47449. // extract props
  47450. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47451. // functional component
  47452. if (isTrue(Ctor.options.functional)) {
  47453. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47454. }
  47455. // extract listeners, since these needs to be treated as
  47456. // child component listeners instead of DOM listeners
  47457. var listeners = data.on;
  47458. // replace with listeners with .native modifier
  47459. // so it gets processed during parent component patch.
  47460. data.on = data.nativeOn;
  47461. if (isTrue(Ctor.options.abstract)) {
  47462. // abstract components do not keep anything
  47463. // other than props & listeners & slot
  47464. // work around flow
  47465. var slot = data.slot;
  47466. data = {};
  47467. if (slot) {
  47468. data.slot = slot;
  47469. }
  47470. }
  47471. // install component management hooks onto the placeholder node
  47472. installComponentHooks(data);
  47473. // return a placeholder vnode
  47474. var name = Ctor.options.name || tag;
  47475. var vnode = new VNode(
  47476. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47477. data, undefined, undefined, undefined, context,
  47478. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47479. asyncFactory
  47480. );
  47481. return vnode
  47482. }
  47483. function createComponentInstanceForVnode (
  47484. vnode, // we know it's MountedComponentVNode but flow doesn't
  47485. parent // activeInstance in lifecycle state
  47486. ) {
  47487. var options = {
  47488. _isComponent: true,
  47489. _parentVnode: vnode,
  47490. parent: parent
  47491. };
  47492. // check inline-template render functions
  47493. var inlineTemplate = vnode.data.inlineTemplate;
  47494. if (isDef(inlineTemplate)) {
  47495. options.render = inlineTemplate.render;
  47496. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47497. }
  47498. return new vnode.componentOptions.Ctor(options)
  47499. }
  47500. function installComponentHooks (data) {
  47501. var hooks = data.hook || (data.hook = {});
  47502. for (var i = 0; i < hooksToMerge.length; i++) {
  47503. var key = hooksToMerge[i];
  47504. var existing = hooks[key];
  47505. var toMerge = componentVNodeHooks[key];
  47506. if (existing !== toMerge && !(existing && existing._merged)) {
  47507. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47508. }
  47509. }
  47510. }
  47511. function mergeHook$1 (f1, f2) {
  47512. var merged = function (a, b) {
  47513. // flow complains about extra args which is why we use any
  47514. f1(a, b);
  47515. f2(a, b);
  47516. };
  47517. merged._merged = true;
  47518. return merged
  47519. }
  47520. // transform component v-model info (value and callback) into
  47521. // prop and event handler respectively.
  47522. function transformModel (options, data) {
  47523. var prop = (options.model && options.model.prop) || 'value';
  47524. var event = (options.model && options.model.event) || 'input'
  47525. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47526. var on = data.on || (data.on = {});
  47527. var existing = on[event];
  47528. var callback = data.model.callback;
  47529. if (isDef(existing)) {
  47530. if (
  47531. Array.isArray(existing)
  47532. ? existing.indexOf(callback) === -1
  47533. : existing !== callback
  47534. ) {
  47535. on[event] = [callback].concat(existing);
  47536. }
  47537. } else {
  47538. on[event] = callback;
  47539. }
  47540. }
  47541. /* */
  47542. var SIMPLE_NORMALIZE = 1;
  47543. var ALWAYS_NORMALIZE = 2;
  47544. // wrapper function for providing a more flexible interface
  47545. // without getting yelled at by flow
  47546. function createElement (
  47547. context,
  47548. tag,
  47549. data,
  47550. children,
  47551. normalizationType,
  47552. alwaysNormalize
  47553. ) {
  47554. if (Array.isArray(data) || isPrimitive(data)) {
  47555. normalizationType = children;
  47556. children = data;
  47557. data = undefined;
  47558. }
  47559. if (isTrue(alwaysNormalize)) {
  47560. normalizationType = ALWAYS_NORMALIZE;
  47561. }
  47562. return _createElement(context, tag, data, children, normalizationType)
  47563. }
  47564. function _createElement (
  47565. context,
  47566. tag,
  47567. data,
  47568. children,
  47569. normalizationType
  47570. ) {
  47571. if (isDef(data) && isDef((data).__ob__)) {
  47572. warn(
  47573. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47574. 'Always create fresh vnode data objects in each render!',
  47575. context
  47576. );
  47577. return createEmptyVNode()
  47578. }
  47579. // object syntax in v-bind
  47580. if (isDef(data) && isDef(data.is)) {
  47581. tag = data.is;
  47582. }
  47583. if (!tag) {
  47584. // in case of component :is set to falsy value
  47585. return createEmptyVNode()
  47586. }
  47587. // warn against non-primitive key
  47588. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47589. ) {
  47590. {
  47591. warn(
  47592. 'Avoid using non-primitive value as key, ' +
  47593. 'use string/number value instead.',
  47594. context
  47595. );
  47596. }
  47597. }
  47598. // support single function children as default scoped slot
  47599. if (Array.isArray(children) &&
  47600. typeof children[0] === 'function'
  47601. ) {
  47602. data = data || {};
  47603. data.scopedSlots = { default: children[0] };
  47604. children.length = 0;
  47605. }
  47606. if (normalizationType === ALWAYS_NORMALIZE) {
  47607. children = normalizeChildren(children);
  47608. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47609. children = simpleNormalizeChildren(children);
  47610. }
  47611. var vnode, ns;
  47612. if (typeof tag === 'string') {
  47613. var Ctor;
  47614. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47615. if (config.isReservedTag(tag)) {
  47616. // platform built-in elements
  47617. if (isDef(data) && isDef(data.nativeOn)) {
  47618. warn(
  47619. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47620. context
  47621. );
  47622. }
  47623. vnode = new VNode(
  47624. config.parsePlatformTagName(tag), data, children,
  47625. undefined, undefined, context
  47626. );
  47627. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47628. // component
  47629. vnode = createComponent(Ctor, data, context, children, tag);
  47630. } else {
  47631. // unknown or unlisted namespaced elements
  47632. // check at runtime because it may get assigned a namespace when its
  47633. // parent normalizes children
  47634. vnode = new VNode(
  47635. tag, data, children,
  47636. undefined, undefined, context
  47637. );
  47638. }
  47639. } else {
  47640. // direct component options / constructor
  47641. vnode = createComponent(tag, data, context, children);
  47642. }
  47643. if (Array.isArray(vnode)) {
  47644. return vnode
  47645. } else if (isDef(vnode)) {
  47646. if (isDef(ns)) { applyNS(vnode, ns); }
  47647. if (isDef(data)) { registerDeepBindings(data); }
  47648. return vnode
  47649. } else {
  47650. return createEmptyVNode()
  47651. }
  47652. }
  47653. function applyNS (vnode, ns, force) {
  47654. vnode.ns = ns;
  47655. if (vnode.tag === 'foreignObject') {
  47656. // use default namespace inside foreignObject
  47657. ns = undefined;
  47658. force = true;
  47659. }
  47660. if (isDef(vnode.children)) {
  47661. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47662. var child = vnode.children[i];
  47663. if (isDef(child.tag) && (
  47664. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47665. applyNS(child, ns, force);
  47666. }
  47667. }
  47668. }
  47669. }
  47670. // ref #5318
  47671. // necessary to ensure parent re-render when deep bindings like :style and
  47672. // :class are used on slot nodes
  47673. function registerDeepBindings (data) {
  47674. if (isObject(data.style)) {
  47675. traverse(data.style);
  47676. }
  47677. if (isObject(data.class)) {
  47678. traverse(data.class);
  47679. }
  47680. }
  47681. /* */
  47682. function initRender (vm) {
  47683. vm._vnode = null; // the root of the child tree
  47684. vm._staticTrees = null; // v-once cached trees
  47685. var options = vm.$options;
  47686. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47687. var renderContext = parentVnode && parentVnode.context;
  47688. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47689. vm.$scopedSlots = emptyObject;
  47690. // bind the createElement fn to this instance
  47691. // so that we get proper render context inside it.
  47692. // args order: tag, data, children, normalizationType, alwaysNormalize
  47693. // internal version is used by render functions compiled from templates
  47694. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47695. // normalization is always applied for the public version, used in
  47696. // user-written render functions.
  47697. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47698. // $attrs & $listeners are exposed for easier HOC creation.
  47699. // they need to be reactive so that HOCs using them are always updated
  47700. var parentData = parentVnode && parentVnode.data;
  47701. /* istanbul ignore else */
  47702. {
  47703. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47704. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47705. }, true);
  47706. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47707. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47708. }, true);
  47709. }
  47710. }
  47711. var currentRenderingInstance = null;
  47712. function renderMixin (Vue) {
  47713. // install runtime convenience helpers
  47714. installRenderHelpers(Vue.prototype);
  47715. Vue.prototype.$nextTick = function (fn) {
  47716. return nextTick(fn, this)
  47717. };
  47718. Vue.prototype._render = function () {
  47719. var vm = this;
  47720. var ref = vm.$options;
  47721. var render = ref.render;
  47722. var _parentVnode = ref._parentVnode;
  47723. if (_parentVnode) {
  47724. vm.$scopedSlots = normalizeScopedSlots(
  47725. _parentVnode.data.scopedSlots,
  47726. vm.$slots,
  47727. vm.$scopedSlots
  47728. );
  47729. }
  47730. // set parent vnode. this allows render functions to have access
  47731. // to the data on the placeholder node.
  47732. vm.$vnode = _parentVnode;
  47733. // render self
  47734. var vnode;
  47735. try {
  47736. // There's no need to maintain a stack because all render fns are called
  47737. // separately from one another. Nested component's render fns are called
  47738. // when parent component is patched.
  47739. currentRenderingInstance = vm;
  47740. vnode = render.call(vm._renderProxy, vm.$createElement);
  47741. } catch (e) {
  47742. handleError(e, vm, "render");
  47743. // return error render result,
  47744. // or previous vnode to prevent render error causing blank component
  47745. /* istanbul ignore else */
  47746. if (vm.$options.renderError) {
  47747. try {
  47748. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47749. } catch (e) {
  47750. handleError(e, vm, "renderError");
  47751. vnode = vm._vnode;
  47752. }
  47753. } else {
  47754. vnode = vm._vnode;
  47755. }
  47756. } finally {
  47757. currentRenderingInstance = null;
  47758. }
  47759. // if the returned array contains only a single node, allow it
  47760. if (Array.isArray(vnode) && vnode.length === 1) {
  47761. vnode = vnode[0];
  47762. }
  47763. // return empty vnode in case the render function errored out
  47764. if (!(vnode instanceof VNode)) {
  47765. if (Array.isArray(vnode)) {
  47766. warn(
  47767. 'Multiple root nodes returned from render function. Render function ' +
  47768. 'should return a single root node.',
  47769. vm
  47770. );
  47771. }
  47772. vnode = createEmptyVNode();
  47773. }
  47774. // set parent
  47775. vnode.parent = _parentVnode;
  47776. return vnode
  47777. };
  47778. }
  47779. /* */
  47780. function ensureCtor (comp, base) {
  47781. if (
  47782. comp.__esModule ||
  47783. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47784. ) {
  47785. comp = comp.default;
  47786. }
  47787. return isObject(comp)
  47788. ? base.extend(comp)
  47789. : comp
  47790. }
  47791. function createAsyncPlaceholder (
  47792. factory,
  47793. data,
  47794. context,
  47795. children,
  47796. tag
  47797. ) {
  47798. var node = createEmptyVNode();
  47799. node.asyncFactory = factory;
  47800. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47801. return node
  47802. }
  47803. function resolveAsyncComponent (
  47804. factory,
  47805. baseCtor
  47806. ) {
  47807. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47808. return factory.errorComp
  47809. }
  47810. if (isDef(factory.resolved)) {
  47811. return factory.resolved
  47812. }
  47813. var owner = currentRenderingInstance;
  47814. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47815. // already pending
  47816. factory.owners.push(owner);
  47817. }
  47818. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47819. return factory.loadingComp
  47820. }
  47821. if (owner && !isDef(factory.owners)) {
  47822. var owners = factory.owners = [owner];
  47823. var sync = true;
  47824. var timerLoading = null;
  47825. var timerTimeout = null
  47826. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47827. var forceRender = function (renderCompleted) {
  47828. for (var i = 0, l = owners.length; i < l; i++) {
  47829. (owners[i]).$forceUpdate();
  47830. }
  47831. if (renderCompleted) {
  47832. owners.length = 0;
  47833. if (timerLoading !== null) {
  47834. clearTimeout(timerLoading);
  47835. timerLoading = null;
  47836. }
  47837. if (timerTimeout !== null) {
  47838. clearTimeout(timerTimeout);
  47839. timerTimeout = null;
  47840. }
  47841. }
  47842. };
  47843. var resolve = once(function (res) {
  47844. // cache resolved
  47845. factory.resolved = ensureCtor(res, baseCtor);
  47846. // invoke callbacks only if this is not a synchronous resolve
  47847. // (async resolves are shimmed as synchronous during SSR)
  47848. if (!sync) {
  47849. forceRender(true);
  47850. } else {
  47851. owners.length = 0;
  47852. }
  47853. });
  47854. var reject = once(function (reason) {
  47855. warn(
  47856. "Failed to resolve async component: " + (String(factory)) +
  47857. (reason ? ("\nReason: " + reason) : '')
  47858. );
  47859. if (isDef(factory.errorComp)) {
  47860. factory.error = true;
  47861. forceRender(true);
  47862. }
  47863. });
  47864. var res = factory(resolve, reject);
  47865. if (isObject(res)) {
  47866. if (isPromise(res)) {
  47867. // () => Promise
  47868. if (isUndef(factory.resolved)) {
  47869. res.then(resolve, reject);
  47870. }
  47871. } else if (isPromise(res.component)) {
  47872. res.component.then(resolve, reject);
  47873. if (isDef(res.error)) {
  47874. factory.errorComp = ensureCtor(res.error, baseCtor);
  47875. }
  47876. if (isDef(res.loading)) {
  47877. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47878. if (res.delay === 0) {
  47879. factory.loading = true;
  47880. } else {
  47881. timerLoading = setTimeout(function () {
  47882. timerLoading = null;
  47883. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47884. factory.loading = true;
  47885. forceRender(false);
  47886. }
  47887. }, res.delay || 200);
  47888. }
  47889. }
  47890. if (isDef(res.timeout)) {
  47891. timerTimeout = setTimeout(function () {
  47892. timerTimeout = null;
  47893. if (isUndef(factory.resolved)) {
  47894. reject(
  47895. "timeout (" + (res.timeout) + "ms)"
  47896. );
  47897. }
  47898. }, res.timeout);
  47899. }
  47900. }
  47901. }
  47902. sync = false;
  47903. // return in case resolved synchronously
  47904. return factory.loading
  47905. ? factory.loadingComp
  47906. : factory.resolved
  47907. }
  47908. }
  47909. /* */
  47910. function isAsyncPlaceholder (node) {
  47911. return node.isComment && node.asyncFactory
  47912. }
  47913. /* */
  47914. function getFirstComponentChild (children) {
  47915. if (Array.isArray(children)) {
  47916. for (var i = 0; i < children.length; i++) {
  47917. var c = children[i];
  47918. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47919. return c
  47920. }
  47921. }
  47922. }
  47923. }
  47924. /* */
  47925. /* */
  47926. function initEvents (vm) {
  47927. vm._events = Object.create(null);
  47928. vm._hasHookEvent = false;
  47929. // init parent attached events
  47930. var listeners = vm.$options._parentListeners;
  47931. if (listeners) {
  47932. updateComponentListeners(vm, listeners);
  47933. }
  47934. }
  47935. var target;
  47936. function add (event, fn) {
  47937. target.$on(event, fn);
  47938. }
  47939. function remove$1 (event, fn) {
  47940. target.$off(event, fn);
  47941. }
  47942. function createOnceHandler (event, fn) {
  47943. var _target = target;
  47944. return function onceHandler () {
  47945. var res = fn.apply(null, arguments);
  47946. if (res !== null) {
  47947. _target.$off(event, onceHandler);
  47948. }
  47949. }
  47950. }
  47951. function updateComponentListeners (
  47952. vm,
  47953. listeners,
  47954. oldListeners
  47955. ) {
  47956. target = vm;
  47957. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47958. target = undefined;
  47959. }
  47960. function eventsMixin (Vue) {
  47961. var hookRE = /^hook:/;
  47962. Vue.prototype.$on = function (event, fn) {
  47963. var vm = this;
  47964. if (Array.isArray(event)) {
  47965. for (var i = 0, l = event.length; i < l; i++) {
  47966. vm.$on(event[i], fn);
  47967. }
  47968. } else {
  47969. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47970. // optimize hook:event cost by using a boolean flag marked at registration
  47971. // instead of a hash lookup
  47972. if (hookRE.test(event)) {
  47973. vm._hasHookEvent = true;
  47974. }
  47975. }
  47976. return vm
  47977. };
  47978. Vue.prototype.$once = function (event, fn) {
  47979. var vm = this;
  47980. function on () {
  47981. vm.$off(event, on);
  47982. fn.apply(vm, arguments);
  47983. }
  47984. on.fn = fn;
  47985. vm.$on(event, on);
  47986. return vm
  47987. };
  47988. Vue.prototype.$off = function (event, fn) {
  47989. var vm = this;
  47990. // all
  47991. if (!arguments.length) {
  47992. vm._events = Object.create(null);
  47993. return vm
  47994. }
  47995. // array of events
  47996. if (Array.isArray(event)) {
  47997. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47998. vm.$off(event[i$1], fn);
  47999. }
  48000. return vm
  48001. }
  48002. // specific event
  48003. var cbs = vm._events[event];
  48004. if (!cbs) {
  48005. return vm
  48006. }
  48007. if (!fn) {
  48008. vm._events[event] = null;
  48009. return vm
  48010. }
  48011. // specific handler
  48012. var cb;
  48013. var i = cbs.length;
  48014. while (i--) {
  48015. cb = cbs[i];
  48016. if (cb === fn || cb.fn === fn) {
  48017. cbs.splice(i, 1);
  48018. break
  48019. }
  48020. }
  48021. return vm
  48022. };
  48023. Vue.prototype.$emit = function (event) {
  48024. var vm = this;
  48025. {
  48026. var lowerCaseEvent = event.toLowerCase();
  48027. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48028. tip(
  48029. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48030. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48031. "Note that HTML attributes are case-insensitive and you cannot use " +
  48032. "v-on to listen to camelCase events when using in-DOM templates. " +
  48033. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48034. );
  48035. }
  48036. }
  48037. var cbs = vm._events[event];
  48038. if (cbs) {
  48039. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48040. var args = toArray(arguments, 1);
  48041. var info = "event handler for \"" + event + "\"";
  48042. for (var i = 0, l = cbs.length; i < l; i++) {
  48043. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48044. }
  48045. }
  48046. return vm
  48047. };
  48048. }
  48049. /* */
  48050. var activeInstance = null;
  48051. var isUpdatingChildComponent = false;
  48052. function setActiveInstance(vm) {
  48053. var prevActiveInstance = activeInstance;
  48054. activeInstance = vm;
  48055. return function () {
  48056. activeInstance = prevActiveInstance;
  48057. }
  48058. }
  48059. function initLifecycle (vm) {
  48060. var options = vm.$options;
  48061. // locate first non-abstract parent
  48062. var parent = options.parent;
  48063. if (parent && !options.abstract) {
  48064. while (parent.$options.abstract && parent.$parent) {
  48065. parent = parent.$parent;
  48066. }
  48067. parent.$children.push(vm);
  48068. }
  48069. vm.$parent = parent;
  48070. vm.$root = parent ? parent.$root : vm;
  48071. vm.$children = [];
  48072. vm.$refs = {};
  48073. vm._watcher = null;
  48074. vm._inactive = null;
  48075. vm._directInactive = false;
  48076. vm._isMounted = false;
  48077. vm._isDestroyed = false;
  48078. vm._isBeingDestroyed = false;
  48079. }
  48080. function lifecycleMixin (Vue) {
  48081. Vue.prototype._update = function (vnode, hydrating) {
  48082. var vm = this;
  48083. var prevEl = vm.$el;
  48084. var prevVnode = vm._vnode;
  48085. var restoreActiveInstance = setActiveInstance(vm);
  48086. vm._vnode = vnode;
  48087. // Vue.prototype.__patch__ is injected in entry points
  48088. // based on the rendering backend used.
  48089. if (!prevVnode) {
  48090. // initial render
  48091. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48092. } else {
  48093. // updates
  48094. vm.$el = vm.__patch__(prevVnode, vnode);
  48095. }
  48096. restoreActiveInstance();
  48097. // update __vue__ reference
  48098. if (prevEl) {
  48099. prevEl.__vue__ = null;
  48100. }
  48101. if (vm.$el) {
  48102. vm.$el.__vue__ = vm;
  48103. }
  48104. // if parent is an HOC, update its $el as well
  48105. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48106. vm.$parent.$el = vm.$el;
  48107. }
  48108. // updated hook is called by the scheduler to ensure that children are
  48109. // updated in a parent's updated hook.
  48110. };
  48111. Vue.prototype.$forceUpdate = function () {
  48112. var vm = this;
  48113. if (vm._watcher) {
  48114. vm._watcher.update();
  48115. }
  48116. };
  48117. Vue.prototype.$destroy = function () {
  48118. var vm = this;
  48119. if (vm._isBeingDestroyed) {
  48120. return
  48121. }
  48122. callHook(vm, 'beforeDestroy');
  48123. vm._isBeingDestroyed = true;
  48124. // remove self from parent
  48125. var parent = vm.$parent;
  48126. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48127. remove(parent.$children, vm);
  48128. }
  48129. // teardown watchers
  48130. if (vm._watcher) {
  48131. vm._watcher.teardown();
  48132. }
  48133. var i = vm._watchers.length;
  48134. while (i--) {
  48135. vm._watchers[i].teardown();
  48136. }
  48137. // remove reference from data ob
  48138. // frozen object may not have observer.
  48139. if (vm._data.__ob__) {
  48140. vm._data.__ob__.vmCount--;
  48141. }
  48142. // call the last hook...
  48143. vm._isDestroyed = true;
  48144. // invoke destroy hooks on current rendered tree
  48145. vm.__patch__(vm._vnode, null);
  48146. // fire destroyed hook
  48147. callHook(vm, 'destroyed');
  48148. // turn off all instance listeners.
  48149. vm.$off();
  48150. // remove __vue__ reference
  48151. if (vm.$el) {
  48152. vm.$el.__vue__ = null;
  48153. }
  48154. // release circular reference (#6759)
  48155. if (vm.$vnode) {
  48156. vm.$vnode.parent = null;
  48157. }
  48158. };
  48159. }
  48160. function mountComponent (
  48161. vm,
  48162. el,
  48163. hydrating
  48164. ) {
  48165. vm.$el = el;
  48166. if (!vm.$options.render) {
  48167. vm.$options.render = createEmptyVNode;
  48168. {
  48169. /* istanbul ignore if */
  48170. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48171. vm.$options.el || el) {
  48172. warn(
  48173. 'You are using the runtime-only build of Vue where the template ' +
  48174. 'compiler is not available. Either pre-compile the templates into ' +
  48175. 'render functions, or use the compiler-included build.',
  48176. vm
  48177. );
  48178. } else {
  48179. warn(
  48180. 'Failed to mount component: template or render function not defined.',
  48181. vm
  48182. );
  48183. }
  48184. }
  48185. }
  48186. callHook(vm, 'beforeMount');
  48187. var updateComponent;
  48188. /* istanbul ignore if */
  48189. if (config.performance && mark) {
  48190. updateComponent = function () {
  48191. var name = vm._name;
  48192. var id = vm._uid;
  48193. var startTag = "vue-perf-start:" + id;
  48194. var endTag = "vue-perf-end:" + id;
  48195. mark(startTag);
  48196. var vnode = vm._render();
  48197. mark(endTag);
  48198. measure(("vue " + name + " render"), startTag, endTag);
  48199. mark(startTag);
  48200. vm._update(vnode, hydrating);
  48201. mark(endTag);
  48202. measure(("vue " + name + " patch"), startTag, endTag);
  48203. };
  48204. } else {
  48205. updateComponent = function () {
  48206. vm._update(vm._render(), hydrating);
  48207. };
  48208. }
  48209. // we set this to vm._watcher inside the watcher's constructor
  48210. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48211. // component's mounted hook), which relies on vm._watcher being already defined
  48212. new Watcher(vm, updateComponent, noop, {
  48213. before: function before () {
  48214. if (vm._isMounted && !vm._isDestroyed) {
  48215. callHook(vm, 'beforeUpdate');
  48216. }
  48217. }
  48218. }, true /* isRenderWatcher */);
  48219. hydrating = false;
  48220. // manually mounted instance, call mounted on self
  48221. // mounted is called for render-created child components in its inserted hook
  48222. if (vm.$vnode == null) {
  48223. vm._isMounted = true;
  48224. callHook(vm, 'mounted');
  48225. }
  48226. return vm
  48227. }
  48228. function updateChildComponent (
  48229. vm,
  48230. propsData,
  48231. listeners,
  48232. parentVnode,
  48233. renderChildren
  48234. ) {
  48235. {
  48236. isUpdatingChildComponent = true;
  48237. }
  48238. // determine whether component has slot children
  48239. // we need to do this before overwriting $options._renderChildren.
  48240. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48241. // dynamic slot names). Static scoped slots compiled from template has the
  48242. // "$stable" marker.
  48243. var newScopedSlots = parentVnode.data.scopedSlots;
  48244. var oldScopedSlots = vm.$scopedSlots;
  48245. var hasDynamicScopedSlot = !!(
  48246. (newScopedSlots && !newScopedSlots.$stable) ||
  48247. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48248. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48249. );
  48250. // Any static slot children from the parent may have changed during parent's
  48251. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48252. // update is necessary to ensure correctness.
  48253. var needsForceUpdate = !!(
  48254. renderChildren || // has new static slots
  48255. vm.$options._renderChildren || // has old static slots
  48256. hasDynamicScopedSlot
  48257. );
  48258. vm.$options._parentVnode = parentVnode;
  48259. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48260. if (vm._vnode) { // update child tree's parent
  48261. vm._vnode.parent = parentVnode;
  48262. }
  48263. vm.$options._renderChildren = renderChildren;
  48264. // update $attrs and $listeners hash
  48265. // these are also reactive so they may trigger child update if the child
  48266. // used them during render
  48267. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48268. vm.$listeners = listeners || emptyObject;
  48269. // update props
  48270. if (propsData && vm.$options.props) {
  48271. toggleObserving(false);
  48272. var props = vm._props;
  48273. var propKeys = vm.$options._propKeys || [];
  48274. for (var i = 0; i < propKeys.length; i++) {
  48275. var key = propKeys[i];
  48276. var propOptions = vm.$options.props; // wtf flow?
  48277. props[key] = validateProp(key, propOptions, propsData, vm);
  48278. }
  48279. toggleObserving(true);
  48280. // keep a copy of raw propsData
  48281. vm.$options.propsData = propsData;
  48282. }
  48283. // update listeners
  48284. listeners = listeners || emptyObject;
  48285. var oldListeners = vm.$options._parentListeners;
  48286. vm.$options._parentListeners = listeners;
  48287. updateComponentListeners(vm, listeners, oldListeners);
  48288. // resolve slots + force update if has children
  48289. if (needsForceUpdate) {
  48290. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48291. vm.$forceUpdate();
  48292. }
  48293. {
  48294. isUpdatingChildComponent = false;
  48295. }
  48296. }
  48297. function isInInactiveTree (vm) {
  48298. while (vm && (vm = vm.$parent)) {
  48299. if (vm._inactive) { return true }
  48300. }
  48301. return false
  48302. }
  48303. function activateChildComponent (vm, direct) {
  48304. if (direct) {
  48305. vm._directInactive = false;
  48306. if (isInInactiveTree(vm)) {
  48307. return
  48308. }
  48309. } else if (vm._directInactive) {
  48310. return
  48311. }
  48312. if (vm._inactive || vm._inactive === null) {
  48313. vm._inactive = false;
  48314. for (var i = 0; i < vm.$children.length; i++) {
  48315. activateChildComponent(vm.$children[i]);
  48316. }
  48317. callHook(vm, 'activated');
  48318. }
  48319. }
  48320. function deactivateChildComponent (vm, direct) {
  48321. if (direct) {
  48322. vm._directInactive = true;
  48323. if (isInInactiveTree(vm)) {
  48324. return
  48325. }
  48326. }
  48327. if (!vm._inactive) {
  48328. vm._inactive = true;
  48329. for (var i = 0; i < vm.$children.length; i++) {
  48330. deactivateChildComponent(vm.$children[i]);
  48331. }
  48332. callHook(vm, 'deactivated');
  48333. }
  48334. }
  48335. function callHook (vm, hook) {
  48336. // #7573 disable dep collection when invoking lifecycle hooks
  48337. pushTarget();
  48338. var handlers = vm.$options[hook];
  48339. var info = hook + " hook";
  48340. if (handlers) {
  48341. for (var i = 0, j = handlers.length; i < j; i++) {
  48342. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48343. }
  48344. }
  48345. if (vm._hasHookEvent) {
  48346. vm.$emit('hook:' + hook);
  48347. }
  48348. popTarget();
  48349. }
  48350. /* */
  48351. var MAX_UPDATE_COUNT = 100;
  48352. var queue = [];
  48353. var activatedChildren = [];
  48354. var has = {};
  48355. var circular = {};
  48356. var waiting = false;
  48357. var flushing = false;
  48358. var index = 0;
  48359. /**
  48360. * Reset the scheduler's state.
  48361. */
  48362. function resetSchedulerState () {
  48363. index = queue.length = activatedChildren.length = 0;
  48364. has = {};
  48365. {
  48366. circular = {};
  48367. }
  48368. waiting = flushing = false;
  48369. }
  48370. // Async edge case #6566 requires saving the timestamp when event listeners are
  48371. // attached. However, calling performance.now() has a perf overhead especially
  48372. // if the page has thousands of event listeners. Instead, we take a timestamp
  48373. // every time the scheduler flushes and use that for all event listeners
  48374. // attached during that flush.
  48375. var currentFlushTimestamp = 0;
  48376. // Async edge case fix requires storing an event listener's attach timestamp.
  48377. var getNow = Date.now;
  48378. // Determine what event timestamp the browser is using. Annoyingly, the
  48379. // timestamp can either be hi-res (relative to page load) or low-res
  48380. // (relative to UNIX epoch), so in order to compare time we have to use the
  48381. // same timestamp type when saving the flush timestamp.
  48382. // All IE versions use low-res event timestamps, and have problematic clock
  48383. // implementations (#9632)
  48384. if (inBrowser && !isIE) {
  48385. var performance = window.performance;
  48386. if (
  48387. performance &&
  48388. typeof performance.now === 'function' &&
  48389. getNow() > document.createEvent('Event').timeStamp
  48390. ) {
  48391. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48392. // smaller than it, it means the event is using a hi-res timestamp,
  48393. // and we need to use the hi-res version for event listener timestamps as
  48394. // well.
  48395. getNow = function () { return performance.now(); };
  48396. }
  48397. }
  48398. /**
  48399. * Flush both queues and run the watchers.
  48400. */
  48401. function flushSchedulerQueue () {
  48402. currentFlushTimestamp = getNow();
  48403. flushing = true;
  48404. var watcher, id;
  48405. // Sort queue before flush.
  48406. // This ensures that:
  48407. // 1. Components are updated from parent to child. (because parent is always
  48408. // created before the child)
  48409. // 2. A component's user watchers are run before its render watcher (because
  48410. // user watchers are created before the render watcher)
  48411. // 3. If a component is destroyed during a parent component's watcher run,
  48412. // its watchers can be skipped.
  48413. queue.sort(function (a, b) { return a.id - b.id; });
  48414. // do not cache length because more watchers might be pushed
  48415. // as we run existing watchers
  48416. for (index = 0; index < queue.length; index++) {
  48417. watcher = queue[index];
  48418. if (watcher.before) {
  48419. watcher.before();
  48420. }
  48421. id = watcher.id;
  48422. has[id] = null;
  48423. watcher.run();
  48424. // in dev build, check and stop circular updates.
  48425. if (has[id] != null) {
  48426. circular[id] = (circular[id] || 0) + 1;
  48427. if (circular[id] > MAX_UPDATE_COUNT) {
  48428. warn(
  48429. 'You may have an infinite update loop ' + (
  48430. watcher.user
  48431. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48432. : "in a component render function."
  48433. ),
  48434. watcher.vm
  48435. );
  48436. break
  48437. }
  48438. }
  48439. }
  48440. // keep copies of post queues before resetting state
  48441. var activatedQueue = activatedChildren.slice();
  48442. var updatedQueue = queue.slice();
  48443. resetSchedulerState();
  48444. // call component updated and activated hooks
  48445. callActivatedHooks(activatedQueue);
  48446. callUpdatedHooks(updatedQueue);
  48447. // devtool hook
  48448. /* istanbul ignore if */
  48449. if (devtools && config.devtools) {
  48450. devtools.emit('flush');
  48451. }
  48452. }
  48453. function callUpdatedHooks (queue) {
  48454. var i = queue.length;
  48455. while (i--) {
  48456. var watcher = queue[i];
  48457. var vm = watcher.vm;
  48458. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48459. callHook(vm, 'updated');
  48460. }
  48461. }
  48462. }
  48463. /**
  48464. * Queue a kept-alive component that was activated during patch.
  48465. * The queue will be processed after the entire tree has been patched.
  48466. */
  48467. function queueActivatedComponent (vm) {
  48468. // setting _inactive to false here so that a render function can
  48469. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48470. vm._inactive = false;
  48471. activatedChildren.push(vm);
  48472. }
  48473. function callActivatedHooks (queue) {
  48474. for (var i = 0; i < queue.length; i++) {
  48475. queue[i]._inactive = true;
  48476. activateChildComponent(queue[i], true /* true */);
  48477. }
  48478. }
  48479. /**
  48480. * Push a watcher into the watcher queue.
  48481. * Jobs with duplicate IDs will be skipped unless it's
  48482. * pushed when the queue is being flushed.
  48483. */
  48484. function queueWatcher (watcher) {
  48485. var id = watcher.id;
  48486. if (has[id] == null) {
  48487. has[id] = true;
  48488. if (!flushing) {
  48489. queue.push(watcher);
  48490. } else {
  48491. // if already flushing, splice the watcher based on its id
  48492. // if already past its id, it will be run next immediately.
  48493. var i = queue.length - 1;
  48494. while (i > index && queue[i].id > watcher.id) {
  48495. i--;
  48496. }
  48497. queue.splice(i + 1, 0, watcher);
  48498. }
  48499. // queue the flush
  48500. if (!waiting) {
  48501. waiting = true;
  48502. if (!config.async) {
  48503. flushSchedulerQueue();
  48504. return
  48505. }
  48506. nextTick(flushSchedulerQueue);
  48507. }
  48508. }
  48509. }
  48510. /* */
  48511. var uid$2 = 0;
  48512. /**
  48513. * A watcher parses an expression, collects dependencies,
  48514. * and fires callback when the expression value changes.
  48515. * This is used for both the $watch() api and directives.
  48516. */
  48517. var Watcher = function Watcher (
  48518. vm,
  48519. expOrFn,
  48520. cb,
  48521. options,
  48522. isRenderWatcher
  48523. ) {
  48524. this.vm = vm;
  48525. if (isRenderWatcher) {
  48526. vm._watcher = this;
  48527. }
  48528. vm._watchers.push(this);
  48529. // options
  48530. if (options) {
  48531. this.deep = !!options.deep;
  48532. this.user = !!options.user;
  48533. this.lazy = !!options.lazy;
  48534. this.sync = !!options.sync;
  48535. this.before = options.before;
  48536. } else {
  48537. this.deep = this.user = this.lazy = this.sync = false;
  48538. }
  48539. this.cb = cb;
  48540. this.id = ++uid$2; // uid for batching
  48541. this.active = true;
  48542. this.dirty = this.lazy; // for lazy watchers
  48543. this.deps = [];
  48544. this.newDeps = [];
  48545. this.depIds = new _Set();
  48546. this.newDepIds = new _Set();
  48547. this.expression = expOrFn.toString();
  48548. // parse expression for getter
  48549. if (typeof expOrFn === 'function') {
  48550. this.getter = expOrFn;
  48551. } else {
  48552. this.getter = parsePath(expOrFn);
  48553. if (!this.getter) {
  48554. this.getter = noop;
  48555. warn(
  48556. "Failed watching path: \"" + expOrFn + "\" " +
  48557. 'Watcher only accepts simple dot-delimited paths. ' +
  48558. 'For full control, use a function instead.',
  48559. vm
  48560. );
  48561. }
  48562. }
  48563. this.value = this.lazy
  48564. ? undefined
  48565. : this.get();
  48566. };
  48567. /**
  48568. * Evaluate the getter, and re-collect dependencies.
  48569. */
  48570. Watcher.prototype.get = function get () {
  48571. pushTarget(this);
  48572. var value;
  48573. var vm = this.vm;
  48574. try {
  48575. value = this.getter.call(vm, vm);
  48576. } catch (e) {
  48577. if (this.user) {
  48578. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48579. } else {
  48580. throw e
  48581. }
  48582. } finally {
  48583. // "touch" every property so they are all tracked as
  48584. // dependencies for deep watching
  48585. if (this.deep) {
  48586. traverse(value);
  48587. }
  48588. popTarget();
  48589. this.cleanupDeps();
  48590. }
  48591. return value
  48592. };
  48593. /**
  48594. * Add a dependency to this directive.
  48595. */
  48596. Watcher.prototype.addDep = function addDep (dep) {
  48597. var id = dep.id;
  48598. if (!this.newDepIds.has(id)) {
  48599. this.newDepIds.add(id);
  48600. this.newDeps.push(dep);
  48601. if (!this.depIds.has(id)) {
  48602. dep.addSub(this);
  48603. }
  48604. }
  48605. };
  48606. /**
  48607. * Clean up for dependency collection.
  48608. */
  48609. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48610. var i = this.deps.length;
  48611. while (i--) {
  48612. var dep = this.deps[i];
  48613. if (!this.newDepIds.has(dep.id)) {
  48614. dep.removeSub(this);
  48615. }
  48616. }
  48617. var tmp = this.depIds;
  48618. this.depIds = this.newDepIds;
  48619. this.newDepIds = tmp;
  48620. this.newDepIds.clear();
  48621. tmp = this.deps;
  48622. this.deps = this.newDeps;
  48623. this.newDeps = tmp;
  48624. this.newDeps.length = 0;
  48625. };
  48626. /**
  48627. * Subscriber interface.
  48628. * Will be called when a dependency changes.
  48629. */
  48630. Watcher.prototype.update = function update () {
  48631. /* istanbul ignore else */
  48632. if (this.lazy) {
  48633. this.dirty = true;
  48634. } else if (this.sync) {
  48635. this.run();
  48636. } else {
  48637. queueWatcher(this);
  48638. }
  48639. };
  48640. /**
  48641. * Scheduler job interface.
  48642. * Will be called by the scheduler.
  48643. */
  48644. Watcher.prototype.run = function run () {
  48645. if (this.active) {
  48646. var value = this.get();
  48647. if (
  48648. value !== this.value ||
  48649. // Deep watchers and watchers on Object/Arrays should fire even
  48650. // when the value is the same, because the value may
  48651. // have mutated.
  48652. isObject(value) ||
  48653. this.deep
  48654. ) {
  48655. // set new value
  48656. var oldValue = this.value;
  48657. this.value = value;
  48658. if (this.user) {
  48659. try {
  48660. this.cb.call(this.vm, value, oldValue);
  48661. } catch (e) {
  48662. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48663. }
  48664. } else {
  48665. this.cb.call(this.vm, value, oldValue);
  48666. }
  48667. }
  48668. }
  48669. };
  48670. /**
  48671. * Evaluate the value of the watcher.
  48672. * This only gets called for lazy watchers.
  48673. */
  48674. Watcher.prototype.evaluate = function evaluate () {
  48675. this.value = this.get();
  48676. this.dirty = false;
  48677. };
  48678. /**
  48679. * Depend on all deps collected by this watcher.
  48680. */
  48681. Watcher.prototype.depend = function depend () {
  48682. var i = this.deps.length;
  48683. while (i--) {
  48684. this.deps[i].depend();
  48685. }
  48686. };
  48687. /**
  48688. * Remove self from all dependencies' subscriber list.
  48689. */
  48690. Watcher.prototype.teardown = function teardown () {
  48691. if (this.active) {
  48692. // remove self from vm's watcher list
  48693. // this is a somewhat expensive operation so we skip it
  48694. // if the vm is being destroyed.
  48695. if (!this.vm._isBeingDestroyed) {
  48696. remove(this.vm._watchers, this);
  48697. }
  48698. var i = this.deps.length;
  48699. while (i--) {
  48700. this.deps[i].removeSub(this);
  48701. }
  48702. this.active = false;
  48703. }
  48704. };
  48705. /* */
  48706. var sharedPropertyDefinition = {
  48707. enumerable: true,
  48708. configurable: true,
  48709. get: noop,
  48710. set: noop
  48711. };
  48712. function proxy (target, sourceKey, key) {
  48713. sharedPropertyDefinition.get = function proxyGetter () {
  48714. return this[sourceKey][key]
  48715. };
  48716. sharedPropertyDefinition.set = function proxySetter (val) {
  48717. this[sourceKey][key] = val;
  48718. };
  48719. Object.defineProperty(target, key, sharedPropertyDefinition);
  48720. }
  48721. function initState (vm) {
  48722. vm._watchers = [];
  48723. var opts = vm.$options;
  48724. if (opts.props) { initProps(vm, opts.props); }
  48725. if (opts.methods) { initMethods(vm, opts.methods); }
  48726. if (opts.data) {
  48727. initData(vm);
  48728. } else {
  48729. observe(vm._data = {}, true /* asRootData */);
  48730. }
  48731. if (opts.computed) { initComputed(vm, opts.computed); }
  48732. if (opts.watch && opts.watch !== nativeWatch) {
  48733. initWatch(vm, opts.watch);
  48734. }
  48735. }
  48736. function initProps (vm, propsOptions) {
  48737. var propsData = vm.$options.propsData || {};
  48738. var props = vm._props = {};
  48739. // cache prop keys so that future props updates can iterate using Array
  48740. // instead of dynamic object key enumeration.
  48741. var keys = vm.$options._propKeys = [];
  48742. var isRoot = !vm.$parent;
  48743. // root instance props should be converted
  48744. if (!isRoot) {
  48745. toggleObserving(false);
  48746. }
  48747. var loop = function ( key ) {
  48748. keys.push(key);
  48749. var value = validateProp(key, propsOptions, propsData, vm);
  48750. /* istanbul ignore else */
  48751. {
  48752. var hyphenatedKey = hyphenate(key);
  48753. if (isReservedAttribute(hyphenatedKey) ||
  48754. config.isReservedAttr(hyphenatedKey)) {
  48755. warn(
  48756. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48757. vm
  48758. );
  48759. }
  48760. defineReactive$$1(props, key, value, function () {
  48761. if (!isRoot && !isUpdatingChildComponent) {
  48762. warn(
  48763. "Avoid mutating a prop directly since the value will be " +
  48764. "overwritten whenever the parent component re-renders. " +
  48765. "Instead, use a data or computed property based on the prop's " +
  48766. "value. Prop being mutated: \"" + key + "\"",
  48767. vm
  48768. );
  48769. }
  48770. });
  48771. }
  48772. // static props are already proxied on the component's prototype
  48773. // during Vue.extend(). We only need to proxy props defined at
  48774. // instantiation here.
  48775. if (!(key in vm)) {
  48776. proxy(vm, "_props", key);
  48777. }
  48778. };
  48779. for (var key in propsOptions) loop( key );
  48780. toggleObserving(true);
  48781. }
  48782. function initData (vm) {
  48783. var data = vm.$options.data;
  48784. data = vm._data = typeof data === 'function'
  48785. ? getData(data, vm)
  48786. : data || {};
  48787. if (!isPlainObject(data)) {
  48788. data = {};
  48789. warn(
  48790. 'data functions should return an object:\n' +
  48791. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48792. vm
  48793. );
  48794. }
  48795. // proxy data on instance
  48796. var keys = Object.keys(data);
  48797. var props = vm.$options.props;
  48798. var methods = vm.$options.methods;
  48799. var i = keys.length;
  48800. while (i--) {
  48801. var key = keys[i];
  48802. {
  48803. if (methods && hasOwn(methods, key)) {
  48804. warn(
  48805. ("Method \"" + key + "\" has already been defined as a data property."),
  48806. vm
  48807. );
  48808. }
  48809. }
  48810. if (props && hasOwn(props, key)) {
  48811. warn(
  48812. "The data property \"" + key + "\" is already declared as a prop. " +
  48813. "Use prop default value instead.",
  48814. vm
  48815. );
  48816. } else if (!isReserved(key)) {
  48817. proxy(vm, "_data", key);
  48818. }
  48819. }
  48820. // observe data
  48821. observe(data, true /* asRootData */);
  48822. }
  48823. function getData (data, vm) {
  48824. // #7573 disable dep collection when invoking data getters
  48825. pushTarget();
  48826. try {
  48827. return data.call(vm, vm)
  48828. } catch (e) {
  48829. handleError(e, vm, "data()");
  48830. return {}
  48831. } finally {
  48832. popTarget();
  48833. }
  48834. }
  48835. var computedWatcherOptions = { lazy: true };
  48836. function initComputed (vm, computed) {
  48837. // $flow-disable-line
  48838. var watchers = vm._computedWatchers = Object.create(null);
  48839. // computed properties are just getters during SSR
  48840. var isSSR = isServerRendering();
  48841. for (var key in computed) {
  48842. var userDef = computed[key];
  48843. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48844. if (getter == null) {
  48845. warn(
  48846. ("Getter is missing for computed property \"" + key + "\"."),
  48847. vm
  48848. );
  48849. }
  48850. if (!isSSR) {
  48851. // create internal watcher for the computed property.
  48852. watchers[key] = new Watcher(
  48853. vm,
  48854. getter || noop,
  48855. noop,
  48856. computedWatcherOptions
  48857. );
  48858. }
  48859. // component-defined computed properties are already defined on the
  48860. // component prototype. We only need to define computed properties defined
  48861. // at instantiation here.
  48862. if (!(key in vm)) {
  48863. defineComputed(vm, key, userDef);
  48864. } else {
  48865. if (key in vm.$data) {
  48866. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48867. } else if (vm.$options.props && key in vm.$options.props) {
  48868. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48869. }
  48870. }
  48871. }
  48872. }
  48873. function defineComputed (
  48874. target,
  48875. key,
  48876. userDef
  48877. ) {
  48878. var shouldCache = !isServerRendering();
  48879. if (typeof userDef === 'function') {
  48880. sharedPropertyDefinition.get = shouldCache
  48881. ? createComputedGetter(key)
  48882. : createGetterInvoker(userDef);
  48883. sharedPropertyDefinition.set = noop;
  48884. } else {
  48885. sharedPropertyDefinition.get = userDef.get
  48886. ? shouldCache && userDef.cache !== false
  48887. ? createComputedGetter(key)
  48888. : createGetterInvoker(userDef.get)
  48889. : noop;
  48890. sharedPropertyDefinition.set = userDef.set || noop;
  48891. }
  48892. if (sharedPropertyDefinition.set === noop) {
  48893. sharedPropertyDefinition.set = function () {
  48894. warn(
  48895. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48896. this
  48897. );
  48898. };
  48899. }
  48900. Object.defineProperty(target, key, sharedPropertyDefinition);
  48901. }
  48902. function createComputedGetter (key) {
  48903. return function computedGetter () {
  48904. var watcher = this._computedWatchers && this._computedWatchers[key];
  48905. if (watcher) {
  48906. if (watcher.dirty) {
  48907. watcher.evaluate();
  48908. }
  48909. if (Dep.target) {
  48910. watcher.depend();
  48911. }
  48912. return watcher.value
  48913. }
  48914. }
  48915. }
  48916. function createGetterInvoker(fn) {
  48917. return function computedGetter () {
  48918. return fn.call(this, this)
  48919. }
  48920. }
  48921. function initMethods (vm, methods) {
  48922. var props = vm.$options.props;
  48923. for (var key in methods) {
  48924. {
  48925. if (typeof methods[key] !== 'function') {
  48926. warn(
  48927. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48928. "Did you reference the function correctly?",
  48929. vm
  48930. );
  48931. }
  48932. if (props && hasOwn(props, key)) {
  48933. warn(
  48934. ("Method \"" + key + "\" has already been defined as a prop."),
  48935. vm
  48936. );
  48937. }
  48938. if ((key in vm) && isReserved(key)) {
  48939. warn(
  48940. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48941. "Avoid defining component methods that start with _ or $."
  48942. );
  48943. }
  48944. }
  48945. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48946. }
  48947. }
  48948. function initWatch (vm, watch) {
  48949. for (var key in watch) {
  48950. var handler = watch[key];
  48951. if (Array.isArray(handler)) {
  48952. for (var i = 0; i < handler.length; i++) {
  48953. createWatcher(vm, key, handler[i]);
  48954. }
  48955. } else {
  48956. createWatcher(vm, key, handler);
  48957. }
  48958. }
  48959. }
  48960. function createWatcher (
  48961. vm,
  48962. expOrFn,
  48963. handler,
  48964. options
  48965. ) {
  48966. if (isPlainObject(handler)) {
  48967. options = handler;
  48968. handler = handler.handler;
  48969. }
  48970. if (typeof handler === 'string') {
  48971. handler = vm[handler];
  48972. }
  48973. return vm.$watch(expOrFn, handler, options)
  48974. }
  48975. function stateMixin (Vue) {
  48976. // flow somehow has problems with directly declared definition object
  48977. // when using Object.defineProperty, so we have to procedurally build up
  48978. // the object here.
  48979. var dataDef = {};
  48980. dataDef.get = function () { return this._data };
  48981. var propsDef = {};
  48982. propsDef.get = function () { return this._props };
  48983. {
  48984. dataDef.set = function () {
  48985. warn(
  48986. 'Avoid replacing instance root $data. ' +
  48987. 'Use nested data properties instead.',
  48988. this
  48989. );
  48990. };
  48991. propsDef.set = function () {
  48992. warn("$props is readonly.", this);
  48993. };
  48994. }
  48995. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48996. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48997. Vue.prototype.$set = set;
  48998. Vue.prototype.$delete = del;
  48999. Vue.prototype.$watch = function (
  49000. expOrFn,
  49001. cb,
  49002. options
  49003. ) {
  49004. var vm = this;
  49005. if (isPlainObject(cb)) {
  49006. return createWatcher(vm, expOrFn, cb, options)
  49007. }
  49008. options = options || {};
  49009. options.user = true;
  49010. var watcher = new Watcher(vm, expOrFn, cb, options);
  49011. if (options.immediate) {
  49012. try {
  49013. cb.call(vm, watcher.value);
  49014. } catch (error) {
  49015. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49016. }
  49017. }
  49018. return function unwatchFn () {
  49019. watcher.teardown();
  49020. }
  49021. };
  49022. }
  49023. /* */
  49024. var uid$3 = 0;
  49025. function initMixin (Vue) {
  49026. Vue.prototype._init = function (options) {
  49027. var vm = this;
  49028. // a uid
  49029. vm._uid = uid$3++;
  49030. var startTag, endTag;
  49031. /* istanbul ignore if */
  49032. if (config.performance && mark) {
  49033. startTag = "vue-perf-start:" + (vm._uid);
  49034. endTag = "vue-perf-end:" + (vm._uid);
  49035. mark(startTag);
  49036. }
  49037. // a flag to avoid this being observed
  49038. vm._isVue = true;
  49039. // merge options
  49040. if (options && options._isComponent) {
  49041. // optimize internal component instantiation
  49042. // since dynamic options merging is pretty slow, and none of the
  49043. // internal component options needs special treatment.
  49044. initInternalComponent(vm, options);
  49045. } else {
  49046. vm.$options = mergeOptions(
  49047. resolveConstructorOptions(vm.constructor),
  49048. options || {},
  49049. vm
  49050. );
  49051. }
  49052. /* istanbul ignore else */
  49053. {
  49054. initProxy(vm);
  49055. }
  49056. // expose real self
  49057. vm._self = vm;
  49058. initLifecycle(vm);
  49059. initEvents(vm);
  49060. initRender(vm);
  49061. callHook(vm, 'beforeCreate');
  49062. initInjections(vm); // resolve injections before data/props
  49063. initState(vm);
  49064. initProvide(vm); // resolve provide after data/props
  49065. callHook(vm, 'created');
  49066. /* istanbul ignore if */
  49067. if (config.performance && mark) {
  49068. vm._name = formatComponentName(vm, false);
  49069. mark(endTag);
  49070. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49071. }
  49072. if (vm.$options.el) {
  49073. vm.$mount(vm.$options.el);
  49074. }
  49075. };
  49076. }
  49077. function initInternalComponent (vm, options) {
  49078. var opts = vm.$options = Object.create(vm.constructor.options);
  49079. // doing this because it's faster than dynamic enumeration.
  49080. var parentVnode = options._parentVnode;
  49081. opts.parent = options.parent;
  49082. opts._parentVnode = parentVnode;
  49083. var vnodeComponentOptions = parentVnode.componentOptions;
  49084. opts.propsData = vnodeComponentOptions.propsData;
  49085. opts._parentListeners = vnodeComponentOptions.listeners;
  49086. opts._renderChildren = vnodeComponentOptions.children;
  49087. opts._componentTag = vnodeComponentOptions.tag;
  49088. if (options.render) {
  49089. opts.render = options.render;
  49090. opts.staticRenderFns = options.staticRenderFns;
  49091. }
  49092. }
  49093. function resolveConstructorOptions (Ctor) {
  49094. var options = Ctor.options;
  49095. if (Ctor.super) {
  49096. var superOptions = resolveConstructorOptions(Ctor.super);
  49097. var cachedSuperOptions = Ctor.superOptions;
  49098. if (superOptions !== cachedSuperOptions) {
  49099. // super option changed,
  49100. // need to resolve new options.
  49101. Ctor.superOptions = superOptions;
  49102. // check if there are any late-modified/attached options (#4976)
  49103. var modifiedOptions = resolveModifiedOptions(Ctor);
  49104. // update base extend options
  49105. if (modifiedOptions) {
  49106. extend(Ctor.extendOptions, modifiedOptions);
  49107. }
  49108. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49109. if (options.name) {
  49110. options.components[options.name] = Ctor;
  49111. }
  49112. }
  49113. }
  49114. return options
  49115. }
  49116. function resolveModifiedOptions (Ctor) {
  49117. var modified;
  49118. var latest = Ctor.options;
  49119. var sealed = Ctor.sealedOptions;
  49120. for (var key in latest) {
  49121. if (latest[key] !== sealed[key]) {
  49122. if (!modified) { modified = {}; }
  49123. modified[key] = latest[key];
  49124. }
  49125. }
  49126. return modified
  49127. }
  49128. function Vue (options) {
  49129. if (!(this instanceof Vue)
  49130. ) {
  49131. warn('Vue is a constructor and should be called with the `new` keyword');
  49132. }
  49133. this._init(options);
  49134. }
  49135. initMixin(Vue);
  49136. stateMixin(Vue);
  49137. eventsMixin(Vue);
  49138. lifecycleMixin(Vue);
  49139. renderMixin(Vue);
  49140. /* */
  49141. function initUse (Vue) {
  49142. Vue.use = function (plugin) {
  49143. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49144. if (installedPlugins.indexOf(plugin) > -1) {
  49145. return this
  49146. }
  49147. // additional parameters
  49148. var args = toArray(arguments, 1);
  49149. args.unshift(this);
  49150. if (typeof plugin.install === 'function') {
  49151. plugin.install.apply(plugin, args);
  49152. } else if (typeof plugin === 'function') {
  49153. plugin.apply(null, args);
  49154. }
  49155. installedPlugins.push(plugin);
  49156. return this
  49157. };
  49158. }
  49159. /* */
  49160. function initMixin$1 (Vue) {
  49161. Vue.mixin = function (mixin) {
  49162. this.options = mergeOptions(this.options, mixin);
  49163. return this
  49164. };
  49165. }
  49166. /* */
  49167. function initExtend (Vue) {
  49168. /**
  49169. * Each instance constructor, including Vue, has a unique
  49170. * cid. This enables us to create wrapped "child
  49171. * constructors" for prototypal inheritance and cache them.
  49172. */
  49173. Vue.cid = 0;
  49174. var cid = 1;
  49175. /**
  49176. * Class inheritance
  49177. */
  49178. Vue.extend = function (extendOptions) {
  49179. extendOptions = extendOptions || {};
  49180. var Super = this;
  49181. var SuperId = Super.cid;
  49182. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49183. if (cachedCtors[SuperId]) {
  49184. return cachedCtors[SuperId]
  49185. }
  49186. var name = extendOptions.name || Super.options.name;
  49187. if (name) {
  49188. validateComponentName(name);
  49189. }
  49190. var Sub = function VueComponent (options) {
  49191. this._init(options);
  49192. };
  49193. Sub.prototype = Object.create(Super.prototype);
  49194. Sub.prototype.constructor = Sub;
  49195. Sub.cid = cid++;
  49196. Sub.options = mergeOptions(
  49197. Super.options,
  49198. extendOptions
  49199. );
  49200. Sub['super'] = Super;
  49201. // For props and computed properties, we define the proxy getters on
  49202. // the Vue instances at extension time, on the extended prototype. This
  49203. // avoids Object.defineProperty calls for each instance created.
  49204. if (Sub.options.props) {
  49205. initProps$1(Sub);
  49206. }
  49207. if (Sub.options.computed) {
  49208. initComputed$1(Sub);
  49209. }
  49210. // allow further extension/mixin/plugin usage
  49211. Sub.extend = Super.extend;
  49212. Sub.mixin = Super.mixin;
  49213. Sub.use = Super.use;
  49214. // create asset registers, so extended classes
  49215. // can have their private assets too.
  49216. ASSET_TYPES.forEach(function (type) {
  49217. Sub[type] = Super[type];
  49218. });
  49219. // enable recursive self-lookup
  49220. if (name) {
  49221. Sub.options.components[name] = Sub;
  49222. }
  49223. // keep a reference to the super options at extension time.
  49224. // later at instantiation we can check if Super's options have
  49225. // been updated.
  49226. Sub.superOptions = Super.options;
  49227. Sub.extendOptions = extendOptions;
  49228. Sub.sealedOptions = extend({}, Sub.options);
  49229. // cache constructor
  49230. cachedCtors[SuperId] = Sub;
  49231. return Sub
  49232. };
  49233. }
  49234. function initProps$1 (Comp) {
  49235. var props = Comp.options.props;
  49236. for (var key in props) {
  49237. proxy(Comp.prototype, "_props", key);
  49238. }
  49239. }
  49240. function initComputed$1 (Comp) {
  49241. var computed = Comp.options.computed;
  49242. for (var key in computed) {
  49243. defineComputed(Comp.prototype, key, computed[key]);
  49244. }
  49245. }
  49246. /* */
  49247. function initAssetRegisters (Vue) {
  49248. /**
  49249. * Create asset registration methods.
  49250. */
  49251. ASSET_TYPES.forEach(function (type) {
  49252. Vue[type] = function (
  49253. id,
  49254. definition
  49255. ) {
  49256. if (!definition) {
  49257. return this.options[type + 's'][id]
  49258. } else {
  49259. /* istanbul ignore if */
  49260. if (type === 'component') {
  49261. validateComponentName(id);
  49262. }
  49263. if (type === 'component' && isPlainObject(definition)) {
  49264. definition.name = definition.name || id;
  49265. definition = this.options._base.extend(definition);
  49266. }
  49267. if (type === 'directive' && typeof definition === 'function') {
  49268. definition = { bind: definition, update: definition };
  49269. }
  49270. this.options[type + 's'][id] = definition;
  49271. return definition
  49272. }
  49273. };
  49274. });
  49275. }
  49276. /* */
  49277. function getComponentName (opts) {
  49278. return opts && (opts.Ctor.options.name || opts.tag)
  49279. }
  49280. function matches (pattern, name) {
  49281. if (Array.isArray(pattern)) {
  49282. return pattern.indexOf(name) > -1
  49283. } else if (typeof pattern === 'string') {
  49284. return pattern.split(',').indexOf(name) > -1
  49285. } else if (isRegExp(pattern)) {
  49286. return pattern.test(name)
  49287. }
  49288. /* istanbul ignore next */
  49289. return false
  49290. }
  49291. function pruneCache (keepAliveInstance, filter) {
  49292. var cache = keepAliveInstance.cache;
  49293. var keys = keepAliveInstance.keys;
  49294. var _vnode = keepAliveInstance._vnode;
  49295. for (var key in cache) {
  49296. var cachedNode = cache[key];
  49297. if (cachedNode) {
  49298. var name = getComponentName(cachedNode.componentOptions);
  49299. if (name && !filter(name)) {
  49300. pruneCacheEntry(cache, key, keys, _vnode);
  49301. }
  49302. }
  49303. }
  49304. }
  49305. function pruneCacheEntry (
  49306. cache,
  49307. key,
  49308. keys,
  49309. current
  49310. ) {
  49311. var cached$$1 = cache[key];
  49312. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49313. cached$$1.componentInstance.$destroy();
  49314. }
  49315. cache[key] = null;
  49316. remove(keys, key);
  49317. }
  49318. var patternTypes = [String, RegExp, Array];
  49319. var KeepAlive = {
  49320. name: 'keep-alive',
  49321. abstract: true,
  49322. props: {
  49323. include: patternTypes,
  49324. exclude: patternTypes,
  49325. max: [String, Number]
  49326. },
  49327. created: function created () {
  49328. this.cache = Object.create(null);
  49329. this.keys = [];
  49330. },
  49331. destroyed: function destroyed () {
  49332. for (var key in this.cache) {
  49333. pruneCacheEntry(this.cache, key, this.keys);
  49334. }
  49335. },
  49336. mounted: function mounted () {
  49337. var this$1 = this;
  49338. this.$watch('include', function (val) {
  49339. pruneCache(this$1, function (name) { return matches(val, name); });
  49340. });
  49341. this.$watch('exclude', function (val) {
  49342. pruneCache(this$1, function (name) { return !matches(val, name); });
  49343. });
  49344. },
  49345. render: function render () {
  49346. var slot = this.$slots.default;
  49347. var vnode = getFirstComponentChild(slot);
  49348. var componentOptions = vnode && vnode.componentOptions;
  49349. if (componentOptions) {
  49350. // check pattern
  49351. var name = getComponentName(componentOptions);
  49352. var ref = this;
  49353. var include = ref.include;
  49354. var exclude = ref.exclude;
  49355. if (
  49356. // not included
  49357. (include && (!name || !matches(include, name))) ||
  49358. // excluded
  49359. (exclude && name && matches(exclude, name))
  49360. ) {
  49361. return vnode
  49362. }
  49363. var ref$1 = this;
  49364. var cache = ref$1.cache;
  49365. var keys = ref$1.keys;
  49366. var key = vnode.key == null
  49367. // same constructor may get registered as different local components
  49368. // so cid alone is not enough (#3269)
  49369. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49370. : vnode.key;
  49371. if (cache[key]) {
  49372. vnode.componentInstance = cache[key].componentInstance;
  49373. // make current key freshest
  49374. remove(keys, key);
  49375. keys.push(key);
  49376. } else {
  49377. cache[key] = vnode;
  49378. keys.push(key);
  49379. // prune oldest entry
  49380. if (this.max && keys.length > parseInt(this.max)) {
  49381. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49382. }
  49383. }
  49384. vnode.data.keepAlive = true;
  49385. }
  49386. return vnode || (slot && slot[0])
  49387. }
  49388. };
  49389. var builtInComponents = {
  49390. KeepAlive: KeepAlive
  49391. };
  49392. /* */
  49393. function initGlobalAPI (Vue) {
  49394. // config
  49395. var configDef = {};
  49396. configDef.get = function () { return config; };
  49397. {
  49398. configDef.set = function () {
  49399. warn(
  49400. 'Do not replace the Vue.config object, set individual fields instead.'
  49401. );
  49402. };
  49403. }
  49404. Object.defineProperty(Vue, 'config', configDef);
  49405. // exposed util methods.
  49406. // NOTE: these are not considered part of the public API - avoid relying on
  49407. // them unless you are aware of the risk.
  49408. Vue.util = {
  49409. warn: warn,
  49410. extend: extend,
  49411. mergeOptions: mergeOptions,
  49412. defineReactive: defineReactive$$1
  49413. };
  49414. Vue.set = set;
  49415. Vue.delete = del;
  49416. Vue.nextTick = nextTick;
  49417. // 2.6 explicit observable API
  49418. Vue.observable = function (obj) {
  49419. observe(obj);
  49420. return obj
  49421. };
  49422. Vue.options = Object.create(null);
  49423. ASSET_TYPES.forEach(function (type) {
  49424. Vue.options[type + 's'] = Object.create(null);
  49425. });
  49426. // this is used to identify the "base" constructor to extend all plain-object
  49427. // components with in Weex's multi-instance scenarios.
  49428. Vue.options._base = Vue;
  49429. extend(Vue.options.components, builtInComponents);
  49430. initUse(Vue);
  49431. initMixin$1(Vue);
  49432. initExtend(Vue);
  49433. initAssetRegisters(Vue);
  49434. }
  49435. initGlobalAPI(Vue);
  49436. Object.defineProperty(Vue.prototype, '$isServer', {
  49437. get: isServerRendering
  49438. });
  49439. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49440. get: function get () {
  49441. /* istanbul ignore next */
  49442. return this.$vnode && this.$vnode.ssrContext
  49443. }
  49444. });
  49445. // expose FunctionalRenderContext for ssr runtime helper installation
  49446. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49447. value: FunctionalRenderContext
  49448. });
  49449. Vue.version = '2.6.11';
  49450. /* */
  49451. // these are reserved for web because they are directly compiled away
  49452. // during template compilation
  49453. var isReservedAttr = makeMap('style,class');
  49454. // attributes that should be using props for binding
  49455. var acceptValue = makeMap('input,textarea,option,select,progress');
  49456. var mustUseProp = function (tag, type, attr) {
  49457. return (
  49458. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49459. (attr === 'selected' && tag === 'option') ||
  49460. (attr === 'checked' && tag === 'input') ||
  49461. (attr === 'muted' && tag === 'video')
  49462. )
  49463. };
  49464. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49465. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49466. var convertEnumeratedValue = function (key, value) {
  49467. return isFalsyAttrValue(value) || value === 'false'
  49468. ? 'false'
  49469. // allow arbitrary string value for contenteditable
  49470. : key === 'contenteditable' && isValidContentEditableValue(value)
  49471. ? value
  49472. : 'true'
  49473. };
  49474. var isBooleanAttr = makeMap(
  49475. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49476. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49477. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49478. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49479. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49480. 'truespeed,typemustmatch,visible'
  49481. );
  49482. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49483. var isXlink = function (name) {
  49484. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49485. };
  49486. var getXlinkProp = function (name) {
  49487. return isXlink(name) ? name.slice(6, name.length) : ''
  49488. };
  49489. var isFalsyAttrValue = function (val) {
  49490. return val == null || val === false
  49491. };
  49492. /* */
  49493. function genClassForVnode (vnode) {
  49494. var data = vnode.data;
  49495. var parentNode = vnode;
  49496. var childNode = vnode;
  49497. while (isDef(childNode.componentInstance)) {
  49498. childNode = childNode.componentInstance._vnode;
  49499. if (childNode && childNode.data) {
  49500. data = mergeClassData(childNode.data, data);
  49501. }
  49502. }
  49503. while (isDef(parentNode = parentNode.parent)) {
  49504. if (parentNode && parentNode.data) {
  49505. data = mergeClassData(data, parentNode.data);
  49506. }
  49507. }
  49508. return renderClass(data.staticClass, data.class)
  49509. }
  49510. function mergeClassData (child, parent) {
  49511. return {
  49512. staticClass: concat(child.staticClass, parent.staticClass),
  49513. class: isDef(child.class)
  49514. ? [child.class, parent.class]
  49515. : parent.class
  49516. }
  49517. }
  49518. function renderClass (
  49519. staticClass,
  49520. dynamicClass
  49521. ) {
  49522. if (isDef(staticClass) || isDef(dynamicClass)) {
  49523. return concat(staticClass, stringifyClass(dynamicClass))
  49524. }
  49525. /* istanbul ignore next */
  49526. return ''
  49527. }
  49528. function concat (a, b) {
  49529. return a ? b ? (a + ' ' + b) : a : (b || '')
  49530. }
  49531. function stringifyClass (value) {
  49532. if (Array.isArray(value)) {
  49533. return stringifyArray(value)
  49534. }
  49535. if (isObject(value)) {
  49536. return stringifyObject(value)
  49537. }
  49538. if (typeof value === 'string') {
  49539. return value
  49540. }
  49541. /* istanbul ignore next */
  49542. return ''
  49543. }
  49544. function stringifyArray (value) {
  49545. var res = '';
  49546. var stringified;
  49547. for (var i = 0, l = value.length; i < l; i++) {
  49548. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49549. if (res) { res += ' '; }
  49550. res += stringified;
  49551. }
  49552. }
  49553. return res
  49554. }
  49555. function stringifyObject (value) {
  49556. var res = '';
  49557. for (var key in value) {
  49558. if (value[key]) {
  49559. if (res) { res += ' '; }
  49560. res += key;
  49561. }
  49562. }
  49563. return res
  49564. }
  49565. /* */
  49566. var namespaceMap = {
  49567. svg: 'http://www.w3.org/2000/svg',
  49568. math: 'http://www.w3.org/1998/Math/MathML'
  49569. };
  49570. var isHTMLTag = makeMap(
  49571. 'html,body,base,head,link,meta,style,title,' +
  49572. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49573. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49574. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49575. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49576. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49577. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49578. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49579. 'output,progress,select,textarea,' +
  49580. 'details,dialog,menu,menuitem,summary,' +
  49581. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49582. );
  49583. // this map is intentionally selective, only covering SVG elements that may
  49584. // contain child elements.
  49585. var isSVG = makeMap(
  49586. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49587. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49588. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49589. true
  49590. );
  49591. var isPreTag = function (tag) { return tag === 'pre'; };
  49592. var isReservedTag = function (tag) {
  49593. return isHTMLTag(tag) || isSVG(tag)
  49594. };
  49595. function getTagNamespace (tag) {
  49596. if (isSVG(tag)) {
  49597. return 'svg'
  49598. }
  49599. // basic support for MathML
  49600. // note it doesn't support other MathML elements being component roots
  49601. if (tag === 'math') {
  49602. return 'math'
  49603. }
  49604. }
  49605. var unknownElementCache = Object.create(null);
  49606. function isUnknownElement (tag) {
  49607. /* istanbul ignore if */
  49608. if (!inBrowser) {
  49609. return true
  49610. }
  49611. if (isReservedTag(tag)) {
  49612. return false
  49613. }
  49614. tag = tag.toLowerCase();
  49615. /* istanbul ignore if */
  49616. if (unknownElementCache[tag] != null) {
  49617. return unknownElementCache[tag]
  49618. }
  49619. var el = document.createElement(tag);
  49620. if (tag.indexOf('-') > -1) {
  49621. // http://stackoverflow.com/a/28210364/1070244
  49622. return (unknownElementCache[tag] = (
  49623. el.constructor === window.HTMLUnknownElement ||
  49624. el.constructor === window.HTMLElement
  49625. ))
  49626. } else {
  49627. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49628. }
  49629. }
  49630. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49631. /* */
  49632. /**
  49633. * Query an element selector if it's not an element already.
  49634. */
  49635. function query (el) {
  49636. if (typeof el === 'string') {
  49637. var selected = document.querySelector(el);
  49638. if (!selected) {
  49639. warn(
  49640. 'Cannot find element: ' + el
  49641. );
  49642. return document.createElement('div')
  49643. }
  49644. return selected
  49645. } else {
  49646. return el
  49647. }
  49648. }
  49649. /* */
  49650. function createElement$1 (tagName, vnode) {
  49651. var elm = document.createElement(tagName);
  49652. if (tagName !== 'select') {
  49653. return elm
  49654. }
  49655. // false or null will remove the attribute but undefined will not
  49656. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49657. elm.setAttribute('multiple', 'multiple');
  49658. }
  49659. return elm
  49660. }
  49661. function createElementNS (namespace, tagName) {
  49662. return document.createElementNS(namespaceMap[namespace], tagName)
  49663. }
  49664. function createTextNode (text) {
  49665. return document.createTextNode(text)
  49666. }
  49667. function createComment (text) {
  49668. return document.createComment(text)
  49669. }
  49670. function insertBefore (parentNode, newNode, referenceNode) {
  49671. parentNode.insertBefore(newNode, referenceNode);
  49672. }
  49673. function removeChild (node, child) {
  49674. node.removeChild(child);
  49675. }
  49676. function appendChild (node, child) {
  49677. node.appendChild(child);
  49678. }
  49679. function parentNode (node) {
  49680. return node.parentNode
  49681. }
  49682. function nextSibling (node) {
  49683. return node.nextSibling
  49684. }
  49685. function tagName (node) {
  49686. return node.tagName
  49687. }
  49688. function setTextContent (node, text) {
  49689. node.textContent = text;
  49690. }
  49691. function setStyleScope (node, scopeId) {
  49692. node.setAttribute(scopeId, '');
  49693. }
  49694. var nodeOps = /*#__PURE__*/Object.freeze({
  49695. createElement: createElement$1,
  49696. createElementNS: createElementNS,
  49697. createTextNode: createTextNode,
  49698. createComment: createComment,
  49699. insertBefore: insertBefore,
  49700. removeChild: removeChild,
  49701. appendChild: appendChild,
  49702. parentNode: parentNode,
  49703. nextSibling: nextSibling,
  49704. tagName: tagName,
  49705. setTextContent: setTextContent,
  49706. setStyleScope: setStyleScope
  49707. });
  49708. /* */
  49709. var ref = {
  49710. create: function create (_, vnode) {
  49711. registerRef(vnode);
  49712. },
  49713. update: function update (oldVnode, vnode) {
  49714. if (oldVnode.data.ref !== vnode.data.ref) {
  49715. registerRef(oldVnode, true);
  49716. registerRef(vnode);
  49717. }
  49718. },
  49719. destroy: function destroy (vnode) {
  49720. registerRef(vnode, true);
  49721. }
  49722. };
  49723. function registerRef (vnode, isRemoval) {
  49724. var key = vnode.data.ref;
  49725. if (!isDef(key)) { return }
  49726. var vm = vnode.context;
  49727. var ref = vnode.componentInstance || vnode.elm;
  49728. var refs = vm.$refs;
  49729. if (isRemoval) {
  49730. if (Array.isArray(refs[key])) {
  49731. remove(refs[key], ref);
  49732. } else if (refs[key] === ref) {
  49733. refs[key] = undefined;
  49734. }
  49735. } else {
  49736. if (vnode.data.refInFor) {
  49737. if (!Array.isArray(refs[key])) {
  49738. refs[key] = [ref];
  49739. } else if (refs[key].indexOf(ref) < 0) {
  49740. // $flow-disable-line
  49741. refs[key].push(ref);
  49742. }
  49743. } else {
  49744. refs[key] = ref;
  49745. }
  49746. }
  49747. }
  49748. /**
  49749. * Virtual DOM patching algorithm based on Snabbdom by
  49750. * Simon Friis Vindum (@paldepind)
  49751. * Licensed under the MIT License
  49752. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49753. *
  49754. * modified by Evan You (@yyx990803)
  49755. *
  49756. * Not type-checking this because this file is perf-critical and the cost
  49757. * of making flow understand it is not worth it.
  49758. */
  49759. var emptyNode = new VNode('', {}, []);
  49760. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49761. function sameVnode (a, b) {
  49762. return (
  49763. a.key === b.key && (
  49764. (
  49765. a.tag === b.tag &&
  49766. a.isComment === b.isComment &&
  49767. isDef(a.data) === isDef(b.data) &&
  49768. sameInputType(a, b)
  49769. ) || (
  49770. isTrue(a.isAsyncPlaceholder) &&
  49771. a.asyncFactory === b.asyncFactory &&
  49772. isUndef(b.asyncFactory.error)
  49773. )
  49774. )
  49775. )
  49776. }
  49777. function sameInputType (a, b) {
  49778. if (a.tag !== 'input') { return true }
  49779. var i;
  49780. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49781. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49782. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49783. }
  49784. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49785. var i, key;
  49786. var map = {};
  49787. for (i = beginIdx; i <= endIdx; ++i) {
  49788. key = children[i].key;
  49789. if (isDef(key)) { map[key] = i; }
  49790. }
  49791. return map
  49792. }
  49793. function createPatchFunction (backend) {
  49794. var i, j;
  49795. var cbs = {};
  49796. var modules = backend.modules;
  49797. var nodeOps = backend.nodeOps;
  49798. for (i = 0; i < hooks.length; ++i) {
  49799. cbs[hooks[i]] = [];
  49800. for (j = 0; j < modules.length; ++j) {
  49801. if (isDef(modules[j][hooks[i]])) {
  49802. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49803. }
  49804. }
  49805. }
  49806. function emptyNodeAt (elm) {
  49807. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49808. }
  49809. function createRmCb (childElm, listeners) {
  49810. function remove$$1 () {
  49811. if (--remove$$1.listeners === 0) {
  49812. removeNode(childElm);
  49813. }
  49814. }
  49815. remove$$1.listeners = listeners;
  49816. return remove$$1
  49817. }
  49818. function removeNode (el) {
  49819. var parent = nodeOps.parentNode(el);
  49820. // element may have already been removed due to v-html / v-text
  49821. if (isDef(parent)) {
  49822. nodeOps.removeChild(parent, el);
  49823. }
  49824. }
  49825. function isUnknownElement$$1 (vnode, inVPre) {
  49826. return (
  49827. !inVPre &&
  49828. !vnode.ns &&
  49829. !(
  49830. config.ignoredElements.length &&
  49831. config.ignoredElements.some(function (ignore) {
  49832. return isRegExp(ignore)
  49833. ? ignore.test(vnode.tag)
  49834. : ignore === vnode.tag
  49835. })
  49836. ) &&
  49837. config.isUnknownElement(vnode.tag)
  49838. )
  49839. }
  49840. var creatingElmInVPre = 0;
  49841. function createElm (
  49842. vnode,
  49843. insertedVnodeQueue,
  49844. parentElm,
  49845. refElm,
  49846. nested,
  49847. ownerArray,
  49848. index
  49849. ) {
  49850. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49851. // This vnode was used in a previous render!
  49852. // now it's used as a new node, overwriting its elm would cause
  49853. // potential patch errors down the road when it's used as an insertion
  49854. // reference node. Instead, we clone the node on-demand before creating
  49855. // associated DOM element for it.
  49856. vnode = ownerArray[index] = cloneVNode(vnode);
  49857. }
  49858. vnode.isRootInsert = !nested; // for transition enter check
  49859. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49860. return
  49861. }
  49862. var data = vnode.data;
  49863. var children = vnode.children;
  49864. var tag = vnode.tag;
  49865. if (isDef(tag)) {
  49866. {
  49867. if (data && data.pre) {
  49868. creatingElmInVPre++;
  49869. }
  49870. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49871. warn(
  49872. 'Unknown custom element: <' + tag + '> - did you ' +
  49873. 'register the component correctly? For recursive components, ' +
  49874. 'make sure to provide the "name" option.',
  49875. vnode.context
  49876. );
  49877. }
  49878. }
  49879. vnode.elm = vnode.ns
  49880. ? nodeOps.createElementNS(vnode.ns, tag)
  49881. : nodeOps.createElement(tag, vnode);
  49882. setScope(vnode);
  49883. /* istanbul ignore if */
  49884. {
  49885. createChildren(vnode, children, insertedVnodeQueue);
  49886. if (isDef(data)) {
  49887. invokeCreateHooks(vnode, insertedVnodeQueue);
  49888. }
  49889. insert(parentElm, vnode.elm, refElm);
  49890. }
  49891. if (data && data.pre) {
  49892. creatingElmInVPre--;
  49893. }
  49894. } else if (isTrue(vnode.isComment)) {
  49895. vnode.elm = nodeOps.createComment(vnode.text);
  49896. insert(parentElm, vnode.elm, refElm);
  49897. } else {
  49898. vnode.elm = nodeOps.createTextNode(vnode.text);
  49899. insert(parentElm, vnode.elm, refElm);
  49900. }
  49901. }
  49902. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49903. var i = vnode.data;
  49904. if (isDef(i)) {
  49905. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49906. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49907. i(vnode, false /* hydrating */);
  49908. }
  49909. // after calling the init hook, if the vnode is a child component
  49910. // it should've created a child instance and mounted it. the child
  49911. // component also has set the placeholder vnode's elm.
  49912. // in that case we can just return the element and be done.
  49913. if (isDef(vnode.componentInstance)) {
  49914. initComponent(vnode, insertedVnodeQueue);
  49915. insert(parentElm, vnode.elm, refElm);
  49916. if (isTrue(isReactivated)) {
  49917. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49918. }
  49919. return true
  49920. }
  49921. }
  49922. }
  49923. function initComponent (vnode, insertedVnodeQueue) {
  49924. if (isDef(vnode.data.pendingInsert)) {
  49925. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49926. vnode.data.pendingInsert = null;
  49927. }
  49928. vnode.elm = vnode.componentInstance.$el;
  49929. if (isPatchable(vnode)) {
  49930. invokeCreateHooks(vnode, insertedVnodeQueue);
  49931. setScope(vnode);
  49932. } else {
  49933. // empty component root.
  49934. // skip all element-related modules except for ref (#3455)
  49935. registerRef(vnode);
  49936. // make sure to invoke the insert hook
  49937. insertedVnodeQueue.push(vnode);
  49938. }
  49939. }
  49940. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49941. var i;
  49942. // hack for #4339: a reactivated component with inner transition
  49943. // does not trigger because the inner node's created hooks are not called
  49944. // again. It's not ideal to involve module-specific logic in here but
  49945. // there doesn't seem to be a better way to do it.
  49946. var innerNode = vnode;
  49947. while (innerNode.componentInstance) {
  49948. innerNode = innerNode.componentInstance._vnode;
  49949. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49950. for (i = 0; i < cbs.activate.length; ++i) {
  49951. cbs.activate[i](emptyNode, innerNode);
  49952. }
  49953. insertedVnodeQueue.push(innerNode);
  49954. break
  49955. }
  49956. }
  49957. // unlike a newly created component,
  49958. // a reactivated keep-alive component doesn't insert itself
  49959. insert(parentElm, vnode.elm, refElm);
  49960. }
  49961. function insert (parent, elm, ref$$1) {
  49962. if (isDef(parent)) {
  49963. if (isDef(ref$$1)) {
  49964. if (nodeOps.parentNode(ref$$1) === parent) {
  49965. nodeOps.insertBefore(parent, elm, ref$$1);
  49966. }
  49967. } else {
  49968. nodeOps.appendChild(parent, elm);
  49969. }
  49970. }
  49971. }
  49972. function createChildren (vnode, children, insertedVnodeQueue) {
  49973. if (Array.isArray(children)) {
  49974. {
  49975. checkDuplicateKeys(children);
  49976. }
  49977. for (var i = 0; i < children.length; ++i) {
  49978. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49979. }
  49980. } else if (isPrimitive(vnode.text)) {
  49981. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49982. }
  49983. }
  49984. function isPatchable (vnode) {
  49985. while (vnode.componentInstance) {
  49986. vnode = vnode.componentInstance._vnode;
  49987. }
  49988. return isDef(vnode.tag)
  49989. }
  49990. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49991. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49992. cbs.create[i$1](emptyNode, vnode);
  49993. }
  49994. i = vnode.data.hook; // Reuse variable
  49995. if (isDef(i)) {
  49996. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49997. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49998. }
  49999. }
  50000. // set scope id attribute for scoped CSS.
  50001. // this is implemented as a special case to avoid the overhead
  50002. // of going through the normal attribute patching process.
  50003. function setScope (vnode) {
  50004. var i;
  50005. if (isDef(i = vnode.fnScopeId)) {
  50006. nodeOps.setStyleScope(vnode.elm, i);
  50007. } else {
  50008. var ancestor = vnode;
  50009. while (ancestor) {
  50010. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50011. nodeOps.setStyleScope(vnode.elm, i);
  50012. }
  50013. ancestor = ancestor.parent;
  50014. }
  50015. }
  50016. // for slot content they should also get the scopeId from the host instance.
  50017. if (isDef(i = activeInstance) &&
  50018. i !== vnode.context &&
  50019. i !== vnode.fnContext &&
  50020. isDef(i = i.$options._scopeId)
  50021. ) {
  50022. nodeOps.setStyleScope(vnode.elm, i);
  50023. }
  50024. }
  50025. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50026. for (; startIdx <= endIdx; ++startIdx) {
  50027. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50028. }
  50029. }
  50030. function invokeDestroyHook (vnode) {
  50031. var i, j;
  50032. var data = vnode.data;
  50033. if (isDef(data)) {
  50034. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50035. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50036. }
  50037. if (isDef(i = vnode.children)) {
  50038. for (j = 0; j < vnode.children.length; ++j) {
  50039. invokeDestroyHook(vnode.children[j]);
  50040. }
  50041. }
  50042. }
  50043. function removeVnodes (vnodes, startIdx, endIdx) {
  50044. for (; startIdx <= endIdx; ++startIdx) {
  50045. var ch = vnodes[startIdx];
  50046. if (isDef(ch)) {
  50047. if (isDef(ch.tag)) {
  50048. removeAndInvokeRemoveHook(ch);
  50049. invokeDestroyHook(ch);
  50050. } else { // Text node
  50051. removeNode(ch.elm);
  50052. }
  50053. }
  50054. }
  50055. }
  50056. function removeAndInvokeRemoveHook (vnode, rm) {
  50057. if (isDef(rm) || isDef(vnode.data)) {
  50058. var i;
  50059. var listeners = cbs.remove.length + 1;
  50060. if (isDef(rm)) {
  50061. // we have a recursively passed down rm callback
  50062. // increase the listeners count
  50063. rm.listeners += listeners;
  50064. } else {
  50065. // directly removing
  50066. rm = createRmCb(vnode.elm, listeners);
  50067. }
  50068. // recursively invoke hooks on child component root node
  50069. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50070. removeAndInvokeRemoveHook(i, rm);
  50071. }
  50072. for (i = 0; i < cbs.remove.length; ++i) {
  50073. cbs.remove[i](vnode, rm);
  50074. }
  50075. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50076. i(vnode, rm);
  50077. } else {
  50078. rm();
  50079. }
  50080. } else {
  50081. removeNode(vnode.elm);
  50082. }
  50083. }
  50084. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50085. var oldStartIdx = 0;
  50086. var newStartIdx = 0;
  50087. var oldEndIdx = oldCh.length - 1;
  50088. var oldStartVnode = oldCh[0];
  50089. var oldEndVnode = oldCh[oldEndIdx];
  50090. var newEndIdx = newCh.length - 1;
  50091. var newStartVnode = newCh[0];
  50092. var newEndVnode = newCh[newEndIdx];
  50093. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50094. // removeOnly is a special flag used only by <transition-group>
  50095. // to ensure removed elements stay in correct relative positions
  50096. // during leaving transitions
  50097. var canMove = !removeOnly;
  50098. {
  50099. checkDuplicateKeys(newCh);
  50100. }
  50101. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50102. if (isUndef(oldStartVnode)) {
  50103. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50104. } else if (isUndef(oldEndVnode)) {
  50105. oldEndVnode = oldCh[--oldEndIdx];
  50106. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50107. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50108. oldStartVnode = oldCh[++oldStartIdx];
  50109. newStartVnode = newCh[++newStartIdx];
  50110. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50111. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50112. oldEndVnode = oldCh[--oldEndIdx];
  50113. newEndVnode = newCh[--newEndIdx];
  50114. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50115. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50116. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50117. oldStartVnode = oldCh[++oldStartIdx];
  50118. newEndVnode = newCh[--newEndIdx];
  50119. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50120. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50121. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50122. oldEndVnode = oldCh[--oldEndIdx];
  50123. newStartVnode = newCh[++newStartIdx];
  50124. } else {
  50125. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50126. idxInOld = isDef(newStartVnode.key)
  50127. ? oldKeyToIdx[newStartVnode.key]
  50128. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50129. if (isUndef(idxInOld)) { // New element
  50130. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50131. } else {
  50132. vnodeToMove = oldCh[idxInOld];
  50133. if (sameVnode(vnodeToMove, newStartVnode)) {
  50134. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50135. oldCh[idxInOld] = undefined;
  50136. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50137. } else {
  50138. // same key but different element. treat as new element
  50139. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50140. }
  50141. }
  50142. newStartVnode = newCh[++newStartIdx];
  50143. }
  50144. }
  50145. if (oldStartIdx > oldEndIdx) {
  50146. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50147. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50148. } else if (newStartIdx > newEndIdx) {
  50149. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50150. }
  50151. }
  50152. function checkDuplicateKeys (children) {
  50153. var seenKeys = {};
  50154. for (var i = 0; i < children.length; i++) {
  50155. var vnode = children[i];
  50156. var key = vnode.key;
  50157. if (isDef(key)) {
  50158. if (seenKeys[key]) {
  50159. warn(
  50160. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50161. vnode.context
  50162. );
  50163. } else {
  50164. seenKeys[key] = true;
  50165. }
  50166. }
  50167. }
  50168. }
  50169. function findIdxInOld (node, oldCh, start, end) {
  50170. for (var i = start; i < end; i++) {
  50171. var c = oldCh[i];
  50172. if (isDef(c) && sameVnode(node, c)) { return i }
  50173. }
  50174. }
  50175. function patchVnode (
  50176. oldVnode,
  50177. vnode,
  50178. insertedVnodeQueue,
  50179. ownerArray,
  50180. index,
  50181. removeOnly
  50182. ) {
  50183. if (oldVnode === vnode) {
  50184. return
  50185. }
  50186. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50187. // clone reused vnode
  50188. vnode = ownerArray[index] = cloneVNode(vnode);
  50189. }
  50190. var elm = vnode.elm = oldVnode.elm;
  50191. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50192. if (isDef(vnode.asyncFactory.resolved)) {
  50193. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50194. } else {
  50195. vnode.isAsyncPlaceholder = true;
  50196. }
  50197. return
  50198. }
  50199. // reuse element for static trees.
  50200. // note we only do this if the vnode is cloned -
  50201. // if the new node is not cloned it means the render functions have been
  50202. // reset by the hot-reload-api and we need to do a proper re-render.
  50203. if (isTrue(vnode.isStatic) &&
  50204. isTrue(oldVnode.isStatic) &&
  50205. vnode.key === oldVnode.key &&
  50206. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50207. ) {
  50208. vnode.componentInstance = oldVnode.componentInstance;
  50209. return
  50210. }
  50211. var i;
  50212. var data = vnode.data;
  50213. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50214. i(oldVnode, vnode);
  50215. }
  50216. var oldCh = oldVnode.children;
  50217. var ch = vnode.children;
  50218. if (isDef(data) && isPatchable(vnode)) {
  50219. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50220. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50221. }
  50222. if (isUndef(vnode.text)) {
  50223. if (isDef(oldCh) && isDef(ch)) {
  50224. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50225. } else if (isDef(ch)) {
  50226. {
  50227. checkDuplicateKeys(ch);
  50228. }
  50229. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50230. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50231. } else if (isDef(oldCh)) {
  50232. removeVnodes(oldCh, 0, oldCh.length - 1);
  50233. } else if (isDef(oldVnode.text)) {
  50234. nodeOps.setTextContent(elm, '');
  50235. }
  50236. } else if (oldVnode.text !== vnode.text) {
  50237. nodeOps.setTextContent(elm, vnode.text);
  50238. }
  50239. if (isDef(data)) {
  50240. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50241. }
  50242. }
  50243. function invokeInsertHook (vnode, queue, initial) {
  50244. // delay insert hooks for component root nodes, invoke them after the
  50245. // element is really inserted
  50246. if (isTrue(initial) && isDef(vnode.parent)) {
  50247. vnode.parent.data.pendingInsert = queue;
  50248. } else {
  50249. for (var i = 0; i < queue.length; ++i) {
  50250. queue[i].data.hook.insert(queue[i]);
  50251. }
  50252. }
  50253. }
  50254. var hydrationBailed = false;
  50255. // list of modules that can skip create hook during hydration because they
  50256. // are already rendered on the client or has no need for initialization
  50257. // Note: style is excluded because it relies on initial clone for future
  50258. // deep updates (#7063).
  50259. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50260. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50261. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50262. var i;
  50263. var tag = vnode.tag;
  50264. var data = vnode.data;
  50265. var children = vnode.children;
  50266. inVPre = inVPre || (data && data.pre);
  50267. vnode.elm = elm;
  50268. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50269. vnode.isAsyncPlaceholder = true;
  50270. return true
  50271. }
  50272. // assert node match
  50273. {
  50274. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50275. return false
  50276. }
  50277. }
  50278. if (isDef(data)) {
  50279. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50280. if (isDef(i = vnode.componentInstance)) {
  50281. // child component. it should have hydrated its own tree.
  50282. initComponent(vnode, insertedVnodeQueue);
  50283. return true
  50284. }
  50285. }
  50286. if (isDef(tag)) {
  50287. if (isDef(children)) {
  50288. // empty element, allow client to pick up and populate children
  50289. if (!elm.hasChildNodes()) {
  50290. createChildren(vnode, children, insertedVnodeQueue);
  50291. } else {
  50292. // v-html and domProps: innerHTML
  50293. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50294. if (i !== elm.innerHTML) {
  50295. /* istanbul ignore if */
  50296. if (typeof console !== 'undefined' &&
  50297. !hydrationBailed
  50298. ) {
  50299. hydrationBailed = true;
  50300. console.warn('Parent: ', elm);
  50301. console.warn('server innerHTML: ', i);
  50302. console.warn('client innerHTML: ', elm.innerHTML);
  50303. }
  50304. return false
  50305. }
  50306. } else {
  50307. // iterate and compare children lists
  50308. var childrenMatch = true;
  50309. var childNode = elm.firstChild;
  50310. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50311. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50312. childrenMatch = false;
  50313. break
  50314. }
  50315. childNode = childNode.nextSibling;
  50316. }
  50317. // if childNode is not null, it means the actual childNodes list is
  50318. // longer than the virtual children list.
  50319. if (!childrenMatch || childNode) {
  50320. /* istanbul ignore if */
  50321. if (typeof console !== 'undefined' &&
  50322. !hydrationBailed
  50323. ) {
  50324. hydrationBailed = true;
  50325. console.warn('Parent: ', elm);
  50326. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50327. }
  50328. return false
  50329. }
  50330. }
  50331. }
  50332. }
  50333. if (isDef(data)) {
  50334. var fullInvoke = false;
  50335. for (var key in data) {
  50336. if (!isRenderedModule(key)) {
  50337. fullInvoke = true;
  50338. invokeCreateHooks(vnode, insertedVnodeQueue);
  50339. break
  50340. }
  50341. }
  50342. if (!fullInvoke && data['class']) {
  50343. // ensure collecting deps for deep class bindings for future updates
  50344. traverse(data['class']);
  50345. }
  50346. }
  50347. } else if (elm.data !== vnode.text) {
  50348. elm.data = vnode.text;
  50349. }
  50350. return true
  50351. }
  50352. function assertNodeMatch (node, vnode, inVPre) {
  50353. if (isDef(vnode.tag)) {
  50354. return vnode.tag.indexOf('vue-component') === 0 || (
  50355. !isUnknownElement$$1(vnode, inVPre) &&
  50356. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50357. )
  50358. } else {
  50359. return node.nodeType === (vnode.isComment ? 8 : 3)
  50360. }
  50361. }
  50362. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50363. if (isUndef(vnode)) {
  50364. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50365. return
  50366. }
  50367. var isInitialPatch = false;
  50368. var insertedVnodeQueue = [];
  50369. if (isUndef(oldVnode)) {
  50370. // empty mount (likely as component), create new root element
  50371. isInitialPatch = true;
  50372. createElm(vnode, insertedVnodeQueue);
  50373. } else {
  50374. var isRealElement = isDef(oldVnode.nodeType);
  50375. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50376. // patch existing root node
  50377. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50378. } else {
  50379. if (isRealElement) {
  50380. // mounting to a real element
  50381. // check if this is server-rendered content and if we can perform
  50382. // a successful hydration.
  50383. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50384. oldVnode.removeAttribute(SSR_ATTR);
  50385. hydrating = true;
  50386. }
  50387. if (isTrue(hydrating)) {
  50388. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50389. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50390. return oldVnode
  50391. } else {
  50392. warn(
  50393. 'The client-side rendered virtual DOM tree is not matching ' +
  50394. 'server-rendered content. This is likely caused by incorrect ' +
  50395. 'HTML markup, for example nesting block-level elements inside ' +
  50396. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50397. 'full client-side render.'
  50398. );
  50399. }
  50400. }
  50401. // either not server-rendered, or hydration failed.
  50402. // create an empty node and replace it
  50403. oldVnode = emptyNodeAt(oldVnode);
  50404. }
  50405. // replacing existing element
  50406. var oldElm = oldVnode.elm;
  50407. var parentElm = nodeOps.parentNode(oldElm);
  50408. // create new node
  50409. createElm(
  50410. vnode,
  50411. insertedVnodeQueue,
  50412. // extremely rare edge case: do not insert if old element is in a
  50413. // leaving transition. Only happens when combining transition +
  50414. // keep-alive + HOCs. (#4590)
  50415. oldElm._leaveCb ? null : parentElm,
  50416. nodeOps.nextSibling(oldElm)
  50417. );
  50418. // update parent placeholder node element, recursively
  50419. if (isDef(vnode.parent)) {
  50420. var ancestor = vnode.parent;
  50421. var patchable = isPatchable(vnode);
  50422. while (ancestor) {
  50423. for (var i = 0; i < cbs.destroy.length; ++i) {
  50424. cbs.destroy[i](ancestor);
  50425. }
  50426. ancestor.elm = vnode.elm;
  50427. if (patchable) {
  50428. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50429. cbs.create[i$1](emptyNode, ancestor);
  50430. }
  50431. // #6513
  50432. // invoke insert hooks that may have been merged by create hooks.
  50433. // e.g. for directives that uses the "inserted" hook.
  50434. var insert = ancestor.data.hook.insert;
  50435. if (insert.merged) {
  50436. // start at index 1 to avoid re-invoking component mounted hook
  50437. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50438. insert.fns[i$2]();
  50439. }
  50440. }
  50441. } else {
  50442. registerRef(ancestor);
  50443. }
  50444. ancestor = ancestor.parent;
  50445. }
  50446. }
  50447. // destroy old node
  50448. if (isDef(parentElm)) {
  50449. removeVnodes([oldVnode], 0, 0);
  50450. } else if (isDef(oldVnode.tag)) {
  50451. invokeDestroyHook(oldVnode);
  50452. }
  50453. }
  50454. }
  50455. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50456. return vnode.elm
  50457. }
  50458. }
  50459. /* */
  50460. var directives = {
  50461. create: updateDirectives,
  50462. update: updateDirectives,
  50463. destroy: function unbindDirectives (vnode) {
  50464. updateDirectives(vnode, emptyNode);
  50465. }
  50466. };
  50467. function updateDirectives (oldVnode, vnode) {
  50468. if (oldVnode.data.directives || vnode.data.directives) {
  50469. _update(oldVnode, vnode);
  50470. }
  50471. }
  50472. function _update (oldVnode, vnode) {
  50473. var isCreate = oldVnode === emptyNode;
  50474. var isDestroy = vnode === emptyNode;
  50475. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50476. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50477. var dirsWithInsert = [];
  50478. var dirsWithPostpatch = [];
  50479. var key, oldDir, dir;
  50480. for (key in newDirs) {
  50481. oldDir = oldDirs[key];
  50482. dir = newDirs[key];
  50483. if (!oldDir) {
  50484. // new directive, bind
  50485. callHook$1(dir, 'bind', vnode, oldVnode);
  50486. if (dir.def && dir.def.inserted) {
  50487. dirsWithInsert.push(dir);
  50488. }
  50489. } else {
  50490. // existing directive, update
  50491. dir.oldValue = oldDir.value;
  50492. dir.oldArg = oldDir.arg;
  50493. callHook$1(dir, 'update', vnode, oldVnode);
  50494. if (dir.def && dir.def.componentUpdated) {
  50495. dirsWithPostpatch.push(dir);
  50496. }
  50497. }
  50498. }
  50499. if (dirsWithInsert.length) {
  50500. var callInsert = function () {
  50501. for (var i = 0; i < dirsWithInsert.length; i++) {
  50502. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50503. }
  50504. };
  50505. if (isCreate) {
  50506. mergeVNodeHook(vnode, 'insert', callInsert);
  50507. } else {
  50508. callInsert();
  50509. }
  50510. }
  50511. if (dirsWithPostpatch.length) {
  50512. mergeVNodeHook(vnode, 'postpatch', function () {
  50513. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50514. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50515. }
  50516. });
  50517. }
  50518. if (!isCreate) {
  50519. for (key in oldDirs) {
  50520. if (!newDirs[key]) {
  50521. // no longer present, unbind
  50522. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50523. }
  50524. }
  50525. }
  50526. }
  50527. var emptyModifiers = Object.create(null);
  50528. function normalizeDirectives$1 (
  50529. dirs,
  50530. vm
  50531. ) {
  50532. var res = Object.create(null);
  50533. if (!dirs) {
  50534. // $flow-disable-line
  50535. return res
  50536. }
  50537. var i, dir;
  50538. for (i = 0; i < dirs.length; i++) {
  50539. dir = dirs[i];
  50540. if (!dir.modifiers) {
  50541. // $flow-disable-line
  50542. dir.modifiers = emptyModifiers;
  50543. }
  50544. res[getRawDirName(dir)] = dir;
  50545. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50546. }
  50547. // $flow-disable-line
  50548. return res
  50549. }
  50550. function getRawDirName (dir) {
  50551. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50552. }
  50553. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50554. var fn = dir.def && dir.def[hook];
  50555. if (fn) {
  50556. try {
  50557. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50558. } catch (e) {
  50559. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50560. }
  50561. }
  50562. }
  50563. var baseModules = [
  50564. ref,
  50565. directives
  50566. ];
  50567. /* */
  50568. function updateAttrs (oldVnode, vnode) {
  50569. var opts = vnode.componentOptions;
  50570. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50571. return
  50572. }
  50573. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50574. return
  50575. }
  50576. var key, cur, old;
  50577. var elm = vnode.elm;
  50578. var oldAttrs = oldVnode.data.attrs || {};
  50579. var attrs = vnode.data.attrs || {};
  50580. // clone observed objects, as the user probably wants to mutate it
  50581. if (isDef(attrs.__ob__)) {
  50582. attrs = vnode.data.attrs = extend({}, attrs);
  50583. }
  50584. for (key in attrs) {
  50585. cur = attrs[key];
  50586. old = oldAttrs[key];
  50587. if (old !== cur) {
  50588. setAttr(elm, key, cur);
  50589. }
  50590. }
  50591. // #4391: in IE9, setting type can reset value for input[type=radio]
  50592. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50593. /* istanbul ignore if */
  50594. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50595. setAttr(elm, 'value', attrs.value);
  50596. }
  50597. for (key in oldAttrs) {
  50598. if (isUndef(attrs[key])) {
  50599. if (isXlink(key)) {
  50600. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50601. } else if (!isEnumeratedAttr(key)) {
  50602. elm.removeAttribute(key);
  50603. }
  50604. }
  50605. }
  50606. }
  50607. function setAttr (el, key, value) {
  50608. if (el.tagName.indexOf('-') > -1) {
  50609. baseSetAttr(el, key, value);
  50610. } else if (isBooleanAttr(key)) {
  50611. // set attribute for blank value
  50612. // e.g. <option disabled>Select one</option>
  50613. if (isFalsyAttrValue(value)) {
  50614. el.removeAttribute(key);
  50615. } else {
  50616. // technically allowfullscreen is a boolean attribute for <iframe>,
  50617. // but Flash expects a value of "true" when used on <embed> tag
  50618. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50619. ? 'true'
  50620. : key;
  50621. el.setAttribute(key, value);
  50622. }
  50623. } else if (isEnumeratedAttr(key)) {
  50624. el.setAttribute(key, convertEnumeratedValue(key, value));
  50625. } else if (isXlink(key)) {
  50626. if (isFalsyAttrValue(value)) {
  50627. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50628. } else {
  50629. el.setAttributeNS(xlinkNS, key, value);
  50630. }
  50631. } else {
  50632. baseSetAttr(el, key, value);
  50633. }
  50634. }
  50635. function baseSetAttr (el, key, value) {
  50636. if (isFalsyAttrValue(value)) {
  50637. el.removeAttribute(key);
  50638. } else {
  50639. // #7138: IE10 & 11 fires input event when setting placeholder on
  50640. // <textarea>... block the first input event and remove the blocker
  50641. // immediately.
  50642. /* istanbul ignore if */
  50643. if (
  50644. isIE && !isIE9 &&
  50645. el.tagName === 'TEXTAREA' &&
  50646. key === 'placeholder' && value !== '' && !el.__ieph
  50647. ) {
  50648. var blocker = function (e) {
  50649. e.stopImmediatePropagation();
  50650. el.removeEventListener('input', blocker);
  50651. };
  50652. el.addEventListener('input', blocker);
  50653. // $flow-disable-line
  50654. el.__ieph = true; /* IE placeholder patched */
  50655. }
  50656. el.setAttribute(key, value);
  50657. }
  50658. }
  50659. var attrs = {
  50660. create: updateAttrs,
  50661. update: updateAttrs
  50662. };
  50663. /* */
  50664. function updateClass (oldVnode, vnode) {
  50665. var el = vnode.elm;
  50666. var data = vnode.data;
  50667. var oldData = oldVnode.data;
  50668. if (
  50669. isUndef(data.staticClass) &&
  50670. isUndef(data.class) && (
  50671. isUndef(oldData) || (
  50672. isUndef(oldData.staticClass) &&
  50673. isUndef(oldData.class)
  50674. )
  50675. )
  50676. ) {
  50677. return
  50678. }
  50679. var cls = genClassForVnode(vnode);
  50680. // handle transition classes
  50681. var transitionClass = el._transitionClasses;
  50682. if (isDef(transitionClass)) {
  50683. cls = concat(cls, stringifyClass(transitionClass));
  50684. }
  50685. // set the class
  50686. if (cls !== el._prevClass) {
  50687. el.setAttribute('class', cls);
  50688. el._prevClass = cls;
  50689. }
  50690. }
  50691. var klass = {
  50692. create: updateClass,
  50693. update: updateClass
  50694. };
  50695. /* */
  50696. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50697. function parseFilters (exp) {
  50698. var inSingle = false;
  50699. var inDouble = false;
  50700. var inTemplateString = false;
  50701. var inRegex = false;
  50702. var curly = 0;
  50703. var square = 0;
  50704. var paren = 0;
  50705. var lastFilterIndex = 0;
  50706. var c, prev, i, expression, filters;
  50707. for (i = 0; i < exp.length; i++) {
  50708. prev = c;
  50709. c = exp.charCodeAt(i);
  50710. if (inSingle) {
  50711. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50712. } else if (inDouble) {
  50713. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50714. } else if (inTemplateString) {
  50715. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50716. } else if (inRegex) {
  50717. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50718. } else if (
  50719. c === 0x7C && // pipe
  50720. exp.charCodeAt(i + 1) !== 0x7C &&
  50721. exp.charCodeAt(i - 1) !== 0x7C &&
  50722. !curly && !square && !paren
  50723. ) {
  50724. if (expression === undefined) {
  50725. // first filter, end of expression
  50726. lastFilterIndex = i + 1;
  50727. expression = exp.slice(0, i).trim();
  50728. } else {
  50729. pushFilter();
  50730. }
  50731. } else {
  50732. switch (c) {
  50733. case 0x22: inDouble = true; break // "
  50734. case 0x27: inSingle = true; break // '
  50735. case 0x60: inTemplateString = true; break // `
  50736. case 0x28: paren++; break // (
  50737. case 0x29: paren--; break // )
  50738. case 0x5B: square++; break // [
  50739. case 0x5D: square--; break // ]
  50740. case 0x7B: curly++; break // {
  50741. case 0x7D: curly--; break // }
  50742. }
  50743. if (c === 0x2f) { // /
  50744. var j = i - 1;
  50745. var p = (void 0);
  50746. // find first non-whitespace prev char
  50747. for (; j >= 0; j--) {
  50748. p = exp.charAt(j);
  50749. if (p !== ' ') { break }
  50750. }
  50751. if (!p || !validDivisionCharRE.test(p)) {
  50752. inRegex = true;
  50753. }
  50754. }
  50755. }
  50756. }
  50757. if (expression === undefined) {
  50758. expression = exp.slice(0, i).trim();
  50759. } else if (lastFilterIndex !== 0) {
  50760. pushFilter();
  50761. }
  50762. function pushFilter () {
  50763. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50764. lastFilterIndex = i + 1;
  50765. }
  50766. if (filters) {
  50767. for (i = 0; i < filters.length; i++) {
  50768. expression = wrapFilter(expression, filters[i]);
  50769. }
  50770. }
  50771. return expression
  50772. }
  50773. function wrapFilter (exp, filter) {
  50774. var i = filter.indexOf('(');
  50775. if (i < 0) {
  50776. // _f: resolveFilter
  50777. return ("_f(\"" + filter + "\")(" + exp + ")")
  50778. } else {
  50779. var name = filter.slice(0, i);
  50780. var args = filter.slice(i + 1);
  50781. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50782. }
  50783. }
  50784. /* */
  50785. /* eslint-disable no-unused-vars */
  50786. function baseWarn (msg, range) {
  50787. console.error(("[Vue compiler]: " + msg));
  50788. }
  50789. /* eslint-enable no-unused-vars */
  50790. function pluckModuleFunction (
  50791. modules,
  50792. key
  50793. ) {
  50794. return modules
  50795. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50796. : []
  50797. }
  50798. function addProp (el, name, value, range, dynamic) {
  50799. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50800. el.plain = false;
  50801. }
  50802. function addAttr (el, name, value, range, dynamic) {
  50803. var attrs = dynamic
  50804. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50805. : (el.attrs || (el.attrs = []));
  50806. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50807. el.plain = false;
  50808. }
  50809. // add a raw attr (use this in preTransforms)
  50810. function addRawAttr (el, name, value, range) {
  50811. el.attrsMap[name] = value;
  50812. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50813. }
  50814. function addDirective (
  50815. el,
  50816. name,
  50817. rawName,
  50818. value,
  50819. arg,
  50820. isDynamicArg,
  50821. modifiers,
  50822. range
  50823. ) {
  50824. (el.directives || (el.directives = [])).push(rangeSetItem({
  50825. name: name,
  50826. rawName: rawName,
  50827. value: value,
  50828. arg: arg,
  50829. isDynamicArg: isDynamicArg,
  50830. modifiers: modifiers
  50831. }, range));
  50832. el.plain = false;
  50833. }
  50834. function prependModifierMarker (symbol, name, dynamic) {
  50835. return dynamic
  50836. ? ("_p(" + name + ",\"" + symbol + "\")")
  50837. : symbol + name // mark the event as captured
  50838. }
  50839. function addHandler (
  50840. el,
  50841. name,
  50842. value,
  50843. modifiers,
  50844. important,
  50845. warn,
  50846. range,
  50847. dynamic
  50848. ) {
  50849. modifiers = modifiers || emptyObject;
  50850. // warn prevent and passive modifier
  50851. /* istanbul ignore if */
  50852. if (
  50853. warn &&
  50854. modifiers.prevent && modifiers.passive
  50855. ) {
  50856. warn(
  50857. 'passive and prevent can\'t be used together. ' +
  50858. 'Passive handler can\'t prevent default event.',
  50859. range
  50860. );
  50861. }
  50862. // normalize click.right and click.middle since they don't actually fire
  50863. // this is technically browser-specific, but at least for now browsers are
  50864. // the only target envs that have right/middle clicks.
  50865. if (modifiers.right) {
  50866. if (dynamic) {
  50867. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50868. } else if (name === 'click') {
  50869. name = 'contextmenu';
  50870. delete modifiers.right;
  50871. }
  50872. } else if (modifiers.middle) {
  50873. if (dynamic) {
  50874. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50875. } else if (name === 'click') {
  50876. name = 'mouseup';
  50877. }
  50878. }
  50879. // check capture modifier
  50880. if (modifiers.capture) {
  50881. delete modifiers.capture;
  50882. name = prependModifierMarker('!', name, dynamic);
  50883. }
  50884. if (modifiers.once) {
  50885. delete modifiers.once;
  50886. name = prependModifierMarker('~', name, dynamic);
  50887. }
  50888. /* istanbul ignore if */
  50889. if (modifiers.passive) {
  50890. delete modifiers.passive;
  50891. name = prependModifierMarker('&', name, dynamic);
  50892. }
  50893. var events;
  50894. if (modifiers.native) {
  50895. delete modifiers.native;
  50896. events = el.nativeEvents || (el.nativeEvents = {});
  50897. } else {
  50898. events = el.events || (el.events = {});
  50899. }
  50900. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50901. if (modifiers !== emptyObject) {
  50902. newHandler.modifiers = modifiers;
  50903. }
  50904. var handlers = events[name];
  50905. /* istanbul ignore if */
  50906. if (Array.isArray(handlers)) {
  50907. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50908. } else if (handlers) {
  50909. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50910. } else {
  50911. events[name] = newHandler;
  50912. }
  50913. el.plain = false;
  50914. }
  50915. function getRawBindingAttr (
  50916. el,
  50917. name
  50918. ) {
  50919. return el.rawAttrsMap[':' + name] ||
  50920. el.rawAttrsMap['v-bind:' + name] ||
  50921. el.rawAttrsMap[name]
  50922. }
  50923. function getBindingAttr (
  50924. el,
  50925. name,
  50926. getStatic
  50927. ) {
  50928. var dynamicValue =
  50929. getAndRemoveAttr(el, ':' + name) ||
  50930. getAndRemoveAttr(el, 'v-bind:' + name);
  50931. if (dynamicValue != null) {
  50932. return parseFilters(dynamicValue)
  50933. } else if (getStatic !== false) {
  50934. var staticValue = getAndRemoveAttr(el, name);
  50935. if (staticValue != null) {
  50936. return JSON.stringify(staticValue)
  50937. }
  50938. }
  50939. }
  50940. // note: this only removes the attr from the Array (attrsList) so that it
  50941. // doesn't get processed by processAttrs.
  50942. // By default it does NOT remove it from the map (attrsMap) because the map is
  50943. // needed during codegen.
  50944. function getAndRemoveAttr (
  50945. el,
  50946. name,
  50947. removeFromMap
  50948. ) {
  50949. var val;
  50950. if ((val = el.attrsMap[name]) != null) {
  50951. var list = el.attrsList;
  50952. for (var i = 0, l = list.length; i < l; i++) {
  50953. if (list[i].name === name) {
  50954. list.splice(i, 1);
  50955. break
  50956. }
  50957. }
  50958. }
  50959. if (removeFromMap) {
  50960. delete el.attrsMap[name];
  50961. }
  50962. return val
  50963. }
  50964. function getAndRemoveAttrByRegex (
  50965. el,
  50966. name
  50967. ) {
  50968. var list = el.attrsList;
  50969. for (var i = 0, l = list.length; i < l; i++) {
  50970. var attr = list[i];
  50971. if (name.test(attr.name)) {
  50972. list.splice(i, 1);
  50973. return attr
  50974. }
  50975. }
  50976. }
  50977. function rangeSetItem (
  50978. item,
  50979. range
  50980. ) {
  50981. if (range) {
  50982. if (range.start != null) {
  50983. item.start = range.start;
  50984. }
  50985. if (range.end != null) {
  50986. item.end = range.end;
  50987. }
  50988. }
  50989. return item
  50990. }
  50991. /* */
  50992. /**
  50993. * Cross-platform code generation for component v-model
  50994. */
  50995. function genComponentModel (
  50996. el,
  50997. value,
  50998. modifiers
  50999. ) {
  51000. var ref = modifiers || {};
  51001. var number = ref.number;
  51002. var trim = ref.trim;
  51003. var baseValueExpression = '$$v';
  51004. var valueExpression = baseValueExpression;
  51005. if (trim) {
  51006. valueExpression =
  51007. "(typeof " + baseValueExpression + " === 'string'" +
  51008. "? " + baseValueExpression + ".trim()" +
  51009. ": " + baseValueExpression + ")";
  51010. }
  51011. if (number) {
  51012. valueExpression = "_n(" + valueExpression + ")";
  51013. }
  51014. var assignment = genAssignmentCode(value, valueExpression);
  51015. el.model = {
  51016. value: ("(" + value + ")"),
  51017. expression: JSON.stringify(value),
  51018. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51019. };
  51020. }
  51021. /**
  51022. * Cross-platform codegen helper for generating v-model value assignment code.
  51023. */
  51024. function genAssignmentCode (
  51025. value,
  51026. assignment
  51027. ) {
  51028. var res = parseModel(value);
  51029. if (res.key === null) {
  51030. return (value + "=" + assignment)
  51031. } else {
  51032. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51033. }
  51034. }
  51035. /**
  51036. * Parse a v-model expression into a base path and a final key segment.
  51037. * Handles both dot-path and possible square brackets.
  51038. *
  51039. * Possible cases:
  51040. *
  51041. * - test
  51042. * - test[key]
  51043. * - test[test1[key]]
  51044. * - test["a"][key]
  51045. * - xxx.test[a[a].test1[key]]
  51046. * - test.xxx.a["asa"][test1[key]]
  51047. *
  51048. */
  51049. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51050. function parseModel (val) {
  51051. // Fix https://github.com/vuejs/vue/pull/7730
  51052. // allow v-model="obj.val " (trailing whitespace)
  51053. val = val.trim();
  51054. len = val.length;
  51055. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51056. index$1 = val.lastIndexOf('.');
  51057. if (index$1 > -1) {
  51058. return {
  51059. exp: val.slice(0, index$1),
  51060. key: '"' + val.slice(index$1 + 1) + '"'
  51061. }
  51062. } else {
  51063. return {
  51064. exp: val,
  51065. key: null
  51066. }
  51067. }
  51068. }
  51069. str = val;
  51070. index$1 = expressionPos = expressionEndPos = 0;
  51071. while (!eof()) {
  51072. chr = next();
  51073. /* istanbul ignore if */
  51074. if (isStringStart(chr)) {
  51075. parseString(chr);
  51076. } else if (chr === 0x5B) {
  51077. parseBracket(chr);
  51078. }
  51079. }
  51080. return {
  51081. exp: val.slice(0, expressionPos),
  51082. key: val.slice(expressionPos + 1, expressionEndPos)
  51083. }
  51084. }
  51085. function next () {
  51086. return str.charCodeAt(++index$1)
  51087. }
  51088. function eof () {
  51089. return index$1 >= len
  51090. }
  51091. function isStringStart (chr) {
  51092. return chr === 0x22 || chr === 0x27
  51093. }
  51094. function parseBracket (chr) {
  51095. var inBracket = 1;
  51096. expressionPos = index$1;
  51097. while (!eof()) {
  51098. chr = next();
  51099. if (isStringStart(chr)) {
  51100. parseString(chr);
  51101. continue
  51102. }
  51103. if (chr === 0x5B) { inBracket++; }
  51104. if (chr === 0x5D) { inBracket--; }
  51105. if (inBracket === 0) {
  51106. expressionEndPos = index$1;
  51107. break
  51108. }
  51109. }
  51110. }
  51111. function parseString (chr) {
  51112. var stringQuote = chr;
  51113. while (!eof()) {
  51114. chr = next();
  51115. if (chr === stringQuote) {
  51116. break
  51117. }
  51118. }
  51119. }
  51120. /* */
  51121. var warn$1;
  51122. // in some cases, the event used has to be determined at runtime
  51123. // so we used some reserved tokens during compile.
  51124. var RANGE_TOKEN = '__r';
  51125. var CHECKBOX_RADIO_TOKEN = '__c';
  51126. function model (
  51127. el,
  51128. dir,
  51129. _warn
  51130. ) {
  51131. warn$1 = _warn;
  51132. var value = dir.value;
  51133. var modifiers = dir.modifiers;
  51134. var tag = el.tag;
  51135. var type = el.attrsMap.type;
  51136. {
  51137. // inputs with type="file" are read only and setting the input's
  51138. // value will throw an error.
  51139. if (tag === 'input' && type === 'file') {
  51140. warn$1(
  51141. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51142. "File inputs are read only. Use a v-on:change listener instead.",
  51143. el.rawAttrsMap['v-model']
  51144. );
  51145. }
  51146. }
  51147. if (el.component) {
  51148. genComponentModel(el, value, modifiers);
  51149. // component v-model doesn't need extra runtime
  51150. return false
  51151. } else if (tag === 'select') {
  51152. genSelect(el, value, modifiers);
  51153. } else if (tag === 'input' && type === 'checkbox') {
  51154. genCheckboxModel(el, value, modifiers);
  51155. } else if (tag === 'input' && type === 'radio') {
  51156. genRadioModel(el, value, modifiers);
  51157. } else if (tag === 'input' || tag === 'textarea') {
  51158. genDefaultModel(el, value, modifiers);
  51159. } else if (!config.isReservedTag(tag)) {
  51160. genComponentModel(el, value, modifiers);
  51161. // component v-model doesn't need extra runtime
  51162. return false
  51163. } else {
  51164. warn$1(
  51165. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51166. "v-model is not supported on this element type. " +
  51167. 'If you are working with contenteditable, it\'s recommended to ' +
  51168. 'wrap a library dedicated for that purpose inside a custom component.',
  51169. el.rawAttrsMap['v-model']
  51170. );
  51171. }
  51172. // ensure runtime directive metadata
  51173. return true
  51174. }
  51175. function genCheckboxModel (
  51176. el,
  51177. value,
  51178. modifiers
  51179. ) {
  51180. var number = modifiers && modifiers.number;
  51181. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51182. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51183. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51184. addProp(el, 'checked',
  51185. "Array.isArray(" + value + ")" +
  51186. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51187. trueValueBinding === 'true'
  51188. ? (":(" + value + ")")
  51189. : (":_q(" + value + "," + trueValueBinding + ")")
  51190. )
  51191. );
  51192. addHandler(el, 'change',
  51193. "var $$a=" + value + "," +
  51194. '$$el=$event.target,' +
  51195. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51196. 'if(Array.isArray($$a)){' +
  51197. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51198. '$$i=_i($$a,$$v);' +
  51199. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51200. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51201. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51202. null, true
  51203. );
  51204. }
  51205. function genRadioModel (
  51206. el,
  51207. value,
  51208. modifiers
  51209. ) {
  51210. var number = modifiers && modifiers.number;
  51211. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51212. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51213. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51214. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51215. }
  51216. function genSelect (
  51217. el,
  51218. value,
  51219. modifiers
  51220. ) {
  51221. var number = modifiers && modifiers.number;
  51222. var selectedVal = "Array.prototype.filter" +
  51223. ".call($event.target.options,function(o){return o.selected})" +
  51224. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51225. "return " + (number ? '_n(val)' : 'val') + "})";
  51226. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51227. var code = "var $$selectedVal = " + selectedVal + ";";
  51228. code = code + " " + (genAssignmentCode(value, assignment));
  51229. addHandler(el, 'change', code, null, true);
  51230. }
  51231. function genDefaultModel (
  51232. el,
  51233. value,
  51234. modifiers
  51235. ) {
  51236. var type = el.attrsMap.type;
  51237. // warn if v-bind:value conflicts with v-model
  51238. // except for inputs with v-bind:type
  51239. {
  51240. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51241. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51242. if (value$1 && !typeBinding) {
  51243. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51244. warn$1(
  51245. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51246. 'because the latter already expands to a value binding internally',
  51247. el.rawAttrsMap[binding]
  51248. );
  51249. }
  51250. }
  51251. var ref = modifiers || {};
  51252. var lazy = ref.lazy;
  51253. var number = ref.number;
  51254. var trim = ref.trim;
  51255. var needCompositionGuard = !lazy && type !== 'range';
  51256. var event = lazy
  51257. ? 'change'
  51258. : type === 'range'
  51259. ? RANGE_TOKEN
  51260. : 'input';
  51261. var valueExpression = '$event.target.value';
  51262. if (trim) {
  51263. valueExpression = "$event.target.value.trim()";
  51264. }
  51265. if (number) {
  51266. valueExpression = "_n(" + valueExpression + ")";
  51267. }
  51268. var code = genAssignmentCode(value, valueExpression);
  51269. if (needCompositionGuard) {
  51270. code = "if($event.target.composing)return;" + code;
  51271. }
  51272. addProp(el, 'value', ("(" + value + ")"));
  51273. addHandler(el, event, code, null, true);
  51274. if (trim || number) {
  51275. addHandler(el, 'blur', '$forceUpdate()');
  51276. }
  51277. }
  51278. /* */
  51279. // normalize v-model event tokens that can only be determined at runtime.
  51280. // it's important to place the event as the first in the array because
  51281. // the whole point is ensuring the v-model callback gets called before
  51282. // user-attached handlers.
  51283. function normalizeEvents (on) {
  51284. /* istanbul ignore if */
  51285. if (isDef(on[RANGE_TOKEN])) {
  51286. // IE input[type=range] only supports `change` event
  51287. var event = isIE ? 'change' : 'input';
  51288. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51289. delete on[RANGE_TOKEN];
  51290. }
  51291. // This was originally intended to fix #4521 but no longer necessary
  51292. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51293. /* istanbul ignore if */
  51294. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51295. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51296. delete on[CHECKBOX_RADIO_TOKEN];
  51297. }
  51298. }
  51299. var target$1;
  51300. function createOnceHandler$1 (event, handler, capture) {
  51301. var _target = target$1; // save current target element in closure
  51302. return function onceHandler () {
  51303. var res = handler.apply(null, arguments);
  51304. if (res !== null) {
  51305. remove$2(event, onceHandler, capture, _target);
  51306. }
  51307. }
  51308. }
  51309. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51310. // implementation and does not fire microtasks in between event propagation, so
  51311. // safe to exclude.
  51312. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51313. function add$1 (
  51314. name,
  51315. handler,
  51316. capture,
  51317. passive
  51318. ) {
  51319. // async edge case #6566: inner click event triggers patch, event handler
  51320. // attached to outer element during patch, and triggered again. This
  51321. // happens because browsers fire microtask ticks between event propagation.
  51322. // the solution is simple: we save the timestamp when a handler is attached,
  51323. // and the handler would only fire if the event passed to it was fired
  51324. // AFTER it was attached.
  51325. if (useMicrotaskFix) {
  51326. var attachedTimestamp = currentFlushTimestamp;
  51327. var original = handler;
  51328. handler = original._wrapper = function (e) {
  51329. if (
  51330. // no bubbling, should always fire.
  51331. // this is just a safety net in case event.timeStamp is unreliable in
  51332. // certain weird environments...
  51333. e.target === e.currentTarget ||
  51334. // event is fired after handler attachment
  51335. e.timeStamp >= attachedTimestamp ||
  51336. // bail for environments that have buggy event.timeStamp implementations
  51337. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51338. // #9681 QtWebEngine event.timeStamp is negative value
  51339. e.timeStamp <= 0 ||
  51340. // #9448 bail if event is fired in another document in a multi-page
  51341. // electron/nw.js app, since event.timeStamp will be using a different
  51342. // starting reference
  51343. e.target.ownerDocument !== document
  51344. ) {
  51345. return original.apply(this, arguments)
  51346. }
  51347. };
  51348. }
  51349. target$1.addEventListener(
  51350. name,
  51351. handler,
  51352. supportsPassive
  51353. ? { capture: capture, passive: passive }
  51354. : capture
  51355. );
  51356. }
  51357. function remove$2 (
  51358. name,
  51359. handler,
  51360. capture,
  51361. _target
  51362. ) {
  51363. (_target || target$1).removeEventListener(
  51364. name,
  51365. handler._wrapper || handler,
  51366. capture
  51367. );
  51368. }
  51369. function updateDOMListeners (oldVnode, vnode) {
  51370. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51371. return
  51372. }
  51373. var on = vnode.data.on || {};
  51374. var oldOn = oldVnode.data.on || {};
  51375. target$1 = vnode.elm;
  51376. normalizeEvents(on);
  51377. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51378. target$1 = undefined;
  51379. }
  51380. var events = {
  51381. create: updateDOMListeners,
  51382. update: updateDOMListeners
  51383. };
  51384. /* */
  51385. var svgContainer;
  51386. function updateDOMProps (oldVnode, vnode) {
  51387. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51388. return
  51389. }
  51390. var key, cur;
  51391. var elm = vnode.elm;
  51392. var oldProps = oldVnode.data.domProps || {};
  51393. var props = vnode.data.domProps || {};
  51394. // clone observed objects, as the user probably wants to mutate it
  51395. if (isDef(props.__ob__)) {
  51396. props = vnode.data.domProps = extend({}, props);
  51397. }
  51398. for (key in oldProps) {
  51399. if (!(key in props)) {
  51400. elm[key] = '';
  51401. }
  51402. }
  51403. for (key in props) {
  51404. cur = props[key];
  51405. // ignore children if the node has textContent or innerHTML,
  51406. // as these will throw away existing DOM nodes and cause removal errors
  51407. // on subsequent patches (#3360)
  51408. if (key === 'textContent' || key === 'innerHTML') {
  51409. if (vnode.children) { vnode.children.length = 0; }
  51410. if (cur === oldProps[key]) { continue }
  51411. // #6601 work around Chrome version <= 55 bug where single textNode
  51412. // replaced by innerHTML/textContent retains its parentNode property
  51413. if (elm.childNodes.length === 1) {
  51414. elm.removeChild(elm.childNodes[0]);
  51415. }
  51416. }
  51417. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51418. // store value as _value as well since
  51419. // non-string values will be stringified
  51420. elm._value = cur;
  51421. // avoid resetting cursor position when value is the same
  51422. var strCur = isUndef(cur) ? '' : String(cur);
  51423. if (shouldUpdateValue(elm, strCur)) {
  51424. elm.value = strCur;
  51425. }
  51426. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51427. // IE doesn't support innerHTML for SVG elements
  51428. svgContainer = svgContainer || document.createElement('div');
  51429. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51430. var svg = svgContainer.firstChild;
  51431. while (elm.firstChild) {
  51432. elm.removeChild(elm.firstChild);
  51433. }
  51434. while (svg.firstChild) {
  51435. elm.appendChild(svg.firstChild);
  51436. }
  51437. } else if (
  51438. // skip the update if old and new VDOM state is the same.
  51439. // `value` is handled separately because the DOM value may be temporarily
  51440. // out of sync with VDOM state due to focus, composition and modifiers.
  51441. // This #4521 by skipping the unnecesarry `checked` update.
  51442. cur !== oldProps[key]
  51443. ) {
  51444. // some property updates can throw
  51445. // e.g. `value` on <progress> w/ non-finite value
  51446. try {
  51447. elm[key] = cur;
  51448. } catch (e) {}
  51449. }
  51450. }
  51451. }
  51452. // check platforms/web/util/attrs.js acceptValue
  51453. function shouldUpdateValue (elm, checkVal) {
  51454. return (!elm.composing && (
  51455. elm.tagName === 'OPTION' ||
  51456. isNotInFocusAndDirty(elm, checkVal) ||
  51457. isDirtyWithModifiers(elm, checkVal)
  51458. ))
  51459. }
  51460. function isNotInFocusAndDirty (elm, checkVal) {
  51461. // return true when textbox (.number and .trim) loses focus and its value is
  51462. // not equal to the updated value
  51463. var notInFocus = true;
  51464. // #6157
  51465. // work around IE bug when accessing document.activeElement in an iframe
  51466. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51467. return notInFocus && elm.value !== checkVal
  51468. }
  51469. function isDirtyWithModifiers (elm, newVal) {
  51470. var value = elm.value;
  51471. var modifiers = elm._vModifiers; // injected by v-model runtime
  51472. if (isDef(modifiers)) {
  51473. if (modifiers.number) {
  51474. return toNumber(value) !== toNumber(newVal)
  51475. }
  51476. if (modifiers.trim) {
  51477. return value.trim() !== newVal.trim()
  51478. }
  51479. }
  51480. return value !== newVal
  51481. }
  51482. var domProps = {
  51483. create: updateDOMProps,
  51484. update: updateDOMProps
  51485. };
  51486. /* */
  51487. var parseStyleText = cached(function (cssText) {
  51488. var res = {};
  51489. var listDelimiter = /;(?![^(]*\))/g;
  51490. var propertyDelimiter = /:(.+)/;
  51491. cssText.split(listDelimiter).forEach(function (item) {
  51492. if (item) {
  51493. var tmp = item.split(propertyDelimiter);
  51494. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51495. }
  51496. });
  51497. return res
  51498. });
  51499. // merge static and dynamic style data on the same vnode
  51500. function normalizeStyleData (data) {
  51501. var style = normalizeStyleBinding(data.style);
  51502. // static style is pre-processed into an object during compilation
  51503. // and is always a fresh object, so it's safe to merge into it
  51504. return data.staticStyle
  51505. ? extend(data.staticStyle, style)
  51506. : style
  51507. }
  51508. // normalize possible array / string values into Object
  51509. function normalizeStyleBinding (bindingStyle) {
  51510. if (Array.isArray(bindingStyle)) {
  51511. return toObject(bindingStyle)
  51512. }
  51513. if (typeof bindingStyle === 'string') {
  51514. return parseStyleText(bindingStyle)
  51515. }
  51516. return bindingStyle
  51517. }
  51518. /**
  51519. * parent component style should be after child's
  51520. * so that parent component's style could override it
  51521. */
  51522. function getStyle (vnode, checkChild) {
  51523. var res = {};
  51524. var styleData;
  51525. if (checkChild) {
  51526. var childNode = vnode;
  51527. while (childNode.componentInstance) {
  51528. childNode = childNode.componentInstance._vnode;
  51529. if (
  51530. childNode && childNode.data &&
  51531. (styleData = normalizeStyleData(childNode.data))
  51532. ) {
  51533. extend(res, styleData);
  51534. }
  51535. }
  51536. }
  51537. if ((styleData = normalizeStyleData(vnode.data))) {
  51538. extend(res, styleData);
  51539. }
  51540. var parentNode = vnode;
  51541. while ((parentNode = parentNode.parent)) {
  51542. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51543. extend(res, styleData);
  51544. }
  51545. }
  51546. return res
  51547. }
  51548. /* */
  51549. var cssVarRE = /^--/;
  51550. var importantRE = /\s*!important$/;
  51551. var setProp = function (el, name, val) {
  51552. /* istanbul ignore if */
  51553. if (cssVarRE.test(name)) {
  51554. el.style.setProperty(name, val);
  51555. } else if (importantRE.test(val)) {
  51556. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51557. } else {
  51558. var normalizedName = normalize(name);
  51559. if (Array.isArray(val)) {
  51560. // Support values array created by autoprefixer, e.g.
  51561. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51562. // Set them one by one, and the browser will only set those it can recognize
  51563. for (var i = 0, len = val.length; i < len; i++) {
  51564. el.style[normalizedName] = val[i];
  51565. }
  51566. } else {
  51567. el.style[normalizedName] = val;
  51568. }
  51569. }
  51570. };
  51571. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51572. var emptyStyle;
  51573. var normalize = cached(function (prop) {
  51574. emptyStyle = emptyStyle || document.createElement('div').style;
  51575. prop = camelize(prop);
  51576. if (prop !== 'filter' && (prop in emptyStyle)) {
  51577. return prop
  51578. }
  51579. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51580. for (var i = 0; i < vendorNames.length; i++) {
  51581. var name = vendorNames[i] + capName;
  51582. if (name in emptyStyle) {
  51583. return name
  51584. }
  51585. }
  51586. });
  51587. function updateStyle (oldVnode, vnode) {
  51588. var data = vnode.data;
  51589. var oldData = oldVnode.data;
  51590. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51591. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51592. ) {
  51593. return
  51594. }
  51595. var cur, name;
  51596. var el = vnode.elm;
  51597. var oldStaticStyle = oldData.staticStyle;
  51598. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51599. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51600. var oldStyle = oldStaticStyle || oldStyleBinding;
  51601. var style = normalizeStyleBinding(vnode.data.style) || {};
  51602. // store normalized style under a different key for next diff
  51603. // make sure to clone it if it's reactive, since the user likely wants
  51604. // to mutate it.
  51605. vnode.data.normalizedStyle = isDef(style.__ob__)
  51606. ? extend({}, style)
  51607. : style;
  51608. var newStyle = getStyle(vnode, true);
  51609. for (name in oldStyle) {
  51610. if (isUndef(newStyle[name])) {
  51611. setProp(el, name, '');
  51612. }
  51613. }
  51614. for (name in newStyle) {
  51615. cur = newStyle[name];
  51616. if (cur !== oldStyle[name]) {
  51617. // ie9 setting to null has no effect, must use empty string
  51618. setProp(el, name, cur == null ? '' : cur);
  51619. }
  51620. }
  51621. }
  51622. var style = {
  51623. create: updateStyle,
  51624. update: updateStyle
  51625. };
  51626. /* */
  51627. var whitespaceRE = /\s+/;
  51628. /**
  51629. * Add class with compatibility for SVG since classList is not supported on
  51630. * SVG elements in IE
  51631. */
  51632. function addClass (el, cls) {
  51633. /* istanbul ignore if */
  51634. if (!cls || !(cls = cls.trim())) {
  51635. return
  51636. }
  51637. /* istanbul ignore else */
  51638. if (el.classList) {
  51639. if (cls.indexOf(' ') > -1) {
  51640. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51641. } else {
  51642. el.classList.add(cls);
  51643. }
  51644. } else {
  51645. var cur = " " + (el.getAttribute('class') || '') + " ";
  51646. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51647. el.setAttribute('class', (cur + cls).trim());
  51648. }
  51649. }
  51650. }
  51651. /**
  51652. * Remove class with compatibility for SVG since classList is not supported on
  51653. * SVG elements in IE
  51654. */
  51655. function removeClass (el, cls) {
  51656. /* istanbul ignore if */
  51657. if (!cls || !(cls = cls.trim())) {
  51658. return
  51659. }
  51660. /* istanbul ignore else */
  51661. if (el.classList) {
  51662. if (cls.indexOf(' ') > -1) {
  51663. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51664. } else {
  51665. el.classList.remove(cls);
  51666. }
  51667. if (!el.classList.length) {
  51668. el.removeAttribute('class');
  51669. }
  51670. } else {
  51671. var cur = " " + (el.getAttribute('class') || '') + " ";
  51672. var tar = ' ' + cls + ' ';
  51673. while (cur.indexOf(tar) >= 0) {
  51674. cur = cur.replace(tar, ' ');
  51675. }
  51676. cur = cur.trim();
  51677. if (cur) {
  51678. el.setAttribute('class', cur);
  51679. } else {
  51680. el.removeAttribute('class');
  51681. }
  51682. }
  51683. }
  51684. /* */
  51685. function resolveTransition (def$$1) {
  51686. if (!def$$1) {
  51687. return
  51688. }
  51689. /* istanbul ignore else */
  51690. if (typeof def$$1 === 'object') {
  51691. var res = {};
  51692. if (def$$1.css !== false) {
  51693. extend(res, autoCssTransition(def$$1.name || 'v'));
  51694. }
  51695. extend(res, def$$1);
  51696. return res
  51697. } else if (typeof def$$1 === 'string') {
  51698. return autoCssTransition(def$$1)
  51699. }
  51700. }
  51701. var autoCssTransition = cached(function (name) {
  51702. return {
  51703. enterClass: (name + "-enter"),
  51704. enterToClass: (name + "-enter-to"),
  51705. enterActiveClass: (name + "-enter-active"),
  51706. leaveClass: (name + "-leave"),
  51707. leaveToClass: (name + "-leave-to"),
  51708. leaveActiveClass: (name + "-leave-active")
  51709. }
  51710. });
  51711. var hasTransition = inBrowser && !isIE9;
  51712. var TRANSITION = 'transition';
  51713. var ANIMATION = 'animation';
  51714. // Transition property/event sniffing
  51715. var transitionProp = 'transition';
  51716. var transitionEndEvent = 'transitionend';
  51717. var animationProp = 'animation';
  51718. var animationEndEvent = 'animationend';
  51719. if (hasTransition) {
  51720. /* istanbul ignore if */
  51721. if (window.ontransitionend === undefined &&
  51722. window.onwebkittransitionend !== undefined
  51723. ) {
  51724. transitionProp = 'WebkitTransition';
  51725. transitionEndEvent = 'webkitTransitionEnd';
  51726. }
  51727. if (window.onanimationend === undefined &&
  51728. window.onwebkitanimationend !== undefined
  51729. ) {
  51730. animationProp = 'WebkitAnimation';
  51731. animationEndEvent = 'webkitAnimationEnd';
  51732. }
  51733. }
  51734. // binding to window is necessary to make hot reload work in IE in strict mode
  51735. var raf = inBrowser
  51736. ? window.requestAnimationFrame
  51737. ? window.requestAnimationFrame.bind(window)
  51738. : setTimeout
  51739. : /* istanbul ignore next */ function (fn) { return fn(); };
  51740. function nextFrame (fn) {
  51741. raf(function () {
  51742. raf(fn);
  51743. });
  51744. }
  51745. function addTransitionClass (el, cls) {
  51746. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51747. if (transitionClasses.indexOf(cls) < 0) {
  51748. transitionClasses.push(cls);
  51749. addClass(el, cls);
  51750. }
  51751. }
  51752. function removeTransitionClass (el, cls) {
  51753. if (el._transitionClasses) {
  51754. remove(el._transitionClasses, cls);
  51755. }
  51756. removeClass(el, cls);
  51757. }
  51758. function whenTransitionEnds (
  51759. el,
  51760. expectedType,
  51761. cb
  51762. ) {
  51763. var ref = getTransitionInfo(el, expectedType);
  51764. var type = ref.type;
  51765. var timeout = ref.timeout;
  51766. var propCount = ref.propCount;
  51767. if (!type) { return cb() }
  51768. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51769. var ended = 0;
  51770. var end = function () {
  51771. el.removeEventListener(event, onEnd);
  51772. cb();
  51773. };
  51774. var onEnd = function (e) {
  51775. if (e.target === el) {
  51776. if (++ended >= propCount) {
  51777. end();
  51778. }
  51779. }
  51780. };
  51781. setTimeout(function () {
  51782. if (ended < propCount) {
  51783. end();
  51784. }
  51785. }, timeout + 1);
  51786. el.addEventListener(event, onEnd);
  51787. }
  51788. var transformRE = /\b(transform|all)(,|$)/;
  51789. function getTransitionInfo (el, expectedType) {
  51790. var styles = window.getComputedStyle(el);
  51791. // JSDOM may return undefined for transition properties
  51792. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51793. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51794. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51795. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51796. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51797. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51798. var type;
  51799. var timeout = 0;
  51800. var propCount = 0;
  51801. /* istanbul ignore if */
  51802. if (expectedType === TRANSITION) {
  51803. if (transitionTimeout > 0) {
  51804. type = TRANSITION;
  51805. timeout = transitionTimeout;
  51806. propCount = transitionDurations.length;
  51807. }
  51808. } else if (expectedType === ANIMATION) {
  51809. if (animationTimeout > 0) {
  51810. type = ANIMATION;
  51811. timeout = animationTimeout;
  51812. propCount = animationDurations.length;
  51813. }
  51814. } else {
  51815. timeout = Math.max(transitionTimeout, animationTimeout);
  51816. type = timeout > 0
  51817. ? transitionTimeout > animationTimeout
  51818. ? TRANSITION
  51819. : ANIMATION
  51820. : null;
  51821. propCount = type
  51822. ? type === TRANSITION
  51823. ? transitionDurations.length
  51824. : animationDurations.length
  51825. : 0;
  51826. }
  51827. var hasTransform =
  51828. type === TRANSITION &&
  51829. transformRE.test(styles[transitionProp + 'Property']);
  51830. return {
  51831. type: type,
  51832. timeout: timeout,
  51833. propCount: propCount,
  51834. hasTransform: hasTransform
  51835. }
  51836. }
  51837. function getTimeout (delays, durations) {
  51838. /* istanbul ignore next */
  51839. while (delays.length < durations.length) {
  51840. delays = delays.concat(delays);
  51841. }
  51842. return Math.max.apply(null, durations.map(function (d, i) {
  51843. return toMs(d) + toMs(delays[i])
  51844. }))
  51845. }
  51846. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51847. // in a locale-dependent way, using a comma instead of a dot.
  51848. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51849. // as a floor function) causing unexpected behaviors
  51850. function toMs (s) {
  51851. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51852. }
  51853. /* */
  51854. function enter (vnode, toggleDisplay) {
  51855. var el = vnode.elm;
  51856. // call leave callback now
  51857. if (isDef(el._leaveCb)) {
  51858. el._leaveCb.cancelled = true;
  51859. el._leaveCb();
  51860. }
  51861. var data = resolveTransition(vnode.data.transition);
  51862. if (isUndef(data)) {
  51863. return
  51864. }
  51865. /* istanbul ignore if */
  51866. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51867. return
  51868. }
  51869. var css = data.css;
  51870. var type = data.type;
  51871. var enterClass = data.enterClass;
  51872. var enterToClass = data.enterToClass;
  51873. var enterActiveClass = data.enterActiveClass;
  51874. var appearClass = data.appearClass;
  51875. var appearToClass = data.appearToClass;
  51876. var appearActiveClass = data.appearActiveClass;
  51877. var beforeEnter = data.beforeEnter;
  51878. var enter = data.enter;
  51879. var afterEnter = data.afterEnter;
  51880. var enterCancelled = data.enterCancelled;
  51881. var beforeAppear = data.beforeAppear;
  51882. var appear = data.appear;
  51883. var afterAppear = data.afterAppear;
  51884. var appearCancelled = data.appearCancelled;
  51885. var duration = data.duration;
  51886. // activeInstance will always be the <transition> component managing this
  51887. // transition. One edge case to check is when the <transition> is placed
  51888. // as the root node of a child component. In that case we need to check
  51889. // <transition>'s parent for appear check.
  51890. var context = activeInstance;
  51891. var transitionNode = activeInstance.$vnode;
  51892. while (transitionNode && transitionNode.parent) {
  51893. context = transitionNode.context;
  51894. transitionNode = transitionNode.parent;
  51895. }
  51896. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51897. if (isAppear && !appear && appear !== '') {
  51898. return
  51899. }
  51900. var startClass = isAppear && appearClass
  51901. ? appearClass
  51902. : enterClass;
  51903. var activeClass = isAppear && appearActiveClass
  51904. ? appearActiveClass
  51905. : enterActiveClass;
  51906. var toClass = isAppear && appearToClass
  51907. ? appearToClass
  51908. : enterToClass;
  51909. var beforeEnterHook = isAppear
  51910. ? (beforeAppear || beforeEnter)
  51911. : beforeEnter;
  51912. var enterHook = isAppear
  51913. ? (typeof appear === 'function' ? appear : enter)
  51914. : enter;
  51915. var afterEnterHook = isAppear
  51916. ? (afterAppear || afterEnter)
  51917. : afterEnter;
  51918. var enterCancelledHook = isAppear
  51919. ? (appearCancelled || enterCancelled)
  51920. : enterCancelled;
  51921. var explicitEnterDuration = toNumber(
  51922. isObject(duration)
  51923. ? duration.enter
  51924. : duration
  51925. );
  51926. if (explicitEnterDuration != null) {
  51927. checkDuration(explicitEnterDuration, 'enter', vnode);
  51928. }
  51929. var expectsCSS = css !== false && !isIE9;
  51930. var userWantsControl = getHookArgumentsLength(enterHook);
  51931. var cb = el._enterCb = once(function () {
  51932. if (expectsCSS) {
  51933. removeTransitionClass(el, toClass);
  51934. removeTransitionClass(el, activeClass);
  51935. }
  51936. if (cb.cancelled) {
  51937. if (expectsCSS) {
  51938. removeTransitionClass(el, startClass);
  51939. }
  51940. enterCancelledHook && enterCancelledHook(el);
  51941. } else {
  51942. afterEnterHook && afterEnterHook(el);
  51943. }
  51944. el._enterCb = null;
  51945. });
  51946. if (!vnode.data.show) {
  51947. // remove pending leave element on enter by injecting an insert hook
  51948. mergeVNodeHook(vnode, 'insert', function () {
  51949. var parent = el.parentNode;
  51950. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51951. if (pendingNode &&
  51952. pendingNode.tag === vnode.tag &&
  51953. pendingNode.elm._leaveCb
  51954. ) {
  51955. pendingNode.elm._leaveCb();
  51956. }
  51957. enterHook && enterHook(el, cb);
  51958. });
  51959. }
  51960. // start enter transition
  51961. beforeEnterHook && beforeEnterHook(el);
  51962. if (expectsCSS) {
  51963. addTransitionClass(el, startClass);
  51964. addTransitionClass(el, activeClass);
  51965. nextFrame(function () {
  51966. removeTransitionClass(el, startClass);
  51967. if (!cb.cancelled) {
  51968. addTransitionClass(el, toClass);
  51969. if (!userWantsControl) {
  51970. if (isValidDuration(explicitEnterDuration)) {
  51971. setTimeout(cb, explicitEnterDuration);
  51972. } else {
  51973. whenTransitionEnds(el, type, cb);
  51974. }
  51975. }
  51976. }
  51977. });
  51978. }
  51979. if (vnode.data.show) {
  51980. toggleDisplay && toggleDisplay();
  51981. enterHook && enterHook(el, cb);
  51982. }
  51983. if (!expectsCSS && !userWantsControl) {
  51984. cb();
  51985. }
  51986. }
  51987. function leave (vnode, rm) {
  51988. var el = vnode.elm;
  51989. // call enter callback now
  51990. if (isDef(el._enterCb)) {
  51991. el._enterCb.cancelled = true;
  51992. el._enterCb();
  51993. }
  51994. var data = resolveTransition(vnode.data.transition);
  51995. if (isUndef(data) || el.nodeType !== 1) {
  51996. return rm()
  51997. }
  51998. /* istanbul ignore if */
  51999. if (isDef(el._leaveCb)) {
  52000. return
  52001. }
  52002. var css = data.css;
  52003. var type = data.type;
  52004. var leaveClass = data.leaveClass;
  52005. var leaveToClass = data.leaveToClass;
  52006. var leaveActiveClass = data.leaveActiveClass;
  52007. var beforeLeave = data.beforeLeave;
  52008. var leave = data.leave;
  52009. var afterLeave = data.afterLeave;
  52010. var leaveCancelled = data.leaveCancelled;
  52011. var delayLeave = data.delayLeave;
  52012. var duration = data.duration;
  52013. var expectsCSS = css !== false && !isIE9;
  52014. var userWantsControl = getHookArgumentsLength(leave);
  52015. var explicitLeaveDuration = toNumber(
  52016. isObject(duration)
  52017. ? duration.leave
  52018. : duration
  52019. );
  52020. if (isDef(explicitLeaveDuration)) {
  52021. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52022. }
  52023. var cb = el._leaveCb = once(function () {
  52024. if (el.parentNode && el.parentNode._pending) {
  52025. el.parentNode._pending[vnode.key] = null;
  52026. }
  52027. if (expectsCSS) {
  52028. removeTransitionClass(el, leaveToClass);
  52029. removeTransitionClass(el, leaveActiveClass);
  52030. }
  52031. if (cb.cancelled) {
  52032. if (expectsCSS) {
  52033. removeTransitionClass(el, leaveClass);
  52034. }
  52035. leaveCancelled && leaveCancelled(el);
  52036. } else {
  52037. rm();
  52038. afterLeave && afterLeave(el);
  52039. }
  52040. el._leaveCb = null;
  52041. });
  52042. if (delayLeave) {
  52043. delayLeave(performLeave);
  52044. } else {
  52045. performLeave();
  52046. }
  52047. function performLeave () {
  52048. // the delayed leave may have already been cancelled
  52049. if (cb.cancelled) {
  52050. return
  52051. }
  52052. // record leaving element
  52053. if (!vnode.data.show && el.parentNode) {
  52054. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52055. }
  52056. beforeLeave && beforeLeave(el);
  52057. if (expectsCSS) {
  52058. addTransitionClass(el, leaveClass);
  52059. addTransitionClass(el, leaveActiveClass);
  52060. nextFrame(function () {
  52061. removeTransitionClass(el, leaveClass);
  52062. if (!cb.cancelled) {
  52063. addTransitionClass(el, leaveToClass);
  52064. if (!userWantsControl) {
  52065. if (isValidDuration(explicitLeaveDuration)) {
  52066. setTimeout(cb, explicitLeaveDuration);
  52067. } else {
  52068. whenTransitionEnds(el, type, cb);
  52069. }
  52070. }
  52071. }
  52072. });
  52073. }
  52074. leave && leave(el, cb);
  52075. if (!expectsCSS && !userWantsControl) {
  52076. cb();
  52077. }
  52078. }
  52079. }
  52080. // only used in dev mode
  52081. function checkDuration (val, name, vnode) {
  52082. if (typeof val !== 'number') {
  52083. warn(
  52084. "<transition> explicit " + name + " duration is not a valid number - " +
  52085. "got " + (JSON.stringify(val)) + ".",
  52086. vnode.context
  52087. );
  52088. } else if (isNaN(val)) {
  52089. warn(
  52090. "<transition> explicit " + name + " duration is NaN - " +
  52091. 'the duration expression might be incorrect.',
  52092. vnode.context
  52093. );
  52094. }
  52095. }
  52096. function isValidDuration (val) {
  52097. return typeof val === 'number' && !isNaN(val)
  52098. }
  52099. /**
  52100. * Normalize a transition hook's argument length. The hook may be:
  52101. * - a merged hook (invoker) with the original in .fns
  52102. * - a wrapped component method (check ._length)
  52103. * - a plain function (.length)
  52104. */
  52105. function getHookArgumentsLength (fn) {
  52106. if (isUndef(fn)) {
  52107. return false
  52108. }
  52109. var invokerFns = fn.fns;
  52110. if (isDef(invokerFns)) {
  52111. // invoker
  52112. return getHookArgumentsLength(
  52113. Array.isArray(invokerFns)
  52114. ? invokerFns[0]
  52115. : invokerFns
  52116. )
  52117. } else {
  52118. return (fn._length || fn.length) > 1
  52119. }
  52120. }
  52121. function _enter (_, vnode) {
  52122. if (vnode.data.show !== true) {
  52123. enter(vnode);
  52124. }
  52125. }
  52126. var transition = inBrowser ? {
  52127. create: _enter,
  52128. activate: _enter,
  52129. remove: function remove$$1 (vnode, rm) {
  52130. /* istanbul ignore else */
  52131. if (vnode.data.show !== true) {
  52132. leave(vnode, rm);
  52133. } else {
  52134. rm();
  52135. }
  52136. }
  52137. } : {};
  52138. var platformModules = [
  52139. attrs,
  52140. klass,
  52141. events,
  52142. domProps,
  52143. style,
  52144. transition
  52145. ];
  52146. /* */
  52147. // the directive module should be applied last, after all
  52148. // built-in modules have been applied.
  52149. var modules = platformModules.concat(baseModules);
  52150. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52151. /**
  52152. * Not type checking this file because flow doesn't like attaching
  52153. * properties to Elements.
  52154. */
  52155. /* istanbul ignore if */
  52156. if (isIE9) {
  52157. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52158. document.addEventListener('selectionchange', function () {
  52159. var el = document.activeElement;
  52160. if (el && el.vmodel) {
  52161. trigger(el, 'input');
  52162. }
  52163. });
  52164. }
  52165. var directive = {
  52166. inserted: function inserted (el, binding, vnode, oldVnode) {
  52167. if (vnode.tag === 'select') {
  52168. // #6903
  52169. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52170. mergeVNodeHook(vnode, 'postpatch', function () {
  52171. directive.componentUpdated(el, binding, vnode);
  52172. });
  52173. } else {
  52174. setSelected(el, binding, vnode.context);
  52175. }
  52176. el._vOptions = [].map.call(el.options, getValue);
  52177. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52178. el._vModifiers = binding.modifiers;
  52179. if (!binding.modifiers.lazy) {
  52180. el.addEventListener('compositionstart', onCompositionStart);
  52181. el.addEventListener('compositionend', onCompositionEnd);
  52182. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52183. // switching focus before confirming composition choice
  52184. // this also fixes the issue where some browsers e.g. iOS Chrome
  52185. // fires "change" instead of "input" on autocomplete.
  52186. el.addEventListener('change', onCompositionEnd);
  52187. /* istanbul ignore if */
  52188. if (isIE9) {
  52189. el.vmodel = true;
  52190. }
  52191. }
  52192. }
  52193. },
  52194. componentUpdated: function componentUpdated (el, binding, vnode) {
  52195. if (vnode.tag === 'select') {
  52196. setSelected(el, binding, vnode.context);
  52197. // in case the options rendered by v-for have changed,
  52198. // it's possible that the value is out-of-sync with the rendered options.
  52199. // detect such cases and filter out values that no longer has a matching
  52200. // option in the DOM.
  52201. var prevOptions = el._vOptions;
  52202. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52203. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52204. // trigger change event if
  52205. // no matching option found for at least one value
  52206. var needReset = el.multiple
  52207. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52208. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52209. if (needReset) {
  52210. trigger(el, 'change');
  52211. }
  52212. }
  52213. }
  52214. }
  52215. };
  52216. function setSelected (el, binding, vm) {
  52217. actuallySetSelected(el, binding, vm);
  52218. /* istanbul ignore if */
  52219. if (isIE || isEdge) {
  52220. setTimeout(function () {
  52221. actuallySetSelected(el, binding, vm);
  52222. }, 0);
  52223. }
  52224. }
  52225. function actuallySetSelected (el, binding, vm) {
  52226. var value = binding.value;
  52227. var isMultiple = el.multiple;
  52228. if (isMultiple && !Array.isArray(value)) {
  52229. warn(
  52230. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52231. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52232. vm
  52233. );
  52234. return
  52235. }
  52236. var selected, option;
  52237. for (var i = 0, l = el.options.length; i < l; i++) {
  52238. option = el.options[i];
  52239. if (isMultiple) {
  52240. selected = looseIndexOf(value, getValue(option)) > -1;
  52241. if (option.selected !== selected) {
  52242. option.selected = selected;
  52243. }
  52244. } else {
  52245. if (looseEqual(getValue(option), value)) {
  52246. if (el.selectedIndex !== i) {
  52247. el.selectedIndex = i;
  52248. }
  52249. return
  52250. }
  52251. }
  52252. }
  52253. if (!isMultiple) {
  52254. el.selectedIndex = -1;
  52255. }
  52256. }
  52257. function hasNoMatchingOption (value, options) {
  52258. return options.every(function (o) { return !looseEqual(o, value); })
  52259. }
  52260. function getValue (option) {
  52261. return '_value' in option
  52262. ? option._value
  52263. : option.value
  52264. }
  52265. function onCompositionStart (e) {
  52266. e.target.composing = true;
  52267. }
  52268. function onCompositionEnd (e) {
  52269. // prevent triggering an input event for no reason
  52270. if (!e.target.composing) { return }
  52271. e.target.composing = false;
  52272. trigger(e.target, 'input');
  52273. }
  52274. function trigger (el, type) {
  52275. var e = document.createEvent('HTMLEvents');
  52276. e.initEvent(type, true, true);
  52277. el.dispatchEvent(e);
  52278. }
  52279. /* */
  52280. // recursively search for possible transition defined inside the component root
  52281. function locateNode (vnode) {
  52282. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52283. ? locateNode(vnode.componentInstance._vnode)
  52284. : vnode
  52285. }
  52286. var show = {
  52287. bind: function bind (el, ref, vnode) {
  52288. var value = ref.value;
  52289. vnode = locateNode(vnode);
  52290. var transition$$1 = vnode.data && vnode.data.transition;
  52291. var originalDisplay = el.__vOriginalDisplay =
  52292. el.style.display === 'none' ? '' : el.style.display;
  52293. if (value && transition$$1) {
  52294. vnode.data.show = true;
  52295. enter(vnode, function () {
  52296. el.style.display = originalDisplay;
  52297. });
  52298. } else {
  52299. el.style.display = value ? originalDisplay : 'none';
  52300. }
  52301. },
  52302. update: function update (el, ref, vnode) {
  52303. var value = ref.value;
  52304. var oldValue = ref.oldValue;
  52305. /* istanbul ignore if */
  52306. if (!value === !oldValue) { return }
  52307. vnode = locateNode(vnode);
  52308. var transition$$1 = vnode.data && vnode.data.transition;
  52309. if (transition$$1) {
  52310. vnode.data.show = true;
  52311. if (value) {
  52312. enter(vnode, function () {
  52313. el.style.display = el.__vOriginalDisplay;
  52314. });
  52315. } else {
  52316. leave(vnode, function () {
  52317. el.style.display = 'none';
  52318. });
  52319. }
  52320. } else {
  52321. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52322. }
  52323. },
  52324. unbind: function unbind (
  52325. el,
  52326. binding,
  52327. vnode,
  52328. oldVnode,
  52329. isDestroy
  52330. ) {
  52331. if (!isDestroy) {
  52332. el.style.display = el.__vOriginalDisplay;
  52333. }
  52334. }
  52335. };
  52336. var platformDirectives = {
  52337. model: directive,
  52338. show: show
  52339. };
  52340. /* */
  52341. var transitionProps = {
  52342. name: String,
  52343. appear: Boolean,
  52344. css: Boolean,
  52345. mode: String,
  52346. type: String,
  52347. enterClass: String,
  52348. leaveClass: String,
  52349. enterToClass: String,
  52350. leaveToClass: String,
  52351. enterActiveClass: String,
  52352. leaveActiveClass: String,
  52353. appearClass: String,
  52354. appearActiveClass: String,
  52355. appearToClass: String,
  52356. duration: [Number, String, Object]
  52357. };
  52358. // in case the child is also an abstract component, e.g. <keep-alive>
  52359. // we want to recursively retrieve the real component to be rendered
  52360. function getRealChild (vnode) {
  52361. var compOptions = vnode && vnode.componentOptions;
  52362. if (compOptions && compOptions.Ctor.options.abstract) {
  52363. return getRealChild(getFirstComponentChild(compOptions.children))
  52364. } else {
  52365. return vnode
  52366. }
  52367. }
  52368. function extractTransitionData (comp) {
  52369. var data = {};
  52370. var options = comp.$options;
  52371. // props
  52372. for (var key in options.propsData) {
  52373. data[key] = comp[key];
  52374. }
  52375. // events.
  52376. // extract listeners and pass them directly to the transition methods
  52377. var listeners = options._parentListeners;
  52378. for (var key$1 in listeners) {
  52379. data[camelize(key$1)] = listeners[key$1];
  52380. }
  52381. return data
  52382. }
  52383. function placeholder (h, rawChild) {
  52384. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52385. return h('keep-alive', {
  52386. props: rawChild.componentOptions.propsData
  52387. })
  52388. }
  52389. }
  52390. function hasParentTransition (vnode) {
  52391. while ((vnode = vnode.parent)) {
  52392. if (vnode.data.transition) {
  52393. return true
  52394. }
  52395. }
  52396. }
  52397. function isSameChild (child, oldChild) {
  52398. return oldChild.key === child.key && oldChild.tag === child.tag
  52399. }
  52400. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52401. var isVShowDirective = function (d) { return d.name === 'show'; };
  52402. var Transition = {
  52403. name: 'transition',
  52404. props: transitionProps,
  52405. abstract: true,
  52406. render: function render (h) {
  52407. var this$1 = this;
  52408. var children = this.$slots.default;
  52409. if (!children) {
  52410. return
  52411. }
  52412. // filter out text nodes (possible whitespaces)
  52413. children = children.filter(isNotTextNode);
  52414. /* istanbul ignore if */
  52415. if (!children.length) {
  52416. return
  52417. }
  52418. // warn multiple elements
  52419. if (children.length > 1) {
  52420. warn(
  52421. '<transition> can only be used on a single element. Use ' +
  52422. '<transition-group> for lists.',
  52423. this.$parent
  52424. );
  52425. }
  52426. var mode = this.mode;
  52427. // warn invalid mode
  52428. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52429. ) {
  52430. warn(
  52431. 'invalid <transition> mode: ' + mode,
  52432. this.$parent
  52433. );
  52434. }
  52435. var rawChild = children[0];
  52436. // if this is a component root node and the component's
  52437. // parent container node also has transition, skip.
  52438. if (hasParentTransition(this.$vnode)) {
  52439. return rawChild
  52440. }
  52441. // apply transition data to child
  52442. // use getRealChild() to ignore abstract components e.g. keep-alive
  52443. var child = getRealChild(rawChild);
  52444. /* istanbul ignore if */
  52445. if (!child) {
  52446. return rawChild
  52447. }
  52448. if (this._leaving) {
  52449. return placeholder(h, rawChild)
  52450. }
  52451. // ensure a key that is unique to the vnode type and to this transition
  52452. // component instance. This key will be used to remove pending leaving nodes
  52453. // during entering.
  52454. var id = "__transition-" + (this._uid) + "-";
  52455. child.key = child.key == null
  52456. ? child.isComment
  52457. ? id + 'comment'
  52458. : id + child.tag
  52459. : isPrimitive(child.key)
  52460. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52461. : child.key;
  52462. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52463. var oldRawChild = this._vnode;
  52464. var oldChild = getRealChild(oldRawChild);
  52465. // mark v-show
  52466. // so that the transition module can hand over the control to the directive
  52467. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52468. child.data.show = true;
  52469. }
  52470. if (
  52471. oldChild &&
  52472. oldChild.data &&
  52473. !isSameChild(child, oldChild) &&
  52474. !isAsyncPlaceholder(oldChild) &&
  52475. // #6687 component root is a comment node
  52476. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52477. ) {
  52478. // replace old child transition data with fresh one
  52479. // important for dynamic transitions!
  52480. var oldData = oldChild.data.transition = extend({}, data);
  52481. // handle transition mode
  52482. if (mode === 'out-in') {
  52483. // return placeholder node and queue update when leave finishes
  52484. this._leaving = true;
  52485. mergeVNodeHook(oldData, 'afterLeave', function () {
  52486. this$1._leaving = false;
  52487. this$1.$forceUpdate();
  52488. });
  52489. return placeholder(h, rawChild)
  52490. } else if (mode === 'in-out') {
  52491. if (isAsyncPlaceholder(child)) {
  52492. return oldRawChild
  52493. }
  52494. var delayedLeave;
  52495. var performLeave = function () { delayedLeave(); };
  52496. mergeVNodeHook(data, 'afterEnter', performLeave);
  52497. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52498. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52499. }
  52500. }
  52501. return rawChild
  52502. }
  52503. };
  52504. /* */
  52505. var props = extend({
  52506. tag: String,
  52507. moveClass: String
  52508. }, transitionProps);
  52509. delete props.mode;
  52510. var TransitionGroup = {
  52511. props: props,
  52512. beforeMount: function beforeMount () {
  52513. var this$1 = this;
  52514. var update = this._update;
  52515. this._update = function (vnode, hydrating) {
  52516. var restoreActiveInstance = setActiveInstance(this$1);
  52517. // force removing pass
  52518. this$1.__patch__(
  52519. this$1._vnode,
  52520. this$1.kept,
  52521. false, // hydrating
  52522. true // removeOnly (!important, avoids unnecessary moves)
  52523. );
  52524. this$1._vnode = this$1.kept;
  52525. restoreActiveInstance();
  52526. update.call(this$1, vnode, hydrating);
  52527. };
  52528. },
  52529. render: function render (h) {
  52530. var tag = this.tag || this.$vnode.data.tag || 'span';
  52531. var map = Object.create(null);
  52532. var prevChildren = this.prevChildren = this.children;
  52533. var rawChildren = this.$slots.default || [];
  52534. var children = this.children = [];
  52535. var transitionData = extractTransitionData(this);
  52536. for (var i = 0; i < rawChildren.length; i++) {
  52537. var c = rawChildren[i];
  52538. if (c.tag) {
  52539. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52540. children.push(c);
  52541. map[c.key] = c
  52542. ;(c.data || (c.data = {})).transition = transitionData;
  52543. } else {
  52544. var opts = c.componentOptions;
  52545. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52546. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52547. }
  52548. }
  52549. }
  52550. if (prevChildren) {
  52551. var kept = [];
  52552. var removed = [];
  52553. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52554. var c$1 = prevChildren[i$1];
  52555. c$1.data.transition = transitionData;
  52556. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52557. if (map[c$1.key]) {
  52558. kept.push(c$1);
  52559. } else {
  52560. removed.push(c$1);
  52561. }
  52562. }
  52563. this.kept = h(tag, null, kept);
  52564. this.removed = removed;
  52565. }
  52566. return h(tag, null, children)
  52567. },
  52568. updated: function updated () {
  52569. var children = this.prevChildren;
  52570. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52571. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52572. return
  52573. }
  52574. // we divide the work into three loops to avoid mixing DOM reads and writes
  52575. // in each iteration - which helps prevent layout thrashing.
  52576. children.forEach(callPendingCbs);
  52577. children.forEach(recordPosition);
  52578. children.forEach(applyTranslation);
  52579. // force reflow to put everything in position
  52580. // assign to this to avoid being removed in tree-shaking
  52581. // $flow-disable-line
  52582. this._reflow = document.body.offsetHeight;
  52583. children.forEach(function (c) {
  52584. if (c.data.moved) {
  52585. var el = c.elm;
  52586. var s = el.style;
  52587. addTransitionClass(el, moveClass);
  52588. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52589. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52590. if (e && e.target !== el) {
  52591. return
  52592. }
  52593. if (!e || /transform$/.test(e.propertyName)) {
  52594. el.removeEventListener(transitionEndEvent, cb);
  52595. el._moveCb = null;
  52596. removeTransitionClass(el, moveClass);
  52597. }
  52598. });
  52599. }
  52600. });
  52601. },
  52602. methods: {
  52603. hasMove: function hasMove (el, moveClass) {
  52604. /* istanbul ignore if */
  52605. if (!hasTransition) {
  52606. return false
  52607. }
  52608. /* istanbul ignore if */
  52609. if (this._hasMove) {
  52610. return this._hasMove
  52611. }
  52612. // Detect whether an element with the move class applied has
  52613. // CSS transitions. Since the element may be inside an entering
  52614. // transition at this very moment, we make a clone of it and remove
  52615. // all other transition classes applied to ensure only the move class
  52616. // is applied.
  52617. var clone = el.cloneNode();
  52618. if (el._transitionClasses) {
  52619. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52620. }
  52621. addClass(clone, moveClass);
  52622. clone.style.display = 'none';
  52623. this.$el.appendChild(clone);
  52624. var info = getTransitionInfo(clone);
  52625. this.$el.removeChild(clone);
  52626. return (this._hasMove = info.hasTransform)
  52627. }
  52628. }
  52629. };
  52630. function callPendingCbs (c) {
  52631. /* istanbul ignore if */
  52632. if (c.elm._moveCb) {
  52633. c.elm._moveCb();
  52634. }
  52635. /* istanbul ignore if */
  52636. if (c.elm._enterCb) {
  52637. c.elm._enterCb();
  52638. }
  52639. }
  52640. function recordPosition (c) {
  52641. c.data.newPos = c.elm.getBoundingClientRect();
  52642. }
  52643. function applyTranslation (c) {
  52644. var oldPos = c.data.pos;
  52645. var newPos = c.data.newPos;
  52646. var dx = oldPos.left - newPos.left;
  52647. var dy = oldPos.top - newPos.top;
  52648. if (dx || dy) {
  52649. c.data.moved = true;
  52650. var s = c.elm.style;
  52651. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52652. s.transitionDuration = '0s';
  52653. }
  52654. }
  52655. var platformComponents = {
  52656. Transition: Transition,
  52657. TransitionGroup: TransitionGroup
  52658. };
  52659. /* */
  52660. // install platform specific utils
  52661. Vue.config.mustUseProp = mustUseProp;
  52662. Vue.config.isReservedTag = isReservedTag;
  52663. Vue.config.isReservedAttr = isReservedAttr;
  52664. Vue.config.getTagNamespace = getTagNamespace;
  52665. Vue.config.isUnknownElement = isUnknownElement;
  52666. // install platform runtime directives & components
  52667. extend(Vue.options.directives, platformDirectives);
  52668. extend(Vue.options.components, platformComponents);
  52669. // install platform patch function
  52670. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52671. // public mount method
  52672. Vue.prototype.$mount = function (
  52673. el,
  52674. hydrating
  52675. ) {
  52676. el = el && inBrowser ? query(el) : undefined;
  52677. return mountComponent(this, el, hydrating)
  52678. };
  52679. // devtools global hook
  52680. /* istanbul ignore next */
  52681. if (inBrowser) {
  52682. setTimeout(function () {
  52683. if (config.devtools) {
  52684. if (devtools) {
  52685. devtools.emit('init', Vue);
  52686. } else {
  52687. console[console.info ? 'info' : 'log'](
  52688. 'Download the Vue Devtools extension for a better development experience:\n' +
  52689. 'https://github.com/vuejs/vue-devtools'
  52690. );
  52691. }
  52692. }
  52693. if (config.productionTip !== false &&
  52694. typeof console !== 'undefined'
  52695. ) {
  52696. console[console.info ? 'info' : 'log'](
  52697. "You are running Vue in development mode.\n" +
  52698. "Make sure to turn on production mode when deploying for production.\n" +
  52699. "See more tips at https://vuejs.org/guide/deployment.html"
  52700. );
  52701. }
  52702. }, 0);
  52703. }
  52704. /* */
  52705. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52706. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52707. var buildRegex = cached(function (delimiters) {
  52708. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52709. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52710. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52711. });
  52712. function parseText (
  52713. text,
  52714. delimiters
  52715. ) {
  52716. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52717. if (!tagRE.test(text)) {
  52718. return
  52719. }
  52720. var tokens = [];
  52721. var rawTokens = [];
  52722. var lastIndex = tagRE.lastIndex = 0;
  52723. var match, index, tokenValue;
  52724. while ((match = tagRE.exec(text))) {
  52725. index = match.index;
  52726. // push text token
  52727. if (index > lastIndex) {
  52728. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52729. tokens.push(JSON.stringify(tokenValue));
  52730. }
  52731. // tag token
  52732. var exp = parseFilters(match[1].trim());
  52733. tokens.push(("_s(" + exp + ")"));
  52734. rawTokens.push({ '@binding': exp });
  52735. lastIndex = index + match[0].length;
  52736. }
  52737. if (lastIndex < text.length) {
  52738. rawTokens.push(tokenValue = text.slice(lastIndex));
  52739. tokens.push(JSON.stringify(tokenValue));
  52740. }
  52741. return {
  52742. expression: tokens.join('+'),
  52743. tokens: rawTokens
  52744. }
  52745. }
  52746. /* */
  52747. function transformNode (el, options) {
  52748. var warn = options.warn || baseWarn;
  52749. var staticClass = getAndRemoveAttr(el, 'class');
  52750. if (staticClass) {
  52751. var res = parseText(staticClass, options.delimiters);
  52752. if (res) {
  52753. warn(
  52754. "class=\"" + staticClass + "\": " +
  52755. 'Interpolation inside attributes has been removed. ' +
  52756. 'Use v-bind or the colon shorthand instead. For example, ' +
  52757. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52758. el.rawAttrsMap['class']
  52759. );
  52760. }
  52761. }
  52762. if (staticClass) {
  52763. el.staticClass = JSON.stringify(staticClass);
  52764. }
  52765. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52766. if (classBinding) {
  52767. el.classBinding = classBinding;
  52768. }
  52769. }
  52770. function genData (el) {
  52771. var data = '';
  52772. if (el.staticClass) {
  52773. data += "staticClass:" + (el.staticClass) + ",";
  52774. }
  52775. if (el.classBinding) {
  52776. data += "class:" + (el.classBinding) + ",";
  52777. }
  52778. return data
  52779. }
  52780. var klass$1 = {
  52781. staticKeys: ['staticClass'],
  52782. transformNode: transformNode,
  52783. genData: genData
  52784. };
  52785. /* */
  52786. function transformNode$1 (el, options) {
  52787. var warn = options.warn || baseWarn;
  52788. var staticStyle = getAndRemoveAttr(el, 'style');
  52789. if (staticStyle) {
  52790. /* istanbul ignore if */
  52791. {
  52792. var res = parseText(staticStyle, options.delimiters);
  52793. if (res) {
  52794. warn(
  52795. "style=\"" + staticStyle + "\": " +
  52796. 'Interpolation inside attributes has been removed. ' +
  52797. 'Use v-bind or the colon shorthand instead. For example, ' +
  52798. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52799. el.rawAttrsMap['style']
  52800. );
  52801. }
  52802. }
  52803. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52804. }
  52805. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52806. if (styleBinding) {
  52807. el.styleBinding = styleBinding;
  52808. }
  52809. }
  52810. function genData$1 (el) {
  52811. var data = '';
  52812. if (el.staticStyle) {
  52813. data += "staticStyle:" + (el.staticStyle) + ",";
  52814. }
  52815. if (el.styleBinding) {
  52816. data += "style:(" + (el.styleBinding) + "),";
  52817. }
  52818. return data
  52819. }
  52820. var style$1 = {
  52821. staticKeys: ['staticStyle'],
  52822. transformNode: transformNode$1,
  52823. genData: genData$1
  52824. };
  52825. /* */
  52826. var decoder;
  52827. var he = {
  52828. decode: function decode (html) {
  52829. decoder = decoder || document.createElement('div');
  52830. decoder.innerHTML = html;
  52831. return decoder.textContent
  52832. }
  52833. };
  52834. /* */
  52835. var isUnaryTag = makeMap(
  52836. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52837. 'link,meta,param,source,track,wbr'
  52838. );
  52839. // Elements that you can, intentionally, leave open
  52840. // (and which close themselves)
  52841. var canBeLeftOpenTag = makeMap(
  52842. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52843. );
  52844. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52845. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52846. var isNonPhrasingTag = makeMap(
  52847. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52848. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52849. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52850. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52851. 'title,tr,track'
  52852. );
  52853. /**
  52854. * Not type-checking this file because it's mostly vendor code.
  52855. */
  52856. // Regular Expressions for parsing tags and attributes
  52857. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52858. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52859. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52860. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52861. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52862. var startTagClose = /^\s*(\/?)>/;
  52863. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52864. var doctype = /^<!DOCTYPE [^>]+>/i;
  52865. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52866. var comment = /^<!\--/;
  52867. var conditionalComment = /^<!\[/;
  52868. // Special Elements (can contain anything)
  52869. var isPlainTextElement = makeMap('script,style,textarea', true);
  52870. var reCache = {};
  52871. var decodingMap = {
  52872. '&lt;': '<',
  52873. '&gt;': '>',
  52874. '&quot;': '"',
  52875. '&amp;': '&',
  52876. '&#10;': '\n',
  52877. '&#9;': '\t',
  52878. '&#39;': "'"
  52879. };
  52880. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52881. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52882. // #5992
  52883. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52884. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52885. function decodeAttr (value, shouldDecodeNewlines) {
  52886. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52887. return value.replace(re, function (match) { return decodingMap[match]; })
  52888. }
  52889. function parseHTML (html, options) {
  52890. var stack = [];
  52891. var expectHTML = options.expectHTML;
  52892. var isUnaryTag$$1 = options.isUnaryTag || no;
  52893. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52894. var index = 0;
  52895. var last, lastTag;
  52896. while (html) {
  52897. last = html;
  52898. // Make sure we're not in a plaintext content element like script/style
  52899. if (!lastTag || !isPlainTextElement(lastTag)) {
  52900. var textEnd = html.indexOf('<');
  52901. if (textEnd === 0) {
  52902. // Comment:
  52903. if (comment.test(html)) {
  52904. var commentEnd = html.indexOf('-->');
  52905. if (commentEnd >= 0) {
  52906. if (options.shouldKeepComment) {
  52907. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52908. }
  52909. advance(commentEnd + 3);
  52910. continue
  52911. }
  52912. }
  52913. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52914. if (conditionalComment.test(html)) {
  52915. var conditionalEnd = html.indexOf(']>');
  52916. if (conditionalEnd >= 0) {
  52917. advance(conditionalEnd + 2);
  52918. continue
  52919. }
  52920. }
  52921. // Doctype:
  52922. var doctypeMatch = html.match(doctype);
  52923. if (doctypeMatch) {
  52924. advance(doctypeMatch[0].length);
  52925. continue
  52926. }
  52927. // End tag:
  52928. var endTagMatch = html.match(endTag);
  52929. if (endTagMatch) {
  52930. var curIndex = index;
  52931. advance(endTagMatch[0].length);
  52932. parseEndTag(endTagMatch[1], curIndex, index);
  52933. continue
  52934. }
  52935. // Start tag:
  52936. var startTagMatch = parseStartTag();
  52937. if (startTagMatch) {
  52938. handleStartTag(startTagMatch);
  52939. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52940. advance(1);
  52941. }
  52942. continue
  52943. }
  52944. }
  52945. var text = (void 0), rest = (void 0), next = (void 0);
  52946. if (textEnd >= 0) {
  52947. rest = html.slice(textEnd);
  52948. while (
  52949. !endTag.test(rest) &&
  52950. !startTagOpen.test(rest) &&
  52951. !comment.test(rest) &&
  52952. !conditionalComment.test(rest)
  52953. ) {
  52954. // < in plain text, be forgiving and treat it as text
  52955. next = rest.indexOf('<', 1);
  52956. if (next < 0) { break }
  52957. textEnd += next;
  52958. rest = html.slice(textEnd);
  52959. }
  52960. text = html.substring(0, textEnd);
  52961. }
  52962. if (textEnd < 0) {
  52963. text = html;
  52964. }
  52965. if (text) {
  52966. advance(text.length);
  52967. }
  52968. if (options.chars && text) {
  52969. options.chars(text, index - text.length, index);
  52970. }
  52971. } else {
  52972. var endTagLength = 0;
  52973. var stackedTag = lastTag.toLowerCase();
  52974. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52975. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52976. endTagLength = endTag.length;
  52977. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52978. text = text
  52979. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52980. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52981. }
  52982. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52983. text = text.slice(1);
  52984. }
  52985. if (options.chars) {
  52986. options.chars(text);
  52987. }
  52988. return ''
  52989. });
  52990. index += html.length - rest$1.length;
  52991. html = rest$1;
  52992. parseEndTag(stackedTag, index - endTagLength, index);
  52993. }
  52994. if (html === last) {
  52995. options.chars && options.chars(html);
  52996. if (!stack.length && options.warn) {
  52997. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52998. }
  52999. break
  53000. }
  53001. }
  53002. // Clean up any remaining tags
  53003. parseEndTag();
  53004. function advance (n) {
  53005. index += n;
  53006. html = html.substring(n);
  53007. }
  53008. function parseStartTag () {
  53009. var start = html.match(startTagOpen);
  53010. if (start) {
  53011. var match = {
  53012. tagName: start[1],
  53013. attrs: [],
  53014. start: index
  53015. };
  53016. advance(start[0].length);
  53017. var end, attr;
  53018. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53019. attr.start = index;
  53020. advance(attr[0].length);
  53021. attr.end = index;
  53022. match.attrs.push(attr);
  53023. }
  53024. if (end) {
  53025. match.unarySlash = end[1];
  53026. advance(end[0].length);
  53027. match.end = index;
  53028. return match
  53029. }
  53030. }
  53031. }
  53032. function handleStartTag (match) {
  53033. var tagName = match.tagName;
  53034. var unarySlash = match.unarySlash;
  53035. if (expectHTML) {
  53036. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53037. parseEndTag(lastTag);
  53038. }
  53039. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53040. parseEndTag(tagName);
  53041. }
  53042. }
  53043. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53044. var l = match.attrs.length;
  53045. var attrs = new Array(l);
  53046. for (var i = 0; i < l; i++) {
  53047. var args = match.attrs[i];
  53048. var value = args[3] || args[4] || args[5] || '';
  53049. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53050. ? options.shouldDecodeNewlinesForHref
  53051. : options.shouldDecodeNewlines;
  53052. attrs[i] = {
  53053. name: args[1],
  53054. value: decodeAttr(value, shouldDecodeNewlines)
  53055. };
  53056. if (options.outputSourceRange) {
  53057. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53058. attrs[i].end = args.end;
  53059. }
  53060. }
  53061. if (!unary) {
  53062. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53063. lastTag = tagName;
  53064. }
  53065. if (options.start) {
  53066. options.start(tagName, attrs, unary, match.start, match.end);
  53067. }
  53068. }
  53069. function parseEndTag (tagName, start, end) {
  53070. var pos, lowerCasedTagName;
  53071. if (start == null) { start = index; }
  53072. if (end == null) { end = index; }
  53073. // Find the closest opened tag of the same type
  53074. if (tagName) {
  53075. lowerCasedTagName = tagName.toLowerCase();
  53076. for (pos = stack.length - 1; pos >= 0; pos--) {
  53077. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53078. break
  53079. }
  53080. }
  53081. } else {
  53082. // If no tag name is provided, clean shop
  53083. pos = 0;
  53084. }
  53085. if (pos >= 0) {
  53086. // Close all the open elements, up the stack
  53087. for (var i = stack.length - 1; i >= pos; i--) {
  53088. if (i > pos || !tagName &&
  53089. options.warn
  53090. ) {
  53091. options.warn(
  53092. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53093. { start: stack[i].start, end: stack[i].end }
  53094. );
  53095. }
  53096. if (options.end) {
  53097. options.end(stack[i].tag, start, end);
  53098. }
  53099. }
  53100. // Remove the open elements from the stack
  53101. stack.length = pos;
  53102. lastTag = pos && stack[pos - 1].tag;
  53103. } else if (lowerCasedTagName === 'br') {
  53104. if (options.start) {
  53105. options.start(tagName, [], true, start, end);
  53106. }
  53107. } else if (lowerCasedTagName === 'p') {
  53108. if (options.start) {
  53109. options.start(tagName, [], false, start, end);
  53110. }
  53111. if (options.end) {
  53112. options.end(tagName, start, end);
  53113. }
  53114. }
  53115. }
  53116. }
  53117. /* */
  53118. var onRE = /^@|^v-on:/;
  53119. var dirRE = /^v-|^@|^:|^#/;
  53120. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53121. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53122. var stripParensRE = /^\(|\)$/g;
  53123. var dynamicArgRE = /^\[.*\]$/;
  53124. var argRE = /:(.*)$/;
  53125. var bindRE = /^:|^\.|^v-bind:/;
  53126. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53127. var slotRE = /^v-slot(:|$)|^#/;
  53128. var lineBreakRE = /[\r\n]/;
  53129. var whitespaceRE$1 = /\s+/g;
  53130. var invalidAttributeRE = /[\s"'<>\/=]/;
  53131. var decodeHTMLCached = cached(he.decode);
  53132. var emptySlotScopeToken = "_empty_";
  53133. // configurable state
  53134. var warn$2;
  53135. var delimiters;
  53136. var transforms;
  53137. var preTransforms;
  53138. var postTransforms;
  53139. var platformIsPreTag;
  53140. var platformMustUseProp;
  53141. var platformGetTagNamespace;
  53142. var maybeComponent;
  53143. function createASTElement (
  53144. tag,
  53145. attrs,
  53146. parent
  53147. ) {
  53148. return {
  53149. type: 1,
  53150. tag: tag,
  53151. attrsList: attrs,
  53152. attrsMap: makeAttrsMap(attrs),
  53153. rawAttrsMap: {},
  53154. parent: parent,
  53155. children: []
  53156. }
  53157. }
  53158. /**
  53159. * Convert HTML string to AST.
  53160. */
  53161. function parse (
  53162. template,
  53163. options
  53164. ) {
  53165. warn$2 = options.warn || baseWarn;
  53166. platformIsPreTag = options.isPreTag || no;
  53167. platformMustUseProp = options.mustUseProp || no;
  53168. platformGetTagNamespace = options.getTagNamespace || no;
  53169. var isReservedTag = options.isReservedTag || no;
  53170. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53171. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53172. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53173. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53174. delimiters = options.delimiters;
  53175. var stack = [];
  53176. var preserveWhitespace = options.preserveWhitespace !== false;
  53177. var whitespaceOption = options.whitespace;
  53178. var root;
  53179. var currentParent;
  53180. var inVPre = false;
  53181. var inPre = false;
  53182. var warned = false;
  53183. function warnOnce (msg, range) {
  53184. if (!warned) {
  53185. warned = true;
  53186. warn$2(msg, range);
  53187. }
  53188. }
  53189. function closeElement (element) {
  53190. trimEndingWhitespace(element);
  53191. if (!inVPre && !element.processed) {
  53192. element = processElement(element, options);
  53193. }
  53194. // tree management
  53195. if (!stack.length && element !== root) {
  53196. // allow root elements with v-if, v-else-if and v-else
  53197. if (root.if && (element.elseif || element.else)) {
  53198. {
  53199. checkRootConstraints(element);
  53200. }
  53201. addIfCondition(root, {
  53202. exp: element.elseif,
  53203. block: element
  53204. });
  53205. } else {
  53206. warnOnce(
  53207. "Component template should contain exactly one root element. " +
  53208. "If you are using v-if on multiple elements, " +
  53209. "use v-else-if to chain them instead.",
  53210. { start: element.start }
  53211. );
  53212. }
  53213. }
  53214. if (currentParent && !element.forbidden) {
  53215. if (element.elseif || element.else) {
  53216. processIfConditions(element, currentParent);
  53217. } else {
  53218. if (element.slotScope) {
  53219. // scoped slot
  53220. // keep it in the children list so that v-else(-if) conditions can
  53221. // find it as the prev node.
  53222. var name = element.slotTarget || '"default"'
  53223. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53224. }
  53225. currentParent.children.push(element);
  53226. element.parent = currentParent;
  53227. }
  53228. }
  53229. // final children cleanup
  53230. // filter out scoped slots
  53231. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53232. // remove trailing whitespace node again
  53233. trimEndingWhitespace(element);
  53234. // check pre state
  53235. if (element.pre) {
  53236. inVPre = false;
  53237. }
  53238. if (platformIsPreTag(element.tag)) {
  53239. inPre = false;
  53240. }
  53241. // apply post-transforms
  53242. for (var i = 0; i < postTransforms.length; i++) {
  53243. postTransforms[i](element, options);
  53244. }
  53245. }
  53246. function trimEndingWhitespace (el) {
  53247. // remove trailing whitespace node
  53248. if (!inPre) {
  53249. var lastNode;
  53250. while (
  53251. (lastNode = el.children[el.children.length - 1]) &&
  53252. lastNode.type === 3 &&
  53253. lastNode.text === ' '
  53254. ) {
  53255. el.children.pop();
  53256. }
  53257. }
  53258. }
  53259. function checkRootConstraints (el) {
  53260. if (el.tag === 'slot' || el.tag === 'template') {
  53261. warnOnce(
  53262. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53263. 'contain multiple nodes.',
  53264. { start: el.start }
  53265. );
  53266. }
  53267. if (el.attrsMap.hasOwnProperty('v-for')) {
  53268. warnOnce(
  53269. 'Cannot use v-for on stateful component root element because ' +
  53270. 'it renders multiple elements.',
  53271. el.rawAttrsMap['v-for']
  53272. );
  53273. }
  53274. }
  53275. parseHTML(template, {
  53276. warn: warn$2,
  53277. expectHTML: options.expectHTML,
  53278. isUnaryTag: options.isUnaryTag,
  53279. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53280. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53281. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53282. shouldKeepComment: options.comments,
  53283. outputSourceRange: options.outputSourceRange,
  53284. start: function start (tag, attrs, unary, start$1, end) {
  53285. // check namespace.
  53286. // inherit parent ns if there is one
  53287. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53288. // handle IE svg bug
  53289. /* istanbul ignore if */
  53290. if (isIE && ns === 'svg') {
  53291. attrs = guardIESVGBug(attrs);
  53292. }
  53293. var element = createASTElement(tag, attrs, currentParent);
  53294. if (ns) {
  53295. element.ns = ns;
  53296. }
  53297. {
  53298. if (options.outputSourceRange) {
  53299. element.start = start$1;
  53300. element.end = end;
  53301. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53302. cumulated[attr.name] = attr;
  53303. return cumulated
  53304. }, {});
  53305. }
  53306. attrs.forEach(function (attr) {
  53307. if (invalidAttributeRE.test(attr.name)) {
  53308. warn$2(
  53309. "Invalid dynamic argument expression: attribute names cannot contain " +
  53310. "spaces, quotes, <, >, / or =.",
  53311. {
  53312. start: attr.start + attr.name.indexOf("["),
  53313. end: attr.start + attr.name.length
  53314. }
  53315. );
  53316. }
  53317. });
  53318. }
  53319. if (isForbiddenTag(element) && !isServerRendering()) {
  53320. element.forbidden = true;
  53321. warn$2(
  53322. 'Templates should only be responsible for mapping the state to the ' +
  53323. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53324. "<" + tag + ">" + ', as they will not be parsed.',
  53325. { start: element.start }
  53326. );
  53327. }
  53328. // apply pre-transforms
  53329. for (var i = 0; i < preTransforms.length; i++) {
  53330. element = preTransforms[i](element, options) || element;
  53331. }
  53332. if (!inVPre) {
  53333. processPre(element);
  53334. if (element.pre) {
  53335. inVPre = true;
  53336. }
  53337. }
  53338. if (platformIsPreTag(element.tag)) {
  53339. inPre = true;
  53340. }
  53341. if (inVPre) {
  53342. processRawAttrs(element);
  53343. } else if (!element.processed) {
  53344. // structural directives
  53345. processFor(element);
  53346. processIf(element);
  53347. processOnce(element);
  53348. }
  53349. if (!root) {
  53350. root = element;
  53351. {
  53352. checkRootConstraints(root);
  53353. }
  53354. }
  53355. if (!unary) {
  53356. currentParent = element;
  53357. stack.push(element);
  53358. } else {
  53359. closeElement(element);
  53360. }
  53361. },
  53362. end: function end (tag, start, end$1) {
  53363. var element = stack[stack.length - 1];
  53364. // pop stack
  53365. stack.length -= 1;
  53366. currentParent = stack[stack.length - 1];
  53367. if (options.outputSourceRange) {
  53368. element.end = end$1;
  53369. }
  53370. closeElement(element);
  53371. },
  53372. chars: function chars (text, start, end) {
  53373. if (!currentParent) {
  53374. {
  53375. if (text === template) {
  53376. warnOnce(
  53377. 'Component template requires a root element, rather than just text.',
  53378. { start: start }
  53379. );
  53380. } else if ((text = text.trim())) {
  53381. warnOnce(
  53382. ("text \"" + text + "\" outside root element will be ignored."),
  53383. { start: start }
  53384. );
  53385. }
  53386. }
  53387. return
  53388. }
  53389. // IE textarea placeholder bug
  53390. /* istanbul ignore if */
  53391. if (isIE &&
  53392. currentParent.tag === 'textarea' &&
  53393. currentParent.attrsMap.placeholder === text
  53394. ) {
  53395. return
  53396. }
  53397. var children = currentParent.children;
  53398. if (inPre || text.trim()) {
  53399. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53400. } else if (!children.length) {
  53401. // remove the whitespace-only node right after an opening tag
  53402. text = '';
  53403. } else if (whitespaceOption) {
  53404. if (whitespaceOption === 'condense') {
  53405. // in condense mode, remove the whitespace node if it contains
  53406. // line break, otherwise condense to a single space
  53407. text = lineBreakRE.test(text) ? '' : ' ';
  53408. } else {
  53409. text = ' ';
  53410. }
  53411. } else {
  53412. text = preserveWhitespace ? ' ' : '';
  53413. }
  53414. if (text) {
  53415. if (!inPre && whitespaceOption === 'condense') {
  53416. // condense consecutive whitespaces into single space
  53417. text = text.replace(whitespaceRE$1, ' ');
  53418. }
  53419. var res;
  53420. var child;
  53421. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53422. child = {
  53423. type: 2,
  53424. expression: res.expression,
  53425. tokens: res.tokens,
  53426. text: text
  53427. };
  53428. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53429. child = {
  53430. type: 3,
  53431. text: text
  53432. };
  53433. }
  53434. if (child) {
  53435. if (options.outputSourceRange) {
  53436. child.start = start;
  53437. child.end = end;
  53438. }
  53439. children.push(child);
  53440. }
  53441. }
  53442. },
  53443. comment: function comment (text, start, end) {
  53444. // adding anyting as a sibling to the root node is forbidden
  53445. // comments should still be allowed, but ignored
  53446. if (currentParent) {
  53447. var child = {
  53448. type: 3,
  53449. text: text,
  53450. isComment: true
  53451. };
  53452. if (options.outputSourceRange) {
  53453. child.start = start;
  53454. child.end = end;
  53455. }
  53456. currentParent.children.push(child);
  53457. }
  53458. }
  53459. });
  53460. return root
  53461. }
  53462. function processPre (el) {
  53463. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53464. el.pre = true;
  53465. }
  53466. }
  53467. function processRawAttrs (el) {
  53468. var list = el.attrsList;
  53469. var len = list.length;
  53470. if (len) {
  53471. var attrs = el.attrs = new Array(len);
  53472. for (var i = 0; i < len; i++) {
  53473. attrs[i] = {
  53474. name: list[i].name,
  53475. value: JSON.stringify(list[i].value)
  53476. };
  53477. if (list[i].start != null) {
  53478. attrs[i].start = list[i].start;
  53479. attrs[i].end = list[i].end;
  53480. }
  53481. }
  53482. } else if (!el.pre) {
  53483. // non root node in pre blocks with no attributes
  53484. el.plain = true;
  53485. }
  53486. }
  53487. function processElement (
  53488. element,
  53489. options
  53490. ) {
  53491. processKey(element);
  53492. // determine whether this is a plain element after
  53493. // removing structural attributes
  53494. element.plain = (
  53495. !element.key &&
  53496. !element.scopedSlots &&
  53497. !element.attrsList.length
  53498. );
  53499. processRef(element);
  53500. processSlotContent(element);
  53501. processSlotOutlet(element);
  53502. processComponent(element);
  53503. for (var i = 0; i < transforms.length; i++) {
  53504. element = transforms[i](element, options) || element;
  53505. }
  53506. processAttrs(element);
  53507. return element
  53508. }
  53509. function processKey (el) {
  53510. var exp = getBindingAttr(el, 'key');
  53511. if (exp) {
  53512. {
  53513. if (el.tag === 'template') {
  53514. warn$2(
  53515. "<template> cannot be keyed. Place the key on real elements instead.",
  53516. getRawBindingAttr(el, 'key')
  53517. );
  53518. }
  53519. if (el.for) {
  53520. var iterator = el.iterator2 || el.iterator1;
  53521. var parent = el.parent;
  53522. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53523. warn$2(
  53524. "Do not use v-for index as key on <transition-group> children, " +
  53525. "this is the same as not using keys.",
  53526. getRawBindingAttr(el, 'key'),
  53527. true /* tip */
  53528. );
  53529. }
  53530. }
  53531. }
  53532. el.key = exp;
  53533. }
  53534. }
  53535. function processRef (el) {
  53536. var ref = getBindingAttr(el, 'ref');
  53537. if (ref) {
  53538. el.ref = ref;
  53539. el.refInFor = checkInFor(el);
  53540. }
  53541. }
  53542. function processFor (el) {
  53543. var exp;
  53544. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53545. var res = parseFor(exp);
  53546. if (res) {
  53547. extend(el, res);
  53548. } else {
  53549. warn$2(
  53550. ("Invalid v-for expression: " + exp),
  53551. el.rawAttrsMap['v-for']
  53552. );
  53553. }
  53554. }
  53555. }
  53556. function parseFor (exp) {
  53557. var inMatch = exp.match(forAliasRE);
  53558. if (!inMatch) { return }
  53559. var res = {};
  53560. res.for = inMatch[2].trim();
  53561. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53562. var iteratorMatch = alias.match(forIteratorRE);
  53563. if (iteratorMatch) {
  53564. res.alias = alias.replace(forIteratorRE, '').trim();
  53565. res.iterator1 = iteratorMatch[1].trim();
  53566. if (iteratorMatch[2]) {
  53567. res.iterator2 = iteratorMatch[2].trim();
  53568. }
  53569. } else {
  53570. res.alias = alias;
  53571. }
  53572. return res
  53573. }
  53574. function processIf (el) {
  53575. var exp = getAndRemoveAttr(el, 'v-if');
  53576. if (exp) {
  53577. el.if = exp;
  53578. addIfCondition(el, {
  53579. exp: exp,
  53580. block: el
  53581. });
  53582. } else {
  53583. if (getAndRemoveAttr(el, 'v-else') != null) {
  53584. el.else = true;
  53585. }
  53586. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53587. if (elseif) {
  53588. el.elseif = elseif;
  53589. }
  53590. }
  53591. }
  53592. function processIfConditions (el, parent) {
  53593. var prev = findPrevElement(parent.children);
  53594. if (prev && prev.if) {
  53595. addIfCondition(prev, {
  53596. exp: el.elseif,
  53597. block: el
  53598. });
  53599. } else {
  53600. warn$2(
  53601. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53602. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53603. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53604. );
  53605. }
  53606. }
  53607. function findPrevElement (children) {
  53608. var i = children.length;
  53609. while (i--) {
  53610. if (children[i].type === 1) {
  53611. return children[i]
  53612. } else {
  53613. if (children[i].text !== ' ') {
  53614. warn$2(
  53615. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53616. "will be ignored.",
  53617. children[i]
  53618. );
  53619. }
  53620. children.pop();
  53621. }
  53622. }
  53623. }
  53624. function addIfCondition (el, condition) {
  53625. if (!el.ifConditions) {
  53626. el.ifConditions = [];
  53627. }
  53628. el.ifConditions.push(condition);
  53629. }
  53630. function processOnce (el) {
  53631. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53632. if (once$$1 != null) {
  53633. el.once = true;
  53634. }
  53635. }
  53636. // handle content being passed to a component as slot,
  53637. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53638. function processSlotContent (el) {
  53639. var slotScope;
  53640. if (el.tag === 'template') {
  53641. slotScope = getAndRemoveAttr(el, 'scope');
  53642. /* istanbul ignore if */
  53643. if (slotScope) {
  53644. warn$2(
  53645. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53646. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53647. "can also be used on plain elements in addition to <template> to " +
  53648. "denote scoped slots.",
  53649. el.rawAttrsMap['scope'],
  53650. true
  53651. );
  53652. }
  53653. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53654. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53655. /* istanbul ignore if */
  53656. if (el.attrsMap['v-for']) {
  53657. warn$2(
  53658. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53659. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53660. "scoped slot to make it clearer.",
  53661. el.rawAttrsMap['slot-scope'],
  53662. true
  53663. );
  53664. }
  53665. el.slotScope = slotScope;
  53666. }
  53667. // slot="xxx"
  53668. var slotTarget = getBindingAttr(el, 'slot');
  53669. if (slotTarget) {
  53670. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53671. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53672. // preserve slot as an attribute for native shadow DOM compat
  53673. // only for non-scoped slots.
  53674. if (el.tag !== 'template' && !el.slotScope) {
  53675. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53676. }
  53677. }
  53678. // 2.6 v-slot syntax
  53679. {
  53680. if (el.tag === 'template') {
  53681. // v-slot on <template>
  53682. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53683. if (slotBinding) {
  53684. {
  53685. if (el.slotTarget || el.slotScope) {
  53686. warn$2(
  53687. "Unexpected mixed usage of different slot syntaxes.",
  53688. el
  53689. );
  53690. }
  53691. if (el.parent && !maybeComponent(el.parent)) {
  53692. warn$2(
  53693. "<template v-slot> can only appear at the root level inside " +
  53694. "the receiving component",
  53695. el
  53696. );
  53697. }
  53698. }
  53699. var ref = getSlotName(slotBinding);
  53700. var name = ref.name;
  53701. var dynamic = ref.dynamic;
  53702. el.slotTarget = name;
  53703. el.slotTargetDynamic = dynamic;
  53704. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53705. }
  53706. } else {
  53707. // v-slot on component, denotes default slot
  53708. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53709. if (slotBinding$1) {
  53710. {
  53711. if (!maybeComponent(el)) {
  53712. warn$2(
  53713. "v-slot can only be used on components or <template>.",
  53714. slotBinding$1
  53715. );
  53716. }
  53717. if (el.slotScope || el.slotTarget) {
  53718. warn$2(
  53719. "Unexpected mixed usage of different slot syntaxes.",
  53720. el
  53721. );
  53722. }
  53723. if (el.scopedSlots) {
  53724. warn$2(
  53725. "To avoid scope ambiguity, the default slot should also use " +
  53726. "<template> syntax when there are other named slots.",
  53727. slotBinding$1
  53728. );
  53729. }
  53730. }
  53731. // add the component's children to its default slot
  53732. var slots = el.scopedSlots || (el.scopedSlots = {});
  53733. var ref$1 = getSlotName(slotBinding$1);
  53734. var name$1 = ref$1.name;
  53735. var dynamic$1 = ref$1.dynamic;
  53736. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53737. slotContainer.slotTarget = name$1;
  53738. slotContainer.slotTargetDynamic = dynamic$1;
  53739. slotContainer.children = el.children.filter(function (c) {
  53740. if (!c.slotScope) {
  53741. c.parent = slotContainer;
  53742. return true
  53743. }
  53744. });
  53745. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53746. // remove children as they are returned from scopedSlots now
  53747. el.children = [];
  53748. // mark el non-plain so data gets generated
  53749. el.plain = false;
  53750. }
  53751. }
  53752. }
  53753. }
  53754. function getSlotName (binding) {
  53755. var name = binding.name.replace(slotRE, '');
  53756. if (!name) {
  53757. if (binding.name[0] !== '#') {
  53758. name = 'default';
  53759. } else {
  53760. warn$2(
  53761. "v-slot shorthand syntax requires a slot name.",
  53762. binding
  53763. );
  53764. }
  53765. }
  53766. return dynamicArgRE.test(name)
  53767. // dynamic [name]
  53768. ? { name: name.slice(1, -1), dynamic: true }
  53769. // static name
  53770. : { name: ("\"" + name + "\""), dynamic: false }
  53771. }
  53772. // handle <slot/> outlets
  53773. function processSlotOutlet (el) {
  53774. if (el.tag === 'slot') {
  53775. el.slotName = getBindingAttr(el, 'name');
  53776. if (el.key) {
  53777. warn$2(
  53778. "`key` does not work on <slot> because slots are abstract outlets " +
  53779. "and can possibly expand into multiple elements. " +
  53780. "Use the key on a wrapping element instead.",
  53781. getRawBindingAttr(el, 'key')
  53782. );
  53783. }
  53784. }
  53785. }
  53786. function processComponent (el) {
  53787. var binding;
  53788. if ((binding = getBindingAttr(el, 'is'))) {
  53789. el.component = binding;
  53790. }
  53791. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53792. el.inlineTemplate = true;
  53793. }
  53794. }
  53795. function processAttrs (el) {
  53796. var list = el.attrsList;
  53797. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53798. for (i = 0, l = list.length; i < l; i++) {
  53799. name = rawName = list[i].name;
  53800. value = list[i].value;
  53801. if (dirRE.test(name)) {
  53802. // mark element as dynamic
  53803. el.hasBindings = true;
  53804. // modifiers
  53805. modifiers = parseModifiers(name.replace(dirRE, ''));
  53806. // support .foo shorthand syntax for the .prop modifier
  53807. if (modifiers) {
  53808. name = name.replace(modifierRE, '');
  53809. }
  53810. if (bindRE.test(name)) { // v-bind
  53811. name = name.replace(bindRE, '');
  53812. value = parseFilters(value);
  53813. isDynamic = dynamicArgRE.test(name);
  53814. if (isDynamic) {
  53815. name = name.slice(1, -1);
  53816. }
  53817. if (
  53818. value.trim().length === 0
  53819. ) {
  53820. warn$2(
  53821. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53822. );
  53823. }
  53824. if (modifiers) {
  53825. if (modifiers.prop && !isDynamic) {
  53826. name = camelize(name);
  53827. if (name === 'innerHtml') { name = 'innerHTML'; }
  53828. }
  53829. if (modifiers.camel && !isDynamic) {
  53830. name = camelize(name);
  53831. }
  53832. if (modifiers.sync) {
  53833. syncGen = genAssignmentCode(value, "$event");
  53834. if (!isDynamic) {
  53835. addHandler(
  53836. el,
  53837. ("update:" + (camelize(name))),
  53838. syncGen,
  53839. null,
  53840. false,
  53841. warn$2,
  53842. list[i]
  53843. );
  53844. if (hyphenate(name) !== camelize(name)) {
  53845. addHandler(
  53846. el,
  53847. ("update:" + (hyphenate(name))),
  53848. syncGen,
  53849. null,
  53850. false,
  53851. warn$2,
  53852. list[i]
  53853. );
  53854. }
  53855. } else {
  53856. // handler w/ dynamic event name
  53857. addHandler(
  53858. el,
  53859. ("\"update:\"+(" + name + ")"),
  53860. syncGen,
  53861. null,
  53862. false,
  53863. warn$2,
  53864. list[i],
  53865. true // dynamic
  53866. );
  53867. }
  53868. }
  53869. }
  53870. if ((modifiers && modifiers.prop) || (
  53871. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53872. )) {
  53873. addProp(el, name, value, list[i], isDynamic);
  53874. } else {
  53875. addAttr(el, name, value, list[i], isDynamic);
  53876. }
  53877. } else if (onRE.test(name)) { // v-on
  53878. name = name.replace(onRE, '');
  53879. isDynamic = dynamicArgRE.test(name);
  53880. if (isDynamic) {
  53881. name = name.slice(1, -1);
  53882. }
  53883. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53884. } else { // normal directives
  53885. name = name.replace(dirRE, '');
  53886. // parse arg
  53887. var argMatch = name.match(argRE);
  53888. var arg = argMatch && argMatch[1];
  53889. isDynamic = false;
  53890. if (arg) {
  53891. name = name.slice(0, -(arg.length + 1));
  53892. if (dynamicArgRE.test(arg)) {
  53893. arg = arg.slice(1, -1);
  53894. isDynamic = true;
  53895. }
  53896. }
  53897. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53898. if (name === 'model') {
  53899. checkForAliasModel(el, value);
  53900. }
  53901. }
  53902. } else {
  53903. // literal attribute
  53904. {
  53905. var res = parseText(value, delimiters);
  53906. if (res) {
  53907. warn$2(
  53908. name + "=\"" + value + "\": " +
  53909. 'Interpolation inside attributes has been removed. ' +
  53910. 'Use v-bind or the colon shorthand instead. For example, ' +
  53911. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53912. list[i]
  53913. );
  53914. }
  53915. }
  53916. addAttr(el, name, JSON.stringify(value), list[i]);
  53917. // #6887 firefox doesn't update muted state if set via attribute
  53918. // even immediately after element creation
  53919. if (!el.component &&
  53920. name === 'muted' &&
  53921. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53922. addProp(el, name, 'true', list[i]);
  53923. }
  53924. }
  53925. }
  53926. }
  53927. function checkInFor (el) {
  53928. var parent = el;
  53929. while (parent) {
  53930. if (parent.for !== undefined) {
  53931. return true
  53932. }
  53933. parent = parent.parent;
  53934. }
  53935. return false
  53936. }
  53937. function parseModifiers (name) {
  53938. var match = name.match(modifierRE);
  53939. if (match) {
  53940. var ret = {};
  53941. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53942. return ret
  53943. }
  53944. }
  53945. function makeAttrsMap (attrs) {
  53946. var map = {};
  53947. for (var i = 0, l = attrs.length; i < l; i++) {
  53948. if (
  53949. map[attrs[i].name] && !isIE && !isEdge
  53950. ) {
  53951. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53952. }
  53953. map[attrs[i].name] = attrs[i].value;
  53954. }
  53955. return map
  53956. }
  53957. // for script (e.g. type="x/template") or style, do not decode content
  53958. function isTextTag (el) {
  53959. return el.tag === 'script' || el.tag === 'style'
  53960. }
  53961. function isForbiddenTag (el) {
  53962. return (
  53963. el.tag === 'style' ||
  53964. (el.tag === 'script' && (
  53965. !el.attrsMap.type ||
  53966. el.attrsMap.type === 'text/javascript'
  53967. ))
  53968. )
  53969. }
  53970. var ieNSBug = /^xmlns:NS\d+/;
  53971. var ieNSPrefix = /^NS\d+:/;
  53972. /* istanbul ignore next */
  53973. function guardIESVGBug (attrs) {
  53974. var res = [];
  53975. for (var i = 0; i < attrs.length; i++) {
  53976. var attr = attrs[i];
  53977. if (!ieNSBug.test(attr.name)) {
  53978. attr.name = attr.name.replace(ieNSPrefix, '');
  53979. res.push(attr);
  53980. }
  53981. }
  53982. return res
  53983. }
  53984. function checkForAliasModel (el, value) {
  53985. var _el = el;
  53986. while (_el) {
  53987. if (_el.for && _el.alias === value) {
  53988. warn$2(
  53989. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53990. "You are binding v-model directly to a v-for iteration alias. " +
  53991. "This will not be able to modify the v-for source array because " +
  53992. "writing to the alias is like modifying a function local variable. " +
  53993. "Consider using an array of objects and use v-model on an object property instead.",
  53994. el.rawAttrsMap['v-model']
  53995. );
  53996. }
  53997. _el = _el.parent;
  53998. }
  53999. }
  54000. /* */
  54001. function preTransformNode (el, options) {
  54002. if (el.tag === 'input') {
  54003. var map = el.attrsMap;
  54004. if (!map['v-model']) {
  54005. return
  54006. }
  54007. var typeBinding;
  54008. if (map[':type'] || map['v-bind:type']) {
  54009. typeBinding = getBindingAttr(el, 'type');
  54010. }
  54011. if (!map.type && !typeBinding && map['v-bind']) {
  54012. typeBinding = "(" + (map['v-bind']) + ").type";
  54013. }
  54014. if (typeBinding) {
  54015. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54016. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54017. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54018. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54019. // 1. checkbox
  54020. var branch0 = cloneASTElement(el);
  54021. // process for on the main node
  54022. processFor(branch0);
  54023. addRawAttr(branch0, 'type', 'checkbox');
  54024. processElement(branch0, options);
  54025. branch0.processed = true; // prevent it from double-processed
  54026. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54027. addIfCondition(branch0, {
  54028. exp: branch0.if,
  54029. block: branch0
  54030. });
  54031. // 2. add radio else-if condition
  54032. var branch1 = cloneASTElement(el);
  54033. getAndRemoveAttr(branch1, 'v-for', true);
  54034. addRawAttr(branch1, 'type', 'radio');
  54035. processElement(branch1, options);
  54036. addIfCondition(branch0, {
  54037. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54038. block: branch1
  54039. });
  54040. // 3. other
  54041. var branch2 = cloneASTElement(el);
  54042. getAndRemoveAttr(branch2, 'v-for', true);
  54043. addRawAttr(branch2, ':type', typeBinding);
  54044. processElement(branch2, options);
  54045. addIfCondition(branch0, {
  54046. exp: ifCondition,
  54047. block: branch2
  54048. });
  54049. if (hasElse) {
  54050. branch0.else = true;
  54051. } else if (elseIfCondition) {
  54052. branch0.elseif = elseIfCondition;
  54053. }
  54054. return branch0
  54055. }
  54056. }
  54057. }
  54058. function cloneASTElement (el) {
  54059. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54060. }
  54061. var model$1 = {
  54062. preTransformNode: preTransformNode
  54063. };
  54064. var modules$1 = [
  54065. klass$1,
  54066. style$1,
  54067. model$1
  54068. ];
  54069. /* */
  54070. function text (el, dir) {
  54071. if (dir.value) {
  54072. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54073. }
  54074. }
  54075. /* */
  54076. function html (el, dir) {
  54077. if (dir.value) {
  54078. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54079. }
  54080. }
  54081. var directives$1 = {
  54082. model: model,
  54083. text: text,
  54084. html: html
  54085. };
  54086. /* */
  54087. var baseOptions = {
  54088. expectHTML: true,
  54089. modules: modules$1,
  54090. directives: directives$1,
  54091. isPreTag: isPreTag,
  54092. isUnaryTag: isUnaryTag,
  54093. mustUseProp: mustUseProp,
  54094. canBeLeftOpenTag: canBeLeftOpenTag,
  54095. isReservedTag: isReservedTag,
  54096. getTagNamespace: getTagNamespace,
  54097. staticKeys: genStaticKeys(modules$1)
  54098. };
  54099. /* */
  54100. var isStaticKey;
  54101. var isPlatformReservedTag;
  54102. var genStaticKeysCached = cached(genStaticKeys$1);
  54103. /**
  54104. * Goal of the optimizer: walk the generated template AST tree
  54105. * and detect sub-trees that are purely static, i.e. parts of
  54106. * the DOM that never needs to change.
  54107. *
  54108. * Once we detect these sub-trees, we can:
  54109. *
  54110. * 1. Hoist them into constants, so that we no longer need to
  54111. * create fresh nodes for them on each re-render;
  54112. * 2. Completely skip them in the patching process.
  54113. */
  54114. function optimize (root, options) {
  54115. if (!root) { return }
  54116. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54117. isPlatformReservedTag = options.isReservedTag || no;
  54118. // first pass: mark all non-static nodes.
  54119. markStatic$1(root);
  54120. // second pass: mark static roots.
  54121. markStaticRoots(root, false);
  54122. }
  54123. function genStaticKeys$1 (keys) {
  54124. return makeMap(
  54125. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54126. (keys ? ',' + keys : '')
  54127. )
  54128. }
  54129. function markStatic$1 (node) {
  54130. node.static = isStatic(node);
  54131. if (node.type === 1) {
  54132. // do not make component slot content static. this avoids
  54133. // 1. components not able to mutate slot nodes
  54134. // 2. static slot content fails for hot-reloading
  54135. if (
  54136. !isPlatformReservedTag(node.tag) &&
  54137. node.tag !== 'slot' &&
  54138. node.attrsMap['inline-template'] == null
  54139. ) {
  54140. return
  54141. }
  54142. for (var i = 0, l = node.children.length; i < l; i++) {
  54143. var child = node.children[i];
  54144. markStatic$1(child);
  54145. if (!child.static) {
  54146. node.static = false;
  54147. }
  54148. }
  54149. if (node.ifConditions) {
  54150. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54151. var block = node.ifConditions[i$1].block;
  54152. markStatic$1(block);
  54153. if (!block.static) {
  54154. node.static = false;
  54155. }
  54156. }
  54157. }
  54158. }
  54159. }
  54160. function markStaticRoots (node, isInFor) {
  54161. if (node.type === 1) {
  54162. if (node.static || node.once) {
  54163. node.staticInFor = isInFor;
  54164. }
  54165. // For a node to qualify as a static root, it should have children that
  54166. // are not just static text. Otherwise the cost of hoisting out will
  54167. // outweigh the benefits and it's better off to just always render it fresh.
  54168. if (node.static && node.children.length && !(
  54169. node.children.length === 1 &&
  54170. node.children[0].type === 3
  54171. )) {
  54172. node.staticRoot = true;
  54173. return
  54174. } else {
  54175. node.staticRoot = false;
  54176. }
  54177. if (node.children) {
  54178. for (var i = 0, l = node.children.length; i < l; i++) {
  54179. markStaticRoots(node.children[i], isInFor || !!node.for);
  54180. }
  54181. }
  54182. if (node.ifConditions) {
  54183. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54184. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54185. }
  54186. }
  54187. }
  54188. }
  54189. function isStatic (node) {
  54190. if (node.type === 2) { // expression
  54191. return false
  54192. }
  54193. if (node.type === 3) { // text
  54194. return true
  54195. }
  54196. return !!(node.pre || (
  54197. !node.hasBindings && // no dynamic bindings
  54198. !node.if && !node.for && // not v-if or v-for or v-else
  54199. !isBuiltInTag(node.tag) && // not a built-in
  54200. isPlatformReservedTag(node.tag) && // not a component
  54201. !isDirectChildOfTemplateFor(node) &&
  54202. Object.keys(node).every(isStaticKey)
  54203. ))
  54204. }
  54205. function isDirectChildOfTemplateFor (node) {
  54206. while (node.parent) {
  54207. node = node.parent;
  54208. if (node.tag !== 'template') {
  54209. return false
  54210. }
  54211. if (node.for) {
  54212. return true
  54213. }
  54214. }
  54215. return false
  54216. }
  54217. /* */
  54218. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54219. var fnInvokeRE = /\([^)]*?\);*$/;
  54220. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54221. // KeyboardEvent.keyCode aliases
  54222. var keyCodes = {
  54223. esc: 27,
  54224. tab: 9,
  54225. enter: 13,
  54226. space: 32,
  54227. up: 38,
  54228. left: 37,
  54229. right: 39,
  54230. down: 40,
  54231. 'delete': [8, 46]
  54232. };
  54233. // KeyboardEvent.key aliases
  54234. var keyNames = {
  54235. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54236. esc: ['Esc', 'Escape'],
  54237. tab: 'Tab',
  54238. enter: 'Enter',
  54239. // #9112: IE11 uses `Spacebar` for Space key name.
  54240. space: [' ', 'Spacebar'],
  54241. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54242. up: ['Up', 'ArrowUp'],
  54243. left: ['Left', 'ArrowLeft'],
  54244. right: ['Right', 'ArrowRight'],
  54245. down: ['Down', 'ArrowDown'],
  54246. // #9112: IE11 uses `Del` for Delete key name.
  54247. 'delete': ['Backspace', 'Delete', 'Del']
  54248. };
  54249. // #4868: modifiers that prevent the execution of the listener
  54250. // need to explicitly return null so that we can determine whether to remove
  54251. // the listener for .once
  54252. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54253. var modifierCode = {
  54254. stop: '$event.stopPropagation();',
  54255. prevent: '$event.preventDefault();',
  54256. self: genGuard("$event.target !== $event.currentTarget"),
  54257. ctrl: genGuard("!$event.ctrlKey"),
  54258. shift: genGuard("!$event.shiftKey"),
  54259. alt: genGuard("!$event.altKey"),
  54260. meta: genGuard("!$event.metaKey"),
  54261. left: genGuard("'button' in $event && $event.button !== 0"),
  54262. middle: genGuard("'button' in $event && $event.button !== 1"),
  54263. right: genGuard("'button' in $event && $event.button !== 2")
  54264. };
  54265. function genHandlers (
  54266. events,
  54267. isNative
  54268. ) {
  54269. var prefix = isNative ? 'nativeOn:' : 'on:';
  54270. var staticHandlers = "";
  54271. var dynamicHandlers = "";
  54272. for (var name in events) {
  54273. var handlerCode = genHandler(events[name]);
  54274. if (events[name] && events[name].dynamic) {
  54275. dynamicHandlers += name + "," + handlerCode + ",";
  54276. } else {
  54277. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54278. }
  54279. }
  54280. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54281. if (dynamicHandlers) {
  54282. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54283. } else {
  54284. return prefix + staticHandlers
  54285. }
  54286. }
  54287. function genHandler (handler) {
  54288. if (!handler) {
  54289. return 'function(){}'
  54290. }
  54291. if (Array.isArray(handler)) {
  54292. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54293. }
  54294. var isMethodPath = simplePathRE.test(handler.value);
  54295. var isFunctionExpression = fnExpRE.test(handler.value);
  54296. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54297. if (!handler.modifiers) {
  54298. if (isMethodPath || isFunctionExpression) {
  54299. return handler.value
  54300. }
  54301. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54302. } else {
  54303. var code = '';
  54304. var genModifierCode = '';
  54305. var keys = [];
  54306. for (var key in handler.modifiers) {
  54307. if (modifierCode[key]) {
  54308. genModifierCode += modifierCode[key];
  54309. // left/right
  54310. if (keyCodes[key]) {
  54311. keys.push(key);
  54312. }
  54313. } else if (key === 'exact') {
  54314. var modifiers = (handler.modifiers);
  54315. genModifierCode += genGuard(
  54316. ['ctrl', 'shift', 'alt', 'meta']
  54317. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54318. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54319. .join('||')
  54320. );
  54321. } else {
  54322. keys.push(key);
  54323. }
  54324. }
  54325. if (keys.length) {
  54326. code += genKeyFilter(keys);
  54327. }
  54328. // Make sure modifiers like prevent and stop get executed after key filtering
  54329. if (genModifierCode) {
  54330. code += genModifierCode;
  54331. }
  54332. var handlerCode = isMethodPath
  54333. ? ("return " + (handler.value) + "($event)")
  54334. : isFunctionExpression
  54335. ? ("return (" + (handler.value) + ")($event)")
  54336. : isFunctionInvocation
  54337. ? ("return " + (handler.value))
  54338. : handler.value;
  54339. return ("function($event){" + code + handlerCode + "}")
  54340. }
  54341. }
  54342. function genKeyFilter (keys) {
  54343. return (
  54344. // make sure the key filters only apply to KeyboardEvents
  54345. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54346. // key events that do not have keyCode property...
  54347. "if(!$event.type.indexOf('key')&&" +
  54348. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54349. )
  54350. }
  54351. function genFilterCode (key) {
  54352. var keyVal = parseInt(key, 10);
  54353. if (keyVal) {
  54354. return ("$event.keyCode!==" + keyVal)
  54355. }
  54356. var keyCode = keyCodes[key];
  54357. var keyName = keyNames[key];
  54358. return (
  54359. "_k($event.keyCode," +
  54360. (JSON.stringify(key)) + "," +
  54361. (JSON.stringify(keyCode)) + "," +
  54362. "$event.key," +
  54363. "" + (JSON.stringify(keyName)) +
  54364. ")"
  54365. )
  54366. }
  54367. /* */
  54368. function on (el, dir) {
  54369. if (dir.modifiers) {
  54370. warn("v-on without argument does not support modifiers.");
  54371. }
  54372. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54373. }
  54374. /* */
  54375. function bind$1 (el, dir) {
  54376. el.wrapData = function (code) {
  54377. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54378. };
  54379. }
  54380. /* */
  54381. var baseDirectives = {
  54382. on: on,
  54383. bind: bind$1,
  54384. cloak: noop
  54385. };
  54386. /* */
  54387. var CodegenState = function CodegenState (options) {
  54388. this.options = options;
  54389. this.warn = options.warn || baseWarn;
  54390. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54391. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54392. this.directives = extend(extend({}, baseDirectives), options.directives);
  54393. var isReservedTag = options.isReservedTag || no;
  54394. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54395. this.onceId = 0;
  54396. this.staticRenderFns = [];
  54397. this.pre = false;
  54398. };
  54399. function generate (
  54400. ast,
  54401. options
  54402. ) {
  54403. var state = new CodegenState(options);
  54404. var code = ast ? genElement(ast, state) : '_c("div")';
  54405. return {
  54406. render: ("with(this){return " + code + "}"),
  54407. staticRenderFns: state.staticRenderFns
  54408. }
  54409. }
  54410. function genElement (el, state) {
  54411. if (el.parent) {
  54412. el.pre = el.pre || el.parent.pre;
  54413. }
  54414. if (el.staticRoot && !el.staticProcessed) {
  54415. return genStatic(el, state)
  54416. } else if (el.once && !el.onceProcessed) {
  54417. return genOnce(el, state)
  54418. } else if (el.for && !el.forProcessed) {
  54419. return genFor(el, state)
  54420. } else if (el.if && !el.ifProcessed) {
  54421. return genIf(el, state)
  54422. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54423. return genChildren(el, state) || 'void 0'
  54424. } else if (el.tag === 'slot') {
  54425. return genSlot(el, state)
  54426. } else {
  54427. // component or element
  54428. var code;
  54429. if (el.component) {
  54430. code = genComponent(el.component, el, state);
  54431. } else {
  54432. var data;
  54433. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54434. data = genData$2(el, state);
  54435. }
  54436. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54437. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54438. }
  54439. // module transforms
  54440. for (var i = 0; i < state.transforms.length; i++) {
  54441. code = state.transforms[i](el, code);
  54442. }
  54443. return code
  54444. }
  54445. }
  54446. // hoist static sub-trees out
  54447. function genStatic (el, state) {
  54448. el.staticProcessed = true;
  54449. // Some elements (templates) need to behave differently inside of a v-pre
  54450. // node. All pre nodes are static roots, so we can use this as a location to
  54451. // wrap a state change and reset it upon exiting the pre node.
  54452. var originalPreState = state.pre;
  54453. if (el.pre) {
  54454. state.pre = el.pre;
  54455. }
  54456. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54457. state.pre = originalPreState;
  54458. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54459. }
  54460. // v-once
  54461. function genOnce (el, state) {
  54462. el.onceProcessed = true;
  54463. if (el.if && !el.ifProcessed) {
  54464. return genIf(el, state)
  54465. } else if (el.staticInFor) {
  54466. var key = '';
  54467. var parent = el.parent;
  54468. while (parent) {
  54469. if (parent.for) {
  54470. key = parent.key;
  54471. break
  54472. }
  54473. parent = parent.parent;
  54474. }
  54475. if (!key) {
  54476. state.warn(
  54477. "v-once can only be used inside v-for that is keyed. ",
  54478. el.rawAttrsMap['v-once']
  54479. );
  54480. return genElement(el, state)
  54481. }
  54482. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54483. } else {
  54484. return genStatic(el, state)
  54485. }
  54486. }
  54487. function genIf (
  54488. el,
  54489. state,
  54490. altGen,
  54491. altEmpty
  54492. ) {
  54493. el.ifProcessed = true; // avoid recursion
  54494. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54495. }
  54496. function genIfConditions (
  54497. conditions,
  54498. state,
  54499. altGen,
  54500. altEmpty
  54501. ) {
  54502. if (!conditions.length) {
  54503. return altEmpty || '_e()'
  54504. }
  54505. var condition = conditions.shift();
  54506. if (condition.exp) {
  54507. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54508. } else {
  54509. return ("" + (genTernaryExp(condition.block)))
  54510. }
  54511. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54512. function genTernaryExp (el) {
  54513. return altGen
  54514. ? altGen(el, state)
  54515. : el.once
  54516. ? genOnce(el, state)
  54517. : genElement(el, state)
  54518. }
  54519. }
  54520. function genFor (
  54521. el,
  54522. state,
  54523. altGen,
  54524. altHelper
  54525. ) {
  54526. var exp = el.for;
  54527. var alias = el.alias;
  54528. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54529. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54530. if (state.maybeComponent(el) &&
  54531. el.tag !== 'slot' &&
  54532. el.tag !== 'template' &&
  54533. !el.key
  54534. ) {
  54535. state.warn(
  54536. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54537. "v-for should have explicit keys. " +
  54538. "See https://vuejs.org/guide/list.html#key for more info.",
  54539. el.rawAttrsMap['v-for'],
  54540. true /* tip */
  54541. );
  54542. }
  54543. el.forProcessed = true; // avoid recursion
  54544. return (altHelper || '_l') + "((" + exp + ")," +
  54545. "function(" + alias + iterator1 + iterator2 + "){" +
  54546. "return " + ((altGen || genElement)(el, state)) +
  54547. '})'
  54548. }
  54549. function genData$2 (el, state) {
  54550. var data = '{';
  54551. // directives first.
  54552. // directives may mutate the el's other properties before they are generated.
  54553. var dirs = genDirectives(el, state);
  54554. if (dirs) { data += dirs + ','; }
  54555. // key
  54556. if (el.key) {
  54557. data += "key:" + (el.key) + ",";
  54558. }
  54559. // ref
  54560. if (el.ref) {
  54561. data += "ref:" + (el.ref) + ",";
  54562. }
  54563. if (el.refInFor) {
  54564. data += "refInFor:true,";
  54565. }
  54566. // pre
  54567. if (el.pre) {
  54568. data += "pre:true,";
  54569. }
  54570. // record original tag name for components using "is" attribute
  54571. if (el.component) {
  54572. data += "tag:\"" + (el.tag) + "\",";
  54573. }
  54574. // module data generation functions
  54575. for (var i = 0; i < state.dataGenFns.length; i++) {
  54576. data += state.dataGenFns[i](el);
  54577. }
  54578. // attributes
  54579. if (el.attrs) {
  54580. data += "attrs:" + (genProps(el.attrs)) + ",";
  54581. }
  54582. // DOM props
  54583. if (el.props) {
  54584. data += "domProps:" + (genProps(el.props)) + ",";
  54585. }
  54586. // event handlers
  54587. if (el.events) {
  54588. data += (genHandlers(el.events, false)) + ",";
  54589. }
  54590. if (el.nativeEvents) {
  54591. data += (genHandlers(el.nativeEvents, true)) + ",";
  54592. }
  54593. // slot target
  54594. // only for non-scoped slots
  54595. if (el.slotTarget && !el.slotScope) {
  54596. data += "slot:" + (el.slotTarget) + ",";
  54597. }
  54598. // scoped slots
  54599. if (el.scopedSlots) {
  54600. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54601. }
  54602. // component v-model
  54603. if (el.model) {
  54604. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54605. }
  54606. // inline-template
  54607. if (el.inlineTemplate) {
  54608. var inlineTemplate = genInlineTemplate(el, state);
  54609. if (inlineTemplate) {
  54610. data += inlineTemplate + ",";
  54611. }
  54612. }
  54613. data = data.replace(/,$/, '') + '}';
  54614. // v-bind dynamic argument wrap
  54615. // v-bind with dynamic arguments must be applied using the same v-bind object
  54616. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54617. if (el.dynamicAttrs) {
  54618. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54619. }
  54620. // v-bind data wrap
  54621. if (el.wrapData) {
  54622. data = el.wrapData(data);
  54623. }
  54624. // v-on data wrap
  54625. if (el.wrapListeners) {
  54626. data = el.wrapListeners(data);
  54627. }
  54628. return data
  54629. }
  54630. function genDirectives (el, state) {
  54631. var dirs = el.directives;
  54632. if (!dirs) { return }
  54633. var res = 'directives:[';
  54634. var hasRuntime = false;
  54635. var i, l, dir, needRuntime;
  54636. for (i = 0, l = dirs.length; i < l; i++) {
  54637. dir = dirs[i];
  54638. needRuntime = true;
  54639. var gen = state.directives[dir.name];
  54640. if (gen) {
  54641. // compile-time directive that manipulates AST.
  54642. // returns true if it also needs a runtime counterpart.
  54643. needRuntime = !!gen(el, dir, state.warn);
  54644. }
  54645. if (needRuntime) {
  54646. hasRuntime = true;
  54647. 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))) : '') + "},";
  54648. }
  54649. }
  54650. if (hasRuntime) {
  54651. return res.slice(0, -1) + ']'
  54652. }
  54653. }
  54654. function genInlineTemplate (el, state) {
  54655. var ast = el.children[0];
  54656. if (el.children.length !== 1 || ast.type !== 1) {
  54657. state.warn(
  54658. 'Inline-template components must have exactly one child element.',
  54659. { start: el.start }
  54660. );
  54661. }
  54662. if (ast && ast.type === 1) {
  54663. var inlineRenderFns = generate(ast, state.options);
  54664. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54665. }
  54666. }
  54667. function genScopedSlots (
  54668. el,
  54669. slots,
  54670. state
  54671. ) {
  54672. // by default scoped slots are considered "stable", this allows child
  54673. // components with only scoped slots to skip forced updates from parent.
  54674. // but in some cases we have to bail-out of this optimization
  54675. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54676. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54677. var slot = slots[key];
  54678. return (
  54679. slot.slotTargetDynamic ||
  54680. slot.if ||
  54681. slot.for ||
  54682. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54683. )
  54684. });
  54685. // #9534: if a component with scoped slots is inside a conditional branch,
  54686. // it's possible for the same component to be reused but with different
  54687. // compiled slot content. To avoid that, we generate a unique key based on
  54688. // the generated code of all the slot contents.
  54689. var needsKey = !!el.if;
  54690. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54691. // disconnected due to the intermediate scope variable)
  54692. // #9438, #9506
  54693. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54694. // and skip force updating ones that do not actually use scope variables.
  54695. if (!needsForceUpdate) {
  54696. var parent = el.parent;
  54697. while (parent) {
  54698. if (
  54699. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54700. parent.for
  54701. ) {
  54702. needsForceUpdate = true;
  54703. break
  54704. }
  54705. if (parent.if) {
  54706. needsKey = true;
  54707. }
  54708. parent = parent.parent;
  54709. }
  54710. }
  54711. var generatedSlots = Object.keys(slots)
  54712. .map(function (key) { return genScopedSlot(slots[key], state); })
  54713. .join(',');
  54714. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54715. }
  54716. function hash(str) {
  54717. var hash = 5381;
  54718. var i = str.length;
  54719. while(i) {
  54720. hash = (hash * 33) ^ str.charCodeAt(--i);
  54721. }
  54722. return hash >>> 0
  54723. }
  54724. function containsSlotChild (el) {
  54725. if (el.type === 1) {
  54726. if (el.tag === 'slot') {
  54727. return true
  54728. }
  54729. return el.children.some(containsSlotChild)
  54730. }
  54731. return false
  54732. }
  54733. function genScopedSlot (
  54734. el,
  54735. state
  54736. ) {
  54737. var isLegacySyntax = el.attrsMap['slot-scope'];
  54738. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54739. return genIf(el, state, genScopedSlot, "null")
  54740. }
  54741. if (el.for && !el.forProcessed) {
  54742. return genFor(el, state, genScopedSlot)
  54743. }
  54744. var slotScope = el.slotScope === emptySlotScopeToken
  54745. ? ""
  54746. : String(el.slotScope);
  54747. var fn = "function(" + slotScope + "){" +
  54748. "return " + (el.tag === 'template'
  54749. ? el.if && isLegacySyntax
  54750. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54751. : genChildren(el, state) || 'undefined'
  54752. : genElement(el, state)) + "}";
  54753. // reverse proxy v-slot without scope on this.$slots
  54754. var reverseProxy = slotScope ? "" : ",proxy:true";
  54755. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54756. }
  54757. function genChildren (
  54758. el,
  54759. state,
  54760. checkSkip,
  54761. altGenElement,
  54762. altGenNode
  54763. ) {
  54764. var children = el.children;
  54765. if (children.length) {
  54766. var el$1 = children[0];
  54767. // optimize single v-for
  54768. if (children.length === 1 &&
  54769. el$1.for &&
  54770. el$1.tag !== 'template' &&
  54771. el$1.tag !== 'slot'
  54772. ) {
  54773. var normalizationType = checkSkip
  54774. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54775. : "";
  54776. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54777. }
  54778. var normalizationType$1 = checkSkip
  54779. ? getNormalizationType(children, state.maybeComponent)
  54780. : 0;
  54781. var gen = altGenNode || genNode;
  54782. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54783. }
  54784. }
  54785. // determine the normalization needed for the children array.
  54786. // 0: no normalization needed
  54787. // 1: simple normalization needed (possible 1-level deep nested array)
  54788. // 2: full normalization needed
  54789. function getNormalizationType (
  54790. children,
  54791. maybeComponent
  54792. ) {
  54793. var res = 0;
  54794. for (var i = 0; i < children.length; i++) {
  54795. var el = children[i];
  54796. if (el.type !== 1) {
  54797. continue
  54798. }
  54799. if (needsNormalization(el) ||
  54800. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54801. res = 2;
  54802. break
  54803. }
  54804. if (maybeComponent(el) ||
  54805. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54806. res = 1;
  54807. }
  54808. }
  54809. return res
  54810. }
  54811. function needsNormalization (el) {
  54812. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54813. }
  54814. function genNode (node, state) {
  54815. if (node.type === 1) {
  54816. return genElement(node, state)
  54817. } else if (node.type === 3 && node.isComment) {
  54818. return genComment(node)
  54819. } else {
  54820. return genText(node)
  54821. }
  54822. }
  54823. function genText (text) {
  54824. return ("_v(" + (text.type === 2
  54825. ? text.expression // no need for () because already wrapped in _s()
  54826. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54827. }
  54828. function genComment (comment) {
  54829. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54830. }
  54831. function genSlot (el, state) {
  54832. var slotName = el.slotName || '"default"';
  54833. var children = genChildren(el, state);
  54834. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54835. var attrs = el.attrs || el.dynamicAttrs
  54836. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54837. // slot props are camelized
  54838. name: camelize(attr.name),
  54839. value: attr.value,
  54840. dynamic: attr.dynamic
  54841. }); }))
  54842. : null;
  54843. var bind$$1 = el.attrsMap['v-bind'];
  54844. if ((attrs || bind$$1) && !children) {
  54845. res += ",null";
  54846. }
  54847. if (attrs) {
  54848. res += "," + attrs;
  54849. }
  54850. if (bind$$1) {
  54851. res += (attrs ? '' : ',null') + "," + bind$$1;
  54852. }
  54853. return res + ')'
  54854. }
  54855. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54856. function genComponent (
  54857. componentName,
  54858. el,
  54859. state
  54860. ) {
  54861. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54862. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54863. }
  54864. function genProps (props) {
  54865. var staticProps = "";
  54866. var dynamicProps = "";
  54867. for (var i = 0; i < props.length; i++) {
  54868. var prop = props[i];
  54869. var value = transformSpecialNewlines(prop.value);
  54870. if (prop.dynamic) {
  54871. dynamicProps += (prop.name) + "," + value + ",";
  54872. } else {
  54873. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54874. }
  54875. }
  54876. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54877. if (dynamicProps) {
  54878. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54879. } else {
  54880. return staticProps
  54881. }
  54882. }
  54883. // #3895, #4268
  54884. function transformSpecialNewlines (text) {
  54885. return text
  54886. .replace(/\u2028/g, '\\u2028')
  54887. .replace(/\u2029/g, '\\u2029')
  54888. }
  54889. /* */
  54890. // these keywords should not appear inside expressions, but operators like
  54891. // typeof, instanceof and in are allowed
  54892. var prohibitedKeywordRE = new RegExp('\\b' + (
  54893. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54894. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54895. 'extends,finally,continue,debugger,function,arguments'
  54896. ).split(',').join('\\b|\\b') + '\\b');
  54897. // these unary operators should not be used as property/method names
  54898. var unaryOperatorsRE = new RegExp('\\b' + (
  54899. 'delete,typeof,void'
  54900. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54901. // strip strings in expressions
  54902. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54903. // detect problematic expressions in a template
  54904. function detectErrors (ast, warn) {
  54905. if (ast) {
  54906. checkNode(ast, warn);
  54907. }
  54908. }
  54909. function checkNode (node, warn) {
  54910. if (node.type === 1) {
  54911. for (var name in node.attrsMap) {
  54912. if (dirRE.test(name)) {
  54913. var value = node.attrsMap[name];
  54914. if (value) {
  54915. var range = node.rawAttrsMap[name];
  54916. if (name === 'v-for') {
  54917. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54918. } else if (name === 'v-slot' || name[0] === '#') {
  54919. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54920. } else if (onRE.test(name)) {
  54921. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54922. } else {
  54923. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54924. }
  54925. }
  54926. }
  54927. }
  54928. if (node.children) {
  54929. for (var i = 0; i < node.children.length; i++) {
  54930. checkNode(node.children[i], warn);
  54931. }
  54932. }
  54933. } else if (node.type === 2) {
  54934. checkExpression(node.expression, node.text, warn, node);
  54935. }
  54936. }
  54937. function checkEvent (exp, text, warn, range) {
  54938. var stripped = exp.replace(stripStringRE, '');
  54939. var keywordMatch = stripped.match(unaryOperatorsRE);
  54940. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54941. warn(
  54942. "avoid using JavaScript unary operator as property name: " +
  54943. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54944. range
  54945. );
  54946. }
  54947. checkExpression(exp, text, warn, range);
  54948. }
  54949. function checkFor (node, text, warn, range) {
  54950. checkExpression(node.for || '', text, warn, range);
  54951. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54952. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54953. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54954. }
  54955. function checkIdentifier (
  54956. ident,
  54957. type,
  54958. text,
  54959. warn,
  54960. range
  54961. ) {
  54962. if (typeof ident === 'string') {
  54963. try {
  54964. new Function(("var " + ident + "=_"));
  54965. } catch (e) {
  54966. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54967. }
  54968. }
  54969. }
  54970. function checkExpression (exp, text, warn, range) {
  54971. try {
  54972. new Function(("return " + exp));
  54973. } catch (e) {
  54974. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54975. if (keywordMatch) {
  54976. warn(
  54977. "avoid using JavaScript keyword as property name: " +
  54978. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54979. range
  54980. );
  54981. } else {
  54982. warn(
  54983. "invalid expression: " + (e.message) + " in\n\n" +
  54984. " " + exp + "\n\n" +
  54985. " Raw expression: " + (text.trim()) + "\n",
  54986. range
  54987. );
  54988. }
  54989. }
  54990. }
  54991. function checkFunctionParameterExpression (exp, text, warn, range) {
  54992. try {
  54993. new Function(exp, '');
  54994. } catch (e) {
  54995. warn(
  54996. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54997. " " + exp + "\n\n" +
  54998. " Raw expression: " + (text.trim()) + "\n",
  54999. range
  55000. );
  55001. }
  55002. }
  55003. /* */
  55004. var range = 2;
  55005. function generateCodeFrame (
  55006. source,
  55007. start,
  55008. end
  55009. ) {
  55010. if ( start === void 0 ) start = 0;
  55011. if ( end === void 0 ) end = source.length;
  55012. var lines = source.split(/\r?\n/);
  55013. var count = 0;
  55014. var res = [];
  55015. for (var i = 0; i < lines.length; i++) {
  55016. count += lines[i].length + 1;
  55017. if (count >= start) {
  55018. for (var j = i - range; j <= i + range || end > count; j++) {
  55019. if (j < 0 || j >= lines.length) { continue }
  55020. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55021. var lineLength = lines[j].length;
  55022. if (j === i) {
  55023. // push underline
  55024. var pad = start - (count - lineLength) + 1;
  55025. var length = end > count ? lineLength - pad : end - start;
  55026. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55027. } else if (j > i) {
  55028. if (end > count) {
  55029. var length$1 = Math.min(end - count, lineLength);
  55030. res.push(" | " + repeat$1("^", length$1));
  55031. }
  55032. count += lineLength + 1;
  55033. }
  55034. }
  55035. break
  55036. }
  55037. }
  55038. return res.join('\n')
  55039. }
  55040. function repeat$1 (str, n) {
  55041. var result = '';
  55042. if (n > 0) {
  55043. while (true) { // eslint-disable-line
  55044. if (n & 1) { result += str; }
  55045. n >>>= 1;
  55046. if (n <= 0) { break }
  55047. str += str;
  55048. }
  55049. }
  55050. return result
  55051. }
  55052. /* */
  55053. function createFunction (code, errors) {
  55054. try {
  55055. return new Function(code)
  55056. } catch (err) {
  55057. errors.push({ err: err, code: code });
  55058. return noop
  55059. }
  55060. }
  55061. function createCompileToFunctionFn (compile) {
  55062. var cache = Object.create(null);
  55063. return function compileToFunctions (
  55064. template,
  55065. options,
  55066. vm
  55067. ) {
  55068. options = extend({}, options);
  55069. var warn$$1 = options.warn || warn;
  55070. delete options.warn;
  55071. /* istanbul ignore if */
  55072. {
  55073. // detect possible CSP restriction
  55074. try {
  55075. new Function('return 1');
  55076. } catch (e) {
  55077. if (e.toString().match(/unsafe-eval|CSP/)) {
  55078. warn$$1(
  55079. 'It seems you are using the standalone build of Vue.js in an ' +
  55080. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55081. 'The template compiler cannot work in this environment. Consider ' +
  55082. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55083. 'templates into render functions.'
  55084. );
  55085. }
  55086. }
  55087. }
  55088. // check cache
  55089. var key = options.delimiters
  55090. ? String(options.delimiters) + template
  55091. : template;
  55092. if (cache[key]) {
  55093. return cache[key]
  55094. }
  55095. // compile
  55096. var compiled = compile(template, options);
  55097. // check compilation errors/tips
  55098. {
  55099. if (compiled.errors && compiled.errors.length) {
  55100. if (options.outputSourceRange) {
  55101. compiled.errors.forEach(function (e) {
  55102. warn$$1(
  55103. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55104. generateCodeFrame(template, e.start, e.end),
  55105. vm
  55106. );
  55107. });
  55108. } else {
  55109. warn$$1(
  55110. "Error compiling template:\n\n" + template + "\n\n" +
  55111. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55112. vm
  55113. );
  55114. }
  55115. }
  55116. if (compiled.tips && compiled.tips.length) {
  55117. if (options.outputSourceRange) {
  55118. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55119. } else {
  55120. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55121. }
  55122. }
  55123. }
  55124. // turn code into functions
  55125. var res = {};
  55126. var fnGenErrors = [];
  55127. res.render = createFunction(compiled.render, fnGenErrors);
  55128. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55129. return createFunction(code, fnGenErrors)
  55130. });
  55131. // check function generation errors.
  55132. // this should only happen if there is a bug in the compiler itself.
  55133. // mostly for codegen development use
  55134. /* istanbul ignore if */
  55135. {
  55136. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55137. warn$$1(
  55138. "Failed to generate render function:\n\n" +
  55139. fnGenErrors.map(function (ref) {
  55140. var err = ref.err;
  55141. var code = ref.code;
  55142. return ((err.toString()) + " in\n\n" + code + "\n");
  55143. }).join('\n'),
  55144. vm
  55145. );
  55146. }
  55147. }
  55148. return (cache[key] = res)
  55149. }
  55150. }
  55151. /* */
  55152. function createCompilerCreator (baseCompile) {
  55153. return function createCompiler (baseOptions) {
  55154. function compile (
  55155. template,
  55156. options
  55157. ) {
  55158. var finalOptions = Object.create(baseOptions);
  55159. var errors = [];
  55160. var tips = [];
  55161. var warn = function (msg, range, tip) {
  55162. (tip ? tips : errors).push(msg);
  55163. };
  55164. if (options) {
  55165. if (options.outputSourceRange) {
  55166. // $flow-disable-line
  55167. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55168. warn = function (msg, range, tip) {
  55169. var data = { msg: msg };
  55170. if (range) {
  55171. if (range.start != null) {
  55172. data.start = range.start + leadingSpaceLength;
  55173. }
  55174. if (range.end != null) {
  55175. data.end = range.end + leadingSpaceLength;
  55176. }
  55177. }
  55178. (tip ? tips : errors).push(data);
  55179. };
  55180. }
  55181. // merge custom modules
  55182. if (options.modules) {
  55183. finalOptions.modules =
  55184. (baseOptions.modules || []).concat(options.modules);
  55185. }
  55186. // merge custom directives
  55187. if (options.directives) {
  55188. finalOptions.directives = extend(
  55189. Object.create(baseOptions.directives || null),
  55190. options.directives
  55191. );
  55192. }
  55193. // copy other options
  55194. for (var key in options) {
  55195. if (key !== 'modules' && key !== 'directives') {
  55196. finalOptions[key] = options[key];
  55197. }
  55198. }
  55199. }
  55200. finalOptions.warn = warn;
  55201. var compiled = baseCompile(template.trim(), finalOptions);
  55202. {
  55203. detectErrors(compiled.ast, warn);
  55204. }
  55205. compiled.errors = errors;
  55206. compiled.tips = tips;
  55207. return compiled
  55208. }
  55209. return {
  55210. compile: compile,
  55211. compileToFunctions: createCompileToFunctionFn(compile)
  55212. }
  55213. }
  55214. }
  55215. /* */
  55216. // `createCompilerCreator` allows creating compilers that use alternative
  55217. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55218. // Here we just export a default compiler using the default parts.
  55219. var createCompiler = createCompilerCreator(function baseCompile (
  55220. template,
  55221. options
  55222. ) {
  55223. var ast = parse(template.trim(), options);
  55224. if (options.optimize !== false) {
  55225. optimize(ast, options);
  55226. }
  55227. var code = generate(ast, options);
  55228. return {
  55229. ast: ast,
  55230. render: code.render,
  55231. staticRenderFns: code.staticRenderFns
  55232. }
  55233. });
  55234. /* */
  55235. var ref$1 = createCompiler(baseOptions);
  55236. var compile = ref$1.compile;
  55237. var compileToFunctions = ref$1.compileToFunctions;
  55238. /* */
  55239. // check whether current browser encodes a char inside attribute values
  55240. var div;
  55241. function getShouldDecode (href) {
  55242. div = div || document.createElement('div');
  55243. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55244. return div.innerHTML.indexOf('&#10;') > 0
  55245. }
  55246. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55247. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55248. // #6828: chrome encodes content in a[href]
  55249. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55250. /* */
  55251. var idToTemplate = cached(function (id) {
  55252. var el = query(id);
  55253. return el && el.innerHTML
  55254. });
  55255. var mount = Vue.prototype.$mount;
  55256. Vue.prototype.$mount = function (
  55257. el,
  55258. hydrating
  55259. ) {
  55260. el = el && query(el);
  55261. /* istanbul ignore if */
  55262. if (el === document.body || el === document.documentElement) {
  55263. warn(
  55264. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55265. );
  55266. return this
  55267. }
  55268. var options = this.$options;
  55269. // resolve template/el and convert to render function
  55270. if (!options.render) {
  55271. var template = options.template;
  55272. if (template) {
  55273. if (typeof template === 'string') {
  55274. if (template.charAt(0) === '#') {
  55275. template = idToTemplate(template);
  55276. /* istanbul ignore if */
  55277. if (!template) {
  55278. warn(
  55279. ("Template element not found or is empty: " + (options.template)),
  55280. this
  55281. );
  55282. }
  55283. }
  55284. } else if (template.nodeType) {
  55285. template = template.innerHTML;
  55286. } else {
  55287. {
  55288. warn('invalid template option:' + template, this);
  55289. }
  55290. return this
  55291. }
  55292. } else if (el) {
  55293. template = getOuterHTML(el);
  55294. }
  55295. if (template) {
  55296. /* istanbul ignore if */
  55297. if (config.performance && mark) {
  55298. mark('compile');
  55299. }
  55300. var ref = compileToFunctions(template, {
  55301. outputSourceRange: "development" !== 'production',
  55302. shouldDecodeNewlines: shouldDecodeNewlines,
  55303. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55304. delimiters: options.delimiters,
  55305. comments: options.comments
  55306. }, this);
  55307. var render = ref.render;
  55308. var staticRenderFns = ref.staticRenderFns;
  55309. options.render = render;
  55310. options.staticRenderFns = staticRenderFns;
  55311. /* istanbul ignore if */
  55312. if (config.performance && mark) {
  55313. mark('compile end');
  55314. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55315. }
  55316. }
  55317. }
  55318. return mount.call(this, el, hydrating)
  55319. };
  55320. /**
  55321. * Get outerHTML of elements, taking care
  55322. * of SVG elements in IE as well.
  55323. */
  55324. function getOuterHTML (el) {
  55325. if (el.outerHTML) {
  55326. return el.outerHTML
  55327. } else {
  55328. var container = document.createElement('div');
  55329. container.appendChild(el.cloneNode(true));
  55330. return container.innerHTML
  55331. }
  55332. }
  55333. Vue.compile = compileToFunctions;
  55334. module.exports = Vue;
  55335. /* 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))
  55336. /***/ }),
  55337. /***/ "./node_modules/vue/dist/vue.common.js":
  55338. /*!*********************************************!*\
  55339. !*** ./node_modules/vue/dist/vue.common.js ***!
  55340. \*********************************************/
  55341. /*! no static exports found */
  55342. /***/ (function(module, exports, __webpack_require__) {
  55343. if (false) {} else {
  55344. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55345. }
  55346. /***/ }),
  55347. /***/ "./node_modules/webpack/buildin/global.js":
  55348. /*!***********************************!*\
  55349. !*** (webpack)/buildin/global.js ***!
  55350. \***********************************/
  55351. /*! no static exports found */
  55352. /***/ (function(module, exports) {
  55353. var g;
  55354. // This works in non-strict mode
  55355. g = (function() {
  55356. return this;
  55357. })();
  55358. try {
  55359. // This works if eval is allowed (see CSP)
  55360. g = g || new Function("return this")();
  55361. } catch (e) {
  55362. // This works if the window reference is available
  55363. if (typeof window === "object") g = window;
  55364. }
  55365. // g can still be undefined, but nothing to do about it...
  55366. // We return undefined, instead of nothing here, so it's
  55367. // easier to handle this case. if(!global) { ...}
  55368. module.exports = g;
  55369. /***/ }),
  55370. /***/ "./node_modules/webpack/buildin/module.js":
  55371. /*!***********************************!*\
  55372. !*** (webpack)/buildin/module.js ***!
  55373. \***********************************/
  55374. /*! no static exports found */
  55375. /***/ (function(module, exports) {
  55376. module.exports = function(module) {
  55377. if (!module.webpackPolyfill) {
  55378. module.deprecate = function() {};
  55379. module.paths = [];
  55380. // module.parent = undefined by default
  55381. if (!module.children) module.children = [];
  55382. Object.defineProperty(module, "loaded", {
  55383. enumerable: true,
  55384. get: function() {
  55385. return module.l;
  55386. }
  55387. });
  55388. Object.defineProperty(module, "id", {
  55389. enumerable: true,
  55390. get: function() {
  55391. return module.i;
  55392. }
  55393. });
  55394. module.webpackPolyfill = 1;
  55395. }
  55396. return module;
  55397. };
  55398. /***/ }),
  55399. /***/ "./resources/js/app.js":
  55400. /*!*****************************!*\
  55401. !*** ./resources/js/app.js ***!
  55402. \*****************************/
  55403. /*! no static exports found */
  55404. /***/ (function(module, exports, __webpack_require__) {
  55405. /**
  55406. * First we will load all of this project's JavaScript dependencies which
  55407. * includes Vue and other libraries. It is a great starting point when
  55408. * building robust, powerful web applications using Vue and Laravel.
  55409. */
  55410. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55411. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55412. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55413. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55414. /**
  55415. * The following block of code may be used to automatically register your
  55416. * Vue components. It will recursively scan this directory for the Vue
  55417. * components and automatically register them with their "basename".
  55418. *
  55419. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55420. */
  55421. // const files = require.context('./', true, /\.vue$/i)
  55422. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55423. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55424. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55425. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55426. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55427. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55428. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55429. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55430. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55431. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55432. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55433. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55434. /**
  55435. * Next, we will create a fresh Vue application instance and attach it to
  55436. * the page. Then, you may begin adding components to this application
  55437. * or customize the JavaScript scaffolding to fit your unique needs.
  55438. */
  55439. var app = new Vue({
  55440. el: '#app'
  55441. });
  55442. $(function () {
  55443. $('[data-toggle="tooltip"]').tooltip();
  55444. });
  55445. var clipboard = new Clipboard('.btn-clip');
  55446. clipboard.on('success', function (e) {
  55447. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55448. position: "right",
  55449. className: 'success'
  55450. });
  55451. e.clearSelection();
  55452. });
  55453. /***/ }),
  55454. /***/ "./resources/js/bootstrap.js":
  55455. /*!***********************************!*\
  55456. !*** ./resources/js/bootstrap.js ***!
  55457. \***********************************/
  55458. /*! no exports provided */
  55459. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55460. "use strict";
  55461. __webpack_require__.r(__webpack_exports__);
  55462. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55463. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55464. /**
  55465. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55466. * for JavaScript based Bootstrap features such as modals and tabs. This
  55467. * code may be modified to fit the specific needs of your application.
  55468. */
  55469. try {
  55470. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55471. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55472. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55473. } catch (e) {}
  55474. /**
  55475. * We'll load the axios HTTP library which allows us to easily issue requests
  55476. * to our Laravel back-end. This library automatically handles sending the
  55477. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55478. */
  55479. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55480. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55481. /**
  55482. * Echo exposes an expressive API for subscribing to channels and listening
  55483. * for events that are broadcast by Laravel. Echo and event broadcasting
  55484. * allows your team to easily build robust real-time web applications.
  55485. */
  55486. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55487. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55488. broadcaster: 'pusher',
  55489. key: "upccrt",
  55490. authEndpoint: '/broadcasting/auth',
  55491. wsHost: window.location.hostname,
  55492. wsPort: 6001,
  55493. disableStats: true
  55494. });
  55495. /***/ }),
  55496. /***/ "./resources/js/components/ExampleComponent.vue":
  55497. /*!******************************************************!*\
  55498. !*** ./resources/js/components/ExampleComponent.vue ***!
  55499. \******************************************************/
  55500. /*! exports provided: default */
  55501. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55502. "use strict";
  55503. __webpack_require__.r(__webpack_exports__);
  55504. /* 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&");
  55505. /* 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&");
  55506. /* 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");
  55507. /* normalize component */
  55508. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55509. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55510. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55511. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55512. false,
  55513. null,
  55514. null,
  55515. null
  55516. )
  55517. /* hot reload */
  55518. if (false) { var api; }
  55519. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55520. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55521. /***/ }),
  55522. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55523. /*!*******************************************************************************!*\
  55524. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55525. \*******************************************************************************/
  55526. /*! exports provided: default */
  55527. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55528. "use strict";
  55529. __webpack_require__.r(__webpack_exports__);
  55530. /* 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&");
  55531. /* 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"]);
  55532. /***/ }),
  55533. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55534. /*!*************************************************************************************!*\
  55535. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55536. \*************************************************************************************/
  55537. /*! exports provided: render, staticRenderFns */
  55538. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55539. "use strict";
  55540. __webpack_require__.r(__webpack_exports__);
  55541. /* 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&");
  55542. /* 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"]; });
  55543. /* 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"]; });
  55544. /***/ }),
  55545. /***/ "./resources/js/components/assetinfo.vue":
  55546. /*!***********************************************!*\
  55547. !*** ./resources/js/components/assetinfo.vue ***!
  55548. \***********************************************/
  55549. /*! exports provided: default */
  55550. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55551. "use strict";
  55552. __webpack_require__.r(__webpack_exports__);
  55553. /* 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&");
  55554. /* 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&");
  55555. /* 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");
  55556. /* normalize component */
  55557. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55558. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55559. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55560. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55561. false,
  55562. null,
  55563. null,
  55564. null
  55565. )
  55566. /* hot reload */
  55567. if (false) { var api; }
  55568. component.options.__file = "resources/js/components/assetinfo.vue"
  55569. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55570. /***/ }),
  55571. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55572. /*!************************************************************************!*\
  55573. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55574. \************************************************************************/
  55575. /*! exports provided: default */
  55576. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55577. "use strict";
  55578. __webpack_require__.r(__webpack_exports__);
  55579. /* 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&");
  55580. /* 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"]);
  55581. /***/ }),
  55582. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55583. /*!******************************************************************************!*\
  55584. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55585. \******************************************************************************/
  55586. /*! exports provided: render, staticRenderFns */
  55587. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55588. "use strict";
  55589. __webpack_require__.r(__webpack_exports__);
  55590. /* 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&");
  55591. /* 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"]; });
  55592. /* 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"]; });
  55593. /***/ }),
  55594. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55595. /*!******************************************************************!*\
  55596. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55597. \******************************************************************/
  55598. /*! exports provided: default */
  55599. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55600. "use strict";
  55601. __webpack_require__.r(__webpack_exports__);
  55602. /* 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&");
  55603. /* 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&");
  55604. /* 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");
  55605. /* normalize component */
  55606. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55607. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55608. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55609. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55610. false,
  55611. null,
  55612. null,
  55613. null
  55614. )
  55615. /* hot reload */
  55616. if (false) { var api; }
  55617. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55618. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55619. /***/ }),
  55620. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55621. /*!*******************************************************************************************!*\
  55622. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55623. \*******************************************************************************************/
  55624. /*! exports provided: default */
  55625. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55626. "use strict";
  55627. __webpack_require__.r(__webpack_exports__);
  55628. /* 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&");
  55629. /* 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"]);
  55630. /***/ }),
  55631. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55632. /*!*************************************************************************************************!*\
  55633. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55634. \*************************************************************************************************/
  55635. /*! exports provided: render, staticRenderFns */
  55636. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55637. "use strict";
  55638. __webpack_require__.r(__webpack_exports__);
  55639. /* 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&");
  55640. /* 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"]; });
  55641. /* 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"]; });
  55642. /***/ }),
  55643. /***/ "./resources/js/components/credential-form-modal.vue":
  55644. /*!***********************************************************!*\
  55645. !*** ./resources/js/components/credential-form-modal.vue ***!
  55646. \***********************************************************/
  55647. /*! exports provided: default */
  55648. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55649. "use strict";
  55650. __webpack_require__.r(__webpack_exports__);
  55651. /* 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&");
  55652. /* 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&");
  55653. /* 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");
  55654. /* normalize component */
  55655. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55656. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55657. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55658. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55659. false,
  55660. null,
  55661. null,
  55662. null
  55663. )
  55664. /* hot reload */
  55665. if (false) { var api; }
  55666. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55667. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55668. /***/ }),
  55669. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55670. /*!************************************************************************************!*\
  55671. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55672. \************************************************************************************/
  55673. /*! exports provided: default */
  55674. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55675. "use strict";
  55676. __webpack_require__.r(__webpack_exports__);
  55677. /* 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&");
  55678. /* 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"]);
  55679. /***/ }),
  55680. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55681. /*!******************************************************************************************!*\
  55682. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55683. \******************************************************************************************/
  55684. /*! exports provided: render, staticRenderFns */
  55685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55686. "use strict";
  55687. __webpack_require__.r(__webpack_exports__);
  55688. /* 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&");
  55689. /* 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"]; });
  55690. /* 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"]; });
  55691. /***/ }),
  55692. /***/ "./resources/js/components/credential-list.vue":
  55693. /*!*****************************************************!*\
  55694. !*** ./resources/js/components/credential-list.vue ***!
  55695. \*****************************************************/
  55696. /*! exports provided: default */
  55697. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55698. "use strict";
  55699. __webpack_require__.r(__webpack_exports__);
  55700. /* 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&");
  55701. /* 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&");
  55702. /* 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");
  55703. /* normalize component */
  55704. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55705. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55706. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55707. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55708. false,
  55709. null,
  55710. null,
  55711. null
  55712. )
  55713. /* hot reload */
  55714. if (false) { var api; }
  55715. component.options.__file = "resources/js/components/credential-list.vue"
  55716. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55717. /***/ }),
  55718. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55719. /*!******************************************************************************!*\
  55720. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55721. \******************************************************************************/
  55722. /*! exports provided: default */
  55723. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55724. "use strict";
  55725. __webpack_require__.r(__webpack_exports__);
  55726. /* 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&");
  55727. /* 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"]);
  55728. /***/ }),
  55729. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55730. /*!************************************************************************************!*\
  55731. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55732. \************************************************************************************/
  55733. /*! exports provided: render, staticRenderFns */
  55734. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55735. "use strict";
  55736. __webpack_require__.r(__webpack_exports__);
  55737. /* 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&");
  55738. /* 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"]; });
  55739. /* 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"]; });
  55740. /***/ }),
  55741. /***/ "./resources/js/components/credential.vue":
  55742. /*!************************************************!*\
  55743. !*** ./resources/js/components/credential.vue ***!
  55744. \************************************************/
  55745. /*! exports provided: default */
  55746. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55747. "use strict";
  55748. __webpack_require__.r(__webpack_exports__);
  55749. /* 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&");
  55750. /* 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&");
  55751. /* 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");
  55752. /* normalize component */
  55753. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55754. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55755. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55756. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55757. false,
  55758. null,
  55759. null,
  55760. null
  55761. )
  55762. /* hot reload */
  55763. if (false) { var api; }
  55764. component.options.__file = "resources/js/components/credential.vue"
  55765. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55766. /***/ }),
  55767. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55768. /*!*************************************************************************!*\
  55769. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55770. \*************************************************************************/
  55771. /*! exports provided: default */
  55772. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55773. "use strict";
  55774. __webpack_require__.r(__webpack_exports__);
  55775. /* 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&");
  55776. /* 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"]);
  55777. /***/ }),
  55778. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55779. /*!*******************************************************************************!*\
  55780. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55781. \*******************************************************************************/
  55782. /*! exports provided: render, staticRenderFns */
  55783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55784. "use strict";
  55785. __webpack_require__.r(__webpack_exports__);
  55786. /* 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&");
  55787. /* 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"]; });
  55788. /* 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"]; });
  55789. /***/ }),
  55790. /***/ "./resources/js/components/errorlist.vue":
  55791. /*!***********************************************!*\
  55792. !*** ./resources/js/components/errorlist.vue ***!
  55793. \***********************************************/
  55794. /*! exports provided: default */
  55795. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55796. "use strict";
  55797. __webpack_require__.r(__webpack_exports__);
  55798. /* 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&");
  55799. /* 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&");
  55800. /* 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");
  55801. /* normalize component */
  55802. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55803. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55804. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55805. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55806. false,
  55807. null,
  55808. null,
  55809. null
  55810. )
  55811. /* hot reload */
  55812. if (false) { var api; }
  55813. component.options.__file = "resources/js/components/errorlist.vue"
  55814. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55815. /***/ }),
  55816. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55817. /*!************************************************************************!*\
  55818. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55819. \************************************************************************/
  55820. /*! exports provided: default */
  55821. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55822. "use strict";
  55823. __webpack_require__.r(__webpack_exports__);
  55824. /* 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&");
  55825. /* 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"]);
  55826. /***/ }),
  55827. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55828. /*!******************************************************************************!*\
  55829. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55830. \******************************************************************************/
  55831. /*! exports provided: render, staticRenderFns */
  55832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55833. "use strict";
  55834. __webpack_require__.r(__webpack_exports__);
  55835. /* 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&");
  55836. /* 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"]; });
  55837. /* 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"]; });
  55838. /***/ }),
  55839. /***/ "./resources/js/components/modal.vue":
  55840. /*!*******************************************!*\
  55841. !*** ./resources/js/components/modal.vue ***!
  55842. \*******************************************/
  55843. /*! exports provided: default */
  55844. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55845. "use strict";
  55846. __webpack_require__.r(__webpack_exports__);
  55847. /* 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&");
  55848. /* 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");
  55849. var script = {}
  55850. /* normalize component */
  55851. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55852. script,
  55853. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55854. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55855. false,
  55856. null,
  55857. null,
  55858. null
  55859. )
  55860. /* hot reload */
  55861. if (false) { var api; }
  55862. component.options.__file = "resources/js/components/modal.vue"
  55863. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55864. /***/ }),
  55865. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55866. /*!**************************************************************************!*\
  55867. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55868. \**************************************************************************/
  55869. /*! exports provided: render, staticRenderFns */
  55870. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55871. "use strict";
  55872. __webpack_require__.r(__webpack_exports__);
  55873. /* 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&");
  55874. /* 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"]; });
  55875. /* 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"]; });
  55876. /***/ }),
  55877. /***/ "./resources/js/components/notes.vue":
  55878. /*!*******************************************!*\
  55879. !*** ./resources/js/components/notes.vue ***!
  55880. \*******************************************/
  55881. /*! exports provided: default */
  55882. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55883. "use strict";
  55884. __webpack_require__.r(__webpack_exports__);
  55885. /* 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&");
  55886. /* 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&");
  55887. /* 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");
  55888. /* normalize component */
  55889. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55890. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55891. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55892. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55893. false,
  55894. null,
  55895. null,
  55896. null
  55897. )
  55898. /* hot reload */
  55899. if (false) { var api; }
  55900. component.options.__file = "resources/js/components/notes.vue"
  55901. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55902. /***/ }),
  55903. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55904. /*!********************************************************************!*\
  55905. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55906. \********************************************************************/
  55907. /*! exports provided: default */
  55908. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55909. "use strict";
  55910. __webpack_require__.r(__webpack_exports__);
  55911. /* 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&");
  55912. /* 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"]);
  55913. /***/ }),
  55914. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55915. /*!**************************************************************************!*\
  55916. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55917. \**************************************************************************/
  55918. /*! exports provided: render, staticRenderFns */
  55919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55920. "use strict";
  55921. __webpack_require__.r(__webpack_exports__);
  55922. /* 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&");
  55923. /* 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"]; });
  55924. /* 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"]; });
  55925. /***/ }),
  55926. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55927. /*!*******************************************************!*\
  55928. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55929. \*******************************************************/
  55930. /*! exports provided: default */
  55931. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55932. "use strict";
  55933. __webpack_require__.r(__webpack_exports__);
  55934. /* 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&");
  55935. /* 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&");
  55936. /* 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");
  55937. /* normalize component */
  55938. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55939. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55940. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55941. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55942. false,
  55943. null,
  55944. null,
  55945. null
  55946. )
  55947. /* hot reload */
  55948. if (false) { var api; }
  55949. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55950. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55951. /***/ }),
  55952. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55953. /*!********************************************************************************!*\
  55954. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55955. \********************************************************************************/
  55956. /*! exports provided: default */
  55957. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55958. "use strict";
  55959. __webpack_require__.r(__webpack_exports__);
  55960. /* 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&");
  55961. /* 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"]);
  55962. /***/ }),
  55963. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55964. /*!**************************************************************************************!*\
  55965. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55966. \**************************************************************************************/
  55967. /*! exports provided: render, staticRenderFns */
  55968. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55969. "use strict";
  55970. __webpack_require__.r(__webpack_exports__);
  55971. /* 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&");
  55972. /* 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"]; });
  55973. /* 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"]; });
  55974. /***/ }),
  55975. /***/ "./resources/js/components/woinfo.vue":
  55976. /*!********************************************!*\
  55977. !*** ./resources/js/components/woinfo.vue ***!
  55978. \********************************************/
  55979. /*! exports provided: default */
  55980. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55981. "use strict";
  55982. __webpack_require__.r(__webpack_exports__);
  55983. /* 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&");
  55984. /* 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&");
  55985. /* 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");
  55986. /* normalize component */
  55987. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55988. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55989. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55990. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55991. false,
  55992. null,
  55993. null,
  55994. null
  55995. )
  55996. /* hot reload */
  55997. if (false) { var api; }
  55998. component.options.__file = "resources/js/components/woinfo.vue"
  55999. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56000. /***/ }),
  56001. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56002. /*!*********************************************************************!*\
  56003. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56004. \*********************************************************************/
  56005. /*! exports provided: default */
  56006. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56007. "use strict";
  56008. __webpack_require__.r(__webpack_exports__);
  56009. /* 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&");
  56010. /* 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"]);
  56011. /***/ }),
  56012. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56013. /*!***************************************************************************!*\
  56014. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56015. \***************************************************************************/
  56016. /*! exports provided: render, staticRenderFns */
  56017. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56018. "use strict";
  56019. __webpack_require__.r(__webpack_exports__);
  56020. /* 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&");
  56021. /* 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"]; });
  56022. /* 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"]; });
  56023. /***/ }),
  56024. /***/ "./resources/js/mixins/dateMixin.js":
  56025. /*!******************************************!*\
  56026. !*** ./resources/js/mixins/dateMixin.js ***!
  56027. \******************************************/
  56028. /*! exports provided: default */
  56029. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56030. "use strict";
  56031. __webpack_require__.r(__webpack_exports__);
  56032. /* harmony default export */ __webpack_exports__["default"] = ({
  56033. methods: {
  56034. treatAsUTC: function treatAsUTC(date) {
  56035. var result = new Date(date);
  56036. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56037. return result;
  56038. },
  56039. daysSinceToday: function daysSinceToday(date) {
  56040. var currentDate = new Date();
  56041. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56042. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56043. },
  56044. getHRDate: function getHRDate(dateString) {
  56045. var date = new Date(dateString);
  56046. return date.toLocaleString('default', {
  56047. month: 'short',
  56048. day: 'numeric',
  56049. year: 'numeric',
  56050. hour: 'numeric',
  56051. minute: 'numeric'
  56052. });
  56053. },
  56054. isZero: function isZero(dateString) {
  56055. return dateString === '0000-00-00 00:00:00';
  56056. }
  56057. }
  56058. });
  56059. /***/ }),
  56060. /***/ "./resources/js/notify.min.js":
  56061. /*!************************************!*\
  56062. !*** ./resources/js/notify.min.js ***!
  56063. \************************************/
  56064. /*! no static exports found */
  56065. /***/ (function(module, exports, __webpack_require__) {
  56066. 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); }
  56067. (function (e) {
  56068. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56069. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56070. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56071. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56072. })(function (e) {
  56073. function A(t, n, i) {
  56074. typeof i == "string" && (i = {
  56075. className: i
  56076. }), 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);
  56077. }
  56078. var t = [].indexOf || function (e) {
  56079. for (var t = 0, n = this.length; t < n; t++) {
  56080. if (t in this && this[t] === e) return t;
  56081. }
  56082. return -1;
  56083. },
  56084. n = "notify",
  56085. r = n + "js",
  56086. i = n + "!blank",
  56087. s = {
  56088. t: "top",
  56089. m: "middle",
  56090. b: "bottom",
  56091. l: "left",
  56092. c: "center",
  56093. r: "right"
  56094. },
  56095. o = ["l", "c", "r"],
  56096. u = ["t", "m", "b"],
  56097. a = ["t", "b", "l", "r"],
  56098. f = {
  56099. t: "b",
  56100. m: null,
  56101. b: "t",
  56102. l: "r",
  56103. c: null,
  56104. r: "l"
  56105. },
  56106. l = function l(t) {
  56107. var n;
  56108. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56109. var r;
  56110. r = t.toLowerCase().charAt(0);
  56111. if (s[r]) return n.push(r);
  56112. }), n;
  56113. },
  56114. c = {},
  56115. h = {
  56116. name: "core",
  56117. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56118. 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}"
  56119. },
  56120. p = {
  56121. "border-radius": ["-webkit-", "-moz-"]
  56122. },
  56123. d = function d(e) {
  56124. return c[e];
  56125. },
  56126. v = function v(e) {
  56127. if (!e) throw "Missing Style name";
  56128. c[e] && delete c[e];
  56129. },
  56130. m = function m(t, i) {
  56131. if (!t) throw "Missing Style name";
  56132. if (!i) throw "Missing Style definition";
  56133. if (!i.html) throw "Missing Style HTML";
  56134. var s = c[t];
  56135. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56136. var o = "";
  56137. i.classes && e.each(i.classes, function (t, n) {
  56138. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56139. return p[t] && e.each(p[t], function (e, r) {
  56140. return o += " " + r + t + ": " + n + ";\n";
  56141. }), o += " " + t + ": " + n + ";\n";
  56142. }), o += "}\n";
  56143. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56144. var u = {},
  56145. a = e(i.html);
  56146. y("html", a, u), y("text", a, u), i.fields = u;
  56147. },
  56148. g = function g(t) {
  56149. var n, r, i;
  56150. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56151. try {
  56152. r.html(t);
  56153. } catch (s) {
  56154. r[0].styleSheet.cssText = t;
  56155. }
  56156. return r;
  56157. },
  56158. y = function y(t, n, r) {
  56159. var s;
  56160. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56161. var n;
  56162. n = e(this).attr(s), n || (n = i), r[n] = t;
  56163. });
  56164. },
  56165. b = function b(e, t) {
  56166. return e.is(t) ? e : e.find(t);
  56167. },
  56168. w = {
  56169. clickToHide: !0,
  56170. autoHide: !0,
  56171. autoHideDelay: 5e3,
  56172. arrowShow: !0,
  56173. arrowSize: 5,
  56174. breakNewLines: !0,
  56175. elementPosition: "bottom",
  56176. globalPosition: "top right",
  56177. style: "bootstrap",
  56178. className: "error",
  56179. showAnimation: "slideDown",
  56180. showDuration: 400,
  56181. hideAnimation: "slideUp",
  56182. hideDuration: 200,
  56183. gap: 5
  56184. },
  56185. E = function E(t, n) {
  56186. var r;
  56187. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56188. },
  56189. S = function S(t) {
  56190. return e.extend(w, t);
  56191. },
  56192. x = function x(t) {
  56193. return e("<" + t + "></" + t + ">");
  56194. },
  56195. T = {},
  56196. N = function N(t) {
  56197. var n;
  56198. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56199. return e(r).attr("name") === t.attr("name");
  56200. }), t = n.first()), t;
  56201. },
  56202. C = function C(e, t, n) {
  56203. var r, i;
  56204. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56205. if (isNaN(n)) return;
  56206. 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;
  56207. },
  56208. k = function k(e, t, n) {
  56209. if (e === "l" || e === "t") return 0;
  56210. if (e === "c" || e === "m") return n / 2 - t / 2;
  56211. if (e === "r" || e === "b") return n - t;
  56212. throw "Invalid alignment";
  56213. },
  56214. L = function L(e) {
  56215. return L.e = L.e || x("div"), L.e.text(e).html();
  56216. };
  56217. A.prototype.loadHTML = function () {
  56218. var t;
  56219. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56220. }, A.prototype.show = function (e, t) {
  56221. var n, r, i, s, o;
  56222. r = function (n) {
  56223. return function () {
  56224. !e && !n.elem && n.destroy();
  56225. if (t) return t();
  56226. };
  56227. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56228. 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 {
  56229. if (!!o || !!e) return r();
  56230. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56231. }
  56232. return n.push(r), i[s].apply(i, n);
  56233. }, A.prototype.setGlobalPosition = function () {
  56234. var t = this.getPosition(),
  56235. n = t[0],
  56236. i = t[1],
  56237. o = s[n],
  56238. u = s[i],
  56239. a = n + "|" + i,
  56240. f = T[a];
  56241. if (!f || !document.body.contains(f[0])) {
  56242. f = T[a] = x("div");
  56243. var l = {};
  56244. 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);
  56245. }
  56246. return f.prepend(this.wrapper);
  56247. }, A.prototype.setElementPosition = function () {
  56248. 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;
  56249. 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"];
  56250. for (w = 0, S = B.length; w < S; w++) {
  56251. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56252. }
  56253. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56254. if (!this.options.arrowShow) this.arrow.hide();else {
  56255. 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";
  56256. for (E = 0, x = a.length; E < x; E++) {
  56257. D = a[E], P = s[D];
  56258. if (D === L) continue;
  56259. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56260. }
  56261. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56262. }
  56263. 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);
  56264. if (r) return this.arrow.removeAttr("style").css(r);
  56265. }, A.prototype.getPosition = function () {
  56266. var e, n, r, i, s, f, c, h;
  56267. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56268. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56269. 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";
  56270. return e.length === 2 && (e[2] = e[1]), e;
  56271. }, A.prototype.getStyle = function (e) {
  56272. var t;
  56273. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56274. if (!t) throw "Missing style: " + e;
  56275. return t;
  56276. }, A.prototype.updateClasses = function () {
  56277. var t, n;
  56278. 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) {
  56279. return r + "-" + n.name + "-" + e;
  56280. }).join(" "), this.userContainer.attr("class", t);
  56281. }, A.prototype.run = function (t, n) {
  56282. var r, s, o, u, a;
  56283. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56284. if (this.container && !t) {
  56285. this.show(!1);
  56286. return;
  56287. }
  56288. if (!this.container && !t) return;
  56289. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56290. for (o in s) {
  56291. r = s[o], u = this.userFields[o];
  56292. if (!u) continue;
  56293. 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);
  56294. }
  56295. 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));
  56296. }, A.prototype.destroy = function () {
  56297. this.wrapper.data(r, null), this.wrapper.remove();
  56298. }, e[n] = function (t, r, i) {
  56299. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56300. }, e.fn[n] = function (t, n) {
  56301. return e(this).each(function () {
  56302. var i = N(e(this)).data(r);
  56303. i && i.destroy();
  56304. var s = new A(e(this), t, n);
  56305. }), this;
  56306. }, e.extend(e[n], {
  56307. defaults: S,
  56308. addStyle: m,
  56309. removeStyle: v,
  56310. pluginOptions: w,
  56311. getStyle: d,
  56312. insertCSS: g
  56313. }), m("bootstrap", {
  56314. html: "<div>\n<span data-notify-text></span>\n</div>",
  56315. classes: {
  56316. base: {
  56317. "font-weight": "bold",
  56318. padding: "8px 15px 8px 14px",
  56319. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56320. "background-color": "#fcf8e3",
  56321. border: "1px solid #fbeed5",
  56322. "border-radius": "4px",
  56323. "white-space": "nowrap",
  56324. "padding-left": "25px",
  56325. "background-repeat": "no-repeat",
  56326. "background-position": "3px 7px"
  56327. },
  56328. error: {
  56329. color: "#B94A48",
  56330. "background-color": "#F2DEDE",
  56331. "border-color": "#EED3D7",
  56332. "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=)"
  56333. },
  56334. success: {
  56335. color: "#468847",
  56336. "background-color": "#DFF0D8",
  56337. "border-color": "#D6E9C6",
  56338. "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==)"
  56339. },
  56340. info: {
  56341. color: "#3A87AD",
  56342. "background-color": "#D9EDF7",
  56343. "border-color": "#BCE8F1",
  56344. "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=)"
  56345. },
  56346. warn: {
  56347. color: "#C09853",
  56348. "background-color": "#FCF8E3",
  56349. "border-color": "#FBEED5",
  56350. "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)"
  56351. }
  56352. }
  56353. }), e(function () {
  56354. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56355. e(this).trigger("notify-hide");
  56356. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56357. var n = e(this).data(r);
  56358. n && n.show(!1);
  56359. });
  56360. });
  56361. });
  56362. /***/ }),
  56363. /***/ "./resources/sass/app.scss":
  56364. /*!*********************************!*\
  56365. !*** ./resources/sass/app.scss ***!
  56366. \*********************************/
  56367. /*! no static exports found */
  56368. /***/ (function(module, exports) {
  56369. // removed by extract-text-webpack-plugin
  56370. /***/ }),
  56371. /***/ 0:
  56372. /*!*************************************************************!*\
  56373. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56374. \*************************************************************/
  56375. /*! no static exports found */
  56376. /***/ (function(module, exports, __webpack_require__) {
  56377. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56378. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56379. /***/ })
  56380. /******/ });